Lysa Nodes  0.0
Lysa Nodes — Scene Graph for the Lysa Engine
SceneTree Class Reference

Detailed Description

A scene tree representing a hierarchy of nodes.

+ Inheritance diagram for SceneTree:

Public Member Functions

 SceneTree (const SceneConfiguration &sceneConfiguration={})
 
 SceneTree (const RenderingWindow &renderingWindow, const SceneConfiguration &sceneConfiguration={})
 
 ~SceneTree () override
 
void attach (const RenderingWindow &renderingWindow)
 
void attach (const RenderTarget &renderTarget)
 
void detach ()
 
void setCamera (const lysa::Camera &camera)
 
void setViewport (const vireo::Viewport &viewport)
 
void setScissors (const vireo::Rect &scissors)
 
virtual void onReady ()
 
virtual void onPhysicsProcess (double delta)
 
virtual void onProcess (double alpha)
 
virtual bool onInput (const InputEvent &event)
 
virtual void onResize (const vireo::Extent &extent)
 
virtual void onPause ()
 
virtual void onResume ()
 
virtual void onAttach ()
 
virtual void onDetach ()
 
template<typename T = Node>
const std::shared_ptr< T > & addChild (const std::shared_ptr< T > &child, const bool async=false)
 
template<typename T = Node>
bool removeChild (const std::shared_ptr< T > &child)
 
template<typename T >
bool haveChild (const std::shared_ptr< T > &child, const bool recursive=true) const
 
bool isPaused () const
 
void setPaused (bool paused)
 
bool isAttached () const
 
bool isAttachedToWindow () const
 
RenderTarget & getRenderTarget () const
 
RenderingWindow & getRenderingWindow () const
 
void setLuaThis () override
 

Protected Attributes

MaterialManager & materialManager
 Material resource manager shared with the engine context. More...
 
MeshManager & meshManager
 Mesh resource manager shared with the engine context. More...
 
ImageManager & imageManager
 Image (texture) resource manager shared with the engine context. More...
 

Constructor & Destructor Documentation

SceneTree ( const SceneConfiguration &  sceneConfiguration = {})

Default constructor

Parameters
sceneConfigurationThe configuration for the scene
SceneTree ( const RenderingWindow &  renderingWindow,
const SceneConfiguration &  sceneConfiguration = {} 
)

Constructor that attaches the scene tree to a rendering window

Parameters
renderingWindowThe window to attach to
sceneConfigurationThe configuration for the scene
~SceneTree ( )
override

Member Function Documentation

const std::shared_ptr<T>& addChild ( const std::shared_ptr< T > &  child,
const bool  async = false 
)
inline

Adds a child node to the scene tree

Template Parameters
TThe type of the child node
Parameters
childThe child node to add
asyncWhether to add the child asynchronously
Returns
A reference to the added child
void attach ( const RenderingWindow &  renderingWindow)

Attaches the scene tree to a rendering window

void attach ( const RenderTarget &  renderTarget)

Attaches the scene tree to a render target

void detach ( )

Detaches the scene tree from its current render target & window

RenderingWindow& getRenderingWindow ( ) const
inline

Returns the rendering window the scene tree is attached to

RenderTarget& getRenderTarget ( ) const
inline

Returns the render target the scene tree is attached to

bool haveChild ( const std::shared_ptr< T > &  child,
const bool  recursive = true 
) const
inline

Checks if the scene tree has a specific child node

Template Parameters
TThe type of the child node
Parameters
childThe child node to check for
recursiveWhether to search recursively
Returns
True if the child exists
bool isAttached ( ) const
inline

Returns whether the scene tree is attached to a render target

bool isAttachedToWindow ( ) const
inline

Returns whether the scene tree is attached to a rendering window

bool isPaused ( ) const
inline

Returns whether the scene tree is paused

virtual void onAttach ( )
inlinevirtual

Called when the scene tree is attached

virtual void onDetach ( )
inlinevirtual

Called when the scene tree is detached

virtual bool onInput ( const InputEvent &  event)
inlinevirtual

Called when an input event occurs

Parameters
eventThe input event
Returns
True if the event was handled
virtual void onPause ( )
inlinevirtual

Called when the scene tree is paused

virtual void onPhysicsProcess ( double  delta)
inlinevirtual

Called during the physics process step

Parameters
deltaThe time delta since the last physics step
virtual void onProcess ( double  alpha)
inlinevirtual

Called during the process step

Parameters
alphaThe interpolated alpha
virtual void onReady ( )
inlinevirtual

Called when the scene tree is ready

virtual void onResize ( const vireo::Extent &  extent)
inlinevirtual

Called when the viewport is resized

virtual void onResume ( )
inlinevirtual

Called when the scene tree is resumed

bool removeChild ( const std::shared_ptr< T > &  child)
inline

Removes a child node from the scene tree

Template Parameters
TThe type of the child node
Parameters
childThe child node to remove
asyncWhether to remove the child asynchronously
Returns
True if the child was removed
void setCamera ( const lysa::Camera &  camera)

Sets the camera for the scene tree

void setLuaThis ( )
override
void setPaused ( bool  paused)

Sets whether the scene tree is paused

void setScissors ( const vireo::Rect &  scissors)

Sets the scissors for the scene tree

void setViewport ( const vireo::Viewport &  viewport)

Sets the viewport for the scene tree

Member Data Documentation

ImageManager& imageManager
protected

Image (texture) resource manager shared with the engine context.

MaterialManager& materialManager
protected

Material resource manager shared with the engine context.

MeshManager& meshManager
protected

Mesh resource manager shared with the engine context.