sculpto
Public Member Functions | Friends | List of all members
scl::scene_object Class Reference

#include <scene_object.h>

Public Member Functions

 scene_object ()=default
 
 scene_object (const scene_object &Other)=default
 
 ~scene_object ()=default
 
scene_object_handle GetHandle () const
 
bool IsOk () const
 
template<typename T >
const bool HasComponent () const
 
template<typename T , typename... Targs>
decltype(auto) AddComponent (Targs &&... Args)
 
template<typename T >
T & GetComponent ()
 
template<typename T >
const T & GetComponent () const
 
template<typename T >
void RemovetComponent ()
 
 operator bool () const
 
 operator u32 () const
 
 operator scene_object_handle () const
 
bool operator== (const scene_object &Other) const
 
bool operator!= (const scene_object &Other) const
 

Friends

class scene
 
class scene_hierarchy_window
 

Detailed Description

Appliaction scene object class.

Definition at line 18 of file scene_object.h.

Constructor & Destructor Documentation

◆ scene_object() [1/2]

scl::scene_object::scene_object ( )
default

Scene object default constructor.

◆ scene_object() [2/2]

scl::scene_object::scene_object ( const scene_object Other)
default

Scene object default copy constructor.

◆ ~scene_object()

scl::scene_object::~scene_object ( )
default

scene object default destructor.

Member Function Documentation

◆ AddComponent()

template<typename T , typename... Targs>
decltype(auto) scl::scene_object::AddComponent ( Targs &&...  Args)
inline
  • Add component to object function.
Template Parameters
componentto add to object.
Parameters
None.
Returns
None.

Definition at line 84 of file scene_object.h.

85 {
86 return Scene->Registry.emplace<T>(Entity, std::forward<Targs>(Args)...);
87 }

◆ GetComponent() [1/2]

template<typename T >
T & scl::scene_object::GetComponent ( )
inline
  • Get object component function.
Template Parameters
componentto get from object.
Parameters
None.
Returns
None.

Definition at line 97 of file scene_object.h.

98 {
99 SCL_CORE_ASSERT(HasComponent<T>(), "Scene object don't have \"{}\" component!", typeid(T).name());
100 return Scene->Registry.get<T>(Entity);
101 }
#define SCL_CORE_ASSERT(expr,...)
Definition: assert.h:69

◆ GetComponent() [2/2]

template<typename T >
const T & scl::scene_object::GetComponent ( ) const
inline
  • Gect object component function.
Template Parameters
componentto get from object.
Parameters
None.
Returns
None.

Definition at line 111 of file scene_object.h.

112 {
113 SCL_CORE_ASSERT(HasComponent<T>(), "Scene object don't have \"{}\" component!", typeid(T).name());
114 return Scene->Registry.get<T>(Entity);
115 }

◆ GetHandle()

scene_object_handle scl::scene_object::GetHandle ( ) const
inline
  • Scene object inner scene_object_handle getter function.
Parameters
None.
Returns
object inner scene_object_handle.

Definition at line 53 of file scene_object.h.

53{ return Entity; }

◆ HasComponent()

template<typename T >
const bool scl::scene_object::HasComponent ( ) const
inline
  • Check if object has specified component function.
Template Parameters
componentto check.
Parameters
None.
Returns
None.

Definition at line 71 of file scene_object.h.

72 {
73 return Scene->Registry.all_of<T>(Entity);
74 }

◆ IsOk()

bool scl::scene_object::IsOk ( ) const
inline
  • Check if scene object is valid function.
Parameters
None.
Returns
wheather object is valid or not.

Definition at line 61 of file scene_object.h.

61{ return Scene && Scene->Registry.valid(Entity); }

◆ operator bool()

scl::scene_object::operator bool ( ) const
inline
  • Check if scene object exists function.
Parameters
None.
Returns
wheather scene object exists or not.

Definition at line 136 of file scene_object.h.

136{ return Entity != entt::null; }

◆ operator scene_object_handle()

scl::scene_object::operator scene_object_handle ( ) const
inline
  • Getting scene object inner scene_object_handle.
Parameters
None.
Returns
inner object scene_object_handle.

Definition at line 152 of file scene_object.h.

152{ return Entity; }

◆ operator u32()

scl::scene_object::operator u32 ( ) const
inline
  • Getting scene object inner scene_object_handle.
Parameters
None.
Returns
inner object scene_object_handle.

Definition at line 144 of file scene_object.h.

144{ return (u32)Entity; }
uint32_t u32
Definition: math_common.h:21

◆ operator!=()

bool scl::scene_object::operator!= ( const scene_object Other) const
inline
  • Scene objects compare function.
Parameters
Other- scene object to compare with.
Returns
wheather scene objects are the same or not.

Definition at line 171 of file scene_object.h.

172 {
173 return Entity != Other.Entity || Scene != Other.Scene;
174 }

◆ operator==()

bool scl::scene_object::operator== ( const scene_object Other) const
inline
  • Scene objects compare function.
Parameters
Other- scene object to compare with.
Returns
wheather scene objects are the same or not.

Definition at line 160 of file scene_object.h.

161 {
162 return Entity == Other.Entity && Scene == Other.Scene;
163 }

◆ RemovetComponent()

template<typename T >
void scl::scene_object::RemovetComponent ( )
inline
  • Remove component from scene object function.
Template Parameters
componentto remove from object.
Parameters
None.
Returns
None.

Definition at line 125 of file scene_object.h.

126 {
127 Scene->Registry.remove<T>(Entity);
128 }

Friends And Related Function Documentation

◆ scene

friend class scene
friend

Definition at line 20 of file scene_object.h.

◆ scene_hierarchy_window

friend class scene_hierarchy_window
friend

Definition at line 21 of file scene_object.h.


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