diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-10 19:04:30 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-10 19:04:30 +0000 |
commit | b8401062e1d3f5e6554ab7fd9b983ea63cfb05c5 (patch) | |
tree | ba5c4f944cee1fa04b4aba8b018c3f1f7864490e /game/scenary | |
parent | Add spot light definition, loader, and rendering (diff) | |
download | ilt-b8401062e1d3f5e6554ab7fd9b983ea63cfb05c5.tar.bz2 ilt-b8401062e1d3f5e6554ab7fd9b983ea63cfb05c5.tar.xz ilt-b8401062e1d3f5e6554ab7fd9b983ea63cfb05c5.zip |
Initial commit with working light instancing
Diffstat (limited to 'game/scenary')
-rw-r--r-- | game/scenary/illuminator.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/game/scenary/illuminator.cpp b/game/scenary/illuminator.cpp index 43b6e4e..6f51506 100644 --- a/game/scenary/illuminator.cpp +++ b/game/scenary/illuminator.cpp @@ -25,10 +25,10 @@ Illuminator::postLoad() bodyMesh->configureVAO(instanceVAO) .addAttribs<LocationVertex, &LocationVertex::first, &LocationVertex::second>(instances.bufferName(), 1); VertexArrayObject {instancesSpotLightVAO} - .addAttribs<LocationVertex, &LocationVertex::first, &LocationVertex::second>(instances.bufferName(), 0) .addAttribs<SpotLightVertex, &SpotLightVertex::position, &SpotLightVertex::direction, &SpotLightVertex::colour, &SpotLightVertex::kq, &SpotLightVertex::arc>( - instancesSpotLight.bufferName(), 1); + instancesSpotLight.bufferName(), 0) + .addAttribs<LocationVertex, &LocationVertex::first, &LocationVertex::second>(instances.bufferName(), 1); std::transform(spotLight.begin(), spotLight.end(), std::back_inserter(spotLightInstances), [this](const auto & s) { return instancesSpotLight.acquire(*s); }); @@ -47,13 +47,13 @@ Illuminator::render(const SceneShader & shader) const } void -Illuminator::lights(const SceneShader &) const +Illuminator::lights(const SceneShader & shader) const { if (const auto count = instances.size()) { if (const auto scount = instancesSpotLight.size()) { - // shader.pointLight.use(); + shader.spotLightInst.use(); glBindVertexArray(instancesSpotLightVAO); - glDrawArraysInstanced(GL_POINTS, 0, static_cast<GLsizei>(count), static_cast<GLsizei>(scount)); + glDrawArraysInstanced(GL_POINTS, 0, static_cast<GLsizei>(scount), static_cast<GLsizei>(count)); } glBindVertexArray(0); |