summaryrefslogtreecommitdiff
path: root/game/scenary
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-07-20 10:57:17 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-08-10 18:11:55 +0100
commit900d19a41bc1886e7a809d99d6119b12235a4f0a (patch)
tree2e72221ae1a470d448497664a95d4e64acc2e8f1 /game/scenary
parentFix texture usage via materials in shadows (diff)
downloadilt-900d19a41bc1886e7a809d99d6119b12235a4f0a.tar.bz2
ilt-900d19a41bc1886e7a809d99d6119b12235a4f0a.tar.xz
ilt-900d19a41bc1886e7a809d99d6119b12235a4f0a.zip
Initial commit of basic shadow depth map creation
Diffstat (limited to 'game/scenary')
-rw-r--r--game/scenary/foliage.cpp3
-rw-r--r--game/scenary/foliage.h2
2 files changed, 5 insertions, 0 deletions
diff --git a/game/scenary/foliage.cpp b/game/scenary/foliage.cpp
index 73d285f..870adb0 100644
--- a/game/scenary/foliage.cpp
+++ b/game/scenary/foliage.cpp
@@ -17,6 +17,9 @@ Foliage::postLoad()
texture = getTexture();
bodyMesh->configureVAO(instanceVAO)
.addAttribs<LocationVertex, &LocationVertex::first, &LocationVertex::second>(instances.bufferName(), 1);
+ ShadowStenciller ss;
+ ss.renderStencil(shadowStencil, *bodyMesh, {-4000, -4000, 0}, {4000, 4000, 8000});
+ Texture::saveDepth(shadowStencil, std::format("/tmp/stencil-{}.tga", id).c_str());
}
void
diff --git a/game/scenary/foliage.h b/game/scenary/foliage.h
index 0a4261c..5367d44 100644
--- a/game/scenary/foliage.h
+++ b/game/scenary/foliage.h
@@ -2,6 +2,7 @@
#include "assetFactory/asset.h"
#include "gfx/gl/instanceVertices.h"
+#include "gfx/gl/shadowStenciller.h"
#include "gfx/models/texture.h"
#include "gfx/renderable.h"
@@ -19,6 +20,7 @@ public:
mutable InstanceVertices<LocationVertex> instances;
void render(const SceneShader &) const override;
void shadows(const ShadowMapper &) const override;
+ glTexture shadowStencil = ShadowStenciller::createStencilTexture(256, 256);
protected:
friend Persistence::SelectionPtrBase<std::shared_ptr<Foliage>>;