SLProject 4.0.000
SLScene Class Reference

The SLScene class represents the top level instance holding the scene structure. More...

#include <SLScene.h>

Inheritance diagram for SLScene:
[legend]

Public Member Functions

 SLScene (const SLstring &name, cbOnSceneLoad onSceneLoadCallback)
 
 ~SLScene () override
 
void initOculus (SLstring shaderDir)
 
void root3D (SLNode *root3D)
 
void root2D (SLNode *root2D)
 
void skybox (SLSkybox *skybox)
 
void stopAnimations (SLbool stop)
 
void info (SLstring i)
 
void loadTimeMS (SLfloat loadTimeMS)
 
SLAnimManageranimManager ()
 
SLAssetManagerassetManager ()
 
SLNoderoot3D ()
 
SLNoderoot2D ()
 
SLSkyboxskybox ()
 
SLstringinfo ()
 
SLfloat elapsedTimeMS () const
 
SLfloat elapsedTimeSec () const
 
SLVEventHandlereventHandlers ()
 
SLfloat loadTimeMS () const
 
SLVLightlights ()
 
SLfloat fps () const
 
AvgFloatframeTimesMS ()
 
AvgFloatupdateTimesMS ()
 
AvgFloatupdateAnimTimesMS ()
 
AvgFloatupdateAABBTimesMS ()
 
AvgFloatupdateDODTimesMS ()
 
SLNodesingleNodeSelected ()
 Returns the node if only one is selected. See also SLMesh::selectNodeMesh. More...
 
SLMeshsingleMeshFullSelected ()
 Returns the node if only one is selected. See also SLMesh::selectNodeMesh. More...
 
SLVNodeselectedNodes ()
 
SLVMeshselectedMeshes ()
 
SLbool stopAnimations () const
 
SLint numSceneCameras ()
 Returns the number of camera nodes in the scene. More...
 
SLCameranextCameraInScene (SLCamera *activeSVCam)
 Returns the next camera in the scene if there is one. More...
 
bool onUpdate (bool renderTypeIsRT, bool voxelsAreShown)
 Updates animations and AABBs. More...
 
void init (SLAssetManager *am)
 
virtual void unInit ()
 
void selectNodeMesh (SLNode *nodeToSelect, SLMesh *meshToSelect)
 Handles the full mesh selection from double-clicks. More...
 
void deselectAllNodesAndMeshes ()
 Deselects all nodes and its meshes. More...
 
SLGLOculusoculus ()
 
- Public Member Functions inherited from SLObject
 SLObject (const SLstring &Name="", const SLstring &url="")
 
virtual ~SLObject ()
 
void name (const SLstring &Name)
 
void url (const SLstring &url)
 
const SLstringname () const
 
const SLstringurl () const
 

Public Attributes

cbOnSceneLoad onLoad
 C-Callback for scene load. More...
 

Protected Attributes

SLVLight _lights
 Vector of all lights. More...
 
SLVEventHandler _eventHandlers
 Vector of all event handler. More...
 
SLAnimManager _animManager
 Animation manager instance. More...
 
SLAssetManager_assetManager
 Pointer to the external assetManager. More...
 
SLNode_root3D
 Root node for 3D scene. More...
 
SLNode_root2D
 Root node for 2D scene displayed in ortho projection. More...
 
SLSkybox_skybox
 pointer to skybox More...
 
SLstring _info
 scene info string More...
 
SLVNode _selectedNodes
 Vector of selected nodes. See SLMesh::selectNodeMesh. More...
 
SLVMesh _selectedMeshes
 Vector of selected meshes. See SLMesh::selectNodeMesh. More...
 
SLfloat _loadTimeMS
 time to load scene in ms More...
 
SLfloat _frameTimeMS
 Last frame time in ms. More...
 
SLfloat _lastUpdateTimeMS
 Last time after update in ms. More...
 
SLfloat _fps
 Averaged no. of frames per second. More...
 
AvgFloat _frameTimesMS
 Averaged total time per frame in ms. More...
 
AvgFloat _updateTimesMS
 Averaged time for update in ms. More...
 
AvgFloat _updateAABBTimesMS
 Averaged time for update the nodes AABB in ms. More...
 
AvgFloat _updateAnimTimesMS
 Averaged time for update the animations in ms. More...
 
AvgFloat _updateDODTimesMS
 Averaged time for update the SLEntities graph. More...
 
SLbool _stopAnimations
 Global flag for stopping all animations. More...
 
std::unique_ptr< SLGLOculus_oculus
 Oculus Rift interface. More...
 
- Protected Attributes inherited from SLObject
SLstring _name
 name of an object More...
 
SLstring _url
 uniform resource locator More...
 

Friends

