summaryrefslogtreecommitdiff
path: root/game/scenary/foliage.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan.goodliffe@octal.co.uk>2026-03-02 13:17:28 +0000
committerDan Goodliffe <dan.goodliffe@octal.co.uk>2026-03-02 13:17:28 +0000
commit64ede41ebaade64ad6705f7f55ca4a778a156481 (patch)
tree6d2fbc64cd28d272fe3f5bbf79ddd41ecc5e2626 /game/scenary/foliage.cpp
parentRefactor glArrays to better expose underlying types (diff)
downloadilt-64ede41ebaade64ad6705f7f55ca4a778a156481.tar.bz2
ilt-64ede41ebaade64ad6705f7f55ca4a778a156481.tar.xz
ilt-64ede41ebaade64ad6705f7f55ca4a778a156481.zip
Wrap up some low level texture operations in glTexture classHEADmain
Fixes previously hard coded billboard texture size.
Diffstat (limited to 'game/scenary/foliage.cpp')
-rw-r--r--game/scenary/foliage.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/game/scenary/foliage.cpp b/game/scenary/foliage.cpp
index 6b471fc..cefee9f 100644
--- a/game/scenary/foliage.cpp
+++ b/game/scenary/foliage.cpp
@@ -77,12 +77,9 @@ Foliage::render(const SceneShader & shader, const Frustum &) const
glDebugScope _ {0, "Billboard"};
const auto dimensions = bodyMesh->getDimensions();
shader.billboard.use(dimensions.size, dimensions.centre);
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D_ARRAY, billboard[0]);
- glActiveTexture(GL_TEXTURE1);
- glBindTexture(GL_TEXTURE_2D_ARRAY, billboard[1]);
- glActiveTexture(GL_TEXTURE2);
- glBindTexture(GL_TEXTURE_2D_ARRAY, billboard[2]);
+ billboard[0].bind(GL_TEXTURE_2D_ARRAY, GL_TEXTURE0);
+ billboard[1].bind(GL_TEXTURE_2D_ARRAY, GL_TEXTURE1);
+ billboard[2].bind(GL_TEXTURE_2D_ARRAY, GL_TEXTURE2);
glBindVertexArray(instancePointVAO);
glDrawArrays(GL_POINTS, static_cast<GLint>(instancePartitions.second.first), static_cast<GLsizei>(count));
glBindVertexArray(0);
@@ -107,8 +104,7 @@ Foliage::shadows(const ShadowMapper & mapper, const Frustum &) const
if (const auto count = instancePartitions.second.second - instancePartitions.second.first) {
const auto dimensions = bodyMesh->getDimensions();
mapper.stencilShadowProgram.use(dimensions.centre, dimensions.size);
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D_ARRAY, shadowStencil);
+ shadowStencil.bind(GL_TEXTURE_2D_ARRAY, GL_TEXTURE0);
glBindVertexArray(instancePointVAO);
glDrawArrays(GL_POINTS, static_cast<GLint>(instancePartitions.second.first), static_cast<GLsizei>(count));
glBindVertexArray(0);