Vp::PhongShader
Shader for lit objects with textures.
#include "Viewport/shader/PhongShader.h"
Inherits from Vp::ObjectShader, Vp::WorldShader, Vp::Shader
Public Types
Name | |
---|---|
enum | LightingModel { PHONG, BLINN_PHONG} |
Public Functions
Name | |
---|---|
PhongShader(GLuint id) | |
virtual void | init(bool initSuperclass) override |
virtual void | setUniforms() override<br>Set uniforms before rendering. |
virtual void | setUniformsPerMeshPart(Core::Mesh::MeshPart & meshPart) override<br>Set uniforms before rendering individual mesh parts. |
Protected Functions
Name | |
---|---|
void | bindTexture(GLuint textureID, const std::string & type, int typeIndex, GLuint textureUnit) |
void | bindTextures(Core::Mesh::TextureSet tSet) |
void | clearTextures() const<br>Sets all texture active flags to false. |
void | setMaterialUniforms(Core::Mesh::Material material) |
Public Attributes
Name | |
---|---|
LightingModel | m_lightingModel |
glm::vec3 | m_tint |
Protected Attributes
Name | |
---|---|
GLint | m_lightingModelId |
GLint | material_ambient |
GLint | material_diffuse |
GLint | material_shininess |
GLint | material_specular |
GLint | normalStrength |
GLint | tintId |
Additional inherited members
Public Functions inherited from Vp::ObjectShader
Name | |
---|---|
ObjectShader(GLuint id) |
Public Attributes inherited from Vp::ObjectShader
Name | |
---|---|
float | m_opacity |
Protected Attributes inherited from Vp::ObjectShader
Name | |
---|---|
GLint | opacityId |
Public Functions inherited from Vp::WorldShader
Name | |
---|---|
WorldShader(GLuint id) | |
void | setWorldTransform(const glm::mat4 & model, const glm::mat4 & view, const glm::mat4 & projection)<br>Updates MVP matrices. |
Public Attributes inherited from Vp::WorldShader
Name | |
---|---|
glm::mat4 | m_model |
glm::mat4 | m_projection |
glm::mat4 | m_view |
GLint | m_wboitFarId |
GLint | m_wboitNearId |
GLint | modelMatrixId |
GLint | normalMatrixId |
GLint | projectionMatrixId |
GLint | pvmMatrixId |
GLint | viewMatrixId |
Public Functions inherited from Vp::Shader
Name | |
---|---|
Shader(GLuint id) | |
virtual | ~Shader() =default |
void | bindTexture2D(GLuint textureUnit, GLuint textureID, GLint samplerLocation) |
void | bindTexture2DMS(GLuint textureUnit, GLuint textureID, GLint samplerLocation) |
bool | hasUniform(GLint location) |
bool | supportsWboit() |
virtual void | use() const |
Public Attributes inherited from Vp::Shader
Name | |
---|---|
GLuint | m_id |
bool | m_wboit <br>Whether to use weighted blended transparency for output if supported. |
int | m_wboitFunc |
Protected Attributes inherited from Vp::Shader
Name | |
---|---|
GLint | m_wboitFlagId <br>Uniform id of the wboit enable/disable flag. |
GLint | m_wboitFuncId |
Public Types Documentation
enum LightingModel
Enumerator | Value | Description |
---|---|---|
PHONG | ||
BLINN_PHONG |
Public Functions Documentation
function PhongShader
explicit PhongShader(
GLuint id
)
explicit PhongShader(
GLuint id
)
function init
virtual void init(
bool initSuperclass
) override
virtual void init(
bool initSuperclass
) override
Reimplements: Vp::ObjectShader::init
function setUniforms
virtual void setUniforms() override
virtual void setUniforms() override
Set uniforms before rendering.
Reimplements: Vp::ObjectShader::setUniforms
function setUniformsPerMeshPart
virtual void setUniformsPerMeshPart(
Core::Mesh::MeshPart & meshPart
) override
virtual void setUniformsPerMeshPart(
Core::Mesh::MeshPart & meshPart
) override
Set uniforms before rendering individual mesh parts.
Parameters:
- meshPart MeshPart being rendered
Reimplements: Vp::Shader::setUniformsPerMeshPart
Protected Functions Documentation
function bindTexture
void bindTexture(
GLuint textureID,
const std::string & type,
int typeIndex,
GLuint textureUnit
)
void bindTexture(
GLuint textureID,
const std::string & type,
int typeIndex,
GLuint textureUnit
)
function bindTextures
void bindTextures(
Core::Mesh::TextureSet tSet
)
void bindTextures(
Core::Mesh::TextureSet tSet
)
function clearTextures
void clearTextures() const
void clearTextures() const
Sets all texture active flags to false.
Used to reset texture state before binding new set of textures.
function setMaterialUniforms
void setMaterialUniforms(
Core::Mesh::Material material
)
void setMaterialUniforms(
Core::Mesh::Material material
)
Public Attributes Documentation
variable m_lightingModel
LightingModel m_lightingModel {BLINN_PHONG};
LightingModel m_lightingModel {BLINN_PHONG};
variable m_tint
glm::vec3 m_tint {1.0f};
glm::vec3 m_tint {1.0f};
Protected Attributes Documentation
variable m_lightingModelId
GLint m_lightingModelId;
GLint m_lightingModelId;
variable material_ambient
GLint material_ambient;
GLint material_ambient;
variable material_diffuse
GLint material_diffuse;
GLint material_diffuse;
variable material_shininess
GLint material_shininess;
GLint material_shininess;
variable material_specular
GLint material_specular;
GLint material_specular;
variable normalStrength
GLint normalStrength;
GLint normalStrength;
variable tintId
GLint tintId;
GLint tintId;
Updated on 2024-11-06 at 20:16:53 +0000