SLProject 4.0.000
SLNode Class Reference

SLNode represents a node in a hierarchical scene graph. More...

#include <SLNode.h>

Inheritance diagram for SLNode:
[legend]

Public Member Functions

 SLNode (const SLstring &name="Node")
 
 SLNode (SLMesh *mesh, const SLstring &name="Node")
 
 SLNode (SLMesh *mesh, const SLVec3f &translation, const SLstring &name)
 
 ~SLNode () override
 
virtual void cull3DRec (SLSceneView *sv)
 
virtual void cullChildren3D (SLSceneView *sv)
 
virtual void cull2DRec (SLSceneView *sv)
 
virtual bool hitRec (SLRay *ray)
 
virtual void statsRec (SLNodeStats &stats)
 
virtual SLNodecopyRec ()
 
virtual SLAABBoxupdateAABBRec (SLbool updateAlsoAABBinOS)
 
virtual void dumpRec ()
 
void setDrawBitsRec (SLuint bit, SLbool state)
 
void setPrimitiveTypeRec (SLGLPrimitiveType primitiveType)
 
virtual void addMesh (SLMesh *mesh)
 
virtual void drawMesh (SLSceneView *sv)
 Draws the single mesh. More...
 
bool removeMesh ()
 Returns true if a mesh was assigned and set it to nullptr. More...
 
bool removeMesh (SLMesh *mesh)
 Returns true if the passed mesh was assigned and sets it to nullptr. More...
 
SLint numChildren ()
 
void addChild (SLNode *child)
 
bool insertChild (SLNode *insertC, SLNode *afterC)
 
void deleteChildren ()
 
bool deleteChild ()
 
bool deleteChild (SLNode *child)
 
bool deleteChild (const SLstring &name)
 
bool removeChild (SLNode *child)
 remove child from vector of children. Removes false if not found, else true. More...
 
template<typename T >
T * find (const SLstring &name="", SLbool findRecursive=true)
 
template<typename T >
T * findChild (const SLstring &name="", SLbool findRecursive=true)
 
template<typename T >
deque< T * > findChildren (const SLstring &name="", SLbool findRecursive=true, SLbool canContain=false)
 
deque< SLNode * > findChildren (const SLMesh *mesh, SLbool findRecursive=true)
 
deque< SLNode * > findChildren (SLuint drawbit, SLbool findRecursive=true)
 
SLVec3f translationOS () const
 
SLVec3f forwardOS () const
 
SLVec3f rightOS () const
 
SLVec3f upOS () const
 
SLVec3f axisXOS () const
 
SLVec3f axisYOS () const
 
SLVec3f axisZOS () const
 
SLVec3f translationWS () const
 
SLVec3f forwardWS () const
 
SLVec3f rightWS () const
 
SLVec3f upWS () const
 
SLVec3f axisXWS () const
 
SLVec3f axisYWS () const
 
SLVec3f axisZWS () const
 
void translation (const SLVec3f &pos, SLTransformSpace relativeTo=TS_parent)
 
void translation (SLfloat x, SLfloat y, SLfloat z, SLTransformSpace relativeTo=TS_parent)
 
void rotation (const SLQuat4f &rot, SLTransformSpace relativeTo=TS_parent)
 
void rotation (SLfloat angleDeg, const SLVec3f &axis, SLTransformSpace relativeTo=TS_parent)
 
void scaling (SLfloat s)
 
void scaling (SLfloat x, SLfloat y, SLfloat z)
 
void scaling (const SLVec3f &scaling)
 
void lookAt (SLfloat targetX, SLfloat targetY, SLfloat targetZ, SLfloat upX=0, SLfloat upY=1, SLfloat upZ=0, SLTransformSpace relativeTo=TS_world)
 
void lookAt (const SLVec3f &target, const SLVec3f &up=SLVec3f::AXISY, SLTransformSpace relativeTo=TS_world)
 
void translate (const SLVec3f &vec, SLTransformSpace relativeTo=TS_object)
 
void translate (SLfloat x, SLfloat y, SLfloat z, SLTransformSpace relativeTo=TS_object)
 
