X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fentity.cpp;h=d72bd1cc20a2772019a9ab85fef51e6776579062;hb=2d5671c2ef977defae9ce0ce7248582ab3e8f011;hp=c572429067c6e0dd77bd4a21ac9e1dde7c864b14;hpb=1a7bbd64b1fef1f4e2f9303f820d6f3ce76cebf1;p=blank.git diff --git a/src/entity.cpp b/src/entity.cpp index c572429..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 { +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;