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 |
| bool | m_normal <br>Whether to provide normal matrix uniform. |
| glm::mat4 | m_projection |
| bool | m_pvm <br>Whether to provide precalculated PVM matrix uniform. |
| bool | m_pvmSeparate <br>Whether to provide individual pvm matrices. |
| 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 | bindTexture2DArray(GLuint textureUnit, GLuint textureID, GLint samplerLocation) |
| void | bindTexture2DMS(GLuint textureUnit, GLuint textureID, GLint samplerLocation) |
| bool | hasUniform(GLint location) const |
| bool | supportsUserClipping() const |
| bool | supportsWboit() const |
| virtual void | use() const |
Public Attributes inherited from Vp::Shader
| Name | |
|---|---|
| const std::array< glm::vec4, 6 > * | m_clippingPlanes |
| std::string | m_fragSource |
| std::string | m_geoSource |
| GLuint | m_id |
| std::string | m_injectedSource |
| std::string | m_vertSource |
| bool | m_wboit <br>Whether to use weighted blended transparency for output if supported. |
| int | m_wboitFunc |
Protected Attributes inherited from Vp::Shader
| Name | |
|---|---|
| std::array< GLint, 6 > | m_clippingPlanesId |
| 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
)function init
virtual void init(
bool initSuperclass
) overrideReimplements: Vp::ObjectShader::init
function setUniforms
virtual void setUniforms() overrideSet uniforms before rendering.
Reimplements: Vp::ObjectShader::setUniforms
function setUniformsPerMeshPart
virtual void setUniformsPerMeshPart(
Core::Mesh::MeshPart & meshPart
) overrideSet 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
)function bindTextures
void bindTextures(
Core::Mesh::TextureSet tSet
)function clearTextures
void clearTextures() constSets 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
)Public Attributes Documentation
variable m_lightingModel
LightingModel m_lightingModel {BLINN_PHONG};variable m_tint
glm::vec3 m_tint {1.0f};Protected Attributes Documentation
variable m_lightingModelId
GLint m_lightingModelId;variable material_ambient
GLint material_ambient;variable material_diffuse
GLint material_diffuse;variable material_shininess
GLint material_shininess;variable material_specular
GLint material_specular;variable normalStrength
GLint normalStrength;variable tintId
GLint tintId;Updated on 2026-09-11 at 21:24:25 +0000