From: Daniel Karbach Date: Fri, 7 Aug 2015 13:17:01 +0000 (+0200) Subject: tvec[234] -> ivec[234] X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=549646ac3e5bede5e77031f773649edf8de83608;p=blank.git tvec[234] -> ivec[234] howcome I didn't think of that before? lol --- diff --git a/src/ai/Spawner.cpp b/src/ai/Spawner.cpp index 2340067..863678d 100644 --- a/src/ai/Spawner.cpp +++ b/src/ai/Spawner.cpp @@ -59,13 +59,13 @@ void Spawner::CheckDespawn() noexcept { void Spawner::TrySpawn() { if (controllers.size() >= max_entities) return; - glm::tvec3 chunk( + glm::ivec3 chunk( (rand() % (chunk_range * 2 + 1)) - chunk_range, (rand() % (chunk_range * 2 + 1)) - chunk_range, (rand() % (chunk_range * 2 + 1)) - chunk_range ); - glm::tvec3 pos( + glm::ivec3 pos( rand() % Chunk::width, rand() % Chunk::height, rand() % Chunk::depth @@ -91,7 +91,7 @@ void Spawner::TrySpawn() { Spawn(world.Player().ChunkCoords() + chunk, glm::vec3(pos) + glm::vec3(0.5f)); } -void Spawner::Spawn(const glm::tvec3 &chunk, const glm::vec3 &pos) { +void Spawner::Spawn(const glm::ivec3 &chunk, const glm::vec3 &pos) { glm::vec3 color(rand() % 6, rand() % 6, rand() % 6); color = color * 0.15f + 0.25f; diff --git a/src/ai/Spawner.hpp b/src/ai/Spawner.hpp index 120db60..127a860 100644 --- a/src/ai/Spawner.hpp +++ b/src/ai/Spawner.hpp @@ -23,7 +23,7 @@ public: private: void CheckDespawn() noexcept; void TrySpawn(); - void Spawn(const glm::tvec3 &, const glm::vec3 &); + void Spawn(const glm::ivec3 &, const glm::vec3 &); private: World &world; diff --git a/src/graphics/Font.hpp b/src/graphics/Font.hpp index 45ea928..b940059 100644 --- a/src/graphics/Font.hpp +++ b/src/graphics/Font.hpp @@ -57,7 +57,7 @@ public: bool HasGlyph(Uint16) const noexcept; - glm::tvec2 TextSize(const char *) const; + glm::ivec2 TextSize(const char *) const; Texture Render(const char *) const; void Render(const char *, Texture &) const; diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index 2b22742..be59d23 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -101,8 +101,8 @@ bool Font::HasGlyph(Uint16 c) const noexcept { } -glm::tvec2 Font::TextSize(const char *text) const { - glm::tvec2 size; +glm::ivec2 Font::TextSize(const char *text) const { + glm::ivec2 size; if (TTF_SizeUTF8(handle, text, &size.x, &size.y) != 0) { throw std::runtime_error(TTF_GetError()); } diff --git a/src/ui/Interface.hpp b/src/ui/Interface.hpp index 82eade3..0d338be 100644 --- a/src/ui/Interface.hpp +++ b/src/ui/Interface.hpp @@ -114,7 +114,7 @@ private: Sound place_sound; Sound remove_sound; - glm::tvec3 fwd, rev; + glm::ivec3 fwd, rev; }; diff --git a/src/world/Block.hpp b/src/world/Block.hpp index 0bb5fd8..274e3d3 100644 --- a/src/world/Block.hpp +++ b/src/world/Block.hpp @@ -66,7 +66,7 @@ struct Block { } } - static glm::tvec3 FaceNormal(Face face) noexcept { + static glm::ivec3 FaceNormal(Face face) noexcept { return face2normal[face]; } @@ -125,7 +125,7 @@ struct Block { }; private: - static const glm::tvec3 face2normal[6]; + static const glm::ivec3 face2normal[6]; static const glm::mat4 orient2transform[ORIENT_COUNT]; static const Face orient2face[ORIENT_COUNT][FACE_COUNT]; diff --git a/src/world/Chunk.hpp b/src/world/Chunk.hpp index 7b84b6e..f4f0bf0 100644 --- a/src/world/Chunk.hpp +++ b/src/world/Chunk.hpp @@ -20,7 +20,7 @@ class WorldCollision; class Chunk { public: - using Pos = glm::tvec3; + using Pos = glm::ivec3; public: explicit Chunk(const BlockTypeRegistry &) noexcept; diff --git a/src/world/World.cpp b/src/world/World.cpp index dc07818..e8b665c 100644 --- a/src/world/World.cpp +++ b/src/world/World.cpp @@ -234,7 +234,7 @@ Chunk &World::PlayerChunk() { return chunks.ForceLoad(player->ChunkCoords()); } -Chunk &World::Next(const Chunk &to, const glm::tvec3 &dir) { +Chunk &World::Next(const Chunk &to, const glm::ivec3 &dir) { const Chunk::Pos tgt_pos = to.Position() + dir; return chunks.ForceLoad(tgt_pos); } diff --git a/src/world/World.hpp b/src/world/World.hpp index da02b1f..b98efca 100644 --- a/src/world/World.hpp +++ b/src/world/World.hpp @@ -55,7 +55,7 @@ public: Entity &AddEntity() { entities.emplace_back(); return entities.back(); } Chunk &PlayerChunk(); - Chunk &Next(const Chunk &to, const glm::tvec3 &dir); + Chunk &Next(const Chunk &to, const glm::ivec3 &dir); void Update(int dt); diff --git a/src/world/block.cpp b/src/world/block.cpp index 442e54f..e06f3e0 100644 --- a/src/world/block.cpp +++ b/src/world/block.cpp @@ -155,7 +155,7 @@ const glm::mat4 Block::orient2transform[ORIENT_COUNT] = { { 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, }, // face: back, turn: right }; -const glm::tvec3 Block::face2normal[FACE_COUNT] = { +const glm::ivec3 Block::face2normal[FACE_COUNT] = { { 0, 1, 0 }, { 0, -1, 0 }, { 1, 0, 0 }, diff --git a/tst/graphics/GLTraitsTest.cpp b/tst/graphics/GLTraitsTest.cpp index 9567331..54d860c 100644 --- a/tst/graphics/GLTraitsTest.cpp +++ b/tst/graphics/GLTraitsTest.cpp @@ -66,15 +66,15 @@ void GLTraitsTest::testSize() { CPPUNIT_ASSERT_EQUAL_MESSAGE( "bad number of components for vec2i", - 2, gl_traits>::size + 2, gl_traits::size ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "bad number of components for vec3i", - 3, gl_traits>::size + 3, gl_traits::size ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "bad number of components for vec4i", - 4, gl_traits>::size + 4, gl_traits::size ); } diff --git a/tst/world/BlockTest.cpp b/tst/world/BlockTest.cpp index b10e9c9..85b5a68 100644 --- a/tst/world/BlockTest.cpp +++ b/tst/world/BlockTest.cpp @@ -74,27 +74,27 @@ void BlockTest::testFaceAxis() { void BlockTest::testFaceNormal() { CPPUNIT_ASSERT_EQUAL_MESSAGE( "[ 0, 1, 0 ] not normal of UP", - glm::tvec3(0, 1, 0), Block::FaceNormal(Block::FACE_UP) + glm::ivec3(0, 1, 0), Block::FaceNormal(Block::FACE_UP) ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "[ 0, -1, 0 ] not normal of DOWN", - glm::tvec3(0, -1, 0), Block::FaceNormal(Block::FACE_DOWN) + glm::ivec3(0, -1, 0), Block::FaceNormal(Block::FACE_DOWN) ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "[ 1, 0, 0 ] not normal of RIGHT", - glm::tvec3(1, 0, 0), Block::FaceNormal(Block::FACE_RIGHT) + glm::ivec3(1, 0, 0), Block::FaceNormal(Block::FACE_RIGHT) ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "[ -1, 0, 0 ] not normal of LEFT", - glm::tvec3(-1, 0, 0), Block::FaceNormal(Block::FACE_LEFT) + glm::ivec3(-1, 0, 0), Block::FaceNormal(Block::FACE_LEFT) ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "[ 0, 0, 1 ] not normal of FRONT", - glm::tvec3(0, 0, 1), Block::FaceNormal(Block::FACE_FRONT) + glm::ivec3(0, 0, 1), Block::FaceNormal(Block::FACE_FRONT) ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "[ 0, 0, -1 ] not normal of BACK", - glm::tvec3(0, 0, -1), Block::FaceNormal(Block::FACE_BACK) + glm::ivec3(0, 0, -1), Block::FaceNormal(Block::FACE_BACK) ); }