diff options
-rw-r--r-- | assetFactory/cylinder.cpp | 6 | ||||
-rw-r--r-- | game/network/link.cpp | 2 | ||||
-rw-r--r-- | game/network/network.cpp | 4 | ||||
-rw-r--r-- | game/network/rail.cpp | 10 | ||||
-rw-r--r-- | gfx/followCameraController.cpp | 2 | ||||
-rw-r--r-- | gfx/gl/camera.cpp | 2 | ||||
-rw-r--r-- | lib/maths.cpp | 2 | ||||
-rw-r--r-- | lib/maths.h | 24 | ||||
-rw-r--r-- | ui/manualCameraController.cpp | 4 |
9 files changed, 23 insertions, 33 deletions
diff --git a/assetFactory/cylinder.cpp b/assetFactory/cylinder.cpp index ed034fd..58980cf 100644 --- a/assetFactory/cylinder.cpp +++ b/assetFactory/cylinder.cpp @@ -19,7 +19,7 @@ Cylinder::createMesh(ModelFactoryMesh & mesh, float lodf) const // Generate bottom face vertices std::vector<OpenMesh::VertexHandle> bottom(P); std::transform(circumference.begin(), circumference.end(), bottom.begin(), [&mesh](const auto & xy) { - return mesh.add_vertex(xy ^ 0.F); + return mesh.add_vertex(xy || 0.F); }); surface.insert(mesh.add_namedFace("bottom", bottom)); } @@ -27,7 +27,7 @@ Cylinder::createMesh(ModelFactoryMesh & mesh, float lodf) const // Generate top face vertices std::vector<OpenMesh::VertexHandle> top(P); std::transform(circumference.rbegin(), circumference.rend(), top.begin(), [&mesh](const auto & xy) { - return mesh.add_vertex(xy ^ 1); + return mesh.add_vertex(xy || 1.F); }); surface.insert(mesh.add_namedFace("top", top)); } @@ -35,7 +35,7 @@ Cylinder::createMesh(ModelFactoryMesh & mesh, float lodf) const // Generate edge vertices std::vector<std::pair<OpenMesh::VertexHandle, OpenMesh::VertexHandle>> edge(P + 1); std::transform(circumference.begin(), circumference.end(), edge.begin(), [&mesh](const auto & xy) { - return std::make_pair(mesh.add_vertex(xy ^ 0), mesh.add_vertex(xy ^ 1)); + return std::make_pair(mesh.add_vertex(xy || 0.F), mesh.add_vertex(xy || 1.F)); }); // Wrap around edge.back() = edge.front(); diff --git a/game/network/link.cpp b/game/network/link.cpp index d8479dd..703a1ca 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) ^ 0.F * 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 5de2f5d..1ff5b26 100644 --- a/game/network/network.cpp +++ b/game/network/network.cpp @@ -125,7 +125,7 @@ Network::genCurveDef(const Position3D & start, const Position3D & end, float sta const auto c1 = flatStart + sincosf(startDir + half_pi) * radius; const auto c2 = flatEnd + sincosf(endDir + half_pi) * radius; const auto mid = (c1 + c2) / 2.F; - const auto midh = mid ^ midheight(mid); + const auto midh = mid || midheight(mid); return {{start, midh, c1}, {end, midh, c2}}; } else { @@ -133,7 +133,7 @@ Network::genCurveDef(const Position3D & start, const Position3D & end, float sta const auto c1 = flatStart + sincosf(startDir - half_pi) * radius; const auto c2 = flatEnd + sincosf(endDir - half_pi) * radius; const auto mid = (c1 + c2) / 2.F; - const auto midh = mid ^ midheight(mid); + const auto midh = mid || midheight(mid); return {{midh, start, c1}, {midh, end, c2}}; } } diff --git a/game/network/rail.cpp b/game/network/rail.cpp index 545a728..303f1c8 100644 --- a/game/network/rail.cpp +++ b/game/network/rail.cpp @@ -57,7 +57,7 @@ RailLinks::addLinksBetween(Position3D start, Position3D end) const auto c1 = flatStart + sincosf(dir + half_pi) * radius; const auto c2 = flatEnd + sincosf(dir2 + half_pi) * radius; const auto mid = (c1 + c2) / 2.F; - const auto midh = mid ^ midheight(mid); + const auto midh = mid || midheight(mid); addLink<RailLinkCurve>(start, midh, c1); return addLink<RailLinkCurve>(end, midh, c2); } @@ -66,7 +66,7 @@ RailLinks::addLinksBetween(Position3D start, Position3D end) const auto c1 = flatStart + sincosf(dir - half_pi) * radius; const auto c2 = flatEnd + sincosf(dir2 - half_pi) * radius; const auto mid = (c1 + c2) / 2.F; - const auto midh = mid ^ midheight(mid); + const auto midh = mid || midheight(mid); addLink<RailLinkCurve>(midh, start, c1); return addLink<RailLinkCurve>(midh, end, c2); } @@ -133,7 +133,7 @@ RailLinkStraight::RailLinkStraight(Node::Ptr a, Node::Ptr b, const Position3D & for (auto ei : {1U, 0U}) { const auto trans {glm::translate(ends[ei].node->pos) * e}; for (const auto & rcs : railCrossSection) { - const Position3D m {(trans * (rcs.first ^ 1))}; + const Position3D m {(trans * (rcs.first || 1.F))}; vertices.emplace_back(m, Position2D {rcs.second, len * static_cast<float>(ei)}, up); } } @@ -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 ^ 0.F, a->pos, b->pos}) + RailLinkCurve(a, b, c || a->pos.z, {c || 0.F, a->pos, b->pos}) { } @@ -166,7 +166,7 @@ RailLinkCurve::RailLinkCurve(const Node::Ptr & a, const Node::Ptr & b, Position3 const auto t { trans * glm::rotate(half_pi - swing.x, up) * glm::translate(Position3D {radius, 0.F, swing.y})}; for (const auto & rcs : railCrossSection) { - const Position3D m {(t * (rcs.first ^ 1))}; + const Position3D m {(t * (rcs.first || 1.F))}; vertices.emplace_back(m, Position2D {rcs.second, swing.z}, up); } } diff --git a/gfx/followCameraController.cpp b/gfx/followCameraController.cpp index 9b23173..5114840 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) ^ 0.F); + camera->setView(pos + GlobalPosition3D(up * 4.8F), -sincosf(rot.y) || 0.F); break; case Mode::ISO: diff --git a/gfx/gl/camera.cpp b/gfx/gl/camera.cpp index 06e409e..9f40998 100644 --- a/gfx/gl/camera.cpp +++ b/gfx/gl/camera.cpp @@ -18,7 +18,7 @@ Camera::unProject(const ScreenRelCoord & mouse) const { static constexpr const glm::vec4 screen {0, 0, 1, 1}; const auto mouseProjection = glm::lookAt(::origin, forward, up); - return {position, glm::normalize(glm::unProject(mouse ^ 1, mouseProjection, projection, screen))}; + return {position, glm::normalize(glm::unProject(mouse || 1.F, mouseProjection, projection, screen))}; } void diff --git a/lib/maths.cpp b/lib/maths.cpp index 0c25820..17082d4 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.xy() ^ 0.F)}; + 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 dd83c4b..f7ff148 100644 --- a/lib/maths.h +++ b/lib/maths.h @@ -99,18 +99,6 @@ perspective_divide(glm::vec<4, T, Q> v) return v / v.w; } -constexpr inline Position3D -operator^(const Position2D & v, float z) -{ - return {v.x, v.y, z}; -} - -constexpr inline glm::vec4 -operator^(const Position3D & v, float w) -{ - return {v.x, v.y, v.z, w}; -} - 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) @@ -125,15 +113,17 @@ operator||(const glm::vec<L, T, Q> v1, const T v2) return {v1, v2}; } -inline Position3D -operator%(const Position3D & p, const glm::mat4 & mutation) +template<glm::length_t L, typename T, glm::qualifier Q> +inline constexpr glm::vec<L, T, Q> +operator%(const glm::vec<L, T, Q> & p, const glm::mat<L + 1, L + 1, T, Q> & mutation) { - const auto p2 = mutation * (p ^ 1); + const auto p2 = mutation * (p || T(1)); return p2 / p2.w; } -inline Position3D -operator%=(Position3D & p, const glm::mat4 & mutation) +template<glm::length_t L, typename T, glm::qualifier Q> +inline constexpr glm::vec<L, T, Q> +operator%=(glm::vec<L, T, Q> & p, const glm::mat<L + 1, L + 1, T, Q> & mutation) { return p = p % mutation; } diff --git a/ui/manualCameraController.cpp b/ui/manualCameraController.cpp index 1f6b510..ef26e81 100644 --- a/ui/manualCameraController.cpp +++ b/ui/manualCameraController.cpp @@ -78,6 +78,6 @@ ManualCameraController::render(const UIShader &, const Position &) const void ManualCameraController::updateCamera(Camera * camera) const { - const auto forward = glm::normalize(sincosf(direction) ^ -sin(pitch)); - camera->setView((focus ^ 0.F) - forward * 3.F * std::pow(dist, 1.3F), forward); + const auto forward = glm::normalize(sincosf(direction) || -sin(pitch)); + camera->setView((focus || 0.F) - forward * 3.F * std::pow(dist, 1.3F), forward); } |