SLProject 4.0.000
SLTransformNode Class Reference

Class that holds all visible gizmo node during mouse transforms. More...

#include <SLTransformNode.h>

Inheritance diagram for SLTransformNode:
[legend]

Public Member Functions

 SLTransformNode (SLSceneView *sv, SLNode *targetNode, SLstring shaderDir)
 
 ~SLTransformNode () override
 
virtual SLbool onMouseDown (SLMouseButton button, SLint x, SLint y, SLKey mod) override
 onMouseDown event handler during editing interaction More...
 
virtual SLbool onMouseUp (SLMouseButton button, SLint x, SLint y, SLKey mod) override
 onMouseUp event handler during editing interaction More...
 
virtual SLbool onMouseMove (SLMouseButton button, SLint x, SLint y, SLKey mod) override
 onMouseMove event handler during editing interaction More...
 
virtual void editMode (SLNodeEditMode editMode)
 
SLNodetargetNode ()
 
SLNodeEditMode editMode ()
 
- Public Member Functions inherited from SLNode
 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 ()
 

Private Member Functions

bool getClosestPointsBetweenRays (const SLVec3f &ray1O, const SLVec3f &ray1Dir, const SLVec3f &ray2O, const SLVec3f &ray2Dir, SLVec3f &ray1P, float &t1, SLVec3f &ray2P, float &t2)
 
bool getClosestPointOnAxis (const SLVec3f &pickRayO, const SLVec3f &pickRayDir, const SLVec3f &axisRayO, const SLVec3f &axisRayDir, SLVec3f &axisPoint)
 
bool rayDiscIntersect (const SLVec3f &rayO, const SLVec3f &rayDir, const SLVec3f &discO, const SLVec3f &discN, const float &distR, float &t)
 
bool rayPlaneIntersect (const SLVec3f &rayO, const SLVec3f &rayDir, const SLVec3f &discO, const SLVec3f &discN, float &t)
 
bool isCCW (const SLVec2f &a, const SLVec2f &b, const SLVec2f &c)
 
void setDrawBitRecursive (SLuint bit, SLNode *node, bool value)
 
void lookAt (SLNode *node, SLCamera *camera)
 

Private Attributes

SLSceneView_sv = nullptr
 
SLNode_targetNode = nullptr
 
SLNodeEditMode _editMode
 
SLGLProgram_prog = nullptr
 
SLMaterial_matR = nullptr
 
SLMaterial_matG = nullptr
 
SLMaterial_matB = nullptr
 
SLMaterial_matY = nullptr
 
SLMaterial_matRT = nullptr
 
SLMaterial_matGT = nullptr
 
SLMaterial_matBT = nullptr
 
SLMaterial_matYT = nullptr
 
SLMesh_axisR = nullptr
 
SLMesh_axisG = nullptr
 
SLMesh_axisB = nullptr
 
SLMesh_lineR = nullptr
 
SLMesh_lineG = nullptr
 
SLMesh_lineB = nullptr
 
SLMesh_circR = nullptr
 
SLMesh_circG = nullptr
 
SLMesh_circB = nullptr
 
SLMesh_circY = nullptr
 
SLMesh_diskR = nullptr
 
SLMesh_diskG = nullptr
 
SLMesh_diskB = nullptr
 
SLMesh_diskY = nullptr
 
bool _mouseIsDown
 
float _gizmoScale
 
SLVec3f _hitCoordinate
 
SLNode_selectedGizmo = nullptr
 
SLNode_transGizmos = nullptr
 
SLNode_transLineX = nullptr
 
SLNode_transLineY = nullptr
 
SLNode_transLineZ = nullptr
 
SLNode_scaleGizmos = nullptr
 
SLNode_scaleDisk = nullptr
 
SLNode_scaleCirc = nullptr
 
SLNode_rotGizmos = nullptr
 
SLNode_rotCircX = nullptr
 
SLNode_rotDiskX = nullptr
 
SLNode_rotCircY = nullptr
 
SLNode_rotDiskY = nullptr
 
SLNode_rotCircZ = nullptr
 
SLNode_rotDiskZ = nullptr
 
SLNode_gizmosNode = nullptr
 

