Implement shadow mapping pipeline for terrain and models

This commit is contained in:
Kelsi 2026-02-04 16:08:35 -08:00
parent dede5a99d4
commit f17b15395d
6 changed files with 306 additions and 1 deletions

View file

@ -125,6 +125,19 @@ public:
void setFogEnabled(bool enabled) { fogEnabled = enabled; }
bool isFogEnabled() const { return fogEnabled; }
/**
* Render terrain geometry into shadow depth map
*/
void renderShadow(GLuint shaderProgram);
/**
* Set shadow map for receiving shadows
*/
void setShadowMap(GLuint depthTex, const glm::mat4& lightSpaceMat) {
shadowDepthTex = depthTex; lightSpaceMatrix = lightSpaceMat; shadowEnabled = true;
}
void clearShadowMap() { shadowEnabled = false; }
/**
* Get statistics
*/
@ -187,6 +200,11 @@ private:
// Default white texture (fallback)
GLuint whiteTexture = 0;
// Shadow mapping (receiving)
GLuint shadowDepthTex = 0;
glm::mat4 lightSpaceMatrix = glm::mat4(1.0f);
bool shadowEnabled = false;
};
} // namespace rendering