From b8401062e1d3f5e6554ab7fd9b983ea63cfb05c5 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 10 Jan 2024 19:04:30 +0000 Subject: Initial commit with working light instancing --- game/scenary/illuminator.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'game') 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(instances.bufferName(), 1); VertexArrayObject {instancesSpotLightVAO} - .addAttribs(instances.bufferName(), 0) .addAttribs( - instancesSpotLight.bufferName(), 1); + instancesSpotLight.bufferName(), 0) + .addAttribs(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(count), static_cast(scount)); + glDrawArraysInstanced(GL_POINTS, 0, static_cast(scount), static_cast(count)); } glBindVertexArray(0); -- cgit v1.2.3