From 356e874050e5ad5af87b04a2bb01ce34a86640bb Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 13 Nov 2023 00:17:11 +0000 Subject: Send position and rotation matrix to GPU separately --- game/scenary/foliage.cpp | 3 ++- game/scenary/foliage.h | 3 ++- game/scenary/plant.cpp | 2 +- game/scenary/plant.h | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) (limited to 'game/scenary') diff --git a/game/scenary/foliage.cpp b/game/scenary/foliage.cpp index 702a52c..c258b77 100644 --- a/game/scenary/foliage.cpp +++ b/game/scenary/foliage.cpp @@ -15,7 +15,8 @@ void Foliage::postLoad() { texture = getTexture(); - bodyMesh->configureVAO(instanceVAO).addAttribs(instances.bufferName(), 1); + bodyMesh->configureVAO(instanceVAO) + .addAttribs(instances.bufferName(), 1); } void diff --git a/game/scenary/foliage.h b/game/scenary/foliage.h index b72a9c2..5a9d2de 100644 --- a/game/scenary/foliage.h +++ b/game/scenary/foliage.h @@ -15,7 +15,8 @@ class Foliage : public Asset, public Renderable, public StdTypeDefs { glVertexArray instanceVAO; public: - mutable InstanceVertices instances; + using LocationVertex = std::pair; + mutable InstanceVertices instances; void render(const SceneShader &) const override; void shadows(const ShadowMapper &) const override; diff --git a/game/scenary/plant.cpp b/game/scenary/plant.cpp index 4fb3cb5..b39c28b 100644 --- a/game/scenary/plant.cpp +++ b/game/scenary/plant.cpp @@ -2,6 +2,6 @@ #include "location.h" Plant::Plant(std::shared_ptr type, const Location & position) : - type {std::move(type)}, location {this->type->instances.acquire(position.getTransform())} + type {std::move(type)}, location {this->type->instances.acquire(position.getRotationTransform(), position.pos)} { } diff --git a/game/scenary/plant.h b/game/scenary/plant.h index 82ab0e5..77c9ff7 100644 --- a/game/scenary/plant.h +++ b/game/scenary/plant.h @@ -7,7 +7,7 @@ class Location; class Plant : public WorldObject { std::shared_ptr type; - InstanceVertices::InstanceProxy location; + InstanceVertices::InstanceProxy location; void tick(TickDuration) override -- cgit v1.2.3 From 0aa665c3648d788755b00c9e431c872d57fddbb8 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 25 Nov 2023 16:28:39 +0000 Subject: Model positions as integers Introduces test failure in arcs due to rounding, but I don't want to create a complicated fix as link positions are still floats and hopefully that'll go away... somehow --- game/scenary/foliage.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'game/scenary') diff --git a/game/scenary/foliage.h b/game/scenary/foliage.h index 5a9d2de..bbb6200 100644 --- a/game/scenary/foliage.h +++ b/game/scenary/foliage.h @@ -15,7 +15,7 @@ class Foliage : public Asset, public Renderable, public StdTypeDefs { glVertexArray instanceVAO; public: - using LocationVertex = std::pair; + using LocationVertex = std::pair; mutable InstanceVertices instances; void render(const SceneShader &) const override; void shadows(const ShadowMapper &) const override; -- cgit v1.2.3