Workspace 6.21.5
Public Member Functions | List of all members
BlinnPhongShader Class Reference

A basic Blinn-Phong specular shader which can be attached to meshmodels. More...

#include <Rendering/SceneComponents/Shaders/blinnphongshader.h>

Inheritance diagram for BlinnPhongShader:
[legend]

Public Member Functions

 BlinnPhongShader ()
 
 BlinnPhongShader (const BlinnPhongShader &shader)
 
 ~BlinnPhongShader () override
 
bool appliesScreenSpaceAmbientOcclusion () override
 
bool appliesSpecular () override
 
bool appliesTransparency () const override
 
BlinnPhongShaderclone () const override
 
const QColor & getColor () const
 
float getReflectance () const
 
float getSmoothness () const
 
SurfaceRepresentation getSurfaceRepresentation () const
 
const TexturizergetTexturizer () const override
 
TexturizergetTexturizer () override
 
BlinnPhongShaderoperator= (const BlinnPhongShader &shader)
 
void setColor (const QColor &color)
 
void setReflectance (float r)
 
void setSmoothness (float smoothness)
 
void setSurfaceRepresentation (SurfaceRepresentation r)
 
void setTexturizer (Texturizer &texturizer)
 
- Public Member Functions inherited from TypedShader< BlinnPhongShader >
 ~TypedShader () override=default
 
- Public Member Functions inherited from Shader
 ~Shader () override
 
bool activate (SceneRenderer &renderer)
 Activates the shader on the target WSGLRenderer in preparation for drawing an object.
 
virtual bool appliesScreenSpaceAmbientOcclusion ()
 
virtual bool appliesSpecular ()
 
virtual bool appliesTransparency () const =0
 
Shaderclone () const override=0
 
bool deactivate (SceneRenderer &renderer)
 Deactivates the shader on the target WSGLRenderer, setting it back to the state it was in before the shader was bound.
 
int getId () const
 
Mesh::MeshModelSource::MeshModelInterfaceLockedPtr getMeshModelInterface (const QString &modelId, Mesh::MeshModelLibrary &modelLib)
 
bool getModelSourceUpdateRequested () const
 
bool getOptimizeOutInternalVolumeElements () const
 
double getSegmentLineWidth () const
 
virtual TexturizergetTexturizer ()
 
virtual const TexturizergetTexturizer () const
 
bool renderCurrentModel (SceneRenderer &renderer)
 Renders the model currently being processed by the specified renderer.s.
 
bool renderCurrentModelGlyphs (SceneRenderer &renderer)
 
void setOptimizeOutInternalVolumeElements (bool val)
 
void setSegmentLineWidth (double width)
 
- Public Member Functions inherited from Clonable
virtual ~Clonable ()=default
 
virtual Clonableclone () const =0
 

Additional Inherited Members

- Static Public Member Functions inherited from TypedShader< BlinnPhongShader >
static void registerImplementation (const SceneRendererTypeId &rendererId, const ShaderImplementationFactory &factory)
 
- Protected Member Functions inherited from TypedShader< BlinnPhongShader >
 TypedShader ()
 
 TypedShader (const TypedShader &shader)
 
TypedShaderclone () const override=0
 
- Protected Member Functions inherited from Shader
 Shader ()
 
 Shader (const Shader &shader)
 
void addImplementation (const SceneRendererContext &context, ShaderImplementation &impl)
 
void setId (int id)
 

Detailed Description

Blinn-Phong shading model adds a specular highlight to the diffuse lighting calculated using the lambert shading model.

To calculate the Lambert radiance contribution the following are required: // User defined inputs Color If the model doesn't have a texture then the color variable will be used instead.

// Model, Camera, and Light defined inputs Texture The object's texture View Position Light Position/Direction/Color Surface Normal

To calculate the Blinn-Phong radiance contribution the following are required: // User defined inputs Smoothness

// Model, Camera, and Light defined inputs View Position Light Position/Direction Surface Normal

Constructor & Destructor Documentation

◆ BlinnPhongShader() [1/2]

◆ BlinnPhongShader() [2/2]

BlinnPhongShader ( const BlinnPhongShader shader)

◆ ~BlinnPhongShader()

~BlinnPhongShader ( )
override

Member Function Documentation

◆ appliesScreenSpaceAmbientOcclusion()

bool appliesScreenSpaceAmbientOcclusion ( )
inlineoverridevirtual

Sub-classes only need to overide this if they can apply Screen Space Ambient Occlusion

Reimplemented from Shader.

◆ appliesSpecular()

bool appliesSpecular ( )
inlineoverridevirtual

Sub-classes only need to overide this if they apply specular high-lights (eg. Blinn-Phong).

Reimplemented from Shader.

◆ appliesTransparency()

bool appliesTransparency ( ) const
overridevirtual
Returns
true if the object is transparent, false if it is not transparent.

Implements Shader.

◆ clone()

BlinnPhongShader * clone ( ) const
overridevirtual
Returns
A clone of this object.
Note
Subclasses would normally return their own type rather than the Clonable type. The C++ language rules allow a more derived type to be returned from a virtual function and the compiler will still treat it as a valid override.

Implements TypedShader< BlinnPhongShader >.

◆ getColor()

const QColor & getColor ( ) const
Returns
The current value of color_
See also
setColor(const QColor& color)

◆ getReflectance()

float getReflectance ( ) const

◆ getSmoothness()

float getSmoothness ( ) const
Returns
The current value of smoothness
See also
setSmoothness(const int& smoothness)

◆ getSurfaceRepresentation()

SurfaceRepresentation getSurfaceRepresentation ( ) const

◆ getTexturizer() [1/2]

const Texturizer & getTexturizer ( ) const
overridevirtual
Returns
The texturizer that contains the object's texture
See also
setTexturizer(Texturizer& texturizer)

Reimplemented from Shader.

◆ getTexturizer() [2/2]

Texturizer & getTexturizer ( )
overridevirtual
Returns
The texturizer that contains the object's texture
See also
setTexturizer(Texturizer& texturizer)

Reimplemented from Shader.

◆ operator=()

BlinnPhongShader & operator= ( const BlinnPhongShader shader)

◆ setColor()

void setColor ( const QColor &  color)
Parameters
colorThe new color to be used to calculate the lambertian radiance contribution.
See also
getColor()

◆ setReflectance()

void setReflectance ( float  r)

◆ setSmoothness()

void setSmoothness ( float  smoothness)

Sets smoothness_ to the input value.

Parameters
smoothnessThe smoothness of the object. The smoother the object, the brighter and smaller the specular highlighting will appear.
See also
getSmoothness()

◆ setSurfaceRepresentation()

void setSurfaceRepresentation ( SurfaceRepresentation  r)

◆ setTexturizer()

void setTexturizer ( Texturizer texturizer)
Parameters
texturizerNew texturizer to replace the old one. Texturizers are used to store textures.
See also
getTexturizer()