Skip to content

Commit

Permalink
fix(transform): make global getters const
Browse files Browse the repository at this point in the history
  • Loading branch information
DiogoMendonc-a committed Feb 27, 2024
1 parent 748c05d commit b51ad04
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed Time Step plugin (#989, **@joaomanita**).
- New feature guide focused on queries (#995, **@RiscadoA**).
- ECS Statistics tesseratos plugin (#1024, **@RiscadoA**).
- Global position, rotation and scale getters (#1002, **@DiogoMendonc-a**)

### Fixed

- Crash in multiple samples due to missing plugin dependencies (**@RiscadoA**).
- Cursor offset in tesseratos when on retina displays (#998, **@diogomsmiranda**).
- Random failures in the ECS stress test (#948, **@RiscadoA**).
- System condition being ignored by Cubos (#1032, **@RiscadoA**).
- Wrong tranform gizmo position for entities with parents (#1003, **@DiogoMendonc-a**)

## [v0.1.0] - 2024-02-17

Expand Down
6 changes: 3 additions & 3 deletions engine/include/cubos/engine/transform/local_to_world.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ namespace cubos::engine

/// @brief Gets global position of the entity.
/// @return Position vector in world space.
glm::vec3 worldPosition();
glm::vec3 worldPosition() const;

/// @brief Gets global rotation of the entity.
/// @return Rotation quaternion in world space.
glm::quat worldRotation();
glm::quat worldRotation() const;

/// @brief Gets global scale of the entity.
/// @return Scale value in world space.
float worldScale();
float worldScale() const;
};

} // namespace cubos::engine
6 changes: 3 additions & 3 deletions engine/src/transform/local_to_world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ CUBOS_REFLECT_IMPL(cubos::engine::LocalToWorld)
.build();
}

glm::vec3 cubos::engine::LocalToWorld::worldPosition()
glm::vec3 cubos::engine::LocalToWorld::worldPosition() const

Check warning on line 16 in engine/src/transform/local_to_world.cpp

View check run for this annotation

Codecov / codecov/patch

engine/src/transform/local_to_world.cpp#L16

Added line #L16 was not covered by tests
{
return mat[3];

Check warning on line 18 in engine/src/transform/local_to_world.cpp

View check run for this annotation

Codecov / codecov/patch

engine/src/transform/local_to_world.cpp#L18

Added line #L18 was not covered by tests
}

glm::quat cubos::engine::LocalToWorld::worldRotation()
glm::quat cubos::engine::LocalToWorld::worldRotation() const

Check warning on line 21 in engine/src/transform/local_to_world.cpp

View check run for this annotation

Codecov / codecov/patch

engine/src/transform/local_to_world.cpp#L21

Added line #L21 was not covered by tests
{
return glm::toQuat(glm::mat3(mat) / worldScale());

Check warning on line 23 in engine/src/transform/local_to_world.cpp

View check run for this annotation

Codecov / codecov/patch

engine/src/transform/local_to_world.cpp#L23

Added line #L23 was not covered by tests
}

float cubos::engine::LocalToWorld::worldScale()
float cubos::engine::LocalToWorld::worldScale() const

Check warning on line 26 in engine/src/transform/local_to_world.cpp

View check run for this annotation

Codecov / codecov/patch

engine/src/transform/local_to_world.cpp#L26

Added line #L26 was not covered by tests
{
return glm::length(mat[0]);

Check warning on line 28 in engine/src/transform/local_to_world.cpp

View check run for this annotation

Codecov / codecov/patch

engine/src/transform/local_to_world.cpp#L28

Added line #L28 was not covered by tests
}

0 comments on commit b51ad04

Please sign in to comment.