summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-12-29 13:20:55 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-12-29 13:20:55 +0000
commit0841ead91c49a212134f19f7c0b411984b0fda29 (patch)
tree605d5e8e512747c79875d2c3a185c9740f7d1080
parentRun shadow mapper in camera relative space (diff)
downloadilt-0841ead91c49a212134f19f7c0b411984b0fda29.tar.bz2
ilt-0841ead91c49a212134f19f7c0b411984b0fda29.tar.xz
ilt-0841ead91c49a212134f19f7c0b411984b0fda29.zip
Remove weird operator! on vec2/3
-rw-r--r--game/network/link.cpp2
-rw-r--r--game/network/network.cpp4
-rw-r--r--game/network/rail.cpp4
-rw-r--r--gfx/followCameraController.cpp2
-rw-r--r--lib/maths.cpp2
-rw-r--r--lib/maths.h12
-rw-r--r--ui/manualCameraController.cpp2
7 files changed, 8 insertions, 20 deletions
diff --git a/game/network/link.cpp b/game/network/link.cpp
index 498afe4..d8479dd 100644
--- a/game/network/link.cpp
+++ b/game/network/link.cpp
@@ -46,7 +46,7 @@ LinkCurve::positionAt(float dist, unsigned char start) const
const auto es {std::make_pair(ends[start].node.get(), ends[1 - start].node.get())};
const auto as {std::make_pair(arc[start], arc[1 - start])};
const auto ang {as.first + ((as.second - as.first) * frac)};
- const auto relPos {!sincosf(ang) * radius};
+ const auto relPos {sincosf(ang) ^ 0.F * radius};
const auto relClimb {vehiclePositionOffset()
+ Position3D {0, 0, es.first->pos.z - centreBase.z + ((es.second->pos.z - es.first->pos.z) * frac)}};
const auto pitch {vector_pitch({0, 0, (es.second->pos.z - es.first->pos.z) / length})};
diff --git a/game/network/network.cpp b/game/network/network.cpp
index d18345c..5de2f5d 100644
--- a/game/network/network.cpp
+++ b/game/network/network.cpp
@@ -100,7 +100,7 @@ Network::genCurveDef(const Position3D & start, const Position3D & end, float sta
const auto diff {end - start};
const auto vy {vector_yaw(diff)};
const auto dir = pi + startDir;
- const auto flatStart {!start}, flatEnd {!end};
+ const auto flatStart {start.xy()}, flatEnd {end.xy()};
const auto n2ed {(vy * 2) - dir - pi};
const auto centre {find_arc_centre(flatStart, dir, flatEnd, n2ed)};
@@ -115,7 +115,7 @@ Network::genCurveDef(const Position3D & start, const Position3D & end, float sta
{
startDir += pi;
endDir += pi;
- const Position2D flatStart {!start}, flatEnd {!end};
+ const Position2D flatStart {start.xy()}, flatEnd {end.xy()};
auto midheight = [&](auto mid) {
const auto sm = glm::distance(flatStart, mid), em = glm::distance(flatEnd, mid);
return start.z + ((end.z - start.z) * (sm / (sm + em)));
diff --git a/game/network/rail.cpp b/game/network/rail.cpp
index ff101d4..545a728 100644
--- a/game/network/rail.cpp
+++ b/game/network/rail.cpp
@@ -45,7 +45,7 @@ RailLinks::addLinksBetween(Position3D start, Position3D end)
if (dir == vector_yaw(end - start)) {
return addLink<RailLinkStraight>(start, end);
}
- const Position2D flatStart {!start}, flatEnd {!end};
+ const Position2D flatStart {start.xy()}, flatEnd {end.xy()};
if (node2ins.second == NodeIs::InNetwork) {
auto midheight = [&](auto mid) {
const auto sm = glm::distance(flatStart, mid), em = glm::distance(flatEnd, mid);
@@ -142,7 +142,7 @@ RailLinkStraight::RailLinkStraight(Node::Ptr a, Node::Ptr b, const Position3D &
}
RailLinkCurve::RailLinkCurve(const Node::Ptr & a, const Node::Ptr & b, Position2D c) :
- RailLinkCurve(a, b, c ^ a->pos.z, {!c, a->pos, b->pos})
+ RailLinkCurve(a, b, c ^ a->pos.z, {c ^ 0.F, a->pos, b->pos})
{
}
diff --git a/gfx/followCameraController.cpp b/gfx/followCameraController.cpp
index aee2187..9b23173 100644
--- a/gfx/followCameraController.cpp
+++ b/gfx/followCameraController.cpp
@@ -24,7 +24,7 @@ FollowCameraController::updateCamera(Camera * camera) const
break;
case Mode::Ride:
- camera->setView(pos + GlobalPosition3D(up * 4.8F), !-sincosf(rot.y));
+ camera->setView(pos + GlobalPosition3D(up * 4.8F), -sincosf(rot.y) ^ 0.F);
break;
case Mode::ISO:
diff --git a/lib/maths.cpp b/lib/maths.cpp
index 5430ef6..0c25820 100644
--- a/lib/maths.cpp
+++ b/lib/maths.cpp
@@ -9,7 +9,7 @@ glm::mat4
flat_orientation(const Direction3D & diff)
{
static const auto oneeighty {glm::rotate(pi, up)};
- const auto flatdiff {glm::normalize(!!diff)};
+ const auto flatdiff {glm::normalize(diff.xy() ^ 0.F)};
auto e {glm::orientation(flatdiff, north)};
// Handle if diff is exactly opposite to north
return (std::isnan(e[0][0])) ? oneeighty : e;
diff --git a/lib/maths.h b/lib/maths.h
index cf369a7..dd83c4b 100644
--- a/lib/maths.h
+++ b/lib/maths.h
@@ -99,12 +99,6 @@ perspective_divide(glm::vec<4, T, Q> v)
return v / v.w;
}
-constexpr inline Position2D
-operator!(const Position3D & v)
-{
- return {v.x, v.y};
-}
-
constexpr inline Position3D
operator^(const Position2D & v, float z)
{
@@ -117,12 +111,6 @@ operator^(const Position3D & v, float w)
return {v.x, v.y, v.z, w};
}
-constexpr inline Position3D
-operator!(const Position2D & v)
-{
- return v ^ 0.F;
-}
-
template<glm::length_t L1, glm::length_t L2, typename T, glm::qualifier Q>
inline constexpr glm::vec<L1 + L2, T, Q>
operator||(const glm::vec<L1, T, Q> v1, const glm::vec<L2, T, Q> v2)
diff --git a/ui/manualCameraController.cpp b/ui/manualCameraController.cpp
index f6993a8..1f6b510 100644
--- a/ui/manualCameraController.cpp
+++ b/ui/manualCameraController.cpp
@@ -79,5 +79,5 @@ void
ManualCameraController::updateCamera(Camera * camera) const
{
const auto forward = glm::normalize(sincosf(direction) ^ -sin(pitch));
- camera->setView(!focus - forward * 3.F * std::pow(dist, 1.3F), forward);
+ camera->setView((focus ^ 0.F) - forward * 3.F * std::pow(dist, 1.3F), forward);
}