Unravel Engine C++ Reference
|
Component that handles transformations (position, rotation, scale, etc.) in the ACE framework. More...
#include <transform_component.h>
Public Types | |
using | flags_t = std::bitset<8> |
![]() | |
using | base |
Public Member Functions | |
void | resolve_transform_global () noexcept |
TRANSFORMS. | |
auto | get_transform_global () const noexcept -> const math::transform & |
Gets the global transform. | |
auto | set_transform_global (const math::transform &trans) noexcept -> bool |
Sets the global transform. | |
auto | set_transform_global_epsilon (const math::transform &trans, float epsilon) noexcept -> bool |
auto | get_transform_local () const noexcept -> const math::transform & |
Gets the local transform. | |
void | set_transform_local (const math::transform &trans) noexcept |
Sets the local transform. | |
auto | get_position_global () const noexcept -> const math::vec3 & |
TRANSLATION. | |
void | set_position_global (const math::vec3 &position) noexcept |
Sets the global position. | |
void | move_by_global (const math::vec3 &amount) noexcept |
Moves the component by a specified amount globally. | |
void | reset_position_global () noexcept |
Resets the global position to the origin. | |
auto | get_position_local () const noexcept -> const math::vec3 & |
Gets the local position. | |
void | set_position_local (const math::vec3 &position) noexcept |
Sets the local position. | |
void | move_by_local (const math::vec3 &amount) noexcept |
Moves the component by a specified amount locally. | |
void | reset_position_local () noexcept |
Resets the local position to the origin. | |
auto | set_position_and_rotation_global (const math::vec3 &position, const math::quat &rotation, float epsilon) noexcept -> bool |
auto | get_rotation_global () const noexcept -> const math::quat & |
ROTATION. | |
void | set_rotation_global (const math::quat &rotation) noexcept |
Sets the global rotation. | |
void | rotate_by_global (const math::quat &rotation) noexcept |
Rotates the component by a specified amount globally. | |
void | reset_rotation_global () noexcept |
Resets the global rotation to the default orientation. | |
auto | get_rotation_local () const noexcept -> const math::quat & |
Gets the local rotation. | |
void | set_rotation_local (const math::quat &rotation) noexcept |
Sets the local rotation. | |
void | rotate_by_local (const math::quat &rotation) noexcept |
Rotates the component by a specified amount locally. | |
void | reset_rotation_local () noexcept |
Resets the local rotation to the default orientation. | |
auto | get_rotation_euler_global () const noexcept -> math::vec3 |
Gets the global rotation in Euler angles. | |
void | set_rotation_euler_global (math::vec3 rotation) noexcept |
Sets the global rotation in Euler angles. | |
void | rotate_by_euler_global (math::vec3 rotation) noexcept |
Rotates the component by a specified amount in Euler angles globally. | |
auto | get_rotation_euler_local () const noexcept -> math::vec3 |
Gets the local rotation in Euler angles. | |
void | set_rotation_euler_local (math::vec3 rotation) noexcept |
Sets the local rotation in Euler angles. | |
void | rotate_by_euler_local (math::vec3 rotation) noexcept |
Rotates the component by a specified amount in Euler angles locally. | |
void | rotate_axis_global (float degrees, const math::vec3 &axis) noexcept |
Rotates the component around a specified axis globally. | |
void | rotate_around_global (const math::vec3 &point, const math::vec3 &axis, float degrees) |
void | rotate_around_global (const math::vec3 &point, const math::quat &rotation) |
void | look_at (const math::vec3 &point) noexcept |
Orients the component to look at a specified point. | |
void | look_at (const math::vec3 &point, const math::vec3 &up) noexcept |
auto | get_scale_global () const noexcept -> const math::vec3 & |
SCALE. | |
void | set_scale_global (const math::vec3 &scale) noexcept |
Sets the global scale. | |
void | scale_by_global (const math::vec3 &scale) noexcept |
Scales the component by a specified amount globally. | |
void | reset_scale_global () noexcept |
Resets the global scale to the default value. | |
auto | get_scale_local () const noexcept -> const math::vec3 & |
Gets the local scale. | |
void | set_scale_local (const math::vec3 &scale) noexcept |
Sets the local scale. | |
void | scale_by_local (const math::vec3 &scale) noexcept |
Scales the component by a specified amount locally. | |
void | reset_scale_local () noexcept |
Resets the local scale to the default value. | |
auto | get_skew_global () const noexcept -> const math::vec3 & |
SKEW. | |
void | set_skew_global (const math::vec3 &s) noexcept |
Sets the global skew. | |
auto | get_skew_local () const noexcept -> const math::vec3 & |
Gets the local skew. | |
void | set_skew_local (const math::vec3 &s) noexcept |
Sets the local skew. | |
auto | get_perspective_global () const noexcept -> const math::vec4 & |
PERSPECTIVE. | |
void | set_perspective_global (const math::vec4 &p) noexcept |
Sets the global perspective. | |
auto | get_perspective_local () const noexcept -> const math::vec4 & |
Gets the local perspective. | |
void | set_perspective_local (const math::vec4 &p) noexcept |
Sets the local perspective. | |
auto | get_x_axis_global () const noexcept -> math::vec3 |
BASIS. | |
auto | get_x_axis_local () const noexcept -> math::vec3 |
Gets the local X-axis. | |
auto | get_y_axis_global () const noexcept -> math::vec3 |
Gets the global Y-axis. | |
auto | get_y_axis_local () const noexcept -> math::vec3 |
Gets the local Y-axis. | |
auto | get_z_axis_global () const noexcept -> math::vec3 |
Gets the global Z-axis. | |
auto | get_z_axis_local () const noexcept -> math::vec3 |
Gets the local Z-axis. | |
auto | to_local (const math::vec3 &point) const noexcept -> math::vec3 |
SPACE UTILS. | |
auto | get_parent () const noexcept -> entt::handle |
RELATIONSHIP. | |
auto | set_parent (const entt::handle &parent, bool global_stays=true) -> bool |
Sets the parent entity. | |
auto | get_children () const noexcept -> const std::vector< entt::handle > & |
Gets the child entities. | |
void | set_children (const std::vector< entt::handle > &children) |
Sets the child entities. | |
void | sort_children () noexcept |
Sorts the child entities. | |
void | set_active (bool active) noexcept |
Sets the active flag. | |
auto | is_active () const noexcept -> bool |
Checks if the component is active. | |
auto | is_active_global () const noexcept -> bool |
void | set_dirty (bool dirty) noexcept |
Sets the dirty flag. | |
auto | is_dirty () const noexcept -> bool |
Checks if the component is dirty. | |
void | set_dirty (uint8_t id, bool dirty) noexcept |
Sets the dirty flag for a specific index. | |
auto | is_dirty (uint8_t id) const noexcept -> bool |
Checks if the component is dirty for a specific index. | |
void | _clear_relationships () |
Clears the relationships of the component. | |
![]() | |
auto | operator= (const owned_component &other) -> owned_component &=default |
void | set_owner (entt::handle owner) |
Sets the owner of the component. | |
auto | get_owner () const noexcept -> entt::const_handle |
Gets the owner of the component. | |
auto | get_owner () noexcept -> entt::handle |
Gets the owner of the component. | |
![]() | |
void | touch () |
Marks the component as 'touched'. | |
Static Public Member Functions | |
static void | on_create_component (entt::registry &r, entt::entity e) |
Called when the component is created. | |
static void | on_destroy_component (entt::registry &r, entt::entity e) |
Called when the component is destroyed. | |
static auto | get_top_level_entities (const std::vector< entt::handle > &list) -> std::vector< entt::handle > |
static auto | get_top_level_entities (const std::vector< entt::handle * > &list) -> std::vector< entt::handle > |
static auto | is_parent_of (entt::handle parent_to_test, entt::handle child) -> bool |
![]() | |
template<typename T > | |
static void | on_create_component (entt::registry &r, entt::entity e) |
template<typename T > | |
static void | on_destroy_component (entt::registry &r, entt::entity e) |
Additional Inherited Members | |
![]() | |
bool | eto {} |
Disable empty type optimizations. | |
![]() | |
static constexpr bool | in_place_delete |
Indicates if the component can be deleted in place. | |
Component that handles transformations (position, rotation, scale, etc.) in the ACE framework.
Definition at line 55 of file transform_component.h.
using unravel::transform_component::flags_t = std::bitset<8> |
Definition at line 58 of file transform_component.h.
void unravel::transform_component::_clear_relationships | ( | ) |
Clears the relationships of the component.
Definition at line 624 of file transform_component.cpp.
|
noexcept |
Gets the child entities.
Definition at line 813 of file transform_component.cpp.
|
noexcept |
RELATIONSHIP.
Gets the parent entity.
Definition at line 694 of file transform_component.cpp.
|
noexcept |
PERSPECTIVE.
Gets the global perspective.
Definition at line 552 of file transform_component.cpp.
|
noexcept |
Gets the local perspective.
Definition at line 499 of file transform_component.cpp.
|
noexcept |
TRANSLATION.
Gets the global position.
Definition at line 267 of file transform_component.cpp.
|
noexcept |
Gets the local position.
Definition at line 296 of file transform_component.cpp.
|
noexcept |
Gets the global rotation in Euler angles.
Definition at line 402 of file transform_component.cpp.
|
noexcept |
Gets the local rotation in Euler angles.
Definition at line 420 of file transform_component.cpp.
|
noexcept |
ROTATION.
Gets the global rotation.
Definition at line 347 of file transform_component.cpp.
|
noexcept |
Gets the local rotation.
Definition at line 379 of file transform_component.cpp.
|
noexcept |
SCALE.
Gets the global scale.
Definition at line 534 of file transform_component.cpp.
|
noexcept |
Gets the local scale.
SCALE.
Definition at line 484 of file transform_component.cpp.
|
noexcept |
SKEW.
Gets the global skew.
Definition at line 547 of file transform_component.cpp.
|
noexcept |
Gets the local skew.
Definition at line 494 of file transform_component.cpp.
|
static |
Definition at line 105 of file transform_component.cpp.
|
static |
Definition at line 149 of file transform_component.cpp.
|
noexcept |
Gets the global transform.
Definition at line 242 of file transform_component.cpp.
|
noexcept |
Gets the local transform.
TRANSFORMS.
Definition at line 214 of file transform_component.cpp.
|
noexcept |
BASIS.
Gets the global X-axis.
Definition at line 519 of file transform_component.cpp.
|
noexcept |
Gets the local X-axis.
Definition at line 504 of file transform_component.cpp.
|
noexcept |
Gets the global Y-axis.
Definition at line 524 of file transform_component.cpp.
|
noexcept |
Gets the local Y-axis.
Definition at line 509 of file transform_component.cpp.
|
noexcept |
Gets the global Z-axis.
Definition at line 529 of file transform_component.cpp.
|
noexcept |
Gets the local Z-axis.
Definition at line 514 of file transform_component.cpp.
|
noexcept |
Checks if the component is active.
Definition at line 776 of file transform_component.cpp.
|
noexcept |
Definition at line 781 of file transform_component.cpp.
|
noexcept |
Checks if the component is dirty.
Definition at line 793 of file transform_component.cpp.
|
noexcept |
Checks if the component is dirty for a specific index.
id | The index of the flag. |
Definition at line 803 of file transform_component.cpp.
|
static |
Definition at line 100 of file transform_component.cpp.
|
noexcept |
Orients the component to look at a specified point.
point | The point to look at. |
Definition at line 466 of file transform_component.cpp.
|
noexcept |
Definition at line 471 of file transform_component.cpp.
|
noexcept |
Moves the component by a specified amount globally.
amount | The amount to move by. |
Definition at line 285 of file transform_component.cpp.
|
noexcept |
Moves the component by a specified amount locally.
amount | The amount to move by. |
Definition at line 306 of file transform_component.cpp.
|
static |
Called when the component is created.
r | The registry containing the component. |
e | The entity associated with the component. |
Definition at line 68 of file transform_component.cpp.
|
static |
Called when the component is destroyed.
r | The registry containing the component. |
e | The entity associated with the component. |
Definition at line 76 of file transform_component.cpp.
|
noexcept |
Resets the global position to the origin.
Definition at line 291 of file transform_component.cpp.
|
noexcept |
Resets the local position to the origin.
Definition at line 311 of file transform_component.cpp.
|
noexcept |
Resets the global rotation to the default orientation.
Definition at line 374 of file transform_component.cpp.
|
noexcept |
Resets the local rotation to the default orientation.
Definition at line 397 of file transform_component.cpp.
|
noexcept |
Resets the global scale to the default value.
Definition at line 614 of file transform_component.cpp.
|
noexcept |
Resets the local scale to the default value.
Definition at line 619 of file transform_component.cpp.
|
noexcept |
TRANSFORMS.
Definition at line 224 of file transform_component.cpp.
void unravel::transform_component::rotate_around_global | ( | const math::vec3 & | point, |
const math::quat & | rotation ) |
Definition at line 458 of file transform_component.cpp.
void unravel::transform_component::rotate_around_global | ( | const math::vec3 & | point, |
const math::vec3 & | axis, | ||
float | degrees ) |
Definition at line 446 of file transform_component.cpp.
|
noexcept |
Rotates the component around a specified axis globally.
degrees | The rotation amount in degrees. |
axis | The axis to rotate around. |
Definition at line 438 of file transform_component.cpp.
|
noexcept |
Rotates the component by a specified amount in Euler angles globally.
rotation | The rotation amount in Euler angles. |
Definition at line 412 of file transform_component.cpp.
|
noexcept |
Rotates the component by a specified amount in Euler angles locally.
rotation | The rotation amount in Euler angles. |
Definition at line 430 of file transform_component.cpp.
|
noexcept |
Rotates the component by a specified amount globally.
rotation | The rotation amount. |
Definition at line 366 of file transform_component.cpp.
|
noexcept |
Rotates the component by a specified amount locally.
rotation | The rotation amount. |
Definition at line 389 of file transform_component.cpp.
|
noexcept |
Scales the component by a specified amount globally.
scale | The scaling amount. |
Definition at line 539 of file transform_component.cpp.
|
noexcept |
Scales the component by a specified amount locally.
scale | The scaling amount. |
Definition at line 489 of file transform_component.cpp.
|
noexcept |
Sets the active flag.
active | The active flag to set. |
Definition at line 786 of file transform_component.cpp.
void unravel::transform_component::set_children | ( | const std::vector< entt::handle > & | children | ) |
Sets the child entities.
children | A vector of child entity handles. |
Definition at line 818 of file transform_component.cpp.
|
noexcept |
Sets the dirty flag.
dirty | The dirty flag to set. |
Definition at line 798 of file transform_component.cpp.
|
noexcept |
Sets the dirty flag for a specific index.
id | The index of the flag. |
dirty | The dirty flag to set. |
Definition at line 808 of file transform_component.cpp.
auto unravel::transform_component::set_parent | ( | const entt::handle & | parent, |
bool | global_stays = true ) -> bool |
Sets the parent entity.
parent | A handle to the parent entity. |
params | Parameters for setting the parent. |
Definition at line 630 of file transform_component.cpp.
|
noexcept |
Sets the global perspective.
p | The global perspective to set. |
Definition at line 595 of file transform_component.cpp.
|
noexcept |
Sets the local perspective.
p | The local perspective to set. |
Definition at line 609 of file transform_component.cpp.
|
noexcept |
Definition at line 316 of file transform_component.cpp.
|
noexcept |
Sets the global position.
position | The global position to set. |
Definition at line 272 of file transform_component.cpp.
|
noexcept |
Sets the local position.
position | The local position to set. |
Definition at line 301 of file transform_component.cpp.
|
noexcept |
Sets the global rotation in Euler angles.
rotation | The global rotation in Euler angles. |
Definition at line 407 of file transform_component.cpp.
|
noexcept |
Sets the local rotation in Euler angles.
rotation | The local rotation in Euler angles. |
Definition at line 425 of file transform_component.cpp.
|
noexcept |
Sets the global rotation.
rotation | The global rotation to set. |
Definition at line 352 of file transform_component.cpp.
|
noexcept |
Sets the local rotation.
rotation | The local rotation to set. |
Definition at line 384 of file transform_component.cpp.
|
noexcept |
Sets the global scale.
scale | The global scale to set. |
Definition at line 557 of file transform_component.cpp.
|
noexcept |
Sets the local scale.
scale | The local scale to set. |
Definition at line 571 of file transform_component.cpp.
|
noexcept |
Sets the global skew.
s | The global skew to set. |
Definition at line 576 of file transform_component.cpp.
|
noexcept |
Sets the local skew.
s | The local skew to set. |
Definition at line 590 of file transform_component.cpp.
|
noexcept |
Sets the global transform.
trans | The global transform to set. |
Definition at line 247 of file transform_component.cpp.
|
noexcept |
Definition at line 252 of file transform_component.cpp.
|
noexcept |
Sets the local transform.
trans | The local transform to set. |
Definition at line 219 of file transform_component.cpp.
|
noexcept |
Sorts the child entities.
Definition at line 740 of file transform_component.cpp.
|
noexcept |
SPACE UTILS.
Converts a point to local space.
point | The point in global space. |
Definition at line 771 of file transform_component.cpp.