diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-03-11 20:45:05 +0000 |
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-03-11 20:45:05 +0000 |
| commit | c403a71564def731f4d3b80d6ff63f08aa3c7ea3 (patch) | |
| tree | e4302316295639da9a2d10181c498986c8806754 /game/terrain.h | |
| parent | Add missing typename exporting base::value_type from InstanceVertices (diff) | |
| download | ilt-c403a71564def731f4d3b80d6ff63f08aa3c7ea3.tar.bz2 ilt-c403a71564def731f4d3b80d6ff63f08aa3c7ea3.tar.xz ilt-c403a71564def731f4d3b80d6ff63f08aa3c7ea3.zip | |
Reuse vertex array objects for common structures with DSA
Slashes the number of VAOs required and the amount of setup required.
Diffstat (limited to 'game/terrain.h')
| -rw-r--r-- | game/terrain.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/game/terrain.h b/game/terrain.h index 1a63296..f1170f2 100644 --- a/game/terrain.h +++ b/game/terrain.h @@ -13,7 +13,7 @@ class Terrain : public GeoData, public WorldObject, public Renderable { public: template<typename... P> explicit Terrain(P &&... params) : GeoData {std::forward<P>(params)...} { - generateMeshes(); + initialise(); } void render(const SceneShader & shader, const Frustum &) const override; @@ -29,15 +29,17 @@ public: void generateMeshes(); private: + void initialise(); void afterChange() override; struct SurfaceArrayBuffer { - glVertexArray vertexArray; glBuffer indicesBuffer; GLsizei count; AxisAlignedBoundingBox<GlobalDistance> aabb; }; + glVertexArray vertexArray; + struct SurfaceKey { const Surface * surface; GlobalPosition2D basePosition; |
