PGR Copakond OpenGL Engine - Bowling
Loading...
Searching...
No Matches
copakond::Shader Class Reference

Core manager for shader program compilation, uniform binding, and rendering. More...

#include <shader.h>

Public Member Functions

 Shader ()
void applyMaterialUniforms (std::shared_ptr< Material > mat)
 Binds material properties and active textures to the shader pipeline.
void setLight (Light *light, int lightIndex)
void updateLight (Light *light)
GLuint init (std::string vertShaderLocation, std::string fragShaderLocation)
 Compiles and links vertex and fragment shaders.
void update (Camera &camera, int winWidth, int winHeight, float deltaTime)
 Updates global shader uniforms (Camera, Fog, Time).
void draw (Mesh &mesh, bool drawTransparent, float deltaTime)
 Issues draw calls for a specific mesh.

Static Public Member Functions

static glm::vec3 getWorldAmbient ()

Protected Attributes

GLuint _shaderProgram = 0
GLuint _worldAmbientUID = 0
GLint _modelUID = 0
GLint _viewUID = 0
GLint _projectionUID = 0
GLint _pvmUID = 0
GLint _camPos = 0
GLint _normalMatrix = 0
GLint _fogEnabled = 0
GLint _fogStart = 0
GLint _fogEnd = 0
GLint _fogColor = 0
GLint _ambient = 0
GLint _diffuse = 0
GLint _specular = 0
GLint _shininess = 0
GLint _alpha = 0
GLuint _diffuseMapUID = 0
GLuint _specularMapUID = 0
GLuint _shininessMapUID = 0
GLuint _alphaMapUID = 0
GLuint _normalMapUID = 0
GLuint _useDiffuseMapUID = 0
GLuint _useSpecularMapUID = 0
GLuint _useShininessMapUID = 0
GLuint _useAlphaMapUID = 0
GLuint _useNormalMapUID = 0
GLuint _isTextLabelUID = 0
GLuint _isVertexWaveUID = 0
GLuint _timeUID = 0
GLint _numLights = 0
size_t totalNumLights = 0
glm::mat4 _viewM
glm::mat4 _projectionM
glm::vec3 _position

Detailed Description

Core manager for shader program compilation, uniform binding, and rendering.

Constructor & Destructor Documentation

◆ Shader()

copakond::Shader::Shader ( )

Member Function Documentation

◆ applyMaterialUniforms()

void copakond::Shader::applyMaterialUniforms ( std::shared_ptr< Material > mat)

Binds material properties and active textures to the shader pipeline.

◆ draw()

void copakond::Shader::draw ( Mesh & mesh,
bool drawTransparent,
float deltaTime )

Issues draw calls for a specific mesh.

Parameters
drawTransparentIf true, renders only transparent submeshes (for blending). If false, renders opaque.
deltaTimePassed for procedural vertex wave animations.

◆ getWorldAmbient()

glm::vec3 copakond::Shader::getWorldAmbient ( )
inlinestatic

◆ init()

GLuint copakond::Shader::init ( std::string vertShaderLocation,
std::string fragShaderLocation )

Compiles and links vertex and fragment shaders.

Returns
The generated OpenGL shader program ID.

◆ setLight()

void copakond::Shader::setLight ( Light * light,
int lightIndex )

◆ update()

void copakond::Shader::update ( Camera & camera,
int winWidth,
int winHeight,
float deltaTime )

Updates global shader uniforms (Camera, Fog, Time).

◆ updateLight()

void copakond::Shader::updateLight ( Light * light)

Member Data Documentation

◆ _alpha

GLint copakond::Shader::_alpha = 0
protected

◆ _alphaMapUID

GLuint copakond::Shader::_alphaMapUID = 0
protected

◆ _ambient

GLint copakond::Shader::_ambient = 0
protected

◆ _camPos

GLint copakond::Shader::_camPos = 0
protected

◆ _diffuse

GLint copakond::Shader::_diffuse = 0
protected

◆ _diffuseMapUID

GLuint copakond::Shader::_diffuseMapUID = 0
protected

◆ _fogColor

GLint copakond::Shader::_fogColor = 0
protected

◆ _fogEnabled

GLint copakond::Shader::_fogEnabled = 0
protected

◆ _fogEnd

GLint copakond::Shader::_fogEnd = 0
protected

◆ _fogStart

GLint copakond::Shader::_fogStart = 0
protected

◆ _isTextLabelUID

GLuint copakond::Shader::_isTextLabelUID = 0
protected

◆ _isVertexWaveUID

GLuint copakond::Shader::_isVertexWaveUID = 0
protected

◆ _modelUID

GLint copakond::Shader::_modelUID = 0
protected

◆ _normalMapUID

GLuint copakond::Shader::_normalMapUID = 0
protected

◆ _normalMatrix

GLint copakond::Shader::_normalMatrix = 0
protected

◆ _numLights

GLint copakond::Shader::_numLights = 0
protected

◆ _position

glm::vec3 copakond::Shader::_position
protected

◆ _projectionM

glm::mat4 copakond::Shader::_projectionM
protected

◆ _projectionUID

GLint copakond::Shader::_projectionUID = 0
protected

◆ _pvmUID

GLint copakond::Shader::_pvmUID = 0
protected

◆ _shaderProgram

GLuint copakond::Shader::_shaderProgram = 0
protected

◆ _shininess

GLint copakond::Shader::_shininess = 0
protected

◆ _shininessMapUID

GLuint copakond::Shader::_shininessMapUID = 0
protected

◆ _specular

GLint copakond::Shader::_specular = 0
protected

◆ _specularMapUID

GLuint copakond::Shader::_specularMapUID = 0
protected

◆ _timeUID

GLuint copakond::Shader::_timeUID = 0
protected

◆ _useAlphaMapUID

GLuint copakond::Shader::_useAlphaMapUID = 0
protected

◆ _useDiffuseMapUID

GLuint copakond::Shader::_useDiffuseMapUID = 0
protected

◆ _useNormalMapUID

GLuint copakond::Shader::_useNormalMapUID = 0
protected

◆ _useShininessMapUID

GLuint copakond::Shader::_useShininessMapUID = 0
protected

◆ _useSpecularMapUID

GLuint copakond::Shader::_useSpecularMapUID = 0
protected

◆ _viewM

glm::mat4 copakond::Shader::_viewM
protected

◆ _viewUID

GLint copakond::Shader::_viewUID = 0
protected

◆ _worldAmbientUID

GLuint copakond::Shader::_worldAmbientUID = 0
protected

◆ totalNumLights

size_t copakond::Shader::totalNumLights = 0
protected

The documentation for this class was generated from the following files: