Skip to content

Vp::PhongShader

Shader for lit objects with textures.

#include "Viewport/shader/PhongShader.h"

Inherits from Vp::ObjectShader, Vp::WorldShader, Vp::Shader

Public Types

Name
enumLightingModel { PHONG, BLINN_PHONG}

Public Functions

Name
PhongShader(GLuint id)
virtual voidinit(bool initSuperclass) override
virtual voidsetUniforms() override<br>Set uniforms before rendering.
virtual voidsetUniformsPerMeshPart(Core::Mesh::MeshPart & meshPart) override<br>Set uniforms before rendering individual mesh parts.

Protected Functions

Name
voidbindTexture(GLuint textureID, const std::string & type, int typeIndex, GLuint textureUnit)
voidbindTextures(Core::Mesh::TextureSet tSet)
voidclearTextures() const<br>Sets all texture active flags to false.
voidsetMaterialUniforms(Core::Mesh::Material material)

Public Attributes

Name
LightingModelm_lightingModel
glm::vec3m_tint

Protected Attributes

Name
GLintm_lightingModelId
GLintmaterial_ambient
GLintmaterial_diffuse
GLintmaterial_shininess
GLintmaterial_specular
GLintnormalStrength
GLinttintId

Additional inherited members

Public Functions inherited from Vp::ObjectShader

Name
ObjectShader(GLuint id)

Public Attributes inherited from Vp::ObjectShader

Name
floatm_opacity

Protected Attributes inherited from Vp::ObjectShader

Name
GLintopacityId

Public Functions inherited from Vp::WorldShader

Name
WorldShader(GLuint id)
voidsetWorldTransform(const glm::mat4 & model, const glm::mat4 & view, const glm::mat4 & projection)<br>Updates MVP matrices.

Public Attributes inherited from Vp::WorldShader

Name
glm::mat4m_model
glm::mat4m_projection
glm::mat4m_view
GLintm_wboitFarId
GLintm_wboitNearId
GLintmodelMatrixId
GLintnormalMatrixId
GLintprojectionMatrixId
GLintpvmMatrixId
GLintviewMatrixId

Public Functions inherited from Vp::Shader

Name
Shader(GLuint id)
virtual~Shader() =default
voidbindTexture2D(GLuint textureUnit, GLuint textureID, GLint samplerLocation)
voidbindTexture2DMS(GLuint textureUnit, GLuint textureID, GLint samplerLocation)
boolhasUniform(GLint location)
boolsupportsWboit()
virtual voiduse() const

Public Attributes inherited from Vp::Shader

Name
GLuintm_id
boolm_wboit <br>Whether to use weighted blended transparency for output if supported.
intm_wboitFunc

Protected Attributes inherited from Vp::Shader

Name
GLintm_wboitFlagId <br>Uniform id of the wboit enable/disable flag.
GLintm_wboitFuncId

Public Types Documentation

enum LightingModel

EnumeratorValueDescription
PHONG
BLINN_PHONG

Public Functions Documentation

function PhongShader

cpp
explicit PhongShader(
    GLuint id
)
explicit PhongShader(
    GLuint id
)

function init

cpp
virtual void init(
    bool initSuperclass
) override
virtual void init(
    bool initSuperclass
) override

Reimplements: Vp::ObjectShader::init

function setUniforms

cpp
virtual void setUniforms() override
virtual void setUniforms() override

Set uniforms before rendering.

Reimplements: Vp::ObjectShader::setUniforms

function setUniformsPerMeshPart

cpp
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

cpp
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

cpp
void bindTextures(
    Core::Mesh::TextureSet tSet
)
void bindTextures(
    Core::Mesh::TextureSet tSet
)

function clearTextures

cpp
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

cpp
void setMaterialUniforms(
    Core::Mesh::Material material
)
void setMaterialUniforms(
    Core::Mesh::Material material
)

Public Attributes Documentation

variable m_lightingModel

cpp
LightingModel m_lightingModel {BLINN_PHONG};
LightingModel m_lightingModel {BLINN_PHONG};

variable m_tint

cpp
glm::vec3 m_tint {1.0f};
glm::vec3 m_tint {1.0f};

Protected Attributes Documentation

variable m_lightingModelId

cpp
GLint m_lightingModelId;
GLint m_lightingModelId;

variable material_ambient

cpp
GLint material_ambient;
GLint material_ambient;

variable material_diffuse

cpp
GLint material_diffuse;
GLint material_diffuse;

variable material_shininess

cpp
GLint material_shininess;
GLint material_shininess;

variable material_specular

cpp
GLint material_specular;
GLint material_specular;

variable normalStrength

cpp
GLint normalStrength;
GLint normalStrength;

variable tintId

cpp
GLint tintId;
GLint tintId;

Updated on 2024-11-06 at 20:16:53 +0000