void rotate (const SLQuat4f &rot, SLTransformSpace relativeTo=TS_object)
 
void rotate (SLfloat angleDeg, const SLVec3f &axis, SLTransformSpace relativeTo=TS_object)
 
void rotate (SLfloat angleDeg, SLfloat x, SLfloat y, SLfloat z, SLTransformSpace relativeTo=TS_object)
 
void rotateAround (const SLVec3f &point, SLVec3f &axis, SLfloat angleDeg, SLTransformSpace relativeTo=TS_world)
 
void scale (SLfloat s)
 
void scale (SLfloat x, SLfloat y, SLfloat z)
 
void scale (const SLVec3f &scale)
 
void scaleToCenter (SLfloat maxDim)
 
void setInitialState ()
 
void resetToInitialState ()
 
void parent (SLNode *p)
 
void entityID (SLint entityID)
 
void om (const SLMat4f &mat)
 
void animation (SLAnimation *a)
 
void castsShadows (SLbool castsShadows)
 
virtual void needUpdate ()
 
void needWMUpdate ()
 
void needAABBUpdate ()
 
void isSelected (bool isSelected)
 
void minLodCoverage (SLfloat minLodCoverage)
 
void levelForSM (SLubyte lfsm)
 
void onUpdateCB (function< void()> callbackFunc)
 
SLNodeparent ()
 
SLint depth () const
 
SLint entityID () const
 
const SLMat4fom ()
 
const SLMat4finitialOM ()
 
const SLMat4fupdateAndGetWM () const
 
const SLMat4fupdateAndGetWMI () const
 
SLDrawBitsdrawBits ()
 
SLbool drawBit (SLuint bit)
 
SLAABBoxaabb ()
 
SLAnimationanimation ()
 
SLbool castsShadows ()
 
SLMeshmesh ()
 
SLVNodechildren ()
 
const SLAnimSkeletonskeleton ()
 Returns the first skeleton found in the meshes. More...
 
void updateRec ()
 
virtual void doUpdate ()
 
bool updateMeshSkins (const std::function< void(SLMesh *)> &cbInformNodes)
 Update all skinned meshes recursively. More...
 
void updateMeshAccelStructs ()
 
void updateMeshMat (std::function< void(SLMaterial *m)> setMat, bool recursive)
 Updates the mesh material recursively with a material lambda. More...
 
void setMeshMat (SLMaterial *mat, bool recursive)
 Set the mesh material recursively. More...
 
bool isSelected ()
 
SLfloat minLodCoverage ()
 
SLubyte levelForSM ()
 
- 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 Member Functions inherited from SLEventHandler
 SLEventHandler ()
 
virtual ~SLEventHandler ()
 
virtual SLbool onMouseDown (const SLMouseButton button, const SLint x, const SLint y, const SLKey mod)
 
virtual SLbool onMouseUp (const SLMouseButton button, const SLint x, const SLint y, const SLKey mod)
 
virtual SLbool onMouseMove (const SLMouseButton button, const SLint x, const SLint y, const SLKey mod)
 
virtual SLbool onDoubleClick (const SLMouseButton button, const SLint x, const SLint y, const SLKey mod)
 
virtual SLbool onMouseWheel (const SLint delta, const SLKey mod)
 
virtual SLbool onTouch2Down (const SLint x1, const SLint y1, const SLint x2, const SLint y2)
 
virtual SLbool onTouch2Move (const SLint x1, const SLint y1, const SLint x2, const SLint y2)
 
virtual SLbool onTouch2Up (const SLint x1, const SLint y1, const SLint x2, const SLint y2)
 
virtual SLbool onTouch3Down (const SLint x1, const SLint y1)
 
virtual SLbool onTouch3Move (const SLint x1, const SLint y1)
 
virtual SLbool onTouch3Up (const SLint x1, const SLint y1)
 
virtual SLbool onKeyPress (const SLKey key, const SLKey mod)
 
virtual SLbool onKeyRelease (const SLKey key, const SLKey mod)
 
virtual SLbool onRotationPYR (const SLfloat pitchRAD, const SLfloat yawRAD, const SLfloat rollRAD)
 
void mouseRotationFactor (SLfloat rf)
 