Additional Inherited Members

- Static Public Attributes inherited from SLNode
static SLuint numWMUpdates = 0
 NO. of calls to updateWMRec per frame. More...
 
static unsigned int instanceIndex = 0
 ??? More...
 
- Protected Attributes inherited from SLNode
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...
 

Detailed Description

Class that holds all visible gizmo node during mouse transforms.

An SLTransformNode is added to the scenegraph during edit mode. Depending on the transform type (translation, rotation or scaling) arrows or disks and circles get shown or hidden. The transform node gets added and removed on the fly. So the assets have to be delete in the destructor.

Constructor & Destructor Documentation

◆ SLTransformNode()

SLTransformNode::SLTransformNode ( SLSceneView sv,
SLNode targetNode,
SLstring  shaderDir 
)

Constructor for a transform node. Because a transform node will be added and removed on the fly to the scenegraph it well be the owner of its meshes (SLMesh), materials (SLMaterial) and shader programs (SLGLProgram). It has to delete them in the destructor.

Parameters
svPointer to the SLSceneView
targetNodePointer to the node that should be transformed.
shaderDirPath to the shader files

◆ ~SLTransformNode()

SLTransformNode::~SLTransformNode ( )
override

Destructor for a transform node. Because a transform node will be added and removed on the fly to the scenegraph it is the owner of its meshes (SLMesh), materials (SLMaterial) and shader programs (SLGLProgram). It has to delete them in here.

Member Function Documentation

◆ editMode() [1/2]

SLNodeEditMode SLTransformNode::editMode ( )
inline

◆ editMode() [2/2]

void SLTransformNode::editMode ( SLNodeEditMode  editMode)
virtual

Setter function for the edit mode. It shows or hides the appropriate gizmo meshes for the mouse interaction.

Parameters
editModeNew edit mode to switch to.

◆ getClosestPointOnAxis()

bool SLTransformNode::getClosestPointOnAxis ( const SLVec3f pickRayO,
const SLVec3f pickRayDir,
const SLVec3f axisRayO,
const SLVec3f axisRayDir,
SLVec3f axisPoint 
)
private

◆ getClosestPointsBetweenRays()

bool SLTransformNode::getClosestPointsBetweenRays ( const SLVec3f ray1O,
const SLVec3f ray1Dir,
const SLVec3f ray2O,
const SLVec3f ray2Dir,
SLVec3f ray1P,
float &  t1,
SLVec3f ray2P,
float &  t2 
)
private

◆ isCCW()

bool SLTransformNode::isCCW ( const SLVec2f a,
const SLVec2f b,
const SLVec2f c 
)
private

◆ lookAt()

void SLTransformNode::lookAt ( SLNode node,
SLCamera camera 
)
private

◆ onMouseDown()

SLbool SLTransformNode::onMouseDown ( SLMouseButton  button,
SLint  x,
SLint  y,
SLKey  mod 
)
overridevirtual

onMouseDown event handler during editing interaction

Reimplemented from SLEventHandler.

◆ onMouseMove()

SLbool SLTransformNode::onMouseMove ( SLMouseButton  button,
SLint  x,
SLint  y,
SLKey  mod 
)
overridevirtual

onMouseMove event handler during editing interaction

Reimplemented from SLEventHandler.

◆ onMouseUp()

SLbool SLTransformNode::onMouseUp ( SLMouseButton  button,
SLint  x,
SLint  y,
SLKey  mod 
)
overridevirtual

onMouseUp event handler during editing interaction

Reimplemented from SLEventHandler.

◆ rayDiscIntersect()

bool SLTransformNode::rayDiscIntersect ( const SLVec3f rayO,
const SLVec3f rayDir,
const SLVec3f discO,
const SLVec3f discN,
const float &  distR,
float &  t 
)
private

◆ rayPlaneIntersect()

bool SLTransformNode::rayPlaneIntersect ( const SLVec3f rayO,
const SLVec3f rayDir,
const SLVec3f discO,
const SLVec3f discN,
float &  t 
)
private

◆ setDrawBitRecursive()

void SLTransformNode::setDrawBitRecursive ( SLuint  bit,
SLNode node,
bool  value 
)
private