class SLNode
 

Detailed Description

The SLScene class represents the top level instance holding the scene structure.

The SLScene class holds everything that is common for all scene views such as the root pointer (_root3D) to the scene, an array of lights as well as the global resources (_meshes (SLMesh), _materials (SLMaterial), _textures (SLGLTexture) and _shaderProgs (SLGLProgram)). All these resources and the scene with all nodes to which _root3D pointer points get deleted in the method unInit.
A scene could have multiple scene views. A pointer of each is stored in the vector _sceneViews.
The scene assembly takes place outside of the library in function of the application. A pointer for this function must be passed to the SLScene constructor. For the demo project this function is in AppDemoSceneLoad.cpp.

Constructor & Destructor Documentation

◆ SLScene()

SLScene::SLScene ( const SLstring name,
cbOnSceneLoad  onSceneLoadCallback 
)

The constructor of the scene. There will be only one scene for an application and it gets constructed in the C-interface function slCreateScene in SLInterface.cpp that is called by the platform and UI-toolkit dependent window initialization. As examples you can see it in:

  • app_demo_slproject/glfw: glfwMain.cpp in function main()
  • app-Demo-SLProject/android: Java_ch_fhnw_comgRT_glES2Lib_onInit()
  • app_demo_slproject/ios: ViewController.m in method viewDidLoad()
  • _old/app-Demo-Qt: qtGLWidget::initializeGL()
  • _old/app-Viewer-Qt: qtGLWidget::initializeGL()

◆ ~SLScene()

SLScene::~SLScene ( )
override

The destructor does the final total deallocation of all global resources. The destructor is called in slTerminate.

Member Function Documentation

◆ animManager()

SLAnimManager & SLScene::animManager ( )
inline

◆ assetManager()

SLAssetManager * SLScene::assetManager ( )
inline

◆ deselectAllNodesAndMeshes()

void SLScene::deselectAllNodesAndMeshes ( )

Deselects all nodes and its meshes.

◆ elapsedTimeMS()

SLfloat SLScene::elapsedTimeMS ( ) const
inline

◆ elapsedTimeSec()

SLfloat SLScene::elapsedTimeSec ( ) const
inline

◆ eventHandlers()

SLVEventHandler & SLScene::eventHandlers ( )
inline

◆ fps()

SLfloat SLScene::fps ( ) const
inline

◆ frameTimesMS()

AvgFloat & SLScene::frameTimesMS ( )
inline

◆ info() [1/2]

SLstring & SLScene::info ( )
inline

◆ info() [2/2]

void SLScene::info ( SLstring  i)
inline

◆ init()

void SLScene::init ( SLAssetManager am)

The scene init is called before a new scene is assembled.

◆ initOculus()

void SLScene::initOculus ( SLstring  shaderDir)

◆ lights()

SLVLight & SLScene::lights ( )
inline

◆ loadTimeMS() [1/2]

SLfloat SLScene::loadTimeMS ( ) const
inline

◆ loadTimeMS() [2/2]

void SLScene::loadTimeMS ( SLfloat  loadTimeMS)
inline

◆ nextCameraInScene()

SLCamera * SLScene::nextCameraInScene ( SLCamera activeSVCam)

Returns the next camera in the scene if there is one.

◆ numSceneCameras()

SLint SLScene::numSceneCameras ( )

Returns the number of camera nodes in the scene.

◆ oculus()

SLGLOculus * SLScene::oculus ( )
inline

◆ onUpdate()

bool SLScene::onUpdate ( bool  renderTypeIsRT,
bool  voxelsAreShown 
)

Updates animations and AABBs.

Updates different updatables in the scene after all views got painted:
1) Calculate frame time
2) Update all animations
3) Update AABBs

Returns
true if really something got updated

◆ root2D() [1/2]

SLNode * SLScene::root2D ( )
inline

◆ root2D() [2/2]

void SLScene::root2D ( SLNode root2D)
inline

◆ root3D() [1/2]

SLNode * SLScene::root3D ( )
inline

◆ root3D() [2/2]

void SLScene::root3D ( SLNode root3D)
inline

◆ selectedMeshes()

SLVMesh & SLScene::selectedMeshes ( )
inline

◆ selectedNodes()

SLVNode & SLScene::selectedNodes ( )
inline

◆ selectNodeMesh()

void SLScene::selectNodeMesh ( SLNode nodeToSelect,
SLMesh meshToSelect 
)

Handles the full mesh selection from double-clicks.

