24 #ifdef SL_USE_ENTITIES
42 _frameTimesMS(60, 0.0f),
43 _updateTimesMS(60, 0.0f),
44 _updateAABBTimesMS(60, 0.0f),
45 _updateAnimTimesMS(60, 0.0f),
46 _updateDODTimesMS(60, 0.0f)
67 SL_LOG_DEBUG(
"------------------------------------------------------------------");
74 assert(am &&
"No asset manager passed to scene");
126 bool forceCPUSkinning)
142 if (averagedFrameTimeMS > 0.001f)
149 SLbool sceneHasChanged =
false;
168 if (renderTypeIsRT || voxelsAreShown)
169 forceCPUSkinning =
true;
175 for (
auto* node : nodes)
176 node->needAABBUpdate(); });
178 if (renderTypeIsRT || voxelsAreShown)
197 #ifdef SL_USE_ENTITIES
202 entities.updateWMRec(0, root);
212 return sceneHasChanged;
237 if (!nodeToSelect && !meshToSelect)
245 SL_LOG(
"Node is not selectable: %s", nodeToSelect->
name().c_str());
250 if (!nodeToSelect && meshToSelect)
251 SL_EXIT_MSG(
"SLScene::selectNodeMesh: No node or mesh to select.");
259 if (nodeToSelect && !meshToSelect)
296 if (foundNode ==
_selectedNodes.end() && *foundMesh == meshToSelect)
307 if (nodeToSelect && *foundNode == nodeToSelect && *foundMesh == meshToSelect)
310 bool otherMeshIsSelected =
false;
315 if (nm ==
sm && nm != meshToSelect)
317 otherMeshIsSelected =
true;
323 if (!otherMeshIsSelected)
334 SL_EXIT_MSG(
"SLScene::selectNodeMesh: We should not get here.");
341 sn->isSelected(
false);
346 sm->deselectPartialSelection();
347 sm->isSelected(
false);
357 return (
SLint)cams.size();
367 if (cams.empty())
return nullptr;
368 if (cams.size() == 1)
return cams[0];
370 SLint activeIndex = 0;
371 for (
SLulong i = 0; i < cams.size(); ++i)
373 if (cams[i] == activeSVCam)
375 activeIndex = (
SLint)i;
384 activeIndex = activeIndex > cams.size() - 2 ? 0 : ++activeIndex;
386 !
dynamic_cast<SLKeyframeCamera*
>(cams[(uint)activeIndex])->allowAsActiveCam());
388 return cams[(uint)activeIndex];
393 _oculus = std::make_unique<SLGLOculus>(shaderDir);
#define PROFILE_FUNCTION()
#define SL_LOG_DEBUG(...)
#define SL_EXIT_MSG(message)
#define SL_DB_NOTSELECTABLE
Flags an object as selected.
deque< SLNode * > SLVNode
SLVNode typedef for a vector of SLNodes.
void clear()
Clears and deletes all node animations and skeletons.
SLbool update(SLfloat elapsedTimeSec)
Advances the time of all enabled animation plays.
Toplevel holder of the assets meshes, materials, textures and shaders.
Active or visible camera node class.
Scenegraph in Data Oriented Design with flat std::vector of SLEntity.
static SLfloat gamma
final output gamma value
static SLCol4f globalAmbient
static global ambient light intensity
Global default color attribute material for meshes that have colors per vertex.
static SLMaterialDefaultColorAttribute * _instance
Global default gray color material for meshes that don't define their own.
static SLMaterialDefaultGray * _instance
An SLMesh object is a triangulated mesh, drawn with one draw call.
void deselectPartialSelection()
SLbool isSelected() const
SLNode represents a node in a hierarchical scene graph.
bool updateMeshSkins(bool forceCPUSkinning, const std::function< void(SLMesh *)> &cbInformNodes)
Update all skinned meshes recursively.
SLbool drawBit(SLuint bit)
static SLuint numWMUpdates
NO. of calls to updateWMRec per frame.
void isSelected(bool isSelected)
void updateMeshAccelStructs()
virtual SLAABBox & updateAABBRec(SLbool updateAlsoAABBinOS)
deque< T * > findChildren(const SLstring &name="", SLbool findRecursive=true, SLbool canContain=false)
Base class for all other classes.
void name(const SLstring &Name)
SLVNode _selectedNodes
Vector of selected nodes. See SLMesh::selectNodeMesh.
SLVLight _lights
Vector of all lights.
SLbool _stopAnimations
Global flag for stopping all animations.
std::unique_ptr< SLGLOculus > _oculus
Oculus Rift interface.
bool onUpdate(bool renderTypeIsRT, bool voxelsAreShown, bool forceCPUSkinning)
Updates animations and AABBs.
SLSkybox * _skybox
pointer to skybox
void deselectAllNodesAndMeshes()
Deselects all nodes and its meshes.
AvgFloat _frameTimesMS
Averaged total time per frame in ms.
SLfloat _frameTimeMS
Last frame time in ms.
SLCamera * nextCameraInScene(SLCamera *activeSVCam)
Returns the next camera in the scene if there is one.
SLint numSceneCameras()
Returns the number of camera nodes in the scene.
AvgFloat _updateDODTimesMS
Averaged time for update the SLEntities graph.
SLNode * _root3D
Root node for 3D scene.
SLAssetManager * _assetManager
Pointer to the external assetManager.
SLVMesh _selectedMeshes
Vector of selected meshes. See SLMesh::selectNodeMesh.
void initOculus(SLstring shaderDir)
SLstring _info
scene info string
SLfloat _fps
Averaged no. of frames per second.
void selectNodeMesh(SLNode *nodeToSelect, SLMesh *meshToSelect)
Handles the full mesh selection from double-clicks.
AvgFloat _updateAABBTimesMS
Averaged time for update the nodes AABB in ms.
SLVEventHandler _eventHandlers
Vector of all event handler.
SLScene(const SLstring &name)
SLNode * _root2D
Root node for 2D scene displayed in ortho projection.
SLfloat _lastUpdateTimeMS
Last time after update in ms.
SLfloat elapsedTimeSec() const
AvgFloat _updateAnimTimesMS
Averaged time for update the animations in ms.
SLAnimManager _animManager
Animation manager instance.
AvgFloat _updateTimesMS
Averaged time for update in ms.
void init(SLAssetManager *am)
void set(const T X, const T Y, const T Z, const T W=1)
void init(int numValues, T initValue)
Initializes the average value array to a given value.
void set(T value)
Sets the current value in the value array and builds the average.
Collection of classes for a state machine implementation used in the Erleb-AR app.