Leviathan  0.8.0.0
Leviathan game engine
Leviathan::SceneAttachable Class Reference

Base class for all objects attachable to a SceneNode. More...

#include <SceneNode.h>

+ Inheritance diagram for Leviathan::SceneAttachable:

Public Member Functions

DLLEXPORT ~SceneAttachable ()
 
DLLEXPORT void DetachFromParent ()
 Detaches this from parent if attached. More...
 
SceneNodeGetParent () const
 
bool HasParent () const
 
 REFERENCE_COUNTED_PTR_TYPE (SceneAttachable)
 
- Public Member Functions inherited from Leviathan::ReferenceCounted
 ReferenceCounted (const ReferenceCounted &other)=delete
 
ReferenceCountedoperator= (const ReferenceCounted &other)=delete
 
FORCE_INLINE void AddRef () const
 
FORCE_INLINE void Release () const
 removes a reference and deletes the object if reference count reaches zero More...
 
FORCE_INLINE void AddRef ()
 
FORCE_INLINE void Release ()
 
int32_t GetRefCount () const
 Returns the reference count. More...
 

Protected Member Functions

virtual DLLEXPORT void OnAttachedToParent (SceneNode &parent)
 
virtual DLLEXPORT void OnDetachedFromParent (SceneNode &oldparent)
 
DLLEXPORT void NotifyDetachParent (SceneNode &oldparent)
 
DLLEXPORT void NotifyAttachParent (SceneNode &parent)
 
virtual DLLEXPORT void PrepareToRender ()
 
- Protected Member Functions inherited from Leviathan::ReferenceCounted
DLLEXPORT ReferenceCounted ()
 
virtual DLLEXPORT ~ReferenceCounted ()
 

Additional Inherited Members

- Public Types inherited from Leviathan::ReferenceCounted
using basepointer = boost::intrusive_ptr< ReferenceCounted >
 
using refcountedpointer = boost::intrusive_ptr< ReferenceCounted >
 
- Static Public Member Functions inherited from Leviathan::ReferenceCounted
template<class ActualType >
static boost::intrusive_ptr< ActualType > WrapPtr (ActualType *ptr)
 Creates an intrusive_ptr from raw pointer. More...
 
template<class ActualType , class... Args>
static boost::intrusive_ptr< ActualType > MakeShared (Args &&... args)
 Constructs a new instance and wraps it. More...
 

Detailed Description

Base class for all objects attachable to a SceneNode.

Definition at line 32 of file SceneNode.h.

Constructor & Destructor Documentation

◆ ~SceneAttachable()

DLLEXPORT SceneAttachable::~SceneAttachable ( )

Definition at line 9 of file SceneNode.cpp.

10 {
12 }
DLLEXPORT void DetachFromParent()
Detaches this from parent if attached.
Definition: SceneNode.cpp:14

Member Function Documentation

◆ DetachFromParent()

DLLEXPORT void SceneAttachable::DetachFromParent ( )

Detaches this from parent if attached.

Definition at line 14 of file SceneNode.cpp.

15 {
16  if(Parent)
17  Parent->DetachChild(this);
18 }
DLLEXPORT bool DetachChild(SceneAttachable *child)
Removes an added child, returns true if succeeded.
Definition: SceneNode.cpp:85

◆ GetParent()

SceneNode* Leviathan::SceneAttachable::GetParent ( ) const
inline

Definition at line 41 of file SceneNode.h.

42  {
43  return Parent;
44  }

◆ HasParent()

bool Leviathan::SceneAttachable::HasParent ( ) const
inline

Definition at line 46 of file SceneNode.h.

47  {
48  return Parent != nullptr;
49  }

◆ NotifyAttachParent()

DLLEXPORT void SceneAttachable::NotifyAttachParent ( SceneNode parent)
protected

Definition at line 34 of file SceneNode.cpp.

35 {
36  if(Parent) {
37  LOG_ERROR(
38  "SceneAttachable: notify attach parent called while already attached to a parent");
40  }
41 
42  Parent = &parent;
43  OnAttachedToParent(parent);
44 }
#define LOG_ERROR(x)
Definition: Define.h:92
DLLEXPORT void DetachFromParent()
Detaches this from parent if attached.
Definition: SceneNode.cpp:14
virtual DLLEXPORT void OnAttachedToParent(SceneNode &parent)
Definition: SceneNode.cpp:20

◆ NotifyDetachParent()

DLLEXPORT void SceneAttachable::NotifyDetachParent ( SceneNode oldparent)
protected

Definition at line 23 of file SceneNode.cpp.

24 {
25  if(Parent != &oldparent) {
26  LOG_ERROR("SceneAttachable: notified detached from wrong parent");
27  return;
28  }
29 
30  Parent = nullptr;
31  OnDetachedFromParent(oldparent);
32 }
#define LOG_ERROR(x)
Definition: Define.h:92
virtual DLLEXPORT void OnDetachedFromParent(SceneNode &oldparent)
Definition: SceneNode.cpp:21

◆ OnAttachedToParent()

DLLEXPORT void SceneAttachable::OnAttachedToParent ( SceneNode parent)
protectedvirtual

Reimplemented in Leviathan::SceneNode, Leviathan::ObjectAnimationHandler, and Leviathan::Renderable.

Definition at line 20 of file SceneNode.cpp.

20 {}

◆ OnDetachedFromParent()

DLLEXPORT void SceneAttachable::OnDetachedFromParent ( SceneNode oldparent)
protectedvirtual

Reimplemented in Leviathan::SceneNode, Leviathan::ObjectAnimationHandler, and Leviathan::Renderable.

Definition at line 21 of file SceneNode.cpp.

21 {}

◆ PrepareToRender()

DLLEXPORT void SceneAttachable::PrepareToRender ( )
protectedvirtual

Reimplemented in Leviathan::SceneNode.

Definition at line 46 of file SceneNode.cpp.

46 {}

◆ REFERENCE_COUNTED_PTR_TYPE()

Leviathan::SceneAttachable::REFERENCE_COUNTED_PTR_TYPE ( SceneAttachable  )

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