]> git.localhorst.tv Git - blobs.git/commitdiff
hooray for könig lookup
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 8 Dec 2017 12:22:01 +0000 (13:22 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 8 Dec 2017 12:22:01 +0000 (13:22 +0100)
src/app/states.cpp
src/creature/creature.cpp
src/creature/goal.cpp
src/graphics/viewport.cpp
src/math/geometry.cpp
src/world/CreatureCreatureCollision.hpp
src/world/Planet.hpp
src/world/world.cpp
tst/math/IntersectTest.cpp

index 92879b4683bc724a5cbd23e35d1bc973cdbb9d0c..cbb2309581f05d35f0babf00374b0b97729ccaf0 100644 (file)
@@ -188,8 +188,8 @@ void MasterState::OnRender(graphics::Viewport &viewport) {
        // TODO: extend to nearby bodies as well
        for (auto c : cam.Reference().Creatures()) {
                assets.shaders.creature_skin.SetM(cam.Model(cam.Reference()) * glm::mat4(c->LocalTransform()));
-               assets.shaders.creature_skin.SetBaseColor(c->BaseColor());
-               assets.shaders.creature_skin.SetHighlightColor(c->HighlightColor());
+               assets.shaders.creature_skin.SetBaseColor(glm::vec3(c->BaseColor()));
+               assets.shaders.creature_skin.SetHighlightColor(glm::vec4(c->HighlightColor()));
                c->Draw(viewport);
        }
 
index 468967887ee96a1d62b7547c2d7a2ad8cff04461..7333fdc42978693728e2d2bf599c9e3c159669b1 100644 (file)
@@ -342,10 +342,10 @@ double Creature::PerceptionField() const noexcept {
 bool Creature::PerceptionTest(const glm::dvec3 &p) const noexcept {
        const glm::dvec3 diff(p - situation.Position());
        double omni_range = PerceptionOmniRange();
-       if (length2(diff) < omni_range * omni_range) return true;
+       if (glm::length2(diff) < omni_range * omni_range) return true;
        double range = PerceptionRange();
-       if (length2(diff) > range * range) return false;
-       return dot(normalize(diff), situation.Heading()) > PerceptionField();
+       if (glm::length2(diff) > range * range) return false;
+       return glm::dot(glm::normalize(diff), situation.Heading()) > PerceptionField();
 }
 
 double Creature::OffspringChance() const noexcept {
@@ -397,21 +397,21 @@ void Creature::TickState(double dt) {
        state.pos += f.vel * dt;
        state.vel += f.acc * dt;
        situation.EnforceConstraints(state);
-       if (length2(state.vel) > 0.000001) {
-               glm::dvec3 nvel(normalize(state.vel));
-               double ang = angle(nvel, state.dir);
+       if (glm::length2(state.vel) > 0.000001) {
+               glm::dvec3 nvel(glm::normalize(state.vel));
+               double ang = glm::angle(nvel, state.dir);
                double turn_rate = PI * 0.75 * dt;
                if (ang < turn_rate) {
-                       state.dir = normalize(state.vel);
+                       state.dir = glm::normalize(state.vel);
                } else if (std::abs(ang - PI) < 0.001) {
-                       state.dir = rotate(state.dir, turn_rate, situation.GetPlanet().NormalAt(state.pos));
+                       state.dir = glm::rotate(state.dir, turn_rate, situation.GetPlanet().NormalAt(state.pos));
                } else {
-                       state.dir = rotate(state.dir, turn_rate, normalize(cross(state.dir, nvel)));
+                       state.dir = glm::rotate(state.dir, turn_rate, glm::normalize(glm::cross(state.dir, nvel)));
                }
        }
        situation.SetState(state);
        // work is force times distance
-       DoWork(length(f.acc) * Mass() * length(f.vel) * dt);
+       DoWork(glm::length(f.acc) * Mass() * glm::length(f.vel) * dt);
 }
 
 Situation::Derivative Creature::Step(const Situation::Derivative &ds, double dt) const noexcept {
@@ -429,10 +429,10 @@ Situation::Derivative Creature::Step(const Situation::Derivative &ds, double dt)
        // if net force is applied and in contact with surface
        if (!allzero(force) && std::abs(std::abs(elevation) - situation.GetPlanet().Radius()) < 0.001) {
                // apply friction = -|normal force| * tangential force * coefficient
-               glm::dvec3 fn(normal * dot(force, normal));
+               glm::dvec3 fn(normal * glm::dot(force, normal));
                glm::dvec3 ft(force - fn);
                double u = 0.4;
-               glm::dvec3 friction(-length(fn) * ft * u);
+               glm::dvec3 friction(-glm::length(fn) * ft * u);
                force += friction;
        }
        return {
@@ -508,11 +508,11 @@ glm::dmat4 Creature::CollisionTransform() const noexcept {
        glm::dmat3 orient;
        orient[1] = situation.GetPlanet().NormalAt(pos);
        orient[2] = situation.Heading();
-       if (std::abs(dot(orient[1], orient[2])) > 0.999) {
+       if (std::abs(glm::dot(orient[1], orient[2])) > 0.999) {
                orient[2] = glm::dvec3(orient[1].z, orient[1].x, orient[1].y);
        }
-       orient[0] = normalize(cross(orient[1], orient[2]));
-       orient[2] = normalize(cross(orient[0], orient[1]));
+       orient[0] = glm::normalize(glm::cross(orient[1], orient[2]));
+       orient[2] = glm::normalize(glm::cross(orient[0], orient[1]));
        return glm::translate(glm::dvec3(pos.x, pos.y, pos.z))
                * glm::dmat4(orient)
                * glm::translate(glm::dvec3(0.0, half_size, 0.0));
@@ -864,8 +864,8 @@ void Situation::Accelerate(const glm::dvec3 &dv) noexcept {
 void Situation::EnforceConstraints(State &s) noexcept {
        if (OnSurface()) {
                double r = GetPlanet().Radius();
-               if (length2(s.pos) < r * r) {
-                       s.pos = normalize(s.pos) * r;
+               if (glm::length2(s.pos) < r * r) {
+                       s.pos = glm::normalize(s.pos) * r;
                }
        }
 }
@@ -947,10 +947,10 @@ glm::dvec3 Steering::Force(const Situation::State &s) const noexcept {
                for (auto &other : s.GetPlanet().Creatures()) {
                        if (&*other == &c) continue;
                        glm::dvec3 diff = s.Position() - other->GetSituation().Position();
-                       if (length2(diff) > max_look * max_look) continue;
+                       if (glm::length2(diff) > max_look * max_look) continue;
                        if (!c.PerceptionTest(other->GetSituation().Position())) continue;
-                       double sep = glm::clamp(length(diff) - other->Size() * 0.707 - c.Size() * 0.707, 0.0, min_dist);
-                       repulse += normalize(diff) * (1.0 - sep / min_dist) * force;
+                       double sep = glm::clamp(glm::length(diff) - other->Size() * 0.707 - c.Size() * 0.707, 0.0, min_dist);
+                       repulse += glm::normalize(diff) * (1.0 - sep / min_dist) * force;
                }
                result += repulse;
        }
@@ -961,18 +961,18 @@ glm::dvec3 Steering::Force(const Situation::State &s) const noexcept {
        if (seeking) {
                glm::dvec3 diff = target - s.pos;
                if (!allzero(diff)) {
-                       result += TargetVelocity(s, (normalize(diff) * speed), force);
+                       result += TargetVelocity(s, (glm::normalize(diff) * speed), force);
                }
        }
        if (arriving) {
                glm::dvec3 diff = target - s.pos;
-               double dist = length(diff);
+               double dist = glm::length(diff);
                if (!allzero(diff) && dist > std::numeric_limits<double>::epsilon()) {
                        result += TargetVelocity(s, diff * std::min(dist * force, speed) / dist, force);
                }
        }
-       if (length2(result) > max_force * max_force) {
-               result = normalize(result) * max_force;
+       if (glm::length2(result) > max_force * max_force) {
+               result = glm::normalize(result) * max_force;
        }
        return result;
 }
index 021e32d2b1c6ca36c3681859576005038c5600ad..c3200a6ca028a64ceef5ebb21e313a15e10d641a 100644 (file)
@@ -424,8 +424,8 @@ void LocateResourceGoal::SearchVicinity() {
        const world::Planet &planet = GetSituation().GetPlanet();
        const glm::dvec3 &pos = GetSituation().Position();
        const glm::dvec3 normal(planet.NormalAt(pos));
-       const glm::dvec3 step_x(normalize(cross(normal, glm::dvec3(normal.z, normal.x, normal.y))));
-       const glm::dvec3 step_y(normalize(cross(step_x, normal)));
+       const glm::dvec3 step_x(glm::normalize(glm::cross(normal, glm::dvec3(normal.z, normal.x, normal.y))));
+       const glm::dvec3 step_y(glm::normalize(glm::cross(step_x, normal)));
 
        constexpr int search_radius = 2;
        double rating[2 * search_radius + 1][2 * search_radius + 1] = {0};
@@ -453,7 +453,7 @@ void LocateResourceGoal::SearchVicinity() {
                for (int y = -search_radius; y < search_radius + 1; ++y) {
                        for (int x = -search_radius; x < search_radius + 1; ++x) {
                                const glm::dvec3 tpos(pos + (double(x) * step_x) + (double(y) * step_y));
-                               if (length2(tpos - c->GetSituation().Position()) < 1.0) {
+                               if (glm::length2(tpos - c->GetSituation().Position()) < 1.0) {
                                        rating[y + search_radius][x + search_radius] *= 0.8;
                                }
                        }
@@ -475,7 +475,7 @@ void LocateResourceGoal::SearchVicinity() {
        if (best_rating > 0.0) {
                found = true;
                searching = false;
-               target_pos = normalize(pos + (double(best_pos.x) * step_x) + (double(best_pos.y) * step_y)) * planet.Radius();
+               target_pos = glm::normalize(pos + (double(best_pos.x) * step_x) + (double(best_pos.y) * step_y)) * planet.Radius();
                GetSteering().GoTo(target_pos);
        } else if (!searching) {
                found = false;
@@ -485,14 +485,14 @@ void LocateResourceGoal::SearchVicinity() {
                target_pos += Random().SNorm() * step_y;
                // bias towards current heading
                target_pos += GetSituation().Heading() * 1.5;
-               target_pos = normalize(target_pos) * planet.Radius();
+               target_pos = glm::normalize(target_pos) * planet.Radius();
                GetSteering().GoTo(target_pos);
        }
 }
 
 bool LocateResourceGoal::NearTarget() const noexcept {
        const Situation &s = GetSituation();
-       return s.OnSurface() && length2(s.Position() - target_pos) < 0.5;
+       return s.OnSurface() && glm::length2(s.Position() - target_pos) < 0.5;
 }
 
 
@@ -516,7 +516,7 @@ void StrollGoal::Enable() {
 }
 
 void StrollGoal::Action() {
-       if (length2(next - GetSituation().Position()) < 0.0001) {
+       if (glm::length2(next - GetSituation().Position()) < 0.0001) {
                PickTarget();
        }
 }
@@ -530,12 +530,12 @@ void StrollGoal::PickTarget() noexcept {
        next += GetSituation().Heading() * 1.5;
        const glm::dvec3 normal(GetSituation().GetPlanet().NormalAt(GetSituation().Position()));
        glm::dvec3 rand_x(GetSituation().Heading());
-       if (std::abs(dot(normal, rand_x)) > 0.999) {
+       if (std::abs(glm::dot(normal, rand_x)) > 0.999) {
                rand_x = glm::dvec3(normal.z, normal.x, normal.y);
        }
-       glm::dvec3 rand_y = cross(normal, rand_x);
+       glm::dvec3 rand_y = glm::cross(normal, rand_x);
        next += ((rand_x * Random().SNorm()) + (rand_y * Random().SNorm())) * 1.5;
-       next = normalize(next) * GetSituation().GetPlanet().Radius();
+       next = glm::normalize(next) * GetSituation().GetPlanet().Radius();
        GetSteering().GoTo(next);
 }
 
index ff19021f39c09eb9e2886b733569c8f707f9b58c..51e8cddd046fe3fd55be684427023ede5fa93ea7 100644 (file)
@@ -75,9 +75,9 @@ Camera &Camera::Radial(const creature::Creature &c, double distance, const glm::
                Reference(s.GetPlanet());
                track_orient = true;
                up = s.GetPlanet().NormalAt(s.Position());
-               glm::dvec3 ref(normalize(cross(up, glm::dvec3(up.z, up.x, up.y))));
+               glm::dvec3 ref(glm::normalize(glm::cross(up, glm::dvec3(up.z, up.x, up.y))));
                dir =
-                       glm::dmat3(ref, up, cross(ref, up))
+                       glm::dmat3(ref, up, glm::cross(ref, up))
                        * glm::dmat3(glm::eulerAngleYX(-angle.y, -angle.x))
                        * dir;
        } else {
@@ -94,17 +94,17 @@ glm::mat4 Camera::Model(const world::Body &b) const noexcept {
        if (&b == ref) {
                return track_orient ? glm::mat4(1.0f) : glm::mat4(ref->LocalTransform());
        } else if (b.HasParent() && &b.Parent() == ref) {
-               return track_orient
+               return glm::mat4(track_orient
                        ? ref->InverseTransform() * b.FromParent() * b.LocalTransform()
-                       : b.FromParent() * b.LocalTransform();
+                       : b.FromParent() * b.LocalTransform());
        } else if (ref->HasParent() && &ref->Parent() == &b) {
-               return track_orient
+               return glm::mat4(track_orient
                        ? ref->InverseTransform() * ref->ToParent() * b.LocalTransform()
-                       : ref->ToParent() * b.LocalTransform();
+                       : ref->ToParent() * b.LocalTransform());
        } else {
-               return track_orient
+               return glm::mat4(track_orient
                        ? ref->InverseTransform() * ref->ToUniverse() * b.FromUniverse() * b.LocalTransform()
-                       : ref->ToUniverse() * b.FromUniverse() * b.LocalTransform();
+                       : ref->ToUniverse() * b.FromUniverse() * b.LocalTransform());
        }
 }
 
index f822ad68e4de3529a14847a6b4d5ab38b5ffeedc..58c97ae71e378b98f14ce3cc1917ed8201e23aad 100644 (file)
@@ -41,15 +41,15 @@ bool Intersect(
                glm::dvec3(b_m[0]),
                glm::dvec3(b_m[1]),
                glm::dvec3(b_m[2]),
-               normalize(cross(glm::dvec3(a_m[0]), glm::dvec3(b_m[0]))),
-               normalize(cross(glm::dvec3(a_m[0]), glm::dvec3(b_m[1]))),
-               normalize(cross(glm::dvec3(a_m[0]), glm::dvec3(b_m[2]))),
-               normalize(cross(glm::dvec3(a_m[1]), glm::dvec3(b_m[0]))),
-               normalize(cross(glm::dvec3(a_m[1]), glm::dvec3(b_m[1]))),
-               normalize(cross(glm::dvec3(a_m[1]), glm::dvec3(b_m[2]))),
-               normalize(cross(glm::dvec3(a_m[2]), glm::dvec3(b_m[0]))),
-               normalize(cross(glm::dvec3(a_m[2]), glm::dvec3(b_m[1]))),
-               normalize(cross(glm::dvec3(a_m[2]), glm::dvec3(b_m[2]))),
+               glm::normalize(glm::cross(glm::dvec3(a_m[0]), glm::dvec3(b_m[0]))),
+               glm::normalize(glm::cross(glm::dvec3(a_m[0]), glm::dvec3(b_m[1]))),
+               glm::normalize(glm::cross(glm::dvec3(a_m[0]), glm::dvec3(b_m[2]))),
+               glm::normalize(glm::cross(glm::dvec3(a_m[1]), glm::dvec3(b_m[0]))),
+               glm::normalize(glm::cross(glm::dvec3(a_m[1]), glm::dvec3(b_m[1]))),
+               glm::normalize(glm::cross(glm::dvec3(a_m[1]), glm::dvec3(b_m[2]))),
+               glm::normalize(glm::cross(glm::dvec3(a_m[2]), glm::dvec3(b_m[0]))),
+               glm::normalize(glm::cross(glm::dvec3(a_m[2]), glm::dvec3(b_m[1]))),
+               glm::normalize(glm::cross(glm::dvec3(a_m[2]), glm::dvec3(b_m[2]))),
        };
 
        depth = std::numeric_limits<double>::infinity();
@@ -57,7 +57,7 @@ bool Intersect(
 
        int cur_axis = 0;
        for (const glm::dvec3 &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;
@@ -65,7 +65,7 @@ bool Intersect(
                double a_min = std::numeric_limits<double>::infinity();
                double a_max = -std::numeric_limits<double>::infinity();
                for (const glm::dvec3 &corner : a_corners) {
-                       double val = dot(corner, axis);
+                       double val = glm::dot(corner, axis);
                        a_min = std::min(a_min, val);
                        a_max = std::max(a_max, val);
                }
@@ -73,7 +73,7 @@ bool Intersect(
                double b_min = std::numeric_limits<double>::infinity();
                double b_max = -std::numeric_limits<double>::infinity();
                for (const glm::dvec3 &corner : b_corners) {
-                       double val = dot(corner, axis);
+                       double val = glm::dot(corner, axis);
                        b_min = std::min(b_min, val);
                        b_max = std::max(b_max, val);
                }
index a26b050a8b637a771114261cfa6e5afe4fa27ef3..0a907952fcc6ed2938243576a96485ac2733972a 100644 (file)
@@ -19,7 +19,7 @@ public:
                const glm::dvec3 &n,
                double depth
        ) : a(&a), b(&b), normal(n), depth(depth) {
-               if (dot(normal, BPos() - APos()) < 0.0) {
+               if (glm::dot(normal, BPos() - APos()) < 0.0) {
                        // make sure normal always is in direction from A to B
                        normal *= -1.0;
                }
index 237159994c47da1c9dbd1e23bd235ffd2214cbb0..2034b8dc4c787b4f30e6a52eb87389402e1c1f95 100644 (file)
@@ -36,11 +36,11 @@ public:
 
 public:
        /// surface normal
-       glm::dvec3 NormalAt(const glm::dvec3 &p) const noexcept { return normalize(p); }
+       glm::dvec3 NormalAt(const glm::dvec3 &p) const noexcept { return glm::normalize(p); }
        /// height over surface
-       double ElevationAt(const glm::dvec3 &p) const noexcept { return length(p) - Radius(); }
+       double ElevationAt(const glm::dvec3 &p) const noexcept { return glm::length(p) - Radius(); }
        /// distance to planet center
-       double DistanceAt(const glm::dvec3 &p) const noexcept { return length(p); }
+       double DistanceAt(const glm::dvec3 &p) const noexcept { return glm::length(p); }
 
        /// get ground tile
        Tile &TileAt(const glm::dvec3 &) noexcept;
index ef9311fbb79022e1f826593dcd3d791c15704f55..682eb9bb3763b8019da31fd206cb4a5bb483aeed 100644 (file)
@@ -189,7 +189,7 @@ void Body::CheckCollision() noexcept {
                for (auto j = (i + 1); j != end; ++j) {
                        glm::dvec3 diff((*i)->GetSituation().Position() - (*j)->GetSituation().Position());
                        double max_dist = ((*i)->Size() + (*j)->Size()) * 1.74;
-                       if (length2(diff) > max_dist * max_dist) continue;
+                       if (glm::length2(diff) > max_dist * max_dist) continue;
                        math::AABB j_box((*j)->CollisionBox());
                        glm::dmat4 j_mat((*j)->CollisionTransform());
                        glm::dvec3 normal;
@@ -202,8 +202,8 @@ void Body::CheckCollision() noexcept {
        for (auto &c : collisions) {
                c.A().GetSituation().Move(c.Normal() * (c.Depth() * -0.5));
                c.B().GetSituation().Move(c.Normal() * (c.Depth() * 0.5));
-               c.A().GetSituation().Accelerate(c.Normal() * -dot(c.Normal(), c.AVel()));
-               c.B().GetSituation().Accelerate(c.Normal() * -dot(c.Normal(), c.BVel()));
+               c.A().GetSituation().Accelerate(c.Normal() * -glm::dot(c.Normal(), c.AVel()));
+               c.B().GetSituation().Accelerate(c.Normal() * -glm::dot(c.Normal(), c.BVel()));
                // TODO: notify participants so they can be annoyed
        }
 }
@@ -314,7 +314,7 @@ double mean2eccentric(double M, double e) {
        for (int i = 0; i < 100; ++i) {
                double dE = (E - e * sin(E) - M) / (1 - e * cos(E));
                E -= dE;
-               if (abs(dE) < 1.0e-6) break;
+               if (std::abs(dE) < 1.0e-6) break;
        }
        return E;
 }
@@ -355,8 +355,8 @@ Planet::~Planet() {
 namespace {
 /// map p onto cube, s gives the surface, u and v the position in [-1,1]
 void cubemap(const glm::dvec3 &p, int &s, double &u, double &v) noexcept {
-       const glm::dvec3 p_abs(abs(p));
-       const glm::bvec3 p_pos(greaterThan(p, glm::dvec3(0.0)));
+       const glm::dvec3 p_abs(glm::abs(p));
+       const glm::bvec3 p_pos(glm::greaterThan(p, glm::dvec3(0.0)));
        double max_axis = 0.0;
 
        if (p_pos.x && p_abs.x >= p_abs.y && p_abs.x >= p_abs.z) {
@@ -452,7 +452,7 @@ const TileType &Planet::TypeAt(int srf, int x, int y) const noexcept {
 glm::dvec3 Planet::TileCenter(int srf, int x, int y, double e) const noexcept {
        double u = (double(x) - Radius() + 0.5) / Radius();
        double v = (double(y) - Radius() + 0.5) / Radius();
-       return normalize(cubeunmap(srf, u, v)) * (Radius() + e);
+       return glm::normalize(cubeunmap(srf, u, v)) * (Radius() + e);
 }
 
 void Planet::BuildVAO(const Set<TileType> &ts) {
@@ -494,25 +494,25 @@ void Planet::BuildVAO(const Set<TileType> &ts) {
                                        const float tex_v_begin = surface < 3 ? 1.0f : 0.0f;
                                        const float tex_v_end = surface < 3 ? 0.0f : 1.0f;
 
-                                       attrib[4 * index + 0].position = normalize(pos[0]) * (surface < 3 ? offset : -offset);
+                                       attrib[4 * index + 0].position = glm::normalize(pos[0]) * (surface < 3 ? offset : -offset);
                                        attrib[4 * index + 0].normal = pos[0];
                                        attrib[4 * index + 0].tex_coord[0] = 0.0f;
                                        attrib[4 * index + 0].tex_coord[1] = tex_v_begin;
                                        attrib[4 * index + 0].tex_coord[2] = tex;
 
-                                       attrib[4 * index + 1].position = normalize(pos[1]) * (surface < 3 ? offset : -offset);
+                                       attrib[4 * index + 1].position = glm::normalize(pos[1]) * (surface < 3 ? offset : -offset);
                                        attrib[4 * index + 1].normal = pos[1];
                                        attrib[4 * index + 1].tex_coord[0] = 0.0f;
                                        attrib[4 * index + 1].tex_coord[1] = tex_v_end;
                                        attrib[4 * index + 1].tex_coord[2] = tex;
 
-                                       attrib[4 * index + 2].position = normalize(pos[2]) * (surface < 3 ? offset : -offset);
+                                       attrib[4 * index + 2].position = glm::normalize(pos[2]) * (surface < 3 ? offset : -offset);
                                        attrib[4 * index + 2].normal = pos[2];
                                        attrib[4 * index + 2].tex_coord[0] = 1.0f;
                                        attrib[4 * index + 2].tex_coord[1] = tex_v_begin;
                                        attrib[4 * index + 2].tex_coord[2] = tex;
 
-                                       attrib[4 * index + 3].position = normalize(pos[3]) * (surface < 3 ? offset : -offset);
+                                       attrib[4 * index + 3].position = glm::normalize(pos[3]) * (surface < 3 ? offset : -offset);
                                        attrib[4 * index + 3].normal = pos[3];
                                        attrib[4 * index + 3].tex_coord[0] = 1.0f;
                                        attrib[4 * index + 3].tex_coord[1] = tex_v_end;
@@ -604,7 +604,7 @@ void GenerateEarthlike(const Set<TileType> &tiles, Planet &p) noexcept {
                                }
                                float elevation = math::OctaveNoise(
                                        elevation_gen,
-                                       to_tile / p.Radius(),
+                                       glm::vec3(to_tile / p.Radius()),
                                        3,   // octaves
                                        0.5, // persistence
                                        5 / p.Radius(), // frequency
@@ -613,7 +613,7 @@ void GenerateEarthlike(const Set<TileType> &tiles, Planet &p) noexcept {
                                );
                                float variation = math::OctaveNoise(
                                        variation_gen,
-                                       to_tile / p.Radius(),
+                                       glm::vec3(to_tile / p.Radius()),
                                        3,   // octaves
                                        0.5, // persistence
                                        16 / p.Radius(), // frequency
index dc6667aaed3c03b05cc254bcbb31f04f03975feb..2ed07fb2fe7e5e1792817da61d1aa8318f597392 100644 (file)
@@ -177,8 +177,8 @@ void IntersectTest::testBoxBoxIntersection() {
        glm::dvec3 normal(0);
 
        AABB box{ { -1, -1, -1 }, { 1, 1, 1 } }; // 2x2x2 cube centered around origin
-       glm::mat4 Ma(1); // identity
-       glm::mat4 Mb(1); // identity
+       glm::dmat4 Ma(1); // identity
+       glm::dmat4 Mb(1); // identity
        // they're identical, so should probably intersect ^^
 
        CPPUNIT_ASSERT_MESSAGE(
@@ -209,11 +209,11 @@ void IntersectTest::testBoxBoxIntersection() {
        );
        CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
                "bad penetration depth (with rotation)",
-               0.0142134428024292, depth, delta
+               0.014213562373095, depth, delta
        );
        AssertEqual(
                "bad intersection normal (with rotation)",
-               glm::dvec3(1, 0, 0), abs(normal) // normal can be in + or - x, therefore abs()
+               glm::dvec3(1, 0, 0), glm::abs(normal) // normal can be in + or - x, therefore abs()
        );
 
        Mb = glm::translate(glm::dvec3(3, 0, 0)); // 3 to the right