◆ targetNode()

SLNode * SLTransformNode::targetNode ( )
inline

Member Data Documentation

◆ _axisB

SLMesh* SLTransformNode::_axisB = nullptr
private

◆ _axisG

SLMesh* SLTransformNode::_axisG = nullptr
private

◆ _axisR

SLMesh* SLTransformNode::_axisR = nullptr
private

◆ _circB

SLMesh* SLTransformNode::_circB = nullptr
private

◆ _circG

SLMesh* SLTransformNode::_circG = nullptr
private

◆ _circR

SLMesh* SLTransformNode::_circR = nullptr
private

◆ _circY

SLMesh* SLTransformNode::_circY = nullptr
private

◆ _diskB

SLMesh* SLTransformNode::_diskB = nullptr
private

◆ _diskG

SLMesh* SLTransformNode::_diskG = nullptr
private

◆ _diskR

SLMesh* SLTransformNode::_diskR = nullptr
private

◆ _diskY

SLMesh* SLTransformNode::_diskY = nullptr
private

◆ _editMode

SLNodeEditMode SLTransformNode::_editMode
private

◆ _gizmoScale

float SLTransformNode::_gizmoScale
private

◆ _gizmosNode

SLNode* SLTransformNode::_gizmosNode = nullptr
private

◆ _hitCoordinate

SLVec3f SLTransformNode::_hitCoordinate
private

◆ _lineB

SLMesh* SLTransformNode::_lineB = nullptr
private

◆ _lineG

SLMesh* SLTransformNode::_lineG = nullptr
private

◆ _lineR

SLMesh* SLTransformNode::_lineR = nullptr
private

◆ _matB

SLMaterial* SLTransformNode::_matB = nullptr
private

◆ _matBT

SLMaterial* SLTransformNode::_matBT = nullptr
private

◆ _matG

SLMaterial* SLTransformNode::_matG = nullptr
private

◆ _matGT

SLMaterial* SLTransformNode::_matGT = nullptr
private

◆ _matR

SLMaterial* SLTransformNode::_matR = nullptr
private

◆ _matRT

SLMaterial* SLTransformNode::_matRT = nullptr
private

◆ _matY

SLMaterial* SLTransformNode::_matY = nullptr
private

◆ _matYT

SLMaterial* SLTransformNode::_matYT = nullptr
private

◆ _mouseIsDown

bool SLTransformNode::_mouseIsDown
private

◆ _prog

SLGLProgram* SLTransformNode::_prog = nullptr
private

◆ _rotCircX

SLNode* SLTransformNode::_rotCircX = nullptr
private

◆ _rotCircY

SLNode* SLTransformNode::_rotCircY = nullptr
private

◆ _rotCircZ

SLNode* SLTransformNode::_rotCircZ = nullptr
private

◆ _rotDiskX

SLNode* SLTransformNode::_rotDiskX = nullptr
private

◆ _rotDiskY

SLNode* SLTransformNode::_rotDiskY = nullptr
private

◆ _rotDiskZ

SLNode* SLTransformNode::_rotDiskZ = nullptr
private

◆ _rotGizmos

SLNode* SLTransformNode::_rotGizmos = nullptr
private

◆ _scaleCirc

SLNode* SLTransformNode::_scaleCirc = nullptr
private

◆ _scaleDisk

SLNode* SLTransformNode::_scaleDisk = nullptr
private

◆ _scaleGizmos

SLNode* SLTransformNode::_scaleGizmos = nullptr
private

◆ _selectedGizmo

SLNode* SLTransformNode::_selectedGizmo = nullptr
private

◆ _sv

SLSceneView* SLTransformNode::_sv = nullptr
private

◆ _targetNode

SLNode* SLTransformNode::_targetNode = nullptr
private

◆ _transGizmos

SLNode* SLTransformNode::_transGizmos = nullptr
private

◆ _transLineX

SLNode* SLTransformNode::_transLineX = nullptr
private

◆ _transLineY

SLNode* SLTransformNode::_transLineY = nullptr
private

◆ _transLineZ

SLNode* SLTransformNode::_transLineZ = nullptr
private

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