SLfloat mouseRotationFactor ()
 

Static Public Attributes

static SLuint numWMUpdates = 0
 NO. of calls to updateWMRec per frame. More...
 
static unsigned int instanceIndex = 0
 ??? More...
 

Protected Attributes

SLNode_parent
 pointer to the parent node More...
 
SLVNode _children
 vector of children nodes More...
 
SLMesh_mesh
 pointer to a single mesh More...
 
SLint _depth
 depth of the node in a scene tree More...
 
SLint _entityID
 ID in the SLVEntity graph for Data Oriented Design. More...
 
SLMat4f _om
 object matrix for local transforms More...
 
SLMat4f _initialOM
 the initial om state More...
 
SLMat4f _wm
 world matrix for world transform More...
 
SLMat4f _wmI
 inverse world matrix More...
 
SLbool _isWMUpToDate
 is the WM of this node still valid More...
 
SLbool _isWMIUpToDate
 is the inverse WM of this node still valid More...
 
SLbool _isAABBUpToDate
 is the saved aabb still valid More...
 
bool _castsShadows
 flag if meshes of node should cast shadows More...
 
bool _isSelected
 flag if node and one or more of its meshes are selected More...
 
SLDrawBits _drawBits
 node level drawing flags More...
 
SLAABBox _aabb
 axis aligned bounding box More...
 
SLAnimation_animation
 animation of the node More...
 
SLfloat _minLodCoverage
 Min. LOD coverage for visibility (0.0 < _minLodCoverage < 1.0) More...
 
SLubyte _levelForSM
 Level of LOD to use for shadow mapping (0 = the visible one will be drawn) More...
 
function< void()> _onUpdateCB
 Optional lambda callback once per update. More...
 
- Protected Attributes inherited from SLObject
SLstring _name
 name of an object More...
 
SLstring _url
 uniform resource locator More...
 
- Protected Attributes inherited from SLEventHandler
SLfloat _mouseRotationFactor
 Mouse rotation sensibility. More...
 
SLfloat _keyboardDeltaPos
 Delta dist. for keyboard translation. More...
 

Private Member Functions

void updateWM () const
 
template<typename T >
void findChildrenHelper (const SLstring &name, deque< T * > &list, SLbool findRecursive, SLbool canContain=false)
 
void findChildrenHelper (const SLMesh *mesh, deque< SLNode * > &list, SLbool findRecursive)
 
void findChildrenHelper (SLuint drawbit, deque< SLNode * > &list, SLbool findRecursive)
 

Friends

class SLSceneView
 

Detailed Description

SLNode represents a node in a hierarchical scene graph.

SLNode is the most important building block of the scene graph. A node can have 0-N children nodes in the vector _children. With child nodes you can build hierarchical structures. A node without a mesh can act as parent node to group its children. A node without children only makes sense to hold a mesh for visualization. The pointer _parent points to the parent of a child node.

A node can point to a single SLMesh object for the rendering of triangles lines or points meshes. Meshes are stored in the SLAssetManager::_meshes vector. Multiple nodes can point to the same mesh object. The node is therefore not the owner of the meshes and does not delete them. The mesh is drawn by the methods SLNode::drawMesh and alternatively by SLNode::drawRec.

A node can be transformed and has therefore a object matrix (_om) for its local transform. All other matrices such as the world matrix (_wm), the inverse world matrix (_wmI) are derived from the object matrix and automatically generated and updated.

A node can be transformed by one of the various transform functions such as translate(). Many of these functions take an additional parameter 'relativeTo'. This parameter tells the transform function in what space the transformation should be applied in. The available transform spaces are:

  • TS_World: Space relative to the global world coordinate system.
  • TS_Parent: Space relative to our parent's transformation.
  • TS_Object: Space relative to our current node's origin.

A node can implement one of the event handlers defined in the inherited SLEventHandler interface. There is special node called SLTransformNode that acts as a visual gizmo for editing the transform. See the example in the menu Edit of the SLProject demo app.

The SLCamera is derived from the SLNode and implements a camera through which the scene can be viewed (see also SLSceneView). The SLLightSpot and SLLightRect are derived from SLNode and represent light sources in the scene. Cameras and lights can be placed in the scene because of their inheritance of SLNode.

Constructor & Destructor Documentation

◆ SLNode() [1/3]

SLNode::SLNode ( const SLstring name = "Node")
explicit

Default constructor just setting the name.

◆ SLNode() [2/3]

SLNode::SLNode ( SLMesh mesh,
const SLstring name = "Node" 
)
explicit

Constructor with a mesh pointer and name.

◆ SLNode() [3/3]

SLNode::SLNode ( SLMesh mesh,
const SLVec3f translation,
const SLstring name 
)
explicit

Constructor with a mesh pointer, translation vector and name.

◆ ~SLNode()

SLNode::~SLNode ( )
override

Destructor deletes all children recursively and the animation. The mesh is not deleted. Meshes get deleted at the end by the SLAssetManager vector. The entire scenegraph is deleted by deleting the SLScene::_root3D node. Nodes that are not in the scenegraph will not be deleted at scene destruction.

Member Function Documentation

◆ aabb()

SLAABBox * SLNode::aabb ( )
inline

◆ addChild()

void SLNode::addChild ( SLNode child)

Adds a child node to the children vector

◆ addMesh()

void SLNode::addMesh ( SLMesh mesh)
virtual

Simply adds a mesh to its mesh pointer vector of the node.

◆ animation() [1/2]

SLAnimation * SLNode::animation ( )
inline

◆ animation() [2/2]

void SLNode::animation ( SLAnimation a)
inline

◆ axisXOS()

SLVec3f SLNode::axisXOS ( ) const
inline

Returns the x-axis in object space

◆ axisXWS()

SLVec3f SLNode::axisXWS ( ) const
inline

Returns the x-axis in world space

◆ axisYOS()

SLVec3f SLNode::axisYOS ( ) const
inline

Returns the y-axis in object space

◆ axisYWS()

SLVec3f SLNode::axisYWS ( ) const
inline

Returns the y-axis in world space

◆ axisZOS()

SLVec3f SLNode::axisZOS ( ) const
inline

Returns the z-axis in object space

◆ axisZWS()

SLVec3f SLNode::axisZWS ( ) const
inline

Returns the z-axis in world space

◆ castsShadows() [1/2]

SLbool SLNode::castsShadows ( )
inline

◆ castsShadows() [2/2]

void SLNode::castsShadows ( SLbool  castsShadows)
inline

◆ children()

SLVNode & SLNode::children ( )
inline

◆ copyRec()

SLNode * SLNode::copyRec ( )
virtual

Returns a deep copy of the node and its children recursively. The meshes do not get copied.

◆ cull2DRec()

void SLNode::cull2DRec ( SLSceneView sv)
virtual

Does the 2D frustum culling. If a node is visible its mesh material is added to the SLSceneview::_visibleMaterials2D set and the node to the SLMaterials::nodesVisible2D vector. See also SLSceneView::draw3DGLAll for more details.

◆ cull3DRec()

void SLNode::cull3DRec ( SLSceneView sv)
virtual

Does the view frustum culling by checking whether the AABB is inside the 3D cameras view frustum. The check is done in world space. If a AABB is visible the nodes children are checked recursively. If a node is visible its mesh material is added to the SLSceneview::_visibleMaterials3D set and the node to the SLMaterials::nodesVisible3D vector. See also SLSceneView::draw3DGLAll for more details.

◆ cullChildren3D()

void SLNode::cullChildren3D ( SLSceneView sv)
virtual

Reimplemented in SLNodeLOD.

◆ deleteChild() [1/3]

bool SLNode::deleteChild ( )

Deletes the last child in the child vector.

◆ deleteChild() [2/3]

bool SLNode::deleteChild ( const SLstring name)

Searches for a child with the name 'name' and deletes it.

◆ deleteChild() [3/3]

bool SLNode::deleteChild ( SLNode child)

Deletes a child from the child vector.

◆ deleteChildren()

void SLNode::deleteChildren ( )

Deletes all child nodes.

◆ depth()

SLint SLNode::depth ( ) const
inline

◆ doUpdate()

