mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
Shadow mapping view frustum clean-up (more intuitive LookAt Up vector).
This commit is contained in:
@@ -164,7 +164,7 @@ int main()
|
|||||||
GLfloat near_plane = 1.0f, far_plane = 7.5f;
|
GLfloat near_plane = 1.0f, far_plane = 7.5f;
|
||||||
lightProjection = glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, near_plane, far_plane);
|
lightProjection = glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, near_plane, far_plane);
|
||||||
//lightProjection = glm::perspective(45.0f, (GLfloat)SHADOW_WIDTH / (GLfloat)SHADOW_HEIGHT, near_plane, far_plane); // Note that if you use a perspective projection matrix you'll have to change the light position as the current light position isn't enough to reflect the whole scene.
|
//lightProjection = glm::perspective(45.0f, (GLfloat)SHADOW_WIDTH / (GLfloat)SHADOW_HEIGHT, near_plane, far_plane); // Note that if you use a perspective projection matrix you'll have to change the light position as the current light position isn't enough to reflect the whole scene.
|
||||||
lightView = glm::lookAt(lightPos, glm::vec3(0.0f), glm::vec3(1.0));
|
lightView = glm::lookAt(lightPos, glm::vec3(0.0f), glm::vec3(0.0, 1.0, 0.0));
|
||||||
lightSpaceMatrix = lightProjection * lightView;
|
lightSpaceMatrix = lightProjection * lightView;
|
||||||
// - now render scene from light's point of view
|
// - now render scene from light's point of view
|
||||||
simpleDepthShader.Use();
|
simpleDepthShader.Use();
|
||||||
|
|||||||
Reference in New Issue
Block a user