]> git.localhorst.tv Git - blank.git/commitdiff
glm backwards compatibility
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 3 Nov 2016 16:22:07 +0000 (17:22 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Tue, 8 Nov 2016 16:30:52 +0000 (17:30 +0100)
74 files changed:
src/ai/AIController.hpp
src/ai/Spawner.cpp
src/ai/Spawner.hpp
src/ai/ai.cpp
src/audio/Audio.hpp
src/client/ChunkTransmission.hpp
src/client/net.cpp
src/geometry/Location.hpp
src/geometry/distance.hpp
src/geometry/geometry.cpp
src/geometry/primitive.hpp
src/geometry/rotation.hpp
src/graphics/BlendedSprite.hpp
src/graphics/BlockLighting.hpp
src/graphics/BlockMesh.hpp
src/graphics/Camera.hpp
src/graphics/Canvas.hpp
src/graphics/DirectionalLighting.hpp
src/graphics/EntityMesh.hpp
src/graphics/Font.hpp
src/graphics/PlainColor.hpp
src/graphics/PrimitiveMesh.hpp
src/graphics/Program.hpp
src/graphics/SkyBoxMesh.hpp
src/graphics/SpriteMesh.hpp
src/graphics/Viewport.hpp
src/graphics/align.hpp
src/graphics/gl_traits.hpp
src/graphics/glm.hpp [new file with mode: 0644]
src/io/TokenStreamReader.hpp
src/model/CollisionBounds.hpp
src/model/Instance.hpp
src/model/Model.hpp
src/model/Part.hpp
src/model/Shape.hpp
src/model/bounds.hpp
src/model/model.cpp
src/net/Packet.hpp
src/net/net.cpp
src/rand/OctaveNoise.hpp
src/rand/SimplexNoise.hpp
src/rand/WorleyNoise.hpp
src/rand/noise.cpp
src/server/net.cpp
src/shared/states.cpp
src/ui/HUD.hpp
src/ui/Interface.hpp
src/ui/MessageBox.hpp
src/ui/PlayerController.hpp
src/ui/Text.hpp
src/ui/TextInput.hpp
src/ui/ui.cpp
src/ui/widgets.cpp
src/world/Block.hpp
src/world/BlockGravity.hpp
src/world/BlockType.hpp
src/world/Chunk.hpp
src/world/Entity.hpp
src/world/EntityDerivative.hpp
src/world/EntityState.hpp
src/world/Generator.cpp
src/world/Generator.hpp
src/world/Steering.hpp
src/world/World.hpp
src/world/WorldCollision.hpp
src/world/block.cpp
src/world/chunk.cpp
src/world/world.cpp
tst/geometry/IntersectionTest.cpp
tst/geometry/LocationTest.hpp
tst/graphics/GLTraitsTest.cpp
tst/net/PacketTest.cpp
tst/net/PacketTest.hpp
tst/rand/StabilityTest.hpp

index cfd49d94a218a12539c98050f45eea0c29416ab9..6d40ded362b083780c54aa2f38aa09523d464d5b 100644 (file)
@@ -3,10 +3,9 @@
 
 #include "../app/IntervalTimer.hpp"
 #include "../geometry/primitive.hpp"
+#include "../graphics/glm.hpp"
 #include "../world/EntityController.hpp"
 
-#include <glm/glm.hpp>
-
 
 namespace blank {
 
index 1f9573b862fca871d0d05e53a2687a5924d339e8..2c5a94ca117e0d4c94175d4484a0eddeaef11f82 100644 (file)
@@ -70,7 +70,7 @@ void Spawner::CheckDespawn() noexcept {
                bool safe = false;
                for (const Player &ref : refs) {
                        glm::vec3 diff(ref.GetEntity().AbsoluteDifference(e));
-                       if (dot(diff, diff) < despawn_range) {
+                       if (glm::length2(diff) < despawn_range) {
                                safe = true;
                                break;
                        }
index 72d2ac136f84c6c7b3228465e3ac959106db5c2a..daa5f7873390b41de1d9be6db9f2f395d8b87fe3 100644 (file)
@@ -2,9 +2,9 @@
 #define BLANK_AI_SPAWNER_HPP_
 
 #include "../app/IntervalTimer.hpp"
+#include "../graphics/glm.hpp"
 
 #include <vector>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index db4ae413d8170a9dbc5f7f7056978a0615f6e5ee..ef0fc23c65e7c311a732b73314f9bf7c5307e686 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "../geometry/distance.hpp"
 #include "../geometry/rotation.hpp"
+#include "../graphics/glm.hpp"
 #include "../rand/GaloisLFSR.hpp"
 #include "../world/Entity.hpp"
 #include "../world/World.hpp"
@@ -13,7 +14,6 @@
 
 #include <cmath>
 #include <limits>
-#include <glm/glm.hpp>
 
 
 namespace blank {
@@ -58,7 +58,7 @@ void AIController::Update(Entity &e, float dt) {
                // orient head towards heading
                glm::vec3 heading(e.Heading());
                // only half pitch, so we don't crane our neck
-               float tgt_pitch = std::atan(heading.y / length(glm::vec2(heading.x, heading.z))) * 0.5f;
+               float tgt_pitch = std::atan(heading.y / glm::length(glm::vec2(heading.x, heading.z))) * 0.5f;
                // always look straight ahead
                // maybe look at the pursuit target if there is one
                float tgt_yaw = 0.0f;
@@ -77,11 +77,11 @@ Player *AIController::ClosestVisiblePlayer(const Entity &e) noexcept {
 
                // distance test
                const glm::vec3 diff(pe.AbsoluteDifference(e));
-               float dist = length(diff);
+               float dist = glm::length(diff);
                if (dist > distance) continue;
 
                // FOV test, 45° in each direction
-               if (dot(diff / dist, aim.dir) < sight_angle) {
+               if (glm::dot(diff / dist, aim.dir) < sight_angle) {
                        continue;
                }
 
@@ -102,8 +102,8 @@ bool AIController::LineOfSight(const Entity &from, const Entity &to) const noexc
        const glm::ivec3 &reference(from.ChunkCoords());
        Ray aim(from.Aim(reference));
        const glm::vec3 diff(to.AbsoluteDifference(from));
-       float dist = length(diff);
-       if (dist > sight_dist || dot(diff / dist, aim.dir) < sight_angle) {
+       float dist = glm::length(diff);
+       if (dist > sight_dist || glm::dot(diff / dist, aim.dir) < sight_angle) {
                return false;
        }
        WorldCollision col;
@@ -166,7 +166,7 @@ void ChaseState::Update(AIController &ctrl, Entity &e, float dt) const {
                return;
        }
        // halt if we're close enough, flee if we're too close
-       float dist_sq = length2(e.AbsoluteDifference(steering.GetTargetEntity()));
+       float dist_sq = glm::length2(e.AbsoluteDifference(steering.GetTargetEntity()));
        if (dist_sq < 8.0f) {
                ctrl.SetState(flee, e);
        } else if (dist_sq < 25.0f) {
index 800e247c010ef770a1a998aae8abd969880dcbec..dfa848f5a4795354f83b91e427dfeec1cf59925e 100644 (file)
@@ -2,9 +2,9 @@
 #define BLANK_AUDIO_AUDIO_HPP_
 
 #include "../app/IntervalTimer.hpp"
+#include "../graphics/glm.hpp"
 
 #include <al.h>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index 7e801eec3b24880d8477d4668dd3e0d5ee180bd0..1d43649d343a5384ea64c090bc9234827ad36fd4 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef BLANK_CLIENT_CHUNKTRANSMISSION_HPP_
 #define BLANK_CLIENT_CHUNKTRANSMISSION_HPP_
 
+#include "../graphics/glm.hpp"
 #include "../world/Chunk.hpp"
 
 #include <cstdint>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index bb28f15a7394347ff8a2a898aec3ff33f62d29c6..551087210e2b99b76d98f17433345dd8fecbdb0d 100644 (file)
@@ -432,7 +432,7 @@ void NetworkedInput::MergePlayerCorrection(uint16_t seq, const EntityState &corr
        }
 
        glm::vec3 displacement(replay.GetState().Diff(player_state));
-       const float disp_squared = dot(displacement, displacement);
+       const float disp_squared = glm::dot(displacement, displacement);
 
        if (disp_squared < 16.0f * numeric_limits<float>::epsilon()) {
                SetMovement(restore_movement);
index 43d94dcdd439a799731c93eb9338cd384530e2c1..d475b3bc4c63e78b4e3347522a57c563b4f0ca5c 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef BLANK_GEOMETRY_LOCATION_HPP_
 #define BLANK_GEOMETRY_LOCATION_HPP_
 
-#include <glm/glm.hpp>
+#include "../graphics/glm.hpp"
 
 
 namespace blank {
@@ -11,7 +11,7 @@ struct Location {
 
        using Coarse = glm::ivec3;
        using CoarseScalar = int;
-       using Fine = glm::tvec3<T>;
+       using Fine = TVEC3<T, glm::precision(0)>;
        using FineScalar = T;
        using Self = Location<T>;
 
index ef2f8a2fee5c570bd4dac293a8c190c0399b16cf..91568082c3e06f8a001b0035840a8540f0857834 100644 (file)
@@ -1,9 +1,10 @@
 #ifndef BLANK_GEOMETRY_DISTANCE_HPP_
 #define BLANK_GEOMETRY_DISTANCE_HPP_
 
+#include "../graphics/glm.hpp"
+
 #include <algorithm>
 #include <limits>
-#include <glm/glm.hpp>
 #include <glm/gtx/component_wise.hpp>
 #include <glm/gtx/norm.hpp>
 
@@ -12,26 +13,26 @@ namespace blank {
 
 template <class T>
 inline bool iszero(const T &v) noexcept {
-       return length2(v) < std::numeric_limits<typename T::value_type>::epsilon();
+       return glm::length2(v) < std::numeric_limits<typename T::value_type>::epsilon();
 }
 
 template<class Vec>
 inline void limit(Vec &v, float max) noexcept {
-       float len2 = length2(v);
+       float len2 = glm::length2(v);
        float max2 = max * max;
        if (len2 > max2) {
-               v = normalize(v) * max;
+               v = glm::normalize(v) * max;
        }
 }
 
-template<class T>
-T manhattan_distance(const glm::tvec3<T> &a, const glm::tvec3<T> &b) noexcept {
-       return compAdd(abs(a - b));
+template<class T, glm::precision P = glm::precision(0)>
+T manhattan_distance(const TVEC3<T, P> &a, const TVEC3<T, P> &b) noexcept {
+       return glm::compAdd(glm::abs(a - b));
 }
 
-template<class T>
-T manhattan_radius(const glm::tvec3<T> &v) noexcept {
-       return compMax(abs(v));
+template<class T, glm::precision P = glm::precision(0)>
+T manhattan_radius(const TVEC3<T, P> &v) noexcept {
+       return glm::compMax(glm::abs(v));
 }
 
 }
index 668e72930c9bfbe91de362de09fc0f59660e9c95..5db29c8c3ad8488ccb655f3d71b15bcae7c2942c 100644 (file)
@@ -14,7 +14,7 @@
 namespace blank {
 
 glm::mat3 find_rotation(const glm::vec3 &a, const glm::vec3 &b) noexcept {
-       glm::vec3 v(cross(a, b));
+       glm::vec3 v(glm::cross(a, b));
        if (iszero(v)) {
                // a and b are parallel
                if (iszero(a - b)) {
@@ -30,15 +30,15 @@ glm::mat3 find_rotation(const glm::vec3 &a, const glm::vec3 &b) noexcept {
                        } else {
                                arb.y += 1.0f;
                        }
-                       glm::vec3 axis(normalize(cross(a, arb)));
+                       glm::vec3 axis(glm::normalize(glm::cross(a, arb)));
                        return glm::mat3(glm::rotate(PI, axis));
                }
        }
-       float mv = length2(v);
-       float c = dot(a, b);
+       float mv = glm::length2(v);
+       float c = glm::dot(a, b);
        float f = (1 - c) / mv;
-       glm::mat3 vx(matrixCross3(v));
-       return glm::mat3(1.0f) + vx + (pow2(vx) * f);
+       glm::mat3 vx(glm::matrixCross3(v));
+       return glm::mat3(1.0f) + vx + (glm::pow2(vx) * f);
 }
 
 std::ostream &operator <<(std::ostream &out, const AABB &box) {
@@ -106,7 +106,7 @@ bool Intersection(
                *dist = t_min;
        }
        if (normal) {
-               glm::vec3 min_all(min(t1, t2));
+               glm::vec3 min_all(glm::min(t1, t2));
                if (min_all.x > min_all.y) {
                        if (min_all.x > min_all.z) {
                                normal->x = t2.x < t1.x ? 1 : -1;
@@ -159,15 +159,15 @@ bool Intersection(
                glm::vec3(b_m[0]),
                glm::vec3(b_m[1]),
                glm::vec3(b_m[2]),
-               normalize(cross(glm::vec3(a_m[0]), glm::vec3(b_m[0]))),
-               normalize(cross(glm::vec3(a_m[0]), glm::vec3(b_m[1]))),
-               normalize(cross(glm::vec3(a_m[0]), glm::vec3(b_m[2]))),
-               normalize(cross(glm::vec3(a_m[1]), glm::vec3(b_m[0]))),
-               normalize(cross(glm::vec3(a_m[1]), glm::vec3(b_m[1]))),
-               normalize(cross(glm::vec3(a_m[1]), glm::vec3(b_m[2]))),
-               normalize(cross(glm::vec3(a_m[2]), glm::vec3(b_m[0]))),
-               normalize(cross(glm::vec3(a_m[2]), glm::vec3(b_m[1]))),
-               normalize(cross(glm::vec3(a_m[2]), glm::vec3(b_m[2]))),
+               glm::normalize(glm::cross(glm::vec3(a_m[0]), glm::vec3(b_m[0]))),
+               glm::normalize(glm::cross(glm::vec3(a_m[0]), glm::vec3(b_m[1]))),
+               glm::normalize(glm::cross(glm::vec3(a_m[0]), glm::vec3(b_m[2]))),
+               glm::normalize(glm::cross(glm::vec3(a_m[1]), glm::vec3(b_m[0]))),
+               glm::normalize(glm::cross(glm::vec3(a_m[1]), glm::vec3(b_m[1]))),
+               glm::normalize(glm::cross(glm::vec3(a_m[1]), glm::vec3(b_m[2]))),
+               glm::normalize(glm::cross(glm::vec3(a_m[2]), glm::vec3(b_m[0]))),
+               glm::normalize(glm::cross(glm::vec3(a_m[2]), glm::vec3(b_m[1]))),
+               glm::normalize(glm::cross(glm::vec3(a_m[2]), glm::vec3(b_m[2]))),
        };
 
        depth = std::numeric_limits<float>::infinity();
@@ -175,7 +175,7 @@ bool Intersection(
 
        int cur_axis = 0;
        for (const glm::vec3 &axis : axes) {
-               if (any(isnan(axis))) {
+               if (glm::any(glm::isnan(axis))) {
                        // can result from the cross products if A and B have parallel axes
                        ++cur_axis;
                        continue;
@@ -270,7 +270,7 @@ bool CullTest(const AABB &box, const Frustum &frustum) noexcept {
                        ((plane.normal.y > 0.0f) ? box.max.y : box.min.y),
                        ((plane.normal.z > 0.0f) ? box.max.z : box.min.z)
                );
-               const float dp = dot(plane.normal, np);
+               const float dp = glm::dot(plane.normal, np);
                // cull if nearest point is on the "outside" side of the plane
                if (dp < -plane.dist) return true;
        }
index b9f2187580f5b64e692451553a352c72006e7e42..76064c1b13f8ce2e26ef26075e3e44b8dce9c750 100644 (file)
@@ -1,9 +1,10 @@
 #ifndef BLANK_GEOMETRY_PRIMITIVE_HPP_
 #define BLANK_GEOMETRY_PRIMITIVE_HPP_
 
+#include "../graphics/glm.hpp"
+
 #include <algorithm>
 #include <iosfwd>
-#include <glm/glm.hpp>
 #include <glm/gtx/norm.hpp>
 
 
@@ -25,8 +26,8 @@ struct AABB {
 
        /// return distance between origin and farthest vertex
        float OriginRadius() const noexcept {
-               glm::vec3 high(glm::max(abs(min), abs(max)));
-               return length(high);
+               glm::vec3 high(glm::max(glm::abs(min), glm::abs(max)));
+               return glm::length(high);
        }
 };
 
@@ -51,10 +52,10 @@ struct Ray {
                // for derivation, see http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html
                // x1 = orig
                // x2-x1 = dir, which means |x2-x1| is 1.0
-               return length(cross(dir, orig - point));
+               return glm::length(glm::cross(dir, orig - point));
        }
        float DistanceSquared(const glm::vec3 &point) const noexcept {
-               return length2(cross(dir, orig - point));
+               return glm::length2(glm::cross(dir, orig - point));
        }
 };
 
@@ -105,7 +106,7 @@ struct Plane {
        : normal(abcd), dist(abcd.w) { }
 
        void Normalize() noexcept {
-               const float l = length(normal);
+               const float l = glm::length(normal);
                normal /= l;
                dist /= l;
        }
index ac208dc4c725b087a902e1a470e45c74d8c3e6dd..3365a326f79e4b0b4555fb3ef708fa6be0f1df28 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef BLANK_GEOMETRY_ROTATION_HPP_
 #define BLANK_GEOMETRY_ROTATION_HPP_
 
-#include <glm/glm.hpp>
+#include "../graphics/glm.hpp"
 
 
 namespace blank {
index a15d8a1cb2b41c077c498f92ed86f377defdeeed..b103a4db4d3d8bc109a5b4e14fc5d815bc374314 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef BLANK_GRAPHICS_BLENDEDSPRITE_HPP_
 #define BLANK_GRAPHICS_BLENDEDSPRITE_HPP_
 
+#include "glm.hpp"
 #include "Program.hpp"
 
 #include <GL/glew.h>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index 9b3e8afcb72a56d19759965c711b451088e94e45..d0d4ea4997f12283576eec354862cf9440b8baf3 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef BLANK_GRAPHICS_BLOCKLIGHTING_HPP_
 #define BLANK_GRAPHICS_BLOCKLIGHTING_HPP_
 
+#include "glm.hpp"
 #include "Program.hpp"
 
 #include <GL/glew.h>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index 534299233a2cc5d6eae9f5aa47b117246acc3d4c..ff41df915dfd2a2e7542d14266df3313c99ab005 100644 (file)
@@ -1,11 +1,11 @@
 #ifndef BLANK_GRAPHICS_BLOCKMESH_HPP_
 #define BLANK_GRAPHICS_BLOCKMESH_HPP_
 
+#include "glm.hpp"
 #include "VertexArray.hpp"
 
 #include <vector>
 #include <GL/glew.h>
-#include <glm/glm.hpp>
 
 
 namespace blank {
@@ -15,7 +15,7 @@ class BlockMesh {
 public:
        using Position = glm::vec3;
        using TexCoord = glm::vec3;
-       using ColorMod = glm::tvec3<unsigned char>;
+       using ColorMod = TVEC3<unsigned char, glm::precision(0)>;
        using Light = float;
        using Index = unsigned int;
 
index 95175dee705a0a8544aa3c592e6efc3f68172c35..d1fa508da3136a5fa8a68a6f7f5f13a3a218c997 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef BLANK_GRAPHICS_CAMERA_HPP_
 #define BLANK_GRAPHICS_CAMERA_HPP_
 
-#include <glm/glm.hpp>
+#include "glm.hpp"
 
 
 namespace blank {
index a9ce7f55a0d15823847d120ae136d893d92b7fdb..b1d8282eb35f2148727506638d6c501e4b01054a 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef BLANK_GRAPHICS_CANVAS_HPP_
 #define BLANK_GRAPHICS_CANVAS_HPP_
 
-#include <glm/glm.hpp>
+#include "glm.hpp"
 
 
 namespace blank {
index 42554014c51707b3dbd4d218cf68f001e8fb39f9..dd76f5e67ef11702495bfd3db62b1dc5be704dd4 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef BLANK_GRAPHICS_DIRECTIONALLIGHTING_HPP_
 #define BLANK_GRAPHICS_DIRECTIONALLIGHTING_HPP_
 
+#include "glm.hpp"
 #include "Program.hpp"
 
 #include <GL/glew.h>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index 58b29e51f7726fa078b8036443e857a587c25730..cdb7ed2515cb743d478e29fc52f3d499d05395bb 100644 (file)
@@ -1,11 +1,11 @@
 #ifndef BLANK_GRAPHICS_ENTITYMESH_HPP_
 #define BLANK_GRAPHICS_ENTITYMESH_HPP_
 
+#include "glm.hpp"
 #include "VertexArray.hpp"
 
 #include <vector>
 #include <GL/glew.h>
-#include <glm/glm.hpp>
 
 
 namespace blank {
@@ -15,7 +15,7 @@ class EntityMesh {
 public:
        using Position = glm::vec3;
        using TexCoord = glm::vec3;
-       using ColorMod = glm::tvec3<unsigned char>;
+       using ColorMod = TVEC3<unsigned char, glm::precision(0)>;
        using Normal = glm::vec3;
        using Index = unsigned int;
 
index b940059787ec0485ed153eb760f5e8b11078dacc..d52d43f63e179df4539d4687f50d30609815e6cd 100644 (file)
@@ -1,8 +1,9 @@
 #ifndef BLANK_GRAPHICS_FONT_HPP_
 #define BLANK_GRAPHICS_FONT_HPP_
 
+#include "glm.hpp"
+
 #include <SDL_ttf.h>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index cfaaebe058c5929ffb6c65c1d7b8cbcb021edd10..6cdf1106d33fdd848ac4849afc21c84bc8e5dfb8 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef BLANK_GRAPHICS_PLAINCOLOR_HPP_
 #define BLANK_GRAPHICS_PLAINCOLOR_HPP_
 
+#include "glm.hpp"
 #include "Program.hpp"
 
 #include <GL/glew.h>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index 577321a73e8204e281a265c8402d193900445cbe..247cc6a0b3b52ca90ca835d5a69194c061cbcdd3 100644 (file)
@@ -1,11 +1,11 @@
 #ifndef BLANK_GRAPHICS_PRIMITIVEMESH_HPP_
 #define BLANK_GRAPHICS_PRIMITIVEMESH_HPP_
 
+#include "glm.hpp"
 #include "VertexArray.hpp"
 
 #include <vector>
 #include <GL/glew.h>
-#include <glm/glm.hpp>
 
 
 namespace blank {
@@ -16,7 +16,7 @@ class PrimitiveMesh {
 
 public:
        using Position = glm::vec3;
-       using Color = glm::tvec4<unsigned char>;
+       using Color = TVEC4<unsigned char, glm::precision(0)>;
        using Index = unsigned short;
 
        using Positions = std::vector<Position>;
index ff01f9dafd1e78b17b2b3980264cf603b6f25a04..7f6590127ab22cf53788d4e0a94290a5e4b8a16f 100644 (file)
@@ -1,10 +1,11 @@
 #ifndef BLANK_GRAPHICS_PROGRAM_HPP_
 #define BLANK_GRAPHICS_PROGRAM_HPP_
 
+#include "glm.hpp"
+
 #include <iosfwd>
 #include <list>
 #include <GL/glew.h>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index 2378327fc50a3848cdd0a3664fc06e6dc43a0823..2962f0764ec4735e984cae2045073f71aec92985 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef BLANK_GRAPHICS_SKYBOXMESH_HPP_
 #define BLANK_GRAPHICS_SKYBOXMESH_HPP_
 
+#include "glm.hpp"
 #include "VertexArray.hpp"
 
 #include <vector>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index 0c6c9a1918b3f97758335147d872471e8b5f85bb..019af862e0d700bfd61d699c8c91a5c82929a530 100644 (file)
@@ -1,11 +1,11 @@
 #ifndef BLANK_GRPAHICS_SPRITEMESH_HPP_
 #define BLANK_GRPAHICS_SPRITEMESH_HPP_
 
+#include "glm.hpp"
 #include "VertexArray.hpp"
 
 #include <vector>
 #include <GL/glew.h>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index de62c4847c9cc67309030c6886ee66b394c19502..69c66a7310ca5f04878a59cdcadbf01e6a854494 100644 (file)
@@ -7,11 +7,10 @@
 #include "Camera.hpp"
 #include "Canvas.hpp"
 #include "DirectionalLighting.hpp"
+#include "glm.hpp"
 #include "PlainColor.hpp"
 #include "SkyBoxShader.hpp"
 
-#include <glm/glm.hpp>
-
 
 namespace blank {
 
index 6563e29f5b98ef23930c4a296ec7531adb6058c9..eba70f7323950a3e38951bcd062f6469a0b07fd6 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef BLANK_GRAPHICS_ALIGN_HPP_
 #define BLANK_GRAPHICS_ALIGN_HPP_
 
-#include <glm/glm.hpp>
+#include "glm.hpp"
 
 
 namespace blank {
index 2a599b358574d128dabb7f478ed1c4f363f9c4e3..89d2dea041f902c06b06c8be088ebaefecaa79b7 100644 (file)
@@ -1,8 +1,9 @@
 #ifndef BLANK_GRAPHICS_GL_TRAITS_HPP_
 #define BLANK_GRAPHICS_GL_TRAITS_HPP_
 
+#include "glm.hpp"
+
 #include <GL/glew.h>
-#include <glm/glm.hpp>
 
 
 namespace blank {
@@ -72,47 +73,47 @@ template<> struct gl_traits<double> {
 
 template<>
 template<class T, glm::precision P>
-struct gl_traits<glm::tvec1<T, P>> {
+struct gl_traits<TVEC1<T, P>> {
        static constexpr GLint size = 1;
        static constexpr GLenum type = gl_traits<T>::type;
 };
 template<class T, glm::precision P>
-constexpr GLint gl_traits<glm::tvec1<T, P>>::size;
+constexpr GLint gl_traits<TVEC1<T, P>>::size;
 template<class T, glm::precision P>
-constexpr GLenum gl_traits<glm::tvec1<T, P>>::type;
+constexpr GLenum gl_traits<TVEC1<T, P>>::type;
 
 template<>
 template<class T, glm::precision P>
-struct gl_traits<glm::tvec2<T, P>> {
+struct gl_traits<TVEC2<T, P>> {
        static constexpr GLint size = 2;
        static constexpr GLenum type = gl_traits<T>::type;
 };
 template<class T, glm::precision P>
-constexpr GLint gl_traits<glm::tvec2<T, P>>::size;
+constexpr GLint gl_traits<TVEC2<T, P>>::size;
 template<class T, glm::precision P>
-constexpr GLenum gl_traits<glm::tvec2<T, P>>::type;
+constexpr GLenum gl_traits<TVEC2<T, P>>::type;
 
 template<>
 template<class T, glm::precision P>
-struct gl_traits<glm::tvec3<T, P>> {
+struct gl_traits<TVEC3<T, P>> {
        static constexpr GLint size = 3;
        static constexpr GLenum type = gl_traits<T>::type;
 };
 template<class T, glm::precision P>
-constexpr GLint gl_traits<glm::tvec3<T, P>>::size;
+constexpr GLint gl_traits<TVEC3<T, P>>::size;
 template<class T, glm::precision P>
-constexpr GLenum gl_traits<glm::tvec3<T, P>>::type;
+constexpr GLenum gl_traits<TVEC3<T, P>>::type;
 
 template<>
 template<class T, glm::precision P>
-struct gl_traits<glm::tvec4<T, P>> {
+struct gl_traits<TVEC4<T, P>> {
        static constexpr GLint size = 4;
        static constexpr GLenum type = gl_traits<T>::type;
 };
 template<class T, glm::precision P>
-constexpr GLint gl_traits<glm::tvec4<T, P>>::size;
+constexpr GLint gl_traits<TVEC4<T, P>>::size;
 template<class T, glm::precision P>
-constexpr GLenum gl_traits<glm::tvec4<T, P>>::type;
+constexpr GLenum gl_traits<TVEC4<T, P>>::type;
 
 }
 
diff --git a/src/graphics/glm.hpp b/src/graphics/glm.hpp
new file mode 100644 (file)
index 0000000..db886e0
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef BLANK_GRAPHICS_GLM_HPP_
+#define BLANK_GRAPHICS_GLM_HPP_
+
+#ifndef GLM_FORCE_RADIANS
+#  define GLM_FORCE_RADIANS 1
+#endif
+
+#include <glm/glm.hpp>
+
+// GLM moved tvec[1234] from glm::detail to glm in 0.9.6
+
+#if GLM_VERSION < 96
+#  define TVEC1 glm::detail::tvec1
+#  define TVEC2 glm::detail::tvec2
+#  define TVEC3 glm::detail::tvec3
+#  define TVEC4 glm::detail::tvec4
+#else
+#  define TVEC1 glm::tvec1
+#  define TVEC2 glm::tvec2
+#  define TVEC3 glm::tvec3
+#  define TVEC4 glm::tvec4
+#endif
+
+#endif
index 9436aba3f3dc355a3d8d050c102d43a4d8e42ed9..c702703f6915c3e201bf71f759afb5b25794e966 100644 (file)
@@ -3,10 +3,10 @@
 
 #include "Token.hpp"
 #include "Tokenizer.hpp"
+#include "../graphics/glm.hpp"
 
 #include <iosfwd>
 #include <string>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index e43b0d82e66e69ae624cbfbfbbba9e540ea8f770..a612286e5c4280bfd8fcd1f35d010633d2216dca 100644 (file)
@@ -2,8 +2,7 @@
 #define BLANK_MODEL_COLLISIONBOUNDS_HPP_
 
 #include "../graphics/PrimitiveMesh.hpp"
-
-#include <glm/glm.hpp>
+#include "../graphics/glm.hpp"
 
 
 namespace blank {
index 80c8f710fd14e7a0f60988a2fc6b0b73122a1110..60e195087099fbfe8f28493d326a2680fdd3355a 100644 (file)
@@ -2,9 +2,9 @@
 #define BLANK_MODEL_INSTANCE_HPP_
 
 #include "Part.hpp"
+#include "../graphics/glm.hpp"
 
 #include <vector>
-#include <glm/glm.hpp>
 #include <glm/gtc/quaternion.hpp>
 
 
index 145a6d9c0fd56cf40dc29145360e2d577a899b26..54b5256c13f34e4767475735d259d3161272aa9c 100644 (file)
@@ -2,11 +2,11 @@
 #define BLANK_MODEL_MODEL_HPP_
 
 #include "Part.hpp"
+#include "../graphics/glm.hpp"
 
 #include <cstdint>
 #include <list>
 #include <vector>
-#include <glm/glm.hpp>
 #include <glm/gtc/quaternion.hpp>
 
 
index 3a17f2046137b39da28699d66452932978843471..6499bb7478ed30ec34cd5077e702e34dbfbea85c 100644 (file)
@@ -1,18 +1,19 @@
 #ifndef BLAMK_MODEL_PART_HPP_
 #define BLAMK_MODEL_PART_HPP_
 
+#include "../graphics/EntityMesh.hpp"
+#include "../graphics/glm.hpp"
+
 #include <cstdint>
 #include <list>
 #include <memory>
 #include <vector>
-#include <glm/glm.hpp>
 #include <glm/gtc/quaternion.hpp>
 
 
 namespace blank {
 
 class DirectionalLighting;
-class EntityMesh;
 class Instance;
 class Model;
 class ResourceIndex;
@@ -56,8 +57,8 @@ private:
        std::vector<float> tex_map;
        mutable std::unique_ptr<EntityMesh> mesh;
        State initial;
-       glm::tvec3<unsigned char> hsl_mod;
-       glm::tvec3<unsigned char> rgb_mod;
+       EntityMesh::ColorMod hsl_mod;
+       EntityMesh::ColorMod rgb_mod;
        std::uint16_t id;
 
 };
index fe58d017510c2cfd1e9da65b265ca52ad1145c8a..80dc4a33ba6d28803f9de4b603e1cf83b2b00b9f 100644 (file)
@@ -5,11 +5,11 @@
 #include "../geometry/primitive.hpp"
 #include "../graphics/BlockMesh.hpp"
 #include "../graphics/EntityMesh.hpp"
+#include "../graphics/glm.hpp"
 #include "../world/Block.hpp"
 
 #include <memory>
 #include <vector>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index df5f77f66410ef1c43e08701aae15d6883553a3c..7177290521bb258311b3763e765c73e9aac8e05c 100644 (file)
@@ -3,9 +3,9 @@
 
 #include "CollisionBounds.hpp"
 #include "../geometry/primitive.hpp"
+#include "../graphics/glm.hpp"
 
 #include <vector>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index ed443138e23e0d5746a551c25fd7e1f6956cf198..9a5801b2a10af3ce527cfae51f7aa66ed9c7c6c5 100644 (file)
@@ -137,10 +137,10 @@ void Part::Read(TokenStreamReader &in, ResourceIndex &tex_index, const ShapeRegi
                        in.ReadQuat(initial.orientation);
                } else if (name == "hsl_mod") {
                        in.ReadVec(color_conv);
-                       hsl_mod = glm::tvec3<unsigned char>(color_conv * 255.0f);
+                       hsl_mod = EntityMesh::ColorMod(color_conv * 255.0f);
                } else if (name == "rgb_mod") {
                        in.ReadVec(color_conv);
-                       rgb_mod = glm::tvec3<unsigned char>(color_conv * 255.0f);
+                       rgb_mod = EntityMesh::ColorMod(color_conv * 255.0f);
                } else if (name == "textures") {
                        in.Skip(Token::BRACKET_OPEN);
                        while (in.HasMore() && in.Peek().type != Token::BRACKET_CLOSE) {
@@ -193,7 +193,7 @@ void Part::Index(std::vector<Part *> &index) noexcept {
 }
 
 glm::mat4 Part::LocalTransform(const Instance &inst) const noexcept {
-       glm::mat4 transform(toMat4(initial.orientation * inst.state[id].orientation));
+       glm::mat4 transform(glm::toMat4(initial.orientation * inst.state[id].orientation));
        transform[3] = glm::vec4(initial.position + inst.state[id].position, 1.0f);
        return transform;
 }
index 7dede0d87d61d0cdb9e1d142fd6694350fe9d025..d7da977275e810e3298808cef8ea3a1b324031c4 100644 (file)
@@ -1,11 +1,12 @@
 #ifndef BLANK_NET_PACKET_HPP_
 #define BLANK_NET_PACKET_HPP_
 
+#include "../graphics/glm.hpp"
+
 #include <cstdint>
 #include <ostream>
 #include <string>
 #include <SDL_net.h>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index 7de901e31f58b7f842461e2a2414e677db8ceca5..4f7fc66647a2817eb8f87133f4f937e382096097 100644 (file)
@@ -493,7 +493,7 @@ void Packet::Payload::Read(glm::quat &val, size_t off) const noexcept {
                }
        }
        // omitted component squared is 1 - length squared of others
-       val[largest_index] = sqrt(1.0f - dot(val, val));
+       val[largest_index] = sqrt(1.0f - glm::length2(val));
        // and already normalized
 }
 
index 7d5832f30b32e9d26b7988e43683dc1db5943049..4c8b78eb0875b79c284833bc3c8f9ab98d5befe5 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef BLANK_RAND_OCTAVENOISE_HPP_
 #define BLANK_RAND_OCTAVENOISE_HPP_
 
-#include <glm/glm.hpp>
+#include "../graphics/glm.hpp"
 
 
 namespace blank {
index 6260426fe8235fe1a6afbeb4f0ff0e9c66f34c4b..dbe3d59c61950c59ee97983e879309a8f288a5d4 100644 (file)
@@ -1,8 +1,9 @@
 #ifndef BLANK_RAND_SIMPLEXNOISE_HPP_
 #define BLANK_RAND_SIMPLEXNOISE_HPP_
 
+#include "../graphics/glm.hpp"
+
 #include <cstdint>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index 20631c46b6749ba917ee5c016263548ae6a1689c..24ef7243650762cea55e1354fe8f63ba0bc5e720 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef BLANK_RAND_WORLEYNOISE_HPP_
 #define BLANK_RAND_WORLEYNOISE_HPP_
 
-#include <glm/glm.hpp>
+#include "../graphics/glm.hpp"
 
 
 namespace blank {
index b3a9bc8cd2c58b237c2e3ff23ccdf4aaa6972bfc..bd6571b35b9503080f246d88bf111b6ff5a2b200 100644 (file)
@@ -3,6 +3,7 @@
 #include "WorleyNoise.hpp"
 
 #include <cmath>
+#include <glm/gtx/norm.hpp>
 
 
 namespace {
@@ -122,28 +123,28 @@ float SimplexNoise::operator ()(const glm::vec3 &in) const noexcept {
        // I know 0.6 is wrong, but for some reason it looks better than 0.5
 
        // 0
-       float t = glm::clamp(0.6f - dot(offset[0], offset[0]), 0.0f, 1.0f);
+       float t = glm::clamp(0.6f - glm::length2(offset[0]), 0.0f, 1.0f);
        t *= t;
        int corner = Perm12(index[0] + Perm(index[1] + Perm(index[2])));
-       n += t * t * dot(Grad(corner), offset[0]);
+       n += t * t * glm::dot(Grad(corner), offset[0]);
 
        // 1
-       t = glm::clamp(0.6f - dot(offset[1], offset[1]), 0.0f, 1.0f);
+       t = glm::clamp(0.6f - glm::length2(offset[1]), 0.0f, 1.0f);
        t *= t;
        corner = Perm12(index[0] + second_int.x + Perm(index[1] + second_int.y + Perm(index[2] + second_int.z)));
-       n += t * t * dot(Grad(corner), offset[1]);
+       n += t * t * glm::dot(Grad(corner), offset[1]);
 
        // 2
-       t = glm::clamp(0.6f - dot(offset[2], offset[2]), 0.0f, 1.0f);
+       t = glm::clamp(0.6f - glm::length2(offset[2]), 0.0f, 1.0f);
        t *= t;
        corner = Perm12(index[0] + third_int.x + Perm(index[1] + third_int.y + Perm(index[2] + third_int.z)));
-       n += t * t * dot(Grad(corner), offset[2]);
+       n += t * t * glm::dot(Grad(corner), offset[2]);
 
        // 3
-       t = glm::clamp(0.6f - dot(offset[3], offset[3]), 0.0f, 1.0f);
+       t = glm::clamp(0.6f - glm::length2(offset[3]), 0.0f, 1.0f);
        t *= t;
        corner = Perm12(index[0] + 1 + Perm(index[1] + 1 + Perm(index[2] + 1)));
-       n += t * t * dot(Grad(corner), offset[3]);
+       n += t * t * glm::dot(Grad(corner), offset[3]);
 
        return 32.0f * n;
 }
@@ -169,7 +170,7 @@ WorleyNoise::WorleyNoise(unsigned int seed) noexcept
 }
 
 float WorleyNoise::operator ()(const glm::vec3 &in) const noexcept {
-       glm::vec3 center = floor(in);
+       glm::vec3 center = glm::floor(in);
 
        float closest = 1.0f;  // cannot be farther away than 1.0
 
@@ -192,8 +193,7 @@ float WorleyNoise::operator ()(const glm::vec3 &in) const noexcept {
                                        cube_rand = 159739 * cube_rand + 112139;
                                        point.z += float(cube_rand % 262144) / 262144.0f;
 
-                                       glm::vec3 diff(in - point);
-                                       float distance = sqrt(dot(diff, diff));
+                                       float distance = glm::distance(in, point);
                                        if (distance < closest) {
                                                closest = distance;
                                        }
index e8325da1bd4ea1f0cfd08f0eda206d2e845e2f0e..e210fef4ff1e7db6cf4a0a2e51f8b0a29f514bb6 100644 (file)
@@ -355,7 +355,7 @@ void ClientConnection::SendUpdates() {
 void ClientConnection::CheckPlayerFix() {
        // player_update_state's position holds the client's most recent prediction
        glm::vec3 diff = player_update_state.Diff(PlayerEntity().GetState());
-       float dist_squared = dot(diff, diff);
+       float dist_squared = glm::length2(diff);
 
        // if client's prediction is off by more than 1cm, send
        // our (authoritative) state back so it can fix it
index 1b907150d73e9937f14f99566476b3f972fe32d9..fc422bbc17504d688b61584730ca59e39709ec2d 100644 (file)
@@ -18,8 +18,8 @@ ChatState::ChatState(Environment &env, State &parent, Responder &responder)
 , input(env.assets.small_ui_font) {
        input.Position(glm::vec3(25.0f, -25.0f, -1.0f), Gravity::SOUTH_WEST, Gravity::SOUTH_WEST);
        input.Width(env.viewport.Width() - 50.0f);
-       input.Foreground(glm::vec4(1.0f));
-       input.Background(glm::vec4(0.5f));
+       input.Foreground(PrimitiveMesh::Color(255));
+       input.Background(PrimitiveMesh::Color(127));
 }
 
 void ChatState::Preset(const std::string &text) {
index b842da392d892340d9d6413cc45c76d85f531865..cbe28762727c81e90c47f973298bce545f3a6393 100644 (file)
@@ -4,10 +4,9 @@
 #include "FixedText.hpp"
 #include "MessageBox.hpp"
 #include "../graphics/EntityMesh.hpp"
+#include "../graphics/glm.hpp"
 #include "../graphics/PrimitiveMesh.hpp"
 
-#include <glm/glm.hpp>
-
 
 namespace blank {
 
index 9a6e927407b212f24063817bda98e2ce1e1b718d..bcc6c662ff1e0750937ff4c5e0750cda9fe0b77c 100644 (file)
@@ -2,9 +2,9 @@
 #define BLANK_UI_INTERFACE_HPP_
 
 #include "../app/Config.hpp"
+#include "../graphics/glm.hpp"
 
 #include <SDL.h>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index b5a82c8b0a7b21f65be52587ee42b0c81dbd30e3..2cfdec9c4da0be7722e5372aeed9da70c675c2ea 100644 (file)
@@ -3,11 +3,11 @@
 
 #include "Text.hpp"
 #include "../graphics/align.hpp"
+#include "../graphics/glm.hpp"
 #include "../graphics/PrimitiveMesh.hpp"
 
 #include <deque>
 #include <string>
-#include <glm/glm.hpp>
 
 
 namespace blank {
@@ -44,8 +44,8 @@ private:
        glm::vec3 adv;
        glm::vec2 size;
 
-       glm::vec4 bg;
-       glm::vec4 fg;
+       PrimitiveMesh::Color bg;
+       PrimitiveMesh::Color fg;
 
        PrimitiveMesh bg_mesh;
 
index 48c3bdcfbc51ff07e65ca1779735a03becac584c..69a15e9846ef7e7b42bd72f9b281682184eb015a 100644 (file)
@@ -1,8 +1,7 @@
 #ifndef BLANK_UI_PLAYERCONTROLLER_HPP_
 #define BLANK_UI_PLAYERCONTROLLER_HPP_
 
-#include <glm/glm.hpp>
-
+#include "../graphics/glm.hpp"
 #include "../world/EntityCollision.hpp"
 #include "../world/EntityController.hpp"
 #include "../world/WorldCollision.hpp"
index c4318737e1246de4036330ecf639f95fa5729621..591740a33c0260dfa3ce5a47b610adb630edc271 100644 (file)
@@ -2,11 +2,11 @@
 #define BLANK_UI_TEXT_HPP_
 
 #include "../graphics/align.hpp"
+#include "../graphics/glm.hpp"
 #include "../graphics/Texture.hpp"
 #include "../graphics/SpriteMesh.hpp"
 
 #include <string>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index 44999faac002259ecdca9c1cbdb21821abb2aec0..66f2ded94c018f67300e5d5d635c49c2ab1bf63f 100644 (file)
@@ -39,8 +39,8 @@ public:
        void Position(const glm::vec3 &p, Gravity g, Gravity pv) noexcept;
        void Width(float) noexcept;
 
-       void Foreground(const glm::vec4 &col) noexcept { fg = col; dirty_cursor = true; }
-       void Background(const glm::vec4 &col) noexcept { bg = col; dirty_box = true; }
+       void Foreground(const PrimitiveMesh::Color &col) noexcept { fg = col; dirty_cursor = true; }
+       void Background(const PrimitiveMesh::Color &col) noexcept { bg = col; dirty_box = true; }
 
        void Handle(const SDL_TextInputEvent &);
        void Handle(const SDL_TextEditingEvent &);
@@ -59,8 +59,8 @@ private:
        PrimitiveMesh bg_mesh;
        PrimitiveMesh cursor_mesh;
 
-       glm::vec4 bg;
-       glm::vec4 fg;
+       PrimitiveMesh::Color bg;
+       PrimitiveMesh::Color fg;
 
        glm::vec3 position;
        glm::vec2 size;
index 2d3b4679552045ad557e1b62fa978046619bc36f..5ff408be5fddc4f615eb2122230603b6b8cc6516 100644 (file)
@@ -54,8 +54,8 @@ PlayerController::~PlayerController() {
 }
 
 void PlayerController::SetMovement(const glm::vec3 &m) noexcept {
-       if (dot(m, m) > 1.0f) {
-               move_dir = normalize(m);
+       if (glm::dot(m, m) > 1.0f) {
+               move_dir = glm::normalize(m);
        } else {
                move_dir = m;
        }
@@ -108,8 +108,8 @@ void PlayerController::UpdatePlayer() noexcept {
                if (!iszero(move_dir)) {
                        // scale input by max velocity, apply yaw, and transform to world space
                        steering.SetTargetVelocity(glm::vec3(
-                               glm::vec4(rotateY(move_dir * entity.MaxVelocity(), entity.Yaw()), 0.0f)
-                               * transpose(entity.Transform())
+                               glm::vec4(glm::rotateY(move_dir * entity.MaxVelocity(), entity.Yaw()), 0.0f)
+                               * glm::transpose(entity.Transform())
                        ));
                        steering.Enable(Steering::TARGET_VELOCITY);
                        steering.Disable(Steering::HALT);
@@ -221,7 +221,7 @@ void DirectInput::PlaceBlock() {
        // if view is straight up or down, this will be a null vector (NaN after normalization)
        // in that case maybe the model forward should be used?
        // the current implementation implicitly falls back to TURN_NONE which is -Z
-       const glm::vec3 local_forward(normalize(view_forward - proj(view_forward, player_up)));
+       const glm::vec3 local_forward(glm::normalize(view_forward - glm::proj(view_forward, player_up)));
        // FIXME: I suspect this only works when player_up is positive Y
        if (local_forward.x > 0.707f) {
                new_block.SetTurn(Block::TURN_RIGHT);
index d05ea2fc3584a762d0f70e5cdc9ea056ac56ea16..bae54cbf023d7395e19d64e9f1917267a8dfa673 100644 (file)
@@ -86,7 +86,7 @@ void MessageBox::Render(Viewport &viewport) noexcept {
        }
        BlendedSprite &prog = viewport.SpriteProgram();
        prog.SetBG(glm::vec4(0.0f));
-       prog.SetFG(fg);
+       prog.SetFG(glm::vec4(fg) * (1.0f / 255.0f));
        for (Text &txt : lines) {
                prog.SetM(viewport.Cursor());
                txt.Render(viewport);
@@ -329,7 +329,7 @@ void TextInput::Render(Viewport &viewport) {
        if (!input.empty()) {
                BlendedSprite &prog = viewport.SpriteProgram();
                prog.SetBG(glm::vec4(0.0f));
-               prog.SetFG(fg);
+               prog.SetFG(glm::vec4(fg) * (1.0f / 255.0f));
                prog.SetM(viewport.Cursor());
                text.Render(viewport);
        }
index ea3de59b206e3ad7b90b9033db7506037bd24692..2eac5ff6ca13b688ad1892ec879181e87ce26bef 100644 (file)
@@ -1,8 +1,9 @@
 #ifndef BLANK_WORLD_BLOCK_HPP_
 #define BLANK_WORLD_BLOCK_HPP_
 
+#include "../graphics/glm.hpp"
+
 #include <iosfwd>
-#include <glm/glm.hpp>
 
 
 namespace blank {
@@ -86,7 +87,7 @@ struct Block {
        }
 
        static Face NormalFace(const glm::vec3 &norm) noexcept {
-               const glm::vec3 anorm(abs(norm));
+               const glm::vec3 anorm(glm::abs(norm));
                if (anorm.x > anorm.y) {
                        if (anorm.x > anorm.z) {
                                return norm.x > 0.0f ? FACE_RIGHT : FACE_LEFT;
index 6a17b61e6dee46b93f2cdd268a91380dd3196e00..3900207e14e08421da46f9a34bdf005f160282df 100644 (file)
@@ -1,8 +1,9 @@
 #ifndef BLANK_WORLD_BLOCKGRAVITY_HPP_
 #define BLANK_WORLD_BLOCKGRAVITY_HPP_
 
+#include "../graphics/glm.hpp"
+
 #include <memory>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index f1b887d3eabc56e998fd64917c8a661df9df52b9..c55c674721df0b21943e293c7125107762ab7c21 100644 (file)
@@ -5,10 +5,10 @@
 #include "BlockGravity.hpp"
 #include "../graphics/BlockMesh.hpp"
 #include "../graphics/EntityMesh.hpp"
+#include "../graphics/glm.hpp"
 #include "../graphics/PrimitiveMesh.hpp"
 #include "../model/Shape.hpp"
 
-#include <glm/glm.hpp>
 #include <limits>
 #include <vector>
 
@@ -25,9 +25,9 @@ struct BlockType {
 
        const Shape *shape;
        std::vector<float> textures;
-       glm::tvec3<unsigned char> hsl_mod;
-       glm::tvec3<unsigned char> rgb_mod;
-       glm::tvec3<unsigned char> outline_color;
+       TVEC3<unsigned char, glm::precision(0)> hsl_mod;
+       TVEC3<unsigned char, glm::precision(0)> rgb_mod;
+       TVEC3<unsigned char, glm::precision(0)> outline_color;
 
        /// gravity configuration or null if not emitting gravity
        std::unique_ptr<BlockGravity> gravity;
index 67794145290ea8adcbaef3dc00618f0122cb93d6..97765677e021be36cc0f863af7ca882b973c6820 100644 (file)
@@ -5,10 +5,10 @@
 #include "BlockTypeRegistry.hpp"
 #include "../geometry/Location.hpp"
 #include "../geometry/primitive.hpp"
+#include "../graphics/glm.hpp"
 
 #include <set>
 #include <vector>
-#include <glm/glm.hpp>
 #include <glm/gtx/transform.hpp>
 
 
@@ -55,6 +55,9 @@ public:
                        pos.y >= 0 && pos.y < side &&
                        pos.z >= 0 && pos.z < side;
        }
+       static int ToIndex(const ExactLocation::Fine &pos) noexcept {
+               return ToIndex(RoughLocation::Fine(pos));
+       }
        static constexpr int ToIndex(const RoughLocation::Fine &pos) noexcept {
                return pos.x + pos.y * side + pos.z * side * side;
        }
@@ -178,7 +181,7 @@ public:
        const ExactLocation::Coarse &Position() const noexcept { return position; }
 
        glm::mat4 Transform(const ExactLocation::Coarse &offset) const noexcept {
-               return glm::translate((position - offset) * ExactLocation::Extent());
+               return glm::translate(ExactLocation::Fine((position - offset) * ExactLocation::Extent()));
        }
 
        void *BlockData() noexcept { return &blocks[0]; }
index b140a08d95d7b21db850ef1966f841ffccf938f3..d5c3cb1822f94a80b53d8d20690f45bbc90b860c 100644 (file)
@@ -6,11 +6,11 @@
 #include "EntityState.hpp"
 #include "Steering.hpp"
 #include "../geometry/primitive.hpp"
+#include "../graphics/glm.hpp"
 #include "../model/Instance.hpp"
 
 #include <cstdint>
 #include <string>
-#include <glm/glm.hpp>
 #include <glm/gtc/quaternion.hpp>
 
 
index d3a6f3056739cdd270c36073c9cf002af6a3c1f8..68654d32c4c370510ccc164cdcd85be86cd3633a 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef BLANK_WORLD_ENTITYDERIVATIVE_HPP_
 #define BLANK_WORLD_ENTITYDERIVATIVE_HPP_
 
-#include <glm/glm.hpp>
+#include "../graphics/glm.hpp"
 
 
 namespace blank {
index ee99c76bd75bef248c655c9673785960ea545b2d..e862161ec4b446eedbb02a66ea6312f2792faba5 100644 (file)
@@ -2,8 +2,8 @@
 #define BLANK_WORLD_ENTITYSTATE_HPP_
 
 #include "../geometry/Location.hpp"
+#include "../graphics/glm.hpp"
 
-#include <glm/glm.hpp>
 #include <glm/gtc/quaternion.hpp>
 
 
index fa6e01e5920ed72a698d67c2ff7e60bc2cb4518b..51efa252cd76ad9546db968ddb58106baf6532b0 100644 (file)
@@ -3,10 +3,9 @@
 #include "BlockType.hpp"
 #include "BlockTypeRegistry.hpp"
 #include "Chunk.hpp"
+#include "../graphics/glm.hpp"
 #include "../rand/OctaveNoise.hpp"
 
-#include <glm/glm.hpp>
-
 
 namespace blank {
 
index 50b50895d0de59f39924be2a64043dc58fa8aa93..e431f7debbd02a588d1d118250795f0e07248a34 100644 (file)
@@ -1,11 +1,11 @@
 #ifndef BLANK_WORLD_GENERATOR_HPP_
 #define BLANK_WORLD_GENERATOR_HPP_
 
+#include "../graphics/glm.hpp"
 #include "../rand/SimplexNoise.hpp"
 
 #include <cstdint>
 #include <vector>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index d6ec57f6556c50d5b4920fe561a857ae67289ca2..6acd0cf484d1c41d374964d35cc6ab978926868a 100644 (file)
@@ -3,8 +3,7 @@
 
 #include "../geometry/Location.hpp"
 #include "../geometry/primitive.hpp"
-
-#include <glm/glm.hpp>
+#include "../graphics/glm.hpp"
 
 
 namespace blank {
index 40136c8dff4a99315003582bd3b58a37d7cc5374..7785ed6a68c3847a866201e6c8d5c3abfb6d8edd 100644 (file)
@@ -5,13 +5,13 @@
 #include "Entity.hpp"
 #include "Generator.hpp"
 #include "Player.hpp"
+#include "../graphics/glm.hpp"
 #include "../rand/GaloisLFSR.hpp"
 
 #include <cstdint>
 #include <list>
 #include <string>
 #include <vector>
-#include <glm/glm.hpp>
 
 
 namespace blank {
index 65cba9de58f5140b664dc2fbbd7e80fed8717957..8b0f5a17b89ce72e3ebe76ccf036ec2b29387830 100644 (file)
@@ -3,8 +3,7 @@
 
 #include "BlockType.hpp"
 #include "Chunk.hpp"
-
-#include <glm/glm.hpp>
+#include "../graphics/glm.hpp"
 
 
 namespace blank {
index b0fdf61d71aee0a35adbfa9c82d5816b20fc4c0e..32cbe04bbdd37bd6fbff379c1e01483b46b132cc 100644 (file)
@@ -149,13 +149,13 @@ void BlockType::Read(
                        in.Skip(Token::BRACKET_CLOSE);
                } else if (name == "rgb_mod") {
                        in.ReadVec(color_conv);
-                       rgb_mod = glm::tvec3<unsigned char>(color_conv * 255.0f);
+                       rgb_mod = BlockMesh::ColorMod(color_conv * 255.0f);
                } else if (name == "hsl_mod") {
                        in.ReadVec(color_conv);
-                       hsl_mod = glm::tvec3<unsigned char>(color_conv * 255.0f);
+                       hsl_mod = BlockMesh::ColorMod(color_conv * 255.0f);
                } else if (name == "outline") {
                        in.ReadVec(color_conv);
-                       outline_color = glm::tvec3<unsigned char>(color_conv * 255.0f);
+                       outline_color = BlockMesh::ColorMod(color_conv * 255.0f);
                } else if (name == "gravity") {
                        gravity = BlockGravity::Read(in);
                } else if (name == "label") {
@@ -240,7 +240,7 @@ void BlockType::FillBlockMesh(
 void BlockType::OutlinePrimitiveMesh(PrimitiveMesh::Buffer &buf) const noexcept {
        if (!shape) return;
        shape->Outline(buf);
-       buf.colors.insert(buf.colors.end(), shape->OutlineCount(), glm::tvec4<unsigned char>(outline_color, 255));
+       buf.colors.insert(buf.colors.end(), shape->OutlineCount(), PrimitiveMesh::Color(outline_color, 255));
 }
 
 
@@ -297,8 +297,8 @@ struct RadialGravity
        : strength(strength) { }
 
        glm::vec3 GetGravity(const glm::vec3 &diff, const glm::mat4 &) const noexcept override {
-               float dist2 = length2(diff);
-               glm::vec3 dir = -normalize(diff);
+               float dist2 = glm::length2(diff);
+               glm::vec3 dir = -glm::normalize(diff);
                return dir * (strength / dist2);
        }
 
index 7f7b185dc91eaff3d9c71c0126ddcd414b3d02d2..3374e996f74bfae6c9a3c1a36d0d9b972ce69f7b 100644 (file)
@@ -465,13 +465,13 @@ bool Chunk::Intersection(
        constexpr float block_rad = 2.0f;
        const float bb_radius = box_rad + block_rad;
 
-       const RoughLocation::Fine begin(max(
+       const RoughLocation::Fine begin(glm::max(
                RoughLocation::Fine(0),
-               RoughLocation::Fine(floor(box_coords - bb_radius))
+               RoughLocation::Fine(glm::floor(box_coords - bb_radius))
        ));
-       const RoughLocation::Fine end(min(
+       const RoughLocation::Fine end(glm::min(
                RoughLocation::Fine(side - 1),
-               RoughLocation::Fine(ceil(box_coords + bb_radius))
+               RoughLocation::Fine(glm::ceil(box_coords + bb_radius))
        ) - 1);
 
        for (RoughLocation::Fine pos(begin); pos.z < end.y; ++pos.z) {
@@ -502,7 +502,7 @@ bool Chunk::Intersection(
        const glm::vec3 entity_coords(Mentity[3] - Mchunk[3]);
        const float ec_radius = entity.Radius() + Radius();
 
-       if (distance2(entity_coords, Center()) > ec_radius * ec_radius) {
+       if (glm::distance2(entity_coords, Center()) > ec_radius * ec_radius) {
                return false;
        }
 
@@ -514,13 +514,13 @@ bool Chunk::Intersection(
        constexpr float block_rad = 2.0f;
        const float eb_radius = entity.Radius() + block_rad;
 
-       const RoughLocation::Fine begin(max(
+       const RoughLocation::Fine begin(glm::max(
                RoughLocation::Fine(0),
-               RoughLocation::Fine(floor(entity_coords - eb_radius))
+               RoughLocation::Fine(glm::floor(entity_coords - eb_radius))
        ));
-       const RoughLocation::Fine end(min(
+       const RoughLocation::Fine end(glm::min(
                RoughLocation::Fine(side),
-               RoughLocation::Fine(ceil(entity_coords + eb_radius))
+               RoughLocation::Fine(glm::ceil(entity_coords + eb_radius))
        ));
 
        for (RoughLocation::Fine pos(begin); pos.z < end.z; ++pos.z) {
@@ -819,7 +819,7 @@ void ChunkRenderer::Render(Viewport &viewport) {
        chunk_prog.SetTexture(block_tex);
        chunk_prog.SetFogDensity(fog_density);
 
-       Frustum frustum(transpose(chunk_prog.GetVP()));
+       Frustum frustum(glm::transpose(chunk_prog.GetVP()));
        AABB box;
 
        for (int i = 0; i < index.TotalChunks(); ++i) {
index a12d86e7f66c030f1b486ca4ca940bb01ce62630..f0f9496c4eff11fbcf31c892eb3c0ef484179580 100644 (file)
@@ -202,12 +202,12 @@ void Entity::UpdateTransforms() noexcept {
        if (model) {
                view_transform = model.EyesTransform();
        } else {
-               view_transform = toMat4(glm::quat(glm::vec3(state.pitch, state.yaw, 0.0f)));
+               view_transform = glm::toMat4(glm::quat(glm::vec3(state.pitch, state.yaw, 0.0f)));
        }
 }
 
 void Entity::UpdateHeading() noexcept {
-       speed = length(Velocity());
+       speed = glm::length(Velocity());
        if (speed > std::numeric_limits<float>::epsilon()) {
                heading = Velocity() / speed;
        } else {
@@ -238,21 +238,21 @@ void Entity::OrientBody(float dt) noexcept {
                // check if our orientation and velocity are aligned
                const glm::vec3 forward(-model_transform[2]);
                // facing is local -Z rotated about local Y by yaw and transformed into world space
-               const glm::vec3 facing(normalize(glm::vec3(glm::vec4(rotateY(glm::vec3(0.0f, 0.0f, -1.0f), state.yaw), 0.0f) * transpose(model_transform))));
+               const glm::vec3 facing(glm::normalize(glm::vec3(glm::vec4(glm::rotateY(glm::vec3(0.0f, 0.0f, -1.0f), state.yaw), 0.0f) * glm::transpose(model_transform))));
                // only adjust if velocity isn't almost parallel to up
-               float vel_dot_up = dot(Velocity(), up);
+               float vel_dot_up = glm::dot(Velocity(), up);
                if (std::abs(1.0f - std::abs(vel_dot_up)) > std::numeric_limits<float>::epsilon()) {
                        // get direction of velocity projected onto model plane
-                       glm::vec3 direction(normalize(Velocity() - (Velocity() * vel_dot_up)));
+                       glm::vec3 direction(glm::normalize(Velocity() - (Velocity() * vel_dot_up)));
                        // if velocity points away from our facing (with a little bias), flip it around
                        // (the entity is "walking backwards")
-                       if (dot(facing, direction) < -0.1f) {
+                       if (glm::dot(facing, direction) < -0.1f) {
                                direction = -direction;
                        }
                        // calculate the difference between forward and direction
-                       const float absolute_difference = std::acos(dot(forward, direction));
+                       const float absolute_difference = std::acos(glm::dot(forward, direction));
                        // if direction is clockwise with respect to up vector, invert the angle
-                       const float relative_difference = dot(cross(forward, direction), up) < 0.0f
+                       const float relative_difference = glm::dot(glm::cross(forward, direction), up) < 0.0f
                                ? -absolute_difference
                                : absolute_difference;
                        // only correct by half the difference max
@@ -268,7 +268,7 @@ void Entity::OrientBody(float dt) noexcept {
                                std::cout << std::endl;
                        }
                        // now rotate body by correction and head by -correction
-                       state.orient = rotate(state.orient, correction, up);
+                       state.orient = glm::rotate(state.orient, correction, up);
                        state.yaw -= correction;
                }
        }
@@ -283,7 +283,7 @@ void Entity::OrientHead(float dt) noexcept {
        if (std::abs(state.yaw) > max_head_yaw) {
                float deviation = state.yaw < 0.0f ? state.yaw + max_head_yaw : state.yaw - max_head_yaw;
                // rotate the entity by deviation about local Y
-               state.orient = rotate(state.orient, deviation, up);
+               state.orient = glm::rotate(state.orient, deviation, up);
                // and remove from head yaw
                state.yaw -= deviation;
                // shouldn't be necessary if max_head_yaw is < PI, but just to be sure :p
@@ -364,7 +364,7 @@ void EntityState::AdjustHeading() noexcept {
 
 glm::mat4 EntityState::Transform(const glm::ivec3 &reference) const noexcept {
        const glm::vec3 translation = RelativePosition(reference);
-       glm::mat4 transform(toMat4(orient));
+       glm::mat4 transform(glm::toMat4(orient));
        transform[3] = glm::vec4(translation, 1.0f);
        return transform;
 }
@@ -449,7 +449,7 @@ void Steering::UpdateWander(World &world, float dt) {
                world.Random().SNorm() * wander_disp
        );
        if (!iszero(displacement)) {
-               wander_pos = normalize(wander_pos + displacement * dt) * wander_radius;
+               wander_pos = glm::normalize(wander_pos + displacement * dt) * wander_radius;
        }
 }
 
@@ -476,7 +476,7 @@ void Steering::UpdateObstacle(World &world) {
        for (const WorldCollision &c : col) {
                // diff points from block to state
                glm::vec3 diff = entity.GetState().RelativePosition(c.ChunkPos()) - c.BlockCoords();
-               float dist = length2(diff);
+               float dist = glm::length2(diff);
                if (dist < distance) {
                        nearest = &c;
                        difference = diff;
@@ -489,9 +489,9 @@ void Steering::UpdateObstacle(World &world) {
                return;
        }
        // and try to avoid it
-       float to_go = dot(difference, entity.Heading());
+       float to_go = glm::dot(difference, entity.Heading());
        glm::vec3 point(entity.Position() + entity.Heading() * to_go);
-       obstacle_dir = normalize(point - nearest->BlockCoords()) * (entity.Speed() / std::sqrt(distance));
+       obstacle_dir = glm::normalize(point - nearest->BlockCoords()) * (entity.Speed() / std::sqrt(distance));
 }
 
 glm::vec3 Steering::Force(const EntityState &state) const noexcept {
@@ -542,17 +542,17 @@ glm::vec3 Steering::Force(const EntityState &state) const noexcept {
 }
 
 bool Steering::SumForce(glm::vec3 &out, const glm::vec3 &in, float max) noexcept {
-       if (iszero(in) || any(isnan(in))) {
+       if (iszero(in) || glm::any(glm::isnan(in))) {
                return false;
        }
-       float current = iszero(out) ? 0.0f : length(out);
+       float current = iszero(out) ? 0.0f : glm::length(out);
        float remain = max - current;
        if (remain <= 0.0f) {
                return true;
        }
-       float additional = length(in);
+       float additional = glm::length(in);
        if (additional > remain) {
-               out += normalize(in) * remain;
+               out += glm::normalize(in) * remain;
                return true;
        } else {
                out += in;
@@ -573,7 +573,7 @@ glm::vec3 Steering::Seek(const EntityState &state, const ExactLocation &loc) con
        if (iszero(diff)) {
                return glm::vec3(0.0f);
        } else {
-               return TargetVelocity(state, normalize(diff) * speed);
+               return TargetVelocity(state, glm::normalize(diff) * speed);
        }
 }
 
@@ -582,13 +582,13 @@ glm::vec3 Steering::Flee(const EntityState &state, const ExactLocation &loc) con
        if (iszero(diff)) {
                return glm::vec3(0.0f);
        } else {
-               return TargetVelocity(state, normalize(diff) * speed);
+               return TargetVelocity(state, glm::normalize(diff) * speed);
        }
 }
 
 glm::vec3 Steering::Arrive(const EntityState &state, const ExactLocation &loc) const noexcept {
        const glm::vec3 diff(loc.Difference(state.pos).Absolute());
-       const float dist = length(diff);
+       const float dist = glm::length(diff);
        if (dist < std::numeric_limits<float>::epsilon()) {
                return glm::vec3(0.0f);
        } else {
@@ -602,7 +602,7 @@ glm::vec3 Steering::Pursuit(const EntityState &state, const Entity &other) const
        if (iszero(diff)) {
                return TargetVelocity(state, other.Velocity());
        } else {
-               const float time_estimate = length(diff) / speed;
+               const float time_estimate = glm::length(diff) / speed;
                ExactLocation prediction(other.ChunkCoords(), other.Position() + (other.Velocity() * time_estimate));
                return Seek(state, prediction);
        }
@@ -613,14 +613,14 @@ glm::vec3 Steering::Evade(const EntityState &state, const Entity &other) const n
        if (iszero(diff)) {
                return TargetVelocity(state, -other.Velocity());
        } else {
-               const float time_estimate = length(diff) / speed;
+               const float time_estimate = glm::length(diff) / speed;
                ExactLocation prediction(other.ChunkCoords(), other.Position() + (other.Velocity() * time_estimate));
                return Flee(state, prediction);
        }
 }
 
 glm::vec3 Steering::Wander(const EntityState &state) const noexcept {
-       return TargetVelocity(state, normalize(entity.Heading() * wander_dist + wander_pos) * speed);
+       return TargetVelocity(state, glm::normalize(entity.Heading() * wander_dist + wander_pos) * speed);
 }
 
 glm::vec3 Steering::ObstacleAvoidance(const EntityState &state) const noexcept {
@@ -951,13 +951,13 @@ void World::ResolveWorldCollision(
        }
        // if entity is already going in the direction of correction,
        // let the problem resolve itself
-       if (dot(state.velocity, correction) >= 0.0f) {
+       if (glm::dot(state.velocity, correction) >= 0.0f) {
                return;
        }
        // apply correction, maybe could use some damping, gotta test
        state.pos.block += correction;
        // kill velocity?
-       glm::vec3 normal_velocity(proj(state.velocity, correction));
+       glm::vec3 normal_velocity(glm::proj(state.velocity, correction));
        state.velocity -= normal_velocity;
 }
 
@@ -972,7 +972,7 @@ glm::vec3 World::CombinedInterpenetration(
                if (!c.Blocks()) continue;
                glm::vec3 normal(c.normal);
                // swap if neccessary (normal may point away from the entity)
-               if (dot(normal, state.RelativePosition(c.ChunkPos()) - c.BlockCoords()) < 0) {
+               if (glm::dot(normal, state.RelativePosition(c.ChunkPos()) - c.BlockCoords()) < 0) {
                        normal = -normal;
                }
                // check if block surface is "inside"
@@ -983,8 +983,8 @@ glm::vec3 World::CombinedInterpenetration(
                        continue;
                }
                glm::vec3 local_pen(normal * c.depth);
-               min_pen = min(min_pen, local_pen);
-               max_pen = max(max_pen, local_pen);
+               min_pen = glm::min(min_pen, local_pen);
+               max_pen = glm::max(max_pen, local_pen);
        }
        glm::vec3 pen(0.0f);
        // only apply correction for axes where penetration is only in one direction
@@ -1060,7 +1060,7 @@ void World::GetLight(
        glm::vec3 &col,
        glm::vec3 &amb
 ) {
-       BlockLookup center(chunks.Get(e.ChunkCoords()), e.Position());
+       BlockLookup center(chunks.Get(e.ChunkCoords()), RoughLocation::Fine(e.Position()));
        if (!center) {
                // chunk unavailable, so make it really dark and from
                // some arbitrary direction
@@ -1103,7 +1103,7 @@ void World::RenderDebug(Viewport &viewport) {
        PrimitiveMesh debug_mesh;
        PlainColor &prog = viewport.WorldColorProgram();
        for (const Entity &entity : entities) {
-               debug_buf.OutlineBox(entity.Bounds(), glm::tvec4<unsigned char>(255, 0, 0, 255));
+               debug_buf.OutlineBox(entity.Bounds(), TVEC4<unsigned char, glm::precision(0)>(255, 0, 0, 255));
                debug_mesh.Update(debug_buf);
                prog.SetM(entity.Transform(players.front().GetEntity().ChunkCoords()));
                debug_mesh.DrawLines();
index 521647e5115b9a3e23aeb168fa1fb81eb2dfb9ea..1b618383fef1bf948d76da6b9d551056f7e3f144 100644 (file)
@@ -165,7 +165,7 @@ void IntersectionTest::testBoxBoxIntersection() {
        );
        CPPUNIT_ASSERT_EQUAL_MESSAGE(
                "bad intersection normal (with rotation)",
-               glm::vec3(1, 0, 0), abs(normal) // normal can be in + or - x, therefore abs()
+               glm::vec3(1, 0, 0), glm::abs(normal) // normal can be in + or - x, therefore abs()
        );
 
        Mb = glm::translate(glm::vec3(3, 0, 0)); // 3 to the right
index d46be0be9d725c6c91d85bf1122c2020e6bfe889..104adcdd449c623d13fefb6e5138e0afd6cc6733 100644 (file)
@@ -2,9 +2,9 @@
 #define BLANK_TEST_GEOMETRY_LOCATIONTEST_HPP_
 
 #include "geometry/Location.hpp"
+#include "graphics/glm.hpp"
 
 #include <string>
-#include <glm/glm.hpp>
 #include <cppunit/extensions/HelperMacros.h>
 
 
index 54d860c23aba549610337293bed8cff38e0ef65b..5f134462c6102cf08bddbd36da50a52402ff90c5 100644 (file)
@@ -127,15 +127,15 @@ void GLTraitsTest::testType() {
 
        CPPUNIT_ASSERT_EQUAL_MESSAGE(
                "bad component type for vec2i",
-               GLenum(GL_INT), gl_traits<glm::tvec2<int>>::type
+               GLenum(GL_INT), gl_traits<glm::ivec2>::type
        );
        CPPUNIT_ASSERT_EQUAL_MESSAGE(
                "bad component type for vec3i",
-               GLenum(GL_INT), gl_traits<glm::tvec3<int>>::type
+               GLenum(GL_INT), gl_traits<glm::ivec3>::type
        );
        CPPUNIT_ASSERT_EQUAL_MESSAGE(
                "bad component type for vec4i",
-               GLenum(GL_INT), gl_traits<glm::tvec4<int>>::type
+               GLenum(GL_INT), gl_traits<glm::ivec4>::type
        );
 }
 
index 880d6a54af47aa6c907e3b5846e1e2203bc583ff..cf76d151520ee1c38618a6edb40ef352419faddb 100644 (file)
@@ -116,7 +116,7 @@ void PacketTest::testJoin() {
        EntityState write_state;
        write_state.pos = { { 7, 2, -3 }, { 1.5f, 0.9f, 12.0f } };
        write_state.velocity = { 0.025f, 0.001f, 0.0f };
-       write_state.orient = normalize(glm::quat(0.863f, 0.0f, 0.505f, 0.0f));
+       write_state.orient = glm::normalize(glm::quat(0.863f, 0.0f, 0.505f, 0.0f));
        write_state.pitch = 0.3f;
        write_state.yaw = -2.3f;
        write_entity.SetState(write_state);
index 25256d9906dc823e6771d55a87306e6b26b524f7..81cdd8280d0ac9a2c5011a65aff646f66d482ea1 100644 (file)
@@ -2,6 +2,7 @@
 #define BLANK_TEST_NET_PACKETTEST_HPP_
 
 #include "geometry/primitive.hpp"
+#include "graphics/glm.hpp"
 #include "net/Packet.hpp"
 #include "world/EntityState.hpp"
 
@@ -9,7 +10,6 @@
 #include <limits>
 #include <string>
 #include <SDL_net.h>
-#include <glm/glm.hpp>
 #include <cppunit/extensions/HelperMacros.h>
 
 
index a4ea86e4d32a66fe0e0af0a1ccb59cb0cf704963..b2ee1aefba1718c99a908da3637f6a622216518a 100644 (file)
@@ -1,7 +1,8 @@
 #ifndef BLANK_TEST_RAND_STABILITYTEST_HPP
 #define BLANK_TEST_RAND_STABILITYTEST_HPP
 
-#include <glm/glm.hpp>
+#include "graphics/glm.hpp"
+
 #include <cppunit/extensions/HelperMacros.h>