There are two different selection modes: Full or partial mesh selection.
The full selection is done by double-clicking a mesh. Multiple meshes can be selected with SHIFT-double-clicking. The full selection is handled in SLScene::selectNodeMesh. The selected nodes are stored in SLScene::_selectedNodes and the fully or partially selected meshes are stored in SLScene::_selectedMeshes. The SLNode::isSelected and SLMesh::isSelected show if a node or mesh is selected. A node can be selected with or without a mesh. If a mesh is selected, its node is always also selected. A node without mesh can only be selected in the scenegraph window. To avoid a node from selection you can set its drawing bit SL_DB_NOTSELECTABLE. You should transform a node or mesh and show the properties of a node or mesh if only a single node and single full mesh is selected. To get them call SLScene::singleNodeSelected() or SLScene::singleMeshFullSelected().
For partial mesh selection see SLMesh::handleRectangleSelection.

◆ singleMeshFullSelected()

SLMesh * SLScene::singleMeshFullSelected ( )
inline

Returns the node if only one is selected. See also SLMesh::selectNodeMesh.

◆ singleNodeSelected()

SLNode * SLScene::singleNodeSelected ( )
inline

Returns the node if only one is selected. See also SLMesh::selectNodeMesh.

◆ skybox() [1/2]

SLSkybox * SLScene::skybox ( )
inline

◆ skybox() [2/2]

void SLScene::skybox ( SLSkybox skybox)
inline

◆ stopAnimations() [1/2]

SLbool SLScene::stopAnimations ( ) const
inline

◆ stopAnimations() [2/2]

void SLScene::stopAnimations ( SLbool  stop)
inline

◆ unInit()

void SLScene::unInit ( )
virtual

The scene uninitializing clears the scenegraph (_root3D) and all global global resources such as materials, textures & custom shaders loaded with the scene. The standard shaders, the fonts and the 2D-GUI elements remain. They are destructed at process end.

◆ updateAABBTimesMS()

AvgFloat & SLScene::updateAABBTimesMS ( )
inline

◆ updateAnimTimesMS()

AvgFloat & SLScene::updateAnimTimesMS ( )
inline

◆ updateDODTimesMS()

AvgFloat & SLScene::updateDODTimesMS ( )
inline

◆ updateTimesMS()

AvgFloat & SLScene::updateTimesMS ( )
inline

Friends And Related Function Documentation

◆ SLNode

friend class SLNode
friend

Member Data Documentation

◆ _animManager

SLAnimManager SLScene::_animManager
protected

Animation manager instance.

◆ _assetManager

SLAssetManager* SLScene::_assetManager
protected

Pointer to the external assetManager.

◆ _eventHandlers

SLVEventHandler SLScene::_eventHandlers
protected

Vector of all event handler.

◆ _fps

SLfloat SLScene::_fps
protected

Averaged no. of frames per second.

◆ _frameTimeMS

SLfloat SLScene::_frameTimeMS
protected

Last frame time in ms.

◆ _frameTimesMS

AvgFloat SLScene::_frameTimesMS
protected

Averaged total time per frame in ms.

◆ _info

SLstring SLScene::_info
protected

scene info string

◆ _lastUpdateTimeMS

SLfloat SLScene::_lastUpdateTimeMS
protected

Last time after update in ms.

◆ _lights

SLVLight SLScene::_lights
protected

Vector of all lights.

◆ _loadTimeMS

SLfloat SLScene::_loadTimeMS
protected

time to load scene in ms

◆ _oculus

std::unique_ptr<SLGLOculus> SLScene::_oculus
protected

Oculus Rift interface.

◆ _root2D

SLNode* SLScene::_root2D
protected

Root node for 2D scene displayed in ortho projection.

◆ _root3D

SLNode* SLScene::_root3D
protected

Root node for 3D scene.

◆ _selectedMeshes

SLVMesh SLScene::_selectedMeshes
protected

Vector of selected meshes. See SLMesh::selectNodeMesh.

◆ _selectedNodes

SLVNode SLScene::_selectedNodes
protected

Vector of selected nodes. See SLMesh::selectNodeMesh.

◆ _skybox

SLSkybox* SLScene::_skybox
protected

pointer to skybox

◆ _stopAnimations

SLbool SLScene::_stopAnimations
protected

Global flag for stopping all animations.

◆ _updateAABBTimesMS

AvgFloat SLScene::_updateAABBTimesMS
protected

Averaged time for update the nodes AABB in ms.

◆ _updateAnimTimesMS

AvgFloat SLScene::_updateAnimTimesMS
protected

Averaged time for update the animations in ms.

◆ _updateDODTimesMS

AvgFloat SLScene::_updateDODTimesMS
protected

Averaged time for update the SLEntities graph.

◆ _updateTimesMS

AvgFloat SLScene::_updateTimesMS
protected

Averaged time for update in ms.

◆ onLoad

cbOnSceneLoad SLScene::onLoad

C-Callback for scene load.


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