]> git.localhorst.tv Git - blank.git/blobdiff - src/entity.cpp
noexcept all the things
[blank.git] / src / entity.cpp
index 23586010e1183f4238420d73e5ba458414748711..054af2a52950abe7842360be59f5192d2704aece 100644 (file)
@@ -14,7 +14,7 @@ blank::Model::Buffer model_buffer;
 
 namespace blank {
 
-Entity::Entity()
+Entity::Entity() noexcept
 : shape(nullptr)
 , model()
 , velocity(0, 0, 0)
@@ -34,16 +34,16 @@ void Entity::SetShape(const Shape *s, const glm::vec3 &color) {
        model.Update(model_buffer);
 }
 
-void Entity::SetShapeless() {
+void Entity::SetShapeless() noexcept {
        shape = nullptr;
 }
 
 
-void Entity::Velocity(const glm::vec3 &vel) {
+void Entity::Velocity(const glm::vec3 &vel) noexcept {
        velocity = vel;
 }
 
-void Entity::Position(const Block::Pos &pos) {
+void Entity::Position(const Block::Pos &pos) noexcept {
        position = pos;
        while (position.x >= Chunk::Width()) {
                position.x -= Chunk::Width();
@@ -71,28 +71,28 @@ void Entity::Position(const Block::Pos &pos) {
        }
 }
 
-void Entity::Move(const glm::vec3 &delta) {
+void Entity::Move(const glm::vec3 &delta) noexcept {
        Position(position + delta);
 }
 
-void Entity::AngularVelocity(const glm::quat &v) {
+void Entity::AngularVelocity(const glm::quat &v) noexcept {
        angular_velocity = v;
 }
 
-void Entity::Rotation(const glm::mat4 &rot) {
+void Entity::Rotation(const glm::mat4 &rot) noexcept {
        rotation = rot;
 }
 
-void Entity::Rotate(const glm::quat &delta) {
+void Entity::Rotate(const glm::quat &delta) noexcept {
        Rotation(rotation * glm::mat4_cast(delta));
 }
 
-glm::mat4 Entity::Transform(const Chunk::Pos &chunk_offset) const {
+glm::mat4 Entity::Transform(const Chunk::Pos &chunk_offset) const noexcept {
        const glm::vec3 chunk_pos = (chunk - chunk_offset) * Chunk::Extent();
        return glm::translate(position + chunk_pos) * rotation;
 }
 
-Ray Entity::Aim(const Chunk::Pos &chunk_offset) const {
+Ray Entity::Aim(const Chunk::Pos &chunk_offset) const noexcept {
        glm::mat4 transform = Transform(chunk_offset);
        glm::vec4 from = transform * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
        from /= from.w;
@@ -101,13 +101,13 @@ Ray Entity::Aim(const Chunk::Pos &chunk_offset) const {
        return Ray{ glm::vec3(from), glm::normalize(glm::vec3(to - from)) };
 }
 
-void Entity::Update(int dt) {
+void Entity::Update(int dt) noexcept {
        Move(velocity * float(dt));
        Rotate(angular_velocity * float(dt));
 }
 
 
-void Entity::Draw() {
+void Entity::Draw() noexcept {
        model.Draw();
 }