Leviathan  0.8.0.0
Leviathan game engine
Leviathan::Scene Class Reference

#include <Scene.h>

+ Inheritance diagram for Leviathan::Scene:

Public Member Functions

 REFERENCE_COUNTED_PTR_TYPE (Scene)
 
DLLEXPORT SceneNode::pointer CreateSceneNode ()
 Creates a new SceneNode as a child of the root node. More...
 
DLLEXPORT void DestroySceneNode (SceneNode::pointer &node)
 "Destroys" a previously created SceneNode More...
 
DLLEXPORT void PrepareForRendering ()
 Computes the final positions of all SceneNodes to be ready for rendering. More...
 
SceneNode::pointer GetRootSceneNode ()
 
int GetInternal ()
 
SceneNodeGetRootSceneNodeWrapper ()
 
- 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

DLLEXPORT Scene ()
 
- Protected Member Functions inherited from Leviathan::ReferenceCounted
DLLEXPORT ReferenceCounted ()
 
virtual DLLEXPORT ~ReferenceCounted ()
 

Protected Attributes

friend 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

Definition at line 11 of file Scene.h.

Constructor & Destructor Documentation

◆ Scene()

DLLEXPORT Scene::Scene ( )
protected

Definition at line 9 of file Scene.cpp.

10 {
11  ++BsSceneCounter;
12 
13  LEVIATHAN_ASSERT(BsSceneCounter < 32, "ran out of bsf scene bits");
14 
15  BsScene = BsSceneCounter;
16 
17  RootNode = SceneNode::pointer(new SceneNode(bs::SceneObject::create("fake_root"), this));
18 }
A node in the Scene used to position renderables and other SceneNodes.
Definition: SceneNode.h:70
#define LEVIATHAN_ASSERT(x, msg)
Definition: Define.h:100

Member Function Documentation

◆ CreateSceneNode()

DLLEXPORT SceneNode::pointer Scene::CreateSceneNode ( )

Creates a new SceneNode as a child of the root node.

Definition at line 20 of file Scene.cpp.

21 {
22  SceneNode::pointer created(new SceneNode(RootNode.get(), this));
23 
24  if(created)
25  created->Release();
26 
27  // LEVIATHAN_ASSERT(RootNode->HasChild(created.get()), "node not attached to root");
28 
29  return created;
30 }
A node in the Scene used to position renderables and other SceneNodes.
Definition: SceneNode.h:70

◆ DestroySceneNode()

DLLEXPORT void Scene::DestroySceneNode ( SceneNode::pointer &  node)

"Destroys" a previously created SceneNode

The node is detached from the scene and its rendering resources are destroyed

Definition at line 32 of file Scene.cpp.

33 {
34  if(!node)
35  return;
36 
37  node->DetachFromParent();
38 
39  if(node->GetInternal())
40  node->GetInternal()->destroy();
41 
42  node.reset();
43 }

◆ GetInternal()

int Leviathan::Scene::GetInternal ( )
inline

Definition at line 38 of file Scene.h.

39  {
40  return BsScene;
41  }

◆ GetRootSceneNode()

SceneNode::pointer Leviathan::Scene::GetRootSceneNode ( )
inline

Definition at line 33 of file Scene.h.

34  {
35  return RootNode;
36  }

◆ GetRootSceneNodeWrapper()

SceneNode* Leviathan::Scene::GetRootSceneNodeWrapper ( )
inline

Definition at line 43 of file Scene.h.

44  {
45  if(RootNode)
46  RootNode->AddRef();
47  return RootNode.get();
48  }

◆ PrepareForRendering()

DLLEXPORT void Scene::PrepareForRendering ( )

Computes the final positions of all SceneNodes to be ready for rendering.

Definition at line 45 of file Scene.cpp.

46 {
47  RootNode->PrepareToRender();
48 }

◆ REFERENCE_COUNTED_PTR_TYPE()

Leviathan::Scene::REFERENCE_COUNTED_PTR_TYPE ( Scene  )

Member Data Documentation

◆ ReferenceCounted

friend Leviathan::Scene::ReferenceCounted
protected

Definition at line 15 of file Scene.h.


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