Browse Source

Cleaned up some minor stuff in the GL demo and PathStrokeType.

tags/2021-05-28
jules 11 years ago
parent
commit
5b25b303fb
3 changed files with 26 additions and 26 deletions
  1. +10
    -14
      extras/Demo/Source/Demos/OpenGLDemo.cpp
  2. +7
    -6
      modules/juce_graphics/geometry/juce_PathStrokeType.cpp
  3. +9
    -6
      modules/juce_graphics/geometry/juce_PathStrokeType.h

+ 10
- 14
extras/Demo/Source/Demos/OpenGLDemo.cpp View File

@@ -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);


+ 7
- 6
modules/juce_graphics/geometry/juce_PathStrokeType.cpp View File

@@ -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)
{
}


+ 9
- 6
modules/juce_graphics/geometry/juce_PathStrokeType.h View File

@@ -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:
//==============================================================================


Loading…
Cancel
Save