Unravel Engine C++ Reference
Loading...
Searching...
No Matches
unravel::model_component Class Reference

Class that contains core data for meshes. More...

#include <model_component.h>

Inheritance diagram for unravel::model_component:
unravel::component_crtp< model_component, owned_component > unravel::owned_component unravel::basic_component

Public Member Functions

void set_enabled (bool enabled)
 Sets whether the model is enabled.
 
void set_casts_shadow (bool cast_shadow)
 Sets whether the model casts shadows.
 
void set_casts_reflection (bool casts_reflection)
 Sets whether the model casts reflections.
 
void set_static (bool is_static)
 Sets whether the model is static.
 
auto is_enabled () const -> bool
 Checks if the model is enabled.
 
auto casts_shadow () const -> bool
 Checks if the model casts shadows.
 
auto casts_reflection () const -> bool
 Checks if the model casts reflections.
 
auto is_static () const -> bool
 Checks if the model is static.
 
auto get_model () const -> const model &
 Gets the model.
 
void set_model (const model &model)
 Sets the model.
 
auto get_bone_transforms () const -> const pose_mat4 &
 Gets the bone transforms.
 
auto get_submesh_transforms () const -> const pose_mat4 &
 Gets the submesh transforms.
 
auto get_armature_entities () const -> const std::vector< entt::handle > &
 Gets the armature entities.
 
auto get_armature_by_id (const std::string &node_id) const -> entt::handle
 
auto get_armature_index_by_id (const std::string &node_id) const -> int
 
auto get_armature_by_index (size_t index) const -> entt::handle
 
auto get_skinning_transforms () const -> const std::vector< pose_mat4 > &
 
auto init_armature (bool force) -> bool
 Updates the armature of the model.
 
auto update_armature () -> bool
 
void set_armature_entities (const std::vector< entt::handle > &submesh_entities)
 Sets the armature entities.
 
auto get_world_bounds () const -> const math::bbox &
 Gets the local bounding box for this mesh.
 
auto get_world_bounds_transform () const -> const math::transform &
 
void update_world_bounds (const math::transform &bounds)
 
auto get_local_bounds () const -> const math::bbox &
 
void set_last_render_frame (uint64_t frame)
 
auto get_last_render_frame () const noexcept -> uint64_t
 
auto was_used_last_frame () const noexcept -> bool
 
auto is_skinned () const -> bool
 
auto get_bind_pose () const -> const animation_pose &
 
- Public Member Functions inherited from unravel::owned_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.
 
- Public Member Functions inherited from unravel::basic_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 Public Member Functions inherited from unravel::owned_component
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

- Public Types inherited from unravel::component_crtp< model_component, owned_component >
using base
 
- Public Attributes inherited from unravel::basic_component
bool eto {}
 Disable empty type optimizations.
 
- Static Public Attributes inherited from unravel::component_crtp< model_component, owned_component >
static constexpr bool in_place_delete
 Indicates if the component can be deleted in place.
 

Detailed Description

Class that contains core data for meshes.

Definition at line 13 of file model_component.h.

Member Function Documentation

◆ casts_reflection()

auto unravel::model_component::casts_reflection ( ) const -> bool

Checks if the model casts reflections.

Returns
True if the model casts reflections, false otherwise.

Definition at line 424 of file model_component.cpp.

◆ casts_shadow()

auto unravel::model_component::casts_shadow ( ) const -> bool

Checks if the model casts shadows.

Returns
True if the model casts shadows, false otherwise.

Definition at line 402 of file model_component.cpp.

◆ get_armature_by_id()

auto unravel::model_component::get_armature_by_id ( const std::string & node_id) const -> entt::handle

Definition at line 456 of file model_component.cpp.

◆ get_armature_by_index()

auto unravel::model_component::get_armature_by_index ( size_t index) const -> entt::handle

Definition at line 487 of file model_component.cpp.

◆ get_armature_entities()

auto unravel::model_component::get_armature_entities ( ) const -> const std::vector<entt::handle>&

Gets the armature entities.

Returns
A constant reference to the vector of armature entity handles.

Definition at line 451 of file model_component.cpp.

◆ get_armature_index_by_id()

auto unravel::model_component::get_armature_index_by_id ( const std::string & node_id) const -> int

Definition at line 470 of file model_component.cpp.

◆ get_bind_pose()

auto unravel::model_component::get_bind_pose ( ) const -> const animation_pose&

Definition at line 330 of file model_component.cpp.

◆ get_bone_transforms()

auto unravel::model_component::get_bone_transforms ( ) const -> const pose_mat4&

Gets the bone transforms.

Returns
A constant reference to the vector of bone transforms.

