X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fentity.cpp;h=d72bd1cc20a2772019a9ab85fef51e6776579062;hb=9c2baccb84195b7a2858c2b967c94d15cd31836b;hp=cd2491f1bdf441282ea666a6f15218075b9ac6b6;hpb=b35ce3a6423c554b34b37362c5550bd705e63a1d;p=blank.git diff --git a/src/entity.cpp b/src/entity.cpp index cd2491f..d72bd1c 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -20,7 +20,7 @@ void Entity::Velocity(const glm::vec3 &vel) { velocity = vel; } -void Entity::Position(const glm::vec3 &pos) { +void Entity::Position(const Block::Pos &pos) { position = pos; while (position.x >= Chunk::Width()) { position.x -= Chunk::Width(); @@ -56,12 +56,12 @@ void Entity::Rotation(const glm::mat4 &rot) { rotation = rot; } -glm::mat4 Entity::Transform(const glm::tvec3 &chunk_offset) const { - const glm::vec3 chunk_pos = glm::vec3(chunk - chunk_offset) * Chunk::Extent(); +glm::mat4 Entity::Transform(const Chunk::Pos &chunk_offset) const { + const glm::vec3 chunk_pos = (chunk - chunk_offset) * Chunk::Extent(); return glm::translate(position + chunk_pos) * rotation; } -Ray Entity::Aim(const glm::tvec3 &chunk_offset) const { +Ray Entity::Aim(const Chunk::Pos &chunk_offset) const { glm::mat4 transform = Transform(chunk_offset); glm::vec4 from = transform * glm::vec4(0.0f, 0.0f, 1.0f, 1.0f); from /= from.w;