From c244b997c136ec47f5502384998f99ba837b3a4f Mon Sep 17 00:00:00 2001 From: Asuro Date: Sun, 30 Mar 2025 20:22:16 +0200 Subject: [PATCH] moving more stuff around --- src/game/Gen.cpp | 315 +++++++++++++++++++++++++++++++++ src/game/Gen.h | 65 +++++++ src/game/Global.cpp | 317 +--------------------------------- src/game/Global.h | 78 --------- src/game/Puzzle.cpp | 2 +- src/game/Tools.cpp | 1 + src/game/rendering/Dither.cpp | 2 +- 7 files changed, 385 insertions(+), 395 deletions(-) diff --git a/src/game/Gen.cpp b/src/game/Gen.cpp index 7f5988e..44b54b7 100644 --- a/src/game/Gen.cpp +++ b/src/game/Gen.cpp @@ -49,4 +49,319 @@ namespace Gen res.Y += rhs.Y; return res; } + + // Vec4 + Vec4& operator+=(Vec4& lhs, const Vec4& rhs) + { + lhs.x += rhs.x; + lhs.y += rhs.y; + lhs.z += rhs.z; + lhs.w += rhs.w; + return lhs; + } + Vec4 operator+(const Vec4& lhs, const Vec4& rhs) + { + Vec4 out = lhs; + return out += rhs; + } + Vec4& operator+=(Vec4& lhs, float rhs) + { + lhs.x += rhs; + lhs.y += rhs; + lhs.z += rhs; + lhs.w += rhs; + return lhs; + } + Vec4 operator+(Vec4& lhs, float rhs) + { + Vec4 out = lhs; + return out += rhs; + } + + Vec4& operator-=(Vec4& lhs, const Vec4& rhs) + { + lhs.x -= rhs.x; + lhs.y -= rhs.y; + lhs.z -= rhs.z; + lhs.w -= rhs.w; + return lhs; + } + Vec4 operator-(const Vec4& lhs, const Vec4& rhs) + { + Vec4 out = lhs; + return out -= rhs; + } + Vec4& operator-=(Vec4& lhs, float rhs) + { + lhs.x -= rhs; + lhs.y -= rhs; + lhs.z -= rhs; + lhs.w -= rhs; + return lhs; + } + Vec4 operator-(const Vec4& lhs, float rhs) + { + Vec4 out = lhs; + return out -= rhs; + } + + Vec4& operator*=(Vec4& lhs, float rhs) + { + lhs.x *= rhs; + lhs.y *= rhs; + lhs.z *= rhs; + lhs.w *= rhs; + return lhs; + } + Vec4 operator*(const Vec4& lhs, float rhs) + { + Vec4 out = lhs; + return out *= rhs; + } + + Vec4& operator/=(Vec4& lhs, float rhs) + { + lhs.x /= rhs; + lhs.y /= rhs; + lhs.z /= rhs; + lhs.w /= rhs; + return lhs; + } + Vec4 operator/(const Vec4& lhs, float rhs) + { + Vec4 out = lhs; + return out /= rhs; + } + + // Vec3 + Vec3& operator+=(Vec3& lhs, const Vec3& rhs) + { + lhs.x += rhs.x; + lhs.y += rhs.y; + lhs.z += rhs.z; + return lhs; + } + Vec3 operator+(const Vec3& lhs, const Vec3& rhs) + { + Vec3 out = lhs; + return out += rhs; + } + Vec3& operator+=(Vec3& lhs, float rhs) + { + lhs.x += rhs; + lhs.y += rhs; + lhs.z += rhs; + return lhs; + } + Vec3 operator+(Vec3& lhs, float rhs) + { + Vec3 out = lhs; + return out += rhs; + } + + Vec3& operator-=(Vec3& lhs, const Vec3& rhs) + { + lhs.x -= rhs.x; + lhs.y -= rhs.y; + lhs.z -= rhs.z; + return lhs; + } + Vec3 operator-(const Vec3& lhs, const Vec3& rhs) + { + Vec3 out = lhs; + return out -= rhs; + } + Vec3& operator-=(Vec3& lhs, float rhs) + { + lhs.x -= rhs; + lhs.y -= rhs; + lhs.z -= rhs; + return lhs; + } + Vec3 operator-(const Vec3& lhs, float rhs) + { + Vec3 out = lhs; + return out -= rhs; + } + + Vec3& operator*=(Vec3& lhs, float rhs) + { + lhs.x *= rhs; + lhs.y *= rhs; + lhs.z *= rhs; + return lhs; + } + Vec3 operator*(const Vec3& lhs, float rhs) + { + Vec3 out = lhs; + return out *= rhs; + } + + Vec3& operator/=(Vec3& lhs, float rhs) + { + lhs.x /= rhs; + lhs.y /= rhs; + lhs.z /= rhs; + return lhs; + } + Vec3 operator/(const Vec3& lhs, float rhs) + { + Vec3 out = lhs; + return out /= rhs; + } + + // Vec2 + Vec2& operator+=(Vec2& lhs, const Vec2& rhs) + { + lhs.x += rhs.x; + lhs.y += rhs.y; + return lhs; + } + Vec2 operator+(const Vec2& lhs, const Vec2& rhs) + { + Vec2 out = lhs; + return out += rhs; + } + Vec2& operator+=(Vec2& lhs, float rhs) + { + lhs.x += rhs; + lhs.y += rhs; + return lhs; + } + Vec2 operator+(Vec2& lhs, float rhs) + { + Vec2 out = lhs; + return out += rhs; + } + + Vec2& operator-=(Vec2& lhs, const Vec2& rhs) + { + lhs.x -= rhs.x; + lhs.y -= rhs.y; + return lhs; + } + Vec2 operator-(const Vec2& lhs, const Vec2& rhs) + { + Vec2 out = lhs; + return out -= rhs; + } + Vec2& operator-=(Vec2& lhs, float rhs) + { + lhs.x -= rhs; + lhs.y -= rhs; + return lhs; + } + Vec2 operator-(const Vec2& lhs, float rhs) + { + Vec2 out = lhs; + return out -= rhs; + } + + Vec2& operator*=(Vec2& lhs, float rhs) + { + lhs.x *= rhs; + lhs.y *= rhs; + return lhs; + } + Vec2 operator*(const Vec2& lhs, float rhs) + { + Vec2 out = lhs; + return out *= rhs; + } + + Vec2& operator/=(Vec2& lhs, float rhs) + { + lhs.x /= rhs; + lhs.y /= rhs; + return lhs; + } + Vec2 operator/(const Vec2& lhs, float rhs) + { + Vec2 out = lhs; + return out /= rhs; + } + + Mat4 Inverse(const Mat4& mat) + { + Mat4 result; + bx::mtxInverse(result.M, &mat.M[0]); + return result; + } + Mat4 Transpose(const Mat4& mat) + { + Mat4 result; + bx::mtxTranspose(result.M, &mat.M[0]); + return result; + } + Vec4 Mul(const Mat4& mat, const Vec4& vec) + { + Vec4 out; + bx::vec4MulMtx(&out.x, &vec.x, &mat.M[0]); + return out; + } + + float Magnitude(const Vec4& vec) + { + return bx::sqrt(vec.x * vec.x + vec.y * vec.y + vec.z * vec.z + vec.w * vec.w); + } + float Magnitude(const Vec3& vec) + { + return bx::sqrt(vec.x * vec.x + vec.y * vec.y + vec.z * vec.z); + } + float Magnitude(const Vec2& vec) + { + return bx::sqrt(vec.x * vec.x + vec.y * vec.y); + } + + Vec4 Normalized(const Vec4& vec) + { + Vec4 res = vec; + return res /= Magnitude(vec); + } + Vec3 Normalized(const Vec3& vec) + { + Vec3 res = vec; + return res /= Magnitude(vec); + } + Vec2 Normalized(const Vec2& vec) + { + Vec2 res = vec; + return res /= Magnitude(vec); + } + + float DotProduct(Vec3 a, Vec3 b) + { + return a.x * b.x + a.y * b.y + a.z * b.z; + } + Vec3 CrossProduct(Vec3 a, Vec3 b) + { + float x = a.y * b.z - a.z * b.y; + float y = a.z * b.x - a.x * b.z; + float z = a.x * b.y - a.y * b.x; + return {x, y, z}; + } + Vec3 CrossProductFromPlane(Vec3 a, Vec3 b, Vec3 c) + { + // TODO: normalize might not be necessary + Vec3 lineA = Normalized(b - a); + Vec3 lineB = Normalized(c - a); + return CrossProduct(lineA, lineB); + } + bool RayPlaneIntersect(Vec3 l1, Vec3 l2, Vec3 p1, Vec3 p2, Vec3 p3, Vec3& out) + { + // thanks to Paul Bourke and Bryan Hanson + // l1,l2 constitute the line. P1,P2,P3 constitute the plane + out = {}; + Vec3 N = CrossProductFromPlane(p1, p2, p3); // N is the normal of the plane + float n = DotProduct(N, Vec3{p3.x - l1.x, p3.y - l1.y, p3.z - l1.z}); + Vec3 LbMinusLa = Vec3{l2.x - l1.x, l2.y - l1.y, l2.z - l1.z}; + float d = DotProduct(N, LbMinusLa); + if (d == 0) return false; // Line is parallel to or in the plane + float u = n / d; + if ((u >= 0.0) && (u <= 1.0)) + { // Plane is between the two points + } // can be used for checking but does not influence the outcome + out = Vec3{l1.x + u * LbMinusLa.x, l1.y + u * LbMinusLa.y, l1.z + u * LbMinusLa.z}; + return true; + } } // namespace Gen diff --git a/src/game/Gen.h b/src/game/Gen.h index 12c1498..b505015 100644 --- a/src/game/Gen.h +++ b/src/game/Gen.h @@ -12,4 +12,69 @@ namespace Gen PuzPos operator+=(PuzPos lhs, const PuzPos& rhs); PuzPos operator+(PuzPos lhs, const PuzPos& rhs); + + Vec4& operator+=(Vec4& lhs, const Vec4& rhs); + Vec4 operator+(const Vec4& lhs, const Vec4& rhs); + Vec4& operator+=(Vec4& lhs, float rhs); + Vec4 operator+(Vec4& lhs, float rhs); + + Vec4& operator-=(Vec4& lhs, const Vec4& rhs); + Vec4 operator-(const Vec4& lhs, const Vec4& rhs); + Vec4& operator-=(Vec4& lhs, float rhs); + Vec4 operator-(const Vec4& lhs, float rhs); + + Vec4& operator*=(Vec4& lhs, float rhs); + Vec4 operator*(const Vec4& lhs, float rhs); + + Vec4& operator/=(Vec4& lhs, float rhs); + Vec4 operator/(const Vec4& lhs, float rhs); + + Vec3& operator+=(Vec3& lhs, const Vec3& rhs); + Vec3 operator+(const Vec3& lhs, const Vec3& rhs); + Vec3& operator+=(Vec3& lhs, float rhs); + Vec3 operator+(Vec3& lhs, float rhs); + + Vec3& operator-=(Vec3& lhs, const Vec3& rhs); + Vec3 operator-(const Vec3& lhs, const Vec3& rhs); + Vec3& operator-=(Vec3& lhs, float rhs); + Vec3 operator-(const Vec3& lhs, float rhs); + + Vec3& operator*=(Vec3& lhs, float rhs); + Vec3 operator*(const Vec3& lhs, float rhs); + + Vec3& operator/=(Vec3& lhs, float rhs); + Vec3 operator/(const Vec3& lhs, float rhs); + + Vec2& operator+=(Vec2& lhs, const Vec2& rhs); + Vec2 operator+(const Vec2& lhs, const Vec2& rhs); + Vec2& operator+=(Vec2& lhs, float rhs); + Vec2 operator+(Vec2& lhs, float rhs); + + Vec2& operator-=(Vec2& lhs, const Vec2& rhs); + Vec2 operator-(const Vec2& lhs, const Vec2& rhs); + Vec2& operator-=(Vec2& lhs, float rhs); + Vec2 operator-(const Vec2& lhs, float rhs); + + Vec2& operator*=(Vec2& lhs, float rhs); + Vec2 operator*(const Vec2& lhs, float rhs); + + Vec2& operator/=(Vec2& lhs, float rhs); + Vec2 operator/(const Vec2& lhs, float rhs); + + float Magnitude(const Vec4& vec); + float Magnitude(const Vec3& vec); + float Magnitude(const Vec2& vec); + + Vec4 Normalized(const Vec4& vec); + Vec3 Normalized(const Vec3& vec); + Vec2 Normalized(const Vec2& vec); + + Mat4 Inverse(const Mat4& mat); + Mat4 Transpose(const Mat4& mat); + Vec4 Mul(const Mat4& mat, const Vec4& vec); + + float DotProduct(Vec3 a, Vec3 b); + Vec3 CrossProduct(Vec3 a, Vec3 b); + Vec3 CrossProductFromPlane(Vec3 a, Vec3 b, Vec3 c); + bool RayPlaneIntersect(Vec3 l1, Vec3 l2, Vec3 p1, Vec3 p2, Vec3 p3, Vec3& out); } // namespace Gen diff --git a/src/game/Global.cpp b/src/game/Global.cpp index d3174cb..e8f45dc 100644 --- a/src/game/Global.cpp +++ b/src/game/Global.cpp @@ -1,6 +1,8 @@ #include "../engine/Shared.h" +#include "Gen.h" #include "Global.h" #include "Instance.h" + #include "bx/bx.h" #include "bx/math.h" #include @@ -162,318 +164,3 @@ Vec3 Transform::GetPosition() { return {Position.x, Position.y, Position.z}; } - -// Vec4 -Vec4& operator+=(Vec4& lhs, const Vec4& rhs) -{ - lhs.x += rhs.x; - lhs.y += rhs.y; - lhs.z += rhs.z; - lhs.w += rhs.w; - return lhs; -} -Vec4 operator+(const Vec4& lhs, const Vec4& rhs) -{ - Vec4 out = lhs; - return out += rhs; -} -Vec4& operator+=(Vec4& lhs, float rhs) -{ - lhs.x += rhs; - lhs.y += rhs; - lhs.z += rhs; - lhs.w += rhs; - return lhs; -} -Vec4 operator+(Vec4& lhs, float rhs) -{ - Vec4 out = lhs; - return out += rhs; -} - -Vec4& operator-=(Vec4& lhs, const Vec4& rhs) -{ - lhs.x -= rhs.x; - lhs.y -= rhs.y; - lhs.z -= rhs.z; - lhs.w -= rhs.w; - return lhs; -} -Vec4 operator-(const Vec4& lhs, const Vec4& rhs) -{ - Vec4 out = lhs; - return out -= rhs; -} -Vec4& operator-=(Vec4& lhs, float rhs) -{ - lhs.x -= rhs; - lhs.y -= rhs; - lhs.z -= rhs; - lhs.w -= rhs; - return lhs; -} -Vec4 operator-(const Vec4& lhs, float rhs) -{ - Vec4 out = lhs; - return out -= rhs; -} - -Vec4& operator*=(Vec4& lhs, float rhs) -{ - lhs.x *= rhs; - lhs.y *= rhs; - lhs.z *= rhs; - lhs.w *= rhs; - return lhs; -} -Vec4 operator*(const Vec4& lhs, float rhs) -{ - Vec4 out = lhs; - return out *= rhs; -} - -Vec4& operator/=(Vec4& lhs, float rhs) -{ - lhs.x /= rhs; - lhs.y /= rhs; - lhs.z /= rhs; - lhs.w /= rhs; - return lhs; -} -Vec4 operator/(const Vec4& lhs, float rhs) -{ - Vec4 out = lhs; - return out /= rhs; -} - -// Vec3 -Vec3& operator+=(Vec3& lhs, const Vec3& rhs) -{ - lhs.x += rhs.x; - lhs.y += rhs.y; - lhs.z += rhs.z; - return lhs; -} -Vec3 operator+(const Vec3& lhs, const Vec3& rhs) -{ - Vec3 out = lhs; - return out += rhs; -} -Vec3& operator+=(Vec3& lhs, float rhs) -{ - lhs.x += rhs; - lhs.y += rhs; - lhs.z += rhs; - return lhs; -} -Vec3 operator+(Vec3& lhs, float rhs) -{ - Vec3 out = lhs; - return out += rhs; -} - -Vec3& operator-=(Vec3& lhs, const Vec3& rhs) -{ - lhs.x -= rhs.x; - lhs.y -= rhs.y; - lhs.z -= rhs.z; - return lhs; -} -Vec3 operator-(const Vec3& lhs, const Vec3& rhs) -{ - Vec3 out = lhs; - return out -= rhs; -} -Vec3& operator-=(Vec3& lhs, float rhs) -{ - lhs.x -= rhs; - lhs.y -= rhs; - lhs.z -= rhs; - return lhs; -} -Vec3 operator-(const Vec3& lhs, float rhs) -{ - Vec3 out = lhs; - return out -= rhs; -} - -Vec3& operator*=(Vec3& lhs, float rhs) -{ - lhs.x *= rhs; - lhs.y *= rhs; - lhs.z *= rhs; - return lhs; -} -Vec3 operator*(const Vec3& lhs, float rhs) -{ - Vec3 out = lhs; - return out *= rhs; -} - -Vec3& operator/=(Vec3& lhs, float rhs) -{ - lhs.x /= rhs; - lhs.y /= rhs; - lhs.z /= rhs; - return lhs; -} -Vec3 operator/(const Vec3& lhs, float rhs) -{ - Vec3 out = lhs; - return out /= rhs; -} - -// Vec2 -Vec2& operator+=(Vec2& lhs, const Vec2& rhs) -{ - lhs.x += rhs.x; - lhs.y += rhs.y; - return lhs; -} -Vec2 operator+(const Vec2& lhs, const Vec2& rhs) -{ - Vec2 out = lhs; - return out += rhs; -} -Vec2& operator+=(Vec2& lhs, float rhs) -{ - lhs.x += rhs; - lhs.y += rhs; - return lhs; -} -Vec2 operator+(Vec2& lhs, float rhs) -{ - Vec2 out = lhs; - return out += rhs; -} - -Vec2& operator-=(Vec2& lhs, const Vec2& rhs) -{ - lhs.x -= rhs.x; - lhs.y -= rhs.y; - return lhs; -} -Vec2 operator-(const Vec2& lhs, const Vec2& rhs) -{ - Vec2 out = lhs; - return out -= rhs; -} -Vec2& operator-=(Vec2& lhs, float rhs) -{ - lhs.x -= rhs; - lhs.y -= rhs; - return lhs; -} -Vec2 operator-(const Vec2& lhs, float rhs) -{ - Vec2 out = lhs; - return out -= rhs; -} - -Vec2& operator*=(Vec2& lhs, float rhs) -{ - lhs.x *= rhs; - lhs.y *= rhs; - return lhs; -} -Vec2 operator*(const Vec2& lhs, float rhs) -{ - Vec2 out = lhs; - return out *= rhs; -} - -Vec2& operator/=(Vec2& lhs, float rhs) -{ - lhs.x /= rhs; - lhs.y /= rhs; - return lhs; -} -Vec2 operator/(const Vec2& lhs, float rhs) -{ - Vec2 out = lhs; - return out /= rhs; -} - -Mat4 Inverse(const Mat4& mat) -{ - Mat4 result; - bx::mtxInverse(result.M, &mat.M[0]); - return result; -} -Mat4 Transpose(const Mat4& mat) -{ - Mat4 result; - bx::mtxTranspose(result.M, &mat.M[0]); - return result; -} -Vec4 Mul(const Mat4& mat, const Vec4& vec) -{ - Vec4 out; - bx::vec4MulMtx(&out.x, &vec.x, &mat.M[0]); - return out; -} - -float Magnitude(const Vec4& vec) -{ - return bx::sqrt(vec.x * vec.x + vec.y * vec.y + vec.z * vec.z + vec.w * vec.w); -} -float Magnitude(const Vec3& vec) -{ - return bx::sqrt(vec.x * vec.x + vec.y * vec.y + vec.z * vec.z); -} -float Magnitude(const Vec2& vec) -{ - return bx::sqrt(vec.x * vec.x + vec.y * vec.y); -} - -Vec4 Normalized(const Vec4& vec) -{ - Vec4 res = vec; - return res /= Magnitude(vec); -} -Vec3 Normalized(const Vec3& vec) -{ - Vec3 res = vec; - return res /= Magnitude(vec); -} -Vec2 Normalized(const Vec2& vec) -{ - Vec2 res = vec; - return res /= Magnitude(vec); -} - -float DotProduct(Vec3 a, Vec3 b) -{ - return a.x * b.x + a.y * b.y + a.z * b.z; -} -Vec3 CrossProduct(Vec3 a, Vec3 b) -{ - float x = a.y * b.z - a.z * b.y; - float y = a.z * b.x - a.x * b.z; - float z = a.x * b.y - a.y * b.x; - return {x, y, z}; -} -Vec3 CrossProductFromPlane(Vec3 a, Vec3 b, Vec3 c) -{ - // TODO: normalize might not be necessary - Vec3 lineA = Normalized(b - a); - Vec3 lineB = Normalized(c - a); - return CrossProduct(lineA, lineB); -} -bool RayPlaneIntersect(Vec3 l1, Vec3 l2, Vec3 p1, Vec3 p2, Vec3 p3, Vec3& out) -{ - // thanks to Paul Bourke and Bryan Hanson - // l1,l2 constitute the line. P1,P2,P3 constitute the plane - out = {}; - Vec3 N = CrossProductFromPlane(p1, p2, p3); // N is the normal of the plane - float n = DotProduct(N, Vec3{p3.x - l1.x, p3.y - l1.y, p3.z - l1.z}); - Vec3 LbMinusLa = Vec3{l2.x - l1.x, l2.y - l1.y, l2.z - l1.z}; - float d = DotProduct(N, LbMinusLa); - if (d == 0) return false; // Line is parallel to or in the plane - float u = n / d; - if ((u >= 0.0) && (u <= 1.0)) - { // Plane is between the two points - } // can be used for checking but does not influence the outcome - out = Vec3{l1.x + u * LbMinusLa.x, l1.y + u * LbMinusLa.y, l1.z + u * LbMinusLa.z}; - return true; -} diff --git a/src/game/Global.h b/src/game/Global.h index 774791e..e424bcc 100644 --- a/src/game/Global.h +++ b/src/game/Global.h @@ -24,19 +24,6 @@ inline bool GetFlag(int32_t in, int32_t flags) return (in & flags) > 0; } -namespace Gen -{ - bool IsValid(const AssetHandle& h); - bool IsValid(const ModelHandle& h); - bool IsValid(const TextureHandle& h); - - bool operator==(const AssetHandle& lhs, const AssetHandle& rhs); - bool operator==(const ModelHandle& lhs, const ModelHandle& rhs); - - PuzPos operator+=(PuzPos lhs, const PuzPos& rhs); - PuzPos operator+(PuzPos lhs, const PuzPos& rhs); -} // namespace Gen - struct Transform { Gen::Mat4 M; @@ -64,71 +51,6 @@ struct Transform void UpdateMatrixForCam(); }; -Gen::Vec4& operator+=(Gen::Vec4& lhs, const Gen::Vec4& rhs); -Gen::Vec4 operator+(const Gen::Vec4& lhs, const Gen::Vec4& rhs); -Gen::Vec4& operator+=(Gen::Vec4& lhs, float rhs); -Gen::Vec4 operator+(Gen::Vec4& lhs, float rhs); - -Gen::Vec4& operator-=(Gen::Vec4& lhs, const Gen::Vec4& rhs); -Gen::Vec4 operator-(const Gen::Vec4& lhs, const Gen::Vec4& rhs); -Gen::Vec4& operator-=(Gen::Vec4& lhs, float rhs); -Gen::Vec4 operator-(const Gen::Vec4& lhs, float rhs); - -Gen::Vec4& operator*=(Gen::Vec4& lhs, float rhs); -Gen::Vec4 operator*(const Gen::Vec4& lhs, float rhs); - -Gen::Vec4& operator/=(Gen::Vec4& lhs, float rhs); -Gen::Vec4 operator/(const Gen::Vec4& lhs, float rhs); - -Gen::Vec3& operator+=(Gen::Vec3& lhs, const Gen::Vec3& rhs); -Gen::Vec3 operator+(const Gen::Vec3& lhs, const Gen::Vec3& rhs); -Gen::Vec3& operator+=(Gen::Vec3& lhs, float rhs); -Gen::Vec3 operator+(Gen::Vec3& lhs, float rhs); - -Gen::Vec3& operator-=(Gen::Vec3& lhs, const Gen::Vec3& rhs); -Gen::Vec3 operator-(const Gen::Vec3& lhs, const Gen::Vec3& rhs); -Gen::Vec3& operator-=(Gen::Vec3& lhs, float rhs); -Gen::Vec3 operator-(const Gen::Vec3& lhs, float rhs); - -Gen::Vec3& operator*=(Gen::Vec3& lhs, float rhs); -Gen::Vec3 operator*(const Gen::Vec3& lhs, float rhs); - -Gen::Vec3& operator/=(Gen::Vec3& lhs, float rhs); -Gen::Vec3 operator/(const Gen::Vec3& lhs, float rhs); - -Gen::Vec2& operator+=(Gen::Vec2& lhs, const Gen::Vec2& rhs); -Gen::Vec2 operator+(const Gen::Vec2& lhs, const Gen::Vec2& rhs); -Gen::Vec2& operator+=(Gen::Vec2& lhs, float rhs); -Gen::Vec2 operator+(Gen::Vec2& lhs, float rhs); - -Gen::Vec2& operator-=(Gen::Vec2& lhs, const Gen::Vec2& rhs); -Gen::Vec2 operator-(const Gen::Vec2& lhs, const Gen::Vec2& rhs); -Gen::Vec2& operator-=(Gen::Vec2& lhs, float rhs); -Gen::Vec2 operator-(const Gen::Vec2& lhs, float rhs); - -Gen::Vec2& operator*=(Gen::Vec2& lhs, float rhs); -Gen::Vec2 operator*(const Gen::Vec2& lhs, float rhs); - -Gen::Vec2& operator/=(Gen::Vec2& lhs, float rhs); -Gen::Vec2 operator/(const Gen::Vec2& lhs, float rhs); - -float Magnitude(const Gen::Vec4& vec); -float Magnitude(const Gen::Vec3& vec); -float Magnitude(const Gen::Vec2& vec); - -Gen::Vec4 Normalized(const Gen::Vec4& vec); -Gen::Vec3 Normalized(const Gen::Vec3& vec); -Gen::Vec2 Normalized(const Gen::Vec2& vec); - -Gen::Mat4 Inverse(const Gen::Mat4& mat); -Gen::Mat4 Transpose(const Gen::Mat4& mat); -Gen::Vec4 Mul(const Gen::Mat4& mat, const Gen::Vec4& vec); - -float DotProduct(Gen::Vec3 a, Gen::Vec3 b); -Gen::Vec3 CrossProduct(Gen::Vec3 a, Gen::Vec3 b); -Gen::Vec3 CrossProductFromPlane(Gen::Vec3 a, Gen::Vec3 b, Gen::Vec3 c); -bool RayPlaneIntersect(Gen::Vec3 l1, Gen::Vec3 l2, Gen::Vec3 p1, Gen::Vec3 p2, Gen::Vec3 p3, Gen::Vec3& out); - struct SharedData; namespace Game diff --git a/src/game/Puzzle.cpp b/src/game/Puzzle.cpp index e0b4731..06b73d0 100644 --- a/src/game/Puzzle.cpp +++ b/src/game/Puzzle.cpp @@ -1,4 +1,4 @@ -#include "../gen/Def.h" +#include "Gen.h" #include "Global.h" #include "Instance.h" #include "Log.h" diff --git a/src/game/Tools.cpp b/src/game/Tools.cpp index 632573a..5117755 100644 --- a/src/game/Tools.cpp +++ b/src/game/Tools.cpp @@ -1,3 +1,4 @@ +#include "Gen.h" #include "Global.h" #include "Instance.h" #include "Mesh.h" diff --git a/src/game/rendering/Dither.cpp b/src/game/rendering/Dither.cpp index f6e4b5f..082918d 100644 --- a/src/game/rendering/Dither.cpp +++ b/src/game/rendering/Dither.cpp @@ -1,4 +1,4 @@ -#include "../Global.h" +#include "../Gen.h" #include "../Log.h" #include "Dither.h"