diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-07-20 12:55:15 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-08-10 18:11:59 +0100 |
commit | 4ba67f34eac848e43bad2ccc4b5c09ac65dd7952 (patch) | |
tree | 999331eb0a08ab9c995e4d39b5d3980eb7f8018b /gfx/gl/shadowStenciller.cpp | |
parent | Calculate and store the extents of a mesh (diff) | |
download | ilt-4ba67f34eac848e43bad2ccc4b5c09ac65dd7952.tar.bz2 ilt-4ba67f34eac848e43bad2ccc4b5c09ac65dd7952.tar.xz ilt-4ba67f34eac848e43bad2ccc4b5c09ac65dd7952.zip |
Use mesh extents for shadow stencil extents
Diffstat (limited to 'gfx/gl/shadowStenciller.cpp')
-rw-r--r-- | gfx/gl/shadowStenciller.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gfx/gl/shadowStenciller.cpp b/gfx/gl/shadowStenciller.cpp index 6d5fa40..e20eda1 100644 --- a/gfx/gl/shadowStenciller.cpp +++ b/gfx/gl/shadowStenciller.cpp @@ -32,8 +32,7 @@ ShadowStenciller::createStencilTexture(GLsizei width, GLsizei height) } void -ShadowStenciller::renderStencil(const glTexture & stencil, const MeshBase & mesh, const RelativePosition3D & mins, - const RelativePosition3D & maxs) const +ShadowStenciller::renderStencil(const glTexture & stencil, const MeshBase & mesh) const { glBindFramebuffer(GL_FRAMEBUFFER, fbo); glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, stencil, 0); @@ -44,6 +43,8 @@ ShadowStenciller::renderStencil(const glTexture & stencil, const MeshBase & mesh glClear(GL_DEPTH_BUFFER_BIT); glViewport(0, 0, 256, 256); glEnable(GL_DEPTH_TEST); + const auto & mins = mesh.minExtent(); + const auto & maxs = mesh.maxExtent(); const auto extents = glm::ortho(mins.x, maxs.x, mins.z, maxs.z, mins.y, maxs.y); const auto lightDir = glm::lookAt({}, north, up); glUniform(viewProjectionLoc, extents * lightDir); |