summaryrefslogtreecommitdiff
path: root/game/scenary
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-23 21:10:46 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-23 21:16:40 +0100
commita2e87cf25f15ec8d6184a0aefc7ad949fb89b52b (patch)
treed34f21fe47d64fcc8743b47146b3cc893f0d8ce8 /game/scenary
parentAdd getTransform to Location; wraps the standard mat4 calculations (diff)
downloadilt-a2e87cf25f15ec8d6184a0aefc7ad949fb89b52b.tar.bz2
ilt-a2e87cf25f15ec8d6184a0aefc7ad949fb89b52b.tar.xz
ilt-a2e87cf25f15ec8d6184a0aefc7ad949fb89b52b.zip
Use Location::getTransform in Plant instead of duplicating
Diffstat (limited to 'game/scenary')
-rw-r--r--game/scenary/plant.cpp6
-rw-r--r--game/scenary/plant.h7
2 files changed, 6 insertions, 7 deletions
diff --git a/game/scenary/plant.cpp b/game/scenary/plant.cpp
index 678d4a7..2a79807 100644
--- a/game/scenary/plant.cpp
+++ b/game/scenary/plant.cpp
@@ -1,7 +1,7 @@
#include "plant.h"
+#include "location.hpp"
-Plant::Plant(std::shared_ptr<const Foliage> type, Location position) :
- type {std::move(type)},
- location {this->type->instances.acquire(glm::translate(position.pos) * rotate_ypr(position.rot))}
+Plant::Plant(std::shared_ptr<const Foliage> type, const Location & position) :
+ type {std::move(type)}, location {this->type->instances.acquire(position.getTransform())}
{
}
diff --git a/game/scenary/plant.h b/game/scenary/plant.h
index 77c5979..82ab0e5 100644
--- a/game/scenary/plant.h
+++ b/game/scenary/plant.h
@@ -2,9 +2,8 @@
#include "foliage.h"
#include "game/worldobject.h"
-#include "location.hpp"
-#include "maths.h"
-#include <glm/gtx/transform.hpp>
+
+class Location;
class Plant : public WorldObject {
std::shared_ptr<const Foliage> type;
@@ -16,5 +15,5 @@ class Plant : public WorldObject {
}
public:
- Plant(std::shared_ptr<const Foliage> type, Location position);
+ Plant(std::shared_ptr<const Foliage> type, const Location & position);
};