virtual void SLNode::doUpdate ( )
inlinevirtual

Reimplemented in SLHorizonNode.

◆ drawBit()

SLbool SLNode::drawBit ( SLuint  bit)
inline

◆ drawBits()

SLDrawBits * SLNode::drawBits ( )
inline

◆ drawMesh()

void SLNode::drawMesh ( SLSceneView sv)
virtual

Draws the single mesh.

Inserts a mesh pointer in the mesh pointer vector after the specified afterM pointer.

Reimplemented in SLKeyframeCamera, SLCamera, SLLightDirect, SLLightRect, SLLightSpot, and SLText.

◆ dumpRec()

void SLNode::dumpRec ( )
virtual

Prints the node name with the names of the meshes recursively

◆ entityID() [1/2]

SLint SLNode::entityID ( ) const
inline

◆ entityID() [2/2]

void SLNode::entityID ( SLint  entityID)
inline

◆ find()

template<typename T >
T * SLNode::find ( const SLstring name = "",
SLbool  findRecursive = true 
)

SLNode::findChild<T> searches a node tree including the node by a given name.

◆ findChild()

template<typename T >
T * SLNode::findChild ( const SLstring name = "",
SLbool  findRecursive = true 
)

SLNode::findChild<T> finds the first child that is of type T or a subclass of T.

◆ findChildren() [1/3]

std::deque< SLNode * > SLNode::findChildren ( const SLMesh mesh,
SLbool  findRecursive = true 
)

Searches for all nodes that contain the provided mesh

◆ findChildren() [2/3]

template<typename T >
deque< T * > SLNode::findChildren ( const SLstring name = "",
SLbool  findRecursive = true,
SLbool  canContain = false 
)

SLNode::findChildren<T> finds a list of all children that are of type T or subclasses of T. If a name is specified only nodes with that name are included.

◆ findChildren() [3/3]

deque< SLNode * > SLNode::findChildren ( SLuint  drawbit,
SLbool  findRecursive = true 
)

Searches for all nodes that contain the provided mesh

◆ findChildrenHelper() [1/3]

void SLNode::findChildrenHelper ( const SLMesh mesh,
deque< SLNode * > &  list,
SLbool  findRecursive 
)
private

Helper function of findChildren for the passed mesh pointer

◆ findChildrenHelper() [2/3]

template<typename T >
void SLNode::findChildrenHelper ( const SLstring name,
deque< T * > &  list,
SLbool  findRecursive,
SLbool  canContain = false 
)
private

SLNode::findChildrenHelper<T> is the helper function for findChildren<T>. It appends all newly found children to 'list'.

◆ findChildrenHelper() [3/3]

void SLNode::findChildrenHelper ( SLuint  drawbit,
deque< SLNode * > &  list,
SLbool  findRecursive 
)
private

Helper function of findChildren for passed drawing bit

◆ forwardOS()

SLVec3f SLNode::forwardOS ( ) const
inline

Returns the local forward vector (= -z-axis) in a right-hand y-up system

◆ forwardWS()

SLVec3f SLNode::forwardWS ( ) const
inline

SLNode::forward returns worlds forward vector

◆ hitRec()

bool SLNode::hitRec ( SLRay ray)
virtual

Intersects the nodes meshes with the given ray. The intersection test is only done if the AABB is intersected. The ray-mesh intersection is done in the nodes object space. The rays origin and direction is therefore transformed into the object space.

Reimplemented in SLLightDirect, SLLightRect, SLLightSpot, and SLText.

◆ initialOM()

const SLMat4f & SLNode::initialOM ( )
inline

◆ insertChild()

bool SLNode::insertChild ( SLNode insertC,
SLNode afterC 
)

Inserts a child node in the children vector after the afterC node.

◆ isSelected() [1/2]

bool SLNode::isSelected ( )
inline

◆ isSelected() [2/2]

void SLNode::isSelected ( bool  isSelected)
inline

◆ levelForSM() [1/2]

SLubyte SLNode::levelForSM ( )
inline

◆ levelForSM() [2/2]

void SLNode::levelForSM ( SLubyte  lfsm)
inline

◆ lookAt() [1/2]