Definition at line 429 of file model_component.cpp.

◆ get_last_render_frame()

auto unravel::model_component::get_last_render_frame ( ) const -> uint64_t
noexcept

Definition at line 300 of file model_component.cpp.

◆ get_local_bounds()

auto unravel::model_component::get_local_bounds ( ) const -> const math::bbox&

Definition at line 278 of file model_component.cpp.

◆ get_model()

auto unravel::model_component::get_model ( ) const -> const model&

Gets the model.

Returns
A constant reference to the model.

Definition at line 412 of file model_component.cpp.

◆ get_skinning_transforms()

auto unravel::model_component::get_skinning_transforms ( ) const -> const std::vector<pose_mat4>&

Definition at line 434 of file model_component.cpp.

◆ get_submesh_transforms()

auto unravel::model_component::get_submesh_transforms ( ) const -> const pose_mat4&

Gets the submesh transforms.

Returns
A constant reference to the vector of submesh transforms.

Definition at line 439 of file model_component.cpp.

◆ get_world_bounds()

auto unravel::model_component::get_world_bounds ( ) const -> const math::bbox&

Gets the local bounding box for this mesh.

Returns
const math::bbox& The bounding box.

Definition at line 268 of file model_component.cpp.

◆ get_world_bounds_transform()

auto unravel::model_component::get_world_bounds_transform ( ) const -> const math::transform&

Definition at line 273 of file model_component.cpp.

◆ init_armature()

auto unravel::model_component::init_armature ( bool force) -> bool

Updates the armature of the model.

Definition at line 223 of file model_component.cpp.

◆ is_enabled()

auto unravel::model_component::is_enabled ( ) const -> bool

Checks if the model is enabled.

Returns
True if the model is enabled, false otherwise.

Definition at line 397 of file model_component.cpp.

◆ is_skinned()

auto unravel::model_component::is_skinned ( ) const -> bool

Definition at line 313 of file model_component.cpp.

◆ is_static()

auto unravel::model_component::is_static ( ) const -> bool

Checks if the model is static.

Returns
True if the model is static, false otherwise.

Definition at line 407 of file model_component.cpp.

◆ on_create_component()

void unravel::model_component::on_create_component ( entt::registry & r,
entt::entity e )
static

Called when the component is created.

Parameters
rThe registry containing the component.
eThe entity associated with the component.

Definition at line 335 of file model_component.cpp.

◆ on_destroy_component()

void unravel::model_component::on_destroy_component ( entt::registry & r,
entt::entity e )
static

Called when the component is destroyed.

Parameters
rThe registry containing the component.
eThe entity associated with the component.

Definition at line 345 of file model_component.cpp.

◆ set_armature_entities()

void unravel::model_component::set_armature_entities ( const std::vector< entt::handle > & submesh_entities)

Sets the armature entities.

Parameters
submesh_entitiesA vector of handles to the armature entities.

Definition at line 444 of file model_component.cpp.

◆ set_casts_reflection()

void unravel::model_component::set_casts_reflection ( bool casts_reflection)

Sets whether the model casts reflections.

Parameters
casts_reflectionTrue if the model casts reflections, false otherwise.

Definition at line 385 of file model_component.cpp.

◆ set_casts_shadow()

void unravel::model_component::set_casts_shadow ( bool cast_shadow)

Sets whether the model casts shadows.

Parameters
cast_shadowTrue if the model casts shadows, false otherwise.

Definition at line 361 of file model_component.cpp.

◆ set_enabled()

void unravel::model_component::set_enabled ( bool enabled)

Sets whether the model is enabled.

Parameters
enabledTrue if the model is enabled, false otherwise.

Definition at line 349 of file model_component.cpp.

◆ set_last_render_frame()

void unravel::model_component::set_last_render_frame ( uint64_t frame)

Definition at line 295 of file model_component.cpp.

◆ set_model()

void unravel::model_component::set_model ( const model & model)

Sets the model.

Parameters
modelThe model to set.

Definition at line 417 of file model_component.cpp.

◆ set_static()

void unravel::model_component::set_static ( bool is_static)

Sets whether the model is static.

Parameters
is_staticTrue if the model is static, false otherwise.

Definition at line 373 of file model_component.cpp.

◆ update_armature()

auto unravel::model_component::update_armature ( ) -> bool

Definition at line 189 of file model_component.cpp.

◆ update_world_bounds()

void unravel::model_component::update_world_bounds ( const math::transform & bounds)

Definition at line 250 of file model_component.cpp.

◆ was_used_last_frame()

auto unravel::model_component::was_used_last_frame ( ) const -> bool
noexcept

Definition at line 305 of file model_component.cpp.


The documentation for this class was generated from the following files: