summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
Diffstat (limited to 'game')
-rw-r--r--game/geoData.cpp4
-rw-r--r--game/scenary/foliage.h2
-rw-r--r--game/vehicles/railVehicle.cpp22
-rw-r--r--game/vehicles/railVehicleClass.h2
4 files changed, 15 insertions, 15 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp
index da067f7..ec990ea 100644
--- a/game/geoData.cpp
+++ b/game/geoData.cpp
@@ -73,7 +73,7 @@ GeoData::loadFromImages(const std::filesystem::path & fileName, float scale_)
}
GeoData::Quad
-GeoData::quad(glm::vec2 wcoord) const
+GeoData::quad(Position2D wcoord) const
{
constexpr static const std::array<glm::vec2, 4> corners {{{0, 0}, {0, 1}, {1, 0}, {1, 1}}};
return transform_array(transform_array(corners,
@@ -154,7 +154,7 @@ GeoData::intersectRay(const Ray & ray) const
try {
const auto point = quad(n);
for (auto offset : {0U, 1U}) {
- glm::vec2 bary;
+ BaryPosition bary;
float distance;
if (glm::intersectRayTriangle(ray.start, ray.direction, point[offset], point[offset + 1],
point[offset + 2], bary, distance)) {
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<Foliage> {
glVertexArray instanceVAO;
public:
- using LocationVertex = std::pair<glm::mat4, Position3D>;
+ using LocationVertex = std::pair<glm::mat4, GlobalPosition3D>;
mutable InstanceVertices<LocationVertex> instances;
void render(const SceneShader &) const override;
void shadows(const ShadowMapper &) const override;
diff --git a/game/vehicles/railVehicle.cpp b/game/vehicles/railVehicle.cpp
index bee0dd0..30b615c 100644
--- a/game/vehicles/railVehicle.cpp
+++ b/game/vehicles/railVehicle.cpp
@@ -38,9 +38,9 @@ RailVehicle::move(const Train * t, float & trailBy)
const auto overhang {(rvClass->length - rvClass->wheelBase) / 2};
const auto & b1Pos = bogies[0] = t->getBogiePosition(t->linkDist, trailBy += overhang);
const auto & b2Pos = bogies[1] = t->getBogiePosition(t->linkDist, trailBy += rvClass->wheelBase);
- const auto diff = glm::normalize(b2Pos.position() - b1Pos.position());
- location.setLocation((b1Pos.position() + b2Pos.position()) / 2.F, {vector_pitch(diff), vector_yaw(diff), 0});
- trailBy += 0.6F + overhang;
+ const auto diff = glm::normalize(RelativePosition3D(b2Pos.position() - b1Pos.position()));
+ location.setLocation((b1Pos.position() + b2Pos.position()) / 2, {vector_pitch(diff), vector_yaw(diff), 0});
+ trailBy += 600.F + overhang;
}
bool
@@ -51,14 +51,14 @@ RailVehicle::intersectRay(const Ray & ray, Position2D * baryPos, float * distanc
constexpr const auto Z = 3900.F;
const auto moveBy = location.getRotationTransform();
const std::array<Position3D, 8> cornerVertices {{
- location.position() + (moveBy * glm::vec4 {-X, Y, 0, 1}).xyz(), // LFB
- location.position() + (moveBy * glm::vec4 {X, Y, 0, 1}).xyz(), // RFB
- location.position() + (moveBy * glm::vec4 {-X, Y, Z, 1}).xyz(), // LFT
- location.position() + (moveBy * glm::vec4 {X, Y, Z, 1}).xyz(), // RFT
- location.position() + (moveBy * glm::vec4 {-X, -Y, 0, 1}).xyz(), // LBB
- location.position() + (moveBy * glm::vec4 {X, -Y, 0, 1}).xyz(), // RBB
- location.position() + (moveBy * glm::vec4 {-X, -Y, Z, 1}).xyz(), // LBT
- location.position() + (moveBy * glm::vec4 {X, -Y, Z, 1}).xyz(), // RBT
+ location.position() + GlobalPosition3D(moveBy * glm::vec4 {-X, Y, 0, 1}).xyz(), // LFB
+ location.position() + GlobalPosition3D(moveBy * glm::vec4 {X, Y, 0, 1}).xyz(), // RFB
+ location.position() + GlobalPosition3D(moveBy * glm::vec4 {-X, Y, Z, 1}).xyz(), // LFT
+ location.position() + GlobalPosition3D(moveBy * glm::vec4 {X, Y, Z, 1}).xyz(), // RFT
+ location.position() + GlobalPosition3D(moveBy * glm::vec4 {-X, -Y, 0, 1}).xyz(), // LBB
+ location.position() + GlobalPosition3D(moveBy * glm::vec4 {X, -Y, 0, 1}).xyz(), // RBB
+ location.position() + GlobalPosition3D(moveBy * glm::vec4 {-X, -Y, Z, 1}).xyz(), // LBT
+ location.position() + GlobalPosition3D(moveBy * glm::vec4 {X, -Y, Z, 1}).xyz(), // RBT
}};
static constexpr const std::array<glm::vec<3, uint8_t>, 10> triangles {{
// Front
diff --git a/game/vehicles/railVehicleClass.h b/game/vehicles/railVehicleClass.h
index 16dce01..913feea 100644
--- a/game/vehicles/railVehicleClass.h
+++ b/game/vehicles/railVehicleClass.h
@@ -20,7 +20,7 @@ public:
struct LocationVertex {
glm::mat4 body, front, back;
- Position3D bodyPos, frontPos, backPos;
+ GlobalPosition3D bodyPos, frontPos, backPos;
};
std::array<Mesh::Ptr, 2> bogies;