SLProject 4.0.000
|
The SLScene class represents the top level instance holding the scene structure. More...
#include <SLScene.h>
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) |
SLAnimManager & | animManager () |
SLAssetManager * | assetManager () |
SLNode * | root3D () |
SLNode * | root2D () |
SLSkybox * | skybox () |
SLstring & | info () |
SLfloat | elapsedTimeMS () const |
SLfloat | elapsedTimeSec () const |
SLVEventHandler & | eventHandlers () |
SLfloat | loadTimeMS () const |
SLVLight & | lights () |
SLfloat | fps () const |
AvgFloat & | frameTimesMS () |
AvgFloat & | updateTimesMS () |
AvgFloat & | updateAnimTimesMS () |
AvgFloat & | updateAABBTimesMS () |
AvgFloat & | updateDODTimesMS () |
SLNode * | singleNodeSelected () |
Returns the node if only one is selected. See also SLMesh::selectNodeMesh. More... | |
SLMesh * | singleMeshFullSelected () |
Returns the node if only one is selected. See also SLMesh::selectNodeMesh. More... | |
SLVNode & | selectedNodes () |
SLVMesh & | selectedMeshes () |
SLbool | stopAnimations () const |
SLint | numSceneCameras () |
Returns the number of camera nodes in the scene. More... | |
SLCamera * | nextCameraInScene (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... | |
SLGLOculus * | oculus () |
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 SLstring & | name () const |
const SLstring & | url () 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 |
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.
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:
|
override |
The destructor does the final total deallocation of all global resources. The destructor is called in slTerminate.
|
inline |
|
inline |
void SLScene::deselectAllNodesAndMeshes | ( | ) |
Deselects all nodes and its meshes.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void SLScene::init | ( | SLAssetManager * | am | ) |
The scene init is called before a new scene is assembled.
void SLScene::initOculus | ( | SLstring | shaderDir | ) |
|
inline |
|
inline |
|
inline |
Returns the next camera in the scene if there is one.
SLint SLScene::numSceneCameras | ( | ) |
Returns the number of camera nodes in the scene.
|
inline |
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
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
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.
|
inline |
Returns the node if only one is selected. See also SLMesh::selectNodeMesh.
|
inline |
Returns the node if only one is selected. See also SLMesh::selectNodeMesh.
|
inline |
|
inline |
|
inline |
|
inline |
|
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.
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
|
protected |
Animation manager instance.
|
protected |
Pointer to the external assetManager.
|
protected |
Vector of all event handler.
|
protected |
Averaged no. of frames per second.
|
protected |
Last frame time in ms.
|
protected |
Averaged total time per frame in ms.
|
protected |
scene info string
|
protected |
Last time after update in ms.
|
protected |
Vector of all lights.
|
protected |
time to load scene in ms
|
protected |
Oculus Rift interface.
|
protected |
Root node for 2D scene displayed in ortho projection.
|
protected |
Root node for 3D scene.
|
protected |
Vector of selected meshes. See SLMesh::selectNodeMesh.
|
protected |
Vector of selected nodes. See SLMesh::selectNodeMesh.
|
protected |
pointer to skybox
|
protected |
Global flag for stopping all animations.
|
protected |
Averaged time for update the nodes AABB in ms.
|
protected |
Averaged time for update the animations in ms.
|
protected |
Averaged time for update the SLEntities graph.
|
protected |
Averaged time for update in ms.
cbOnSceneLoad SLScene::onLoad |
C-Callback for scene load.