void SLNode::lookAt ( const SLVec3f target,
const SLVec3f up = SLVec3f::AXISY,
SLTransformSpace  relativeTo = TS_world 
)

Rotates the object so that it's forward vector is pointing towards the 'target' point. Default forward is -Z. The 'relativeTo' parameter defines in what space the 'target' parameter is to be interpreted in.

◆ lookAt() [2/2]

void SLNode::lookAt ( SLfloat  targetX,
SLfloat  targetY,
SLfloat  targetZ,
SLfloat  upX = 0,
SLfloat  upY = 1,
SLfloat  upZ = 0,
SLTransformSpace  relativeTo = TS_world 
)
inline

◆ mesh()

SLMesh * SLNode::mesh ( )
inline

◆ minLodCoverage() [1/2]

SLfloat SLNode::minLodCoverage ( )
inline

◆ minLodCoverage() [2/2]

void SLNode::minLodCoverage ( SLfloat  minLodCoverage)
inline

◆ needAABBUpdate()

void SLNode::needAABBUpdate ( )

Flags this node's AABB for an updateRec. If a node changed we need to updateRec it's world space AABB. This needs to also be propagated up the parent chain since the AABB of a node incorporates the AABB's of child nodes.

◆ needUpdate()

void SLNode::needUpdate ( )
virtual

Flags this node for an updateRec. This function is called automatically if the local transform of the node or of its parent changed. Nodes that are flagged for updating will recalculate their world transform the next time it is requested by updateAndGetWM().

Reimplemented in SLJoint.

◆ needWMUpdate()

void SLNode::needWMUpdate ( )

Flags this node for a wm updateRec. It is almost identical to the needUpdate function but it won't flag AABBs. This function is currently not in use but could give a slight performance boost if it was called instead of needUpdate for the children of a node that changed.

◆ numChildren()

SLint SLNode::numChildren ( )
inline

◆ om() [1/2]

const SLMat4f & SLNode::om ( )
inline

◆ om() [2/2]

void SLNode::om ( const SLMat4f mat)
inline

◆ onUpdateCB()

void SLNode::onUpdateCB ( function< void()>  callbackFunc)
inline

◆ parent() [1/2]

SLNode * SLNode::parent ( )
inline

◆ parent() [2/2]

void SLNode::parent ( SLNode p)

Sets the parent for this node and updates its depth

◆ removeChild()

bool SLNode::removeChild ( SLNode child)

remove child from vector of children. Removes false if not found, else true.

◆ removeMesh() [1/2]

bool SLNode::removeMesh ( )

Returns true if a mesh was assigned and set it to nullptr.

◆ removeMesh() [2/2]

bool SLNode::removeMesh ( SLMesh mesh)

Returns true if the passed mesh was assigned and sets it to nullptr.

◆ resetToInitialState()

void SLNode::resetToInitialState ( )

Resets this object to its initial state

◆ rightOS()

SLVec3f SLNode::rightOS ( ) const
inline

Returns the local right vector (= x-axis) in a right-hand y-up system

◆ rightWS()

SLVec3f SLNode::rightWS ( ) const
inline

SLNode::right returns worlds right vector

◆ rotate() [1/3]

void SLNode::rotate ( const SLQuat4f rot,
SLTransformSpace  relativeTo = TS_object 
)

Rotates the node around its local origin relative to the space expressed by 'relativeTo'.

◆ rotate() [2/3]

void SLNode::rotate ( SLfloat  angleDeg,
const SLVec3f axis,
SLTransformSpace  relativeTo = TS_object 
)

Rotates the node around its local origin relative to the space expressed by 'relativeTo'.

◆ rotate() [3/3]

void SLNode::rotate ( SLfloat  angleDeg,
SLfloat  x,
SLfloat  y,
SLfloat  z,
SLTransformSpace  relativeTo = TS_object 
)
inline

◆ rotateAround()

void SLNode::rotateAround ( const SLVec3f point,
SLVec3f axis,
SLfloat  angleDeg,
SLTransformSpace  relativeTo = TS_world 
)

Rotates the node around an arbitrary point. The 'axis' and 'point' parameter are relative to the space described by 'relativeTo'.

◆ rotation() [1/2]

void SLNode::rotation ( const SLQuat4f rot,
SLTransformSpace  relativeTo = TS_parent 
)

sets the rotation of this node. The axis parameter will be transformed into 'relativeTo' space. So an passing in an axis of (0, 1, 0) with TS_Object will rotate the node around its own up axis.

◆ rotation() [2/2]

void SLNode::rotation ( SLfloat  angleDeg,
const SLVec3f axis,
SLTransformSpace  relativeTo = TS_parent 
)

sets the rotation of this node. The axis parameter will be transformed into 'relativeTo' space. So a passing in an axis of (0, 1, 0) with TS_Object will rotate the node around its own up axis.

◆ scale() [1/3]

void SLNode::scale ( const SLVec3f scale)

Adds a scale transform to the current object matrix

Note
this is not a setter but a scale modifier.
this modifier doesn't allow for different transform spaces, so there isn't the possibility for shearing an object currently.

◆ scale() [2/3]

void SLNode::scale ( SLfloat  s)
inline

◆ scale() [3/3]

void SLNode::scale ( SLfloat  x,
SLfloat  y,
SLfloat  z 
)
inline

◆ scaleToCenter()

void SLNode::scaleToCenter ( SLfloat  maxDim)

Scales and translates the node so that its largest dimension is maxDim and the center is in [0,0,0].

◆ scaling() [1/3]

void SLNode::scaling ( const SLVec3f scaling)

Sets the scaling of current object matrix

Note
this modifier doesn't allow for different transform spaces, so there isn't the possiblity for shearing an object currently.

◆ scaling() [2/3]

void SLNode::scaling ( SLfloat  s)
inline

◆ scaling() [3/3]

void SLNode::scaling ( SLfloat  x,
SLfloat  y,
SLfloat  z 
)
inline

◆ setDrawBitsRec()

void SLNode::setDrawBitsRec ( SLuint  bit,
SLbool  state 
)

Recursively sets the specified drawbit on or off. See also SLDrawBits.

◆ setInitialState()

void SLNode::setInitialState ( )

Saves the current position as the initial state

◆ setMeshMat()

void SLNode::setMeshMat ( SLMaterial mat,
bool  recursive 
)

Set the mesh material recursively.

◆ setPrimitiveTypeRec()

void SLNode::setPrimitiveTypeRec ( SLGLPrimitiveType  primitiveType)

Recursively sets the specified OpenGL primitive type.

◆ skeleton()

const SLAnimSkeleton * SLNode::skeleton ( )

Returns the first skeleton found in the meshes.

◆ statsRec()

void SLNode::statsRec ( SLNodeStats stats)
virtual

Updates the statistic numbers of the passed SLNodeStats struct and calls recursively the same method for all children.

Reimplemented in SLCamera, SLLightDirect, SLLightRect, SLLightSpot, and SLText.

◆ translate() [1/2]

void SLNode::translate ( const SLVec3f delta,
SLTransformSpace  relativeTo = TS_object 
)

Moves the node by the vector 'delta' relative to the space expressed by 'relativeTo'.

◆ translate() [2/2]

void SLNode::translate ( SLfloat  x,
SLfloat  y,
SLfloat  z,
SLTransformSpace  relativeTo = TS_object 
)
inline

◆ translation() [1/2]

void SLNode::translation ( const SLVec3f pos,
SLTransformSpace  relativeTo = TS_parent 
)

sets the position of this node to pos in 'relativeTo' space.

Note
using TS_Object for this function yields the same result as calling translate(pos, TS_Object)

◆ translation() [2/2]

void SLNode::translation ( SLfloat  x,
SLfloat  y,
SLfloat  z,
SLTransformSpace  relativeTo = TS_parent 
)
inline

◆ translationOS()

SLVec3f SLNode::translationOS ( ) const
inline

SLNode::position returns current local position

◆ translationWS()

SLVec3f SLNode::translationWS ( ) const
inline

SLNode::position returns current world position

◆ updateAABBRec()

SLAABBox & SLNode::updateAABBRec ( SLbool  updateAlsoAABBinOS)
virtual

Updates the axis aligned bounding box in world space recursively.

Reimplemented in SLText.

◆ updateAndGetWM()

const SLMat4f & SLNode::updateAndGetWM ( ) const

Returns the current world matrix for this node. If the world matrix is out of date it will updateRec it and return a current result.

◆ updateAndGetWMI()

const SLMat4f & SLNode::updateAndGetWMI ( ) const

Returns the current world inverse matrix for this node. If the world matrix is out of date it will updateRec it and return a current result.

◆ updateMeshAccelStructs()

void SLNode::updateMeshAccelStructs ( )

◆ updateMeshMat()

void SLNode::updateMeshMat ( std::function< void(SLMaterial *m)>  setMat,
bool  recursive 
)

Updates the mesh material recursively with a material lambda.

◆ updateMeshSkins()

bool SLNode::updateMeshSkins ( const std::function< void(SLMesh *)> &  cbInformNodes)

Update all skinned meshes recursively.

Do software skinning on all changed skeletons && updateRec any out of date acceleration structure for RT or if they're being rendered.

◆ updateRec()

void SLNode::updateRec ( )

◆ updateWM()

void SLNode::updateWM ( ) const
private

A helper function that updates the current _wm to reflect the local matrix. recursively calls the updateAndGetWM of the node's parent.

Note
This function is const because it has to be called from inside the updateAndGetWM function which has to be const. Since we only updateRec the private cache of this class it is ok.

◆ upOS()

SLVec3f SLNode::upOS ( ) const
inline

Returns the local up vector in a right-hand y-up system

◆ upWS()

SLVec3f SLNode::upWS ( ) const
inline

SLNode::up returns worlds up vector

Friends And Related Function Documentation

◆ SLSceneView

friend class SLSceneView
friend

Member Data Documentation

◆ _aabb

SLAABBox SLNode::_aabb
protected

axis aligned bounding box

◆ _animation

SLAnimation* SLNode::_animation
protected

animation of the node

◆ _castsShadows

bool SLNode::_castsShadows
protected

flag if meshes of node should cast shadows

◆ _children

SLVNode SLNode::_children
protected

vector of children nodes

◆ _depth

SLint SLNode::_depth
protected

depth of the node in a scene tree

◆ _drawBits

SLDrawBits SLNode::_drawBits
protected

node level drawing flags

◆ _entityID

SLint SLNode::_entityID
protected

ID in the SLVEntity graph for Data Oriented Design.

◆ _initialOM

SLMat4f SLNode::_initialOM
protected

the initial om state

◆ _isAABBUpToDate

SLbool SLNode::_isAABBUpToDate
mutableprotected

is the saved aabb still valid

◆ _isSelected

bool SLNode::_isSelected
protected

flag if node and one or more of its meshes are selected

◆ _isWMIUpToDate

SLbool SLNode::_isWMIUpToDate
mutableprotected

is the inverse WM of this node still valid

◆ _isWMUpToDate

SLbool SLNode::_isWMUpToDate
mutableprotected

is the WM of this node still valid

◆ _levelForSM

SLubyte SLNode::_levelForSM
protected

Level of LOD to use for shadow mapping (0 = the visible one will be drawn)

◆ _mesh

SLMesh* SLNode::_mesh
protected

pointer to a single mesh

◆ _minLodCoverage

SLfloat SLNode::_minLodCoverage
protected

Min. LOD coverage for visibility (0.0 < _minLodCoverage < 1.0)

◆ _om

SLMat4f SLNode::_om
protected

object matrix for local transforms

◆ _onUpdateCB

function<void()> SLNode::_onUpdateCB
protected

Optional lambda callback once per update.

◆ _parent

SLNode* SLNode::_parent
protected

pointer to the parent node

◆ _wm

SLMat4f SLNode::_wm
mutableprotected

world matrix for world transform

◆ _wmI

SLMat4f SLNode::_wmI
mutableprotected

inverse world matrix

◆ instanceIndex

unsigned int SLNode::instanceIndex = 0
static

???

◆ numWMUpdates

SLuint SLNode::numWMUpdates = 0
static

NO. of calls to updateWMRec per frame.


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