summaryrefslogtreecommitdiff
path: root/game/vehicles
diff options
context:
space:
mode:
Diffstat (limited to 'game/vehicles')
-rw-r--r--game/vehicles/railVehicle.cpp9
-rw-r--r--game/vehicles/railVehicleClass.cpp8
-rw-r--r--game/vehicles/railVehicleClass.h1
3 files changed, 12 insertions, 6 deletions
diff --git a/game/vehicles/railVehicle.cpp b/game/vehicles/railVehicle.cpp
index 1ed904d..6e6e18f 100644
--- a/game/vehicles/railVehicle.cpp
+++ b/game/vehicles/railVehicle.cpp
@@ -14,15 +14,18 @@
RailVehicle::RailVehicle(RailVehicleClassPtr rvc) :
RailVehicleClass::Instance {rvc->instances.acquire()}, rvClass {std::move(rvc)},
location {[this](const BufferedLocation * l) {
- this->get()->body = l->getTransform();
+ this->get()->body = l->getRotationTransform();
+ this->get()->bodyPos = l->position();
}},
bogies {{
{[this](const BufferedLocation * l) {
- this->get()->front = l->getTransform();
+ this->get()->front = l->getRotationTransform();
+ this->get()->frontPos = l->position();
},
Position3D {0, rvClass->wheelBase / 2.F, 0}},
{[this](const BufferedLocation * l) {
- this->get()->back = l->getTransform();
+ this->get()->back = l->getRotationTransform();
+ this->get()->backPos = l->position();
},
Position3D {0, -rvClass->wheelBase / 2.F, 0}},
}}
diff --git a/game/vehicles/railVehicleClass.cpp b/game/vehicles/railVehicleClass.cpp
index 324148c..7a6a9fe 100644
--- a/game/vehicles/railVehicleClass.cpp
+++ b/game/vehicles/railVehicleClass.cpp
@@ -35,13 +35,15 @@ void
RailVehicleClass::postLoad()
{
texture = getTexture();
- bodyMesh->configureVAO(instanceVAO).addAttribs<LocationVertex, &LocationVertex::body>(instances.bufferName(), 1);
+ bodyMesh->configureVAO(instanceVAO)
+ .addAttribs<LocationVertex, &LocationVertex::body, &LocationVertex::bodyPos>(instances.bufferName(), 1);
bogies.front()
->configureVAO(instancesBogiesVAO.front())
- .addAttribs<LocationVertex, &LocationVertex::front>(instances.bufferName(), 1);
+ .addAttribs<LocationVertex, &LocationVertex::front, &LocationVertex::frontPos>(instances.bufferName(), 1);
bogies.back()
->configureVAO(instancesBogiesVAO.back())
- .addAttribs<LocationVertex, &LocationVertex::back>(instances.bufferName(), 1);
+ .addAttribs<LocationVertex, &LocationVertex::back, &LocationVertex::backPos>(instances.bufferName(), 1);
+ static_assert(sizeof(LocationVertex) == 228UL);
}
void
diff --git a/game/vehicles/railVehicleClass.h b/game/vehicles/railVehicleClass.h
index 4668d7d..16dce01 100644
--- a/game/vehicles/railVehicleClass.h
+++ b/game/vehicles/railVehicleClass.h
@@ -20,6 +20,7 @@ public:
struct LocationVertex {
glm::mat4 body, front, back;
+ Position3D bodyPos, frontPos, backPos;
};
std::array<Mesh::Ptr, 2> bogies;