Workspace 6.21.5
|
A basic Blinn-Phong specular shader which can be attached to meshmodels. More...
#include <Rendering/SceneComponents/Shaders/blinnphongshader.h>
Public Member Functions | |
BlinnPhongShader () | |
BlinnPhongShader (const BlinnPhongShader &shader) | |
~BlinnPhongShader () override | |
bool | appliesScreenSpaceAmbientOcclusion () override |
bool | appliesSpecular () override |
bool | appliesTransparency () const override |
BlinnPhongShader * | clone () const override |
const QColor & | getColor () const |
float | getReflectance () const |
float | getSmoothness () const |
SurfaceRepresentation | getSurfaceRepresentation () const |
const Texturizer & | getTexturizer () const override |
Texturizer & | getTexturizer () override |
BlinnPhongShader & | operator= (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 |
Shader * | clone () 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 Texturizer & | getTexturizer () |
virtual const Texturizer & | getTexturizer () 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 Clonable * | clone () 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) | |
TypedShader * | clone () 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) |
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
BlinnPhongShader | ( | ) |
BlinnPhongShader | ( | const BlinnPhongShader & | shader | ) |
|
override |
|
inlineoverridevirtual |
Sub-classes only need to overide this if they can apply Screen Space Ambient Occlusion
Reimplemented from Shader.
|
inlineoverridevirtual |
Sub-classes only need to overide this if they apply specular high-lights (eg. Blinn-Phong).
Reimplemented from Shader.
|
overridevirtual |
Implements Shader.
|
overridevirtual |
Implements TypedShader< BlinnPhongShader >.
const QColor & getColor | ( | ) | const |
float getReflectance | ( | ) | const |
float getSmoothness | ( | ) | const |
SurfaceRepresentation getSurfaceRepresentation | ( | ) | const |
|
overridevirtual |
Reimplemented from Shader.
|
overridevirtual |
Reimplemented from Shader.
BlinnPhongShader & operator= | ( | const BlinnPhongShader & | shader | ) |
void setColor | ( | const QColor & | color | ) |
color | The new color to be used to calculate the lambertian radiance contribution. |
void setReflectance | ( | float | r | ) |
void setSmoothness | ( | float | smoothness | ) |
Sets smoothness_ to the input value.
smoothness | The smoothness of the object. The smoother the object, the brighter and smaller the specular highlighting will appear. |
void setSurfaceRepresentation | ( | SurfaceRepresentation | r | ) |
void setTexturizer | ( | Texturizer & | texturizer | ) |
texturizer | New texturizer to replace the old one. Texturizers are used to store textures. |