From 5b25b303fb8ea73fbae6a6aacdfd9674e558550d Mon Sep 17 00:00:00 2001 From: jules Date: Sun, 12 Jan 2014 15:50:16 +0000 Subject: [PATCH] Cleaned up some minor stuff in the GL demo and PathStrokeType. --- extras/Demo/Source/Demos/OpenGLDemo.cpp | 24 ++++++++----------- .../geometry/juce_PathStrokeType.cpp | 13 +++++----- .../geometry/juce_PathStrokeType.h | 15 +++++++----- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/extras/Demo/Source/Demos/OpenGLDemo.cpp b/extras/Demo/Source/Demos/OpenGLDemo.cpp index 541dec9474..7aff337461 100644 --- a/extras/Demo/Source/Demos/OpenGLDemo.cpp +++ b/extras/Demo/Source/Demos/OpenGLDemo.cpp @@ -658,24 +658,20 @@ struct OpenGLDemoClasses shader->use(); - // Setup our projection uniform - if (OpenGLShaderProgram::Uniform* uni = uniforms->projectionMatrix) - openGLContext.extensions.glUniformMatrix4fv (uni->uniformID, 1, 0, getProjectionMatrix().mat); + if (uniforms->projectionMatrix != nullptr) + uniforms->projectionMatrix->setMatrix4 (getProjectionMatrix().mat, 1, 0); - // And the matrix for our model view - if (OpenGLShaderProgram::Uniform* uni = uniforms->viewMatrix) - openGLContext.extensions.glUniformMatrix4fv (uni->uniformID, 1, 0, getViewMatrix().mat); + if (uniforms->viewMatrix != nullptr) + uniforms->viewMatrix->setMatrix4 (getViewMatrix().mat, 1, 0); - if (OpenGLShaderProgram::Uniform* uni = uniforms->texture) - openGLContext.extensions.glUniform1i (uni->uniformID, 0); + if (uniforms->texture != nullptr) + uniforms->texture->set (0); - // Set the direction of our light source - if (OpenGLShaderProgram::Uniform* uni = uniforms->lightPosition) - openGLContext.extensions.glUniform4f (uni->uniformID, -15.0f, 10.0f, 15.0f, 0.0f); + if (uniforms->lightPosition != nullptr) + uniforms->lightPosition->set (-15.0f, 10.0f, 15.0f, 0.0f); - // Set our bouncing number - if (OpenGLShaderProgram::Uniform* uni = uniforms->bouncingNumber) - openGLContext.extensions.glUniform1f (uni->uniformID, bouncingNumber.getValue()); + if (uniforms->bouncingNumber != nullptr) + uniforms->bouncingNumber->set (bouncingNumber.getValue()); shape->draw (openGLContext, *attributes); diff --git a/modules/juce_graphics/geometry/juce_PathStrokeType.cpp b/modules/juce_graphics/geometry/juce_PathStrokeType.cpp index 3e5e373e78..bdac333d3d 100644 --- a/modules/juce_graphics/geometry/juce_PathStrokeType.cpp +++ b/modules/juce_graphics/geometry/juce_PathStrokeType.cpp @@ -22,12 +22,13 @@ ============================================================================== */ -PathStrokeType::PathStrokeType (const float strokeThickness, - const JointStyle jointStyle_, - const EndCapStyle endStyle_) noexcept - : thickness (strokeThickness), - jointStyle (jointStyle_), - endStyle (endStyle_) +PathStrokeType::PathStrokeType (float strokeThickness) noexcept + : thickness (strokeThickness), jointStyle (mitered), endStyle (butt) +{ +} + +PathStrokeType::PathStrokeType (float strokeThickness, JointStyle joint, EndCapStyle end) noexcept + : thickness (strokeThickness), jointStyle (joint), endStyle (end) { } diff --git a/modules/juce_graphics/geometry/juce_PathStrokeType.h b/modules/juce_graphics/geometry/juce_PathStrokeType.h index 60bb4641d2..63747419c2 100644 --- a/modules/juce_graphics/geometry/juce_PathStrokeType.h +++ b/modules/juce_graphics/geometry/juce_PathStrokeType.h @@ -63,6 +63,9 @@ public: }; //============================================================================== + /** Creates a stroke type with a given line-width, and default joint/end styles. */ + explicit PathStrokeType (float strokeThickness) noexcept; + /** Creates a stroke type. @param strokeThickness the width of the line to use @@ -70,14 +73,14 @@ public: @param endStyle the type of end-caps to use for the ends of open paths. */ PathStrokeType (float strokeThickness, - JointStyle jointStyle = mitered, + JointStyle jointStyle, EndCapStyle endStyle = butt) noexcept; - /** Createes a copy of another stroke type. */ - PathStrokeType (const PathStrokeType& other) noexcept; + /** Creates a copy of another stroke type. */ + PathStrokeType (const PathStrokeType&) noexcept; /** Copies another stroke onto this one. */ - PathStrokeType& operator= (const PathStrokeType& other) noexcept; + PathStrokeType& operator= (const PathStrokeType&) noexcept; /** Destructor. */ ~PathStrokeType() noexcept; @@ -184,10 +187,10 @@ public: //============================================================================== /** Compares the stroke thickness, joint and end styles of two stroke types. */ - bool operator== (const PathStrokeType& other) const noexcept; + bool operator== (const PathStrokeType&) const noexcept; /** Compares the stroke thickness, joint and end styles of two stroke types. */ - bool operator!= (const PathStrokeType& other) const noexcept; + bool operator!= (const PathStrokeType&) const noexcept; private: //==============================================================================