SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
AppNodeSceneView Class Reference

#include <AppNodeSceneView.h>

Inheritance diagram for AppNodeSceneView:
[legend]

Public Member Functions

 AppNodeSceneView (SLScene *s, int dpi, SLInputManager &inputManager)
 
 ~AppNodeSceneView ()
 
void preDraw ()
 
void postSceneLoad ()
 
SLbool onKeyPress (const SLKey key, const SLKey mod)
 
SLbool onKeyRelease (const SLKey key, const SLKey mod)
 
void reset ()
 
void translateObject (SLVec3f vec) const
 
void rotateObject (const SLVec3f &val) const
 
void rotateObjectAroundPivot (SLVec3f val) const
 
void translatePivot (SLVec3f vec)
 
SLbool onContinuousKeyPress (SLKey key)
 
void updateCurOrigin ()
 
void updateInfoText ()
 
- Public Member Functions inherited from SLSceneView
 SLSceneView (SLScene *s, int dpi, SLInputManager &inputManager)
 SLSceneView default constructor. More...
 
 ~SLSceneView () override
 
void init (SLstring name, SLint screenWidth, SLint screenHeight, void *onWndUpdateCallback, void *onSelectNodeMeshCallback, SLUiInterface *gui, const string &configPath)
 
void unInit ()
 
void onInitialize ()
 
SLbool onPaint ()
 
void onResize (SLint width, SLint height)
 
virtual void onStartup ()
 
virtual void postDraw ()
 
virtual SLbool onMouseDown (SLMouseButton button, SLint scrX, SLint scrY, SLKey mod)
 
virtual SLbool onMouseUp (SLMouseButton button, SLint scrX, SLint scrY, SLKey mod)
 
virtual SLbool onMouseMove (SLint x, SLint y)
 
virtual SLbool onMouseWheelPos (SLint wheelPos, SLKey mod)
 
virtual SLbool onMouseWheel (SLint delta, SLKey mod)
 
virtual SLbool onTouch2Down (SLint scrX1, SLint scrY1, SLint scrX2, SLint scrY2)
 
virtual SLbool onTouch2Move (SLint scrX1, SLint scrY1, SLint scrX2, SLint scrY2)
 
virtual SLbool onTouch2Up (SLint scrX1, SLint scrY1, SLint scrX2, SLint scrY2)
 
virtual SLbool onDoubleClick (SLMouseButton button, SLint x, SLint y, SLKey mod)
 
virtual SLbool onCharInput (SLuint c)
 
SLbool draw3DGL (SLfloat elapsedTimeSec)
 Draws the 3D scene with OpenGL. More...
 
void draw3DGLAll ()
 
void draw3DGLNodes (SLVNode &nodes, SLbool alphaBlended, SLbool depthSorted)
 
void draw3DGLLines (SLVNode &nodes)
 
void draw3DGLLinesOverlay (SLVNode &nodes)
 
void draw2DGL ()
 
void draw2DGLNodes ()
 
SLbool draw3DRT ()
 
SLbool draw3DPT ()
 
SLbool draw3DCT ()
 
void initSceneViewCamera (const SLVec3f &dir=-SLVec3f::AXISZ, SLProjType proj=P_monoPerspective)
 
void switchToSceneViewCamera ()
 
void switchToNextCameraInScene ()
 Sets the active camera to the next in the scene. More...
 
SLbool isSceneViewCameraActive ()
 
SLstring windowTitle ()
 
void printStats ()
 
void startRaytracing (SLint maxDepth)
 
void startPathtracing (SLint maxDepth, SLint samples)
 
void setViewportFromRatio (const SLVec2i &vpRatio, SLViewportAlign vpAlignment, SLbool vpSameAsVideo)
 Sets the viewport ratio and the viewport rectangle. More...
 
void saveFrameBufferAsImage (SLstring pathFilename, cv::Size targetSize=cv::Size(-1, -1))
 Saves after n wait frames the front frame buffer as a PNG image. More...
 
void camera (SLCamera *camera)
 
void scene (SLScene *scene)
 
void scrW (SLint scrW)
 
void scrH (SLint scrH)
 
void doWaitOnIdle (SLbool doWI)
 
void doMultiSampling (SLbool doMS)
 
void doDepthTest (SLbool doDT)
 
void doFrustumCulling (SLbool doFC)
 
void doAlphaSorting (SLbool doAS)
 
void renderType (SLRenderType rt)
 
void viewportSameAsVideo (bool sameAsVideo)
 
void screenCaptureIsRequested (bool doScreenCap)
 
SLScenes ()
 
SLCameracamera ()
 
SLCamerasceneViewCamera ()
 
SLint scrW () const
 
SLint scrH () const
 
SLint scrWdiv2 () const
 
SLint scrHdiv2 () const
 
SLfloat scrWdivH () const
 
SLint dpi () const
 
SLRecti viewportRect () const
 
SLVec2i viewportRatio () const
 
SLfloat viewportWdivH () const
 
SLint viewportW () const
 
SLint viewportH () const
 
SLViewportAlign viewportAlign () const
 
SLbool viewportSameAsVideo () const
 
SLUiInterfacegui ()
 
SLbool doFrustumCulling () const
 
SLbool doAlphaSorting () const
 
SLbool doMultiSampling () const
 
SLbool doDepthTest () const
 
SLbool doWaitOnIdle () const
 
SLVNodenodesOpaque3D ()
 
SLVNodenodesBlended3D ()
 
SLVNodenodesOpaque2D ()
 
SLVNodenodesBlended2D ()
 
SLVNodenodesOverdrawn ()
 
SLRaytracerraytracer ()
 
SLPathtracerpathtracer ()
 
SLRenderType renderType () const
 
SLGLOculusFBoculusFB ()
 
SLDrawBitsdrawBits ()
 
SLbool drawBit (SLuint bit)
 
AvgFloatshadowMapTimeMS ()
 
AvgFloatcullTimesMS ()
 
AvgFloatdraw2DTimesMS ()
 
AvgFloatdraw3DTimesMS ()
 
SLNodeStatsstats2D ()
 
SLNodeStatsstats3D ()
 
SLbool screenCaptureIsRequested ()
 
std::unordered_set< SLMaterial * > & visibleMaterials2D ()
 
std::unordered_set< SLMaterial * > & visibleMaterials3D ()
 
- 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

SLMat4f _curOrigin
 current origin of relative space (orientation and position of axes) More...
 
SLNode_moveBox
 big parent cube More...
 
SLNode_moveBoxChild
 little child cube More...
 
SLVec3f _pivotPos
 position of the pivot point More...
 
SLNode_axesNode
 node for axis mesh More...
 
bool _keyStates [65536]
 key press states of all keys More...
 
SLKey _modifiers
 pressed modifier keys More...
 
bool _continuousInput
 flag for continuous input processing More...
 
SLfloat _deltaTime
 delta time of a frame More...
 
TransformMode _curMode
 current transform mode More...
 
SLNode_curObject
 current object to transform More...
 
SLTransformSpace _curSpace
 current transform space More...
 
- Public Attributes inherited from SLSceneView
cbOnWndUpdate onWndUpdate
 C-Callback for app for intermediate window repaint. More...
 
cbOnSelectNodeMesh onSelectedNodeMesh
 C-Callback for app on node selection. More...
 

Additional Inherited Members

- Protected Attributes inherited from SLSceneView
SLScene_s
 Pointer to the scene observed by this scene view. More...
 
SLCamera_camera
 Pointer to the _active camera. More...
 
SLCamera _sceneViewCamera
 Default camera for this SceneView (default cam not in scenegraph) More...
 
SLUiInterface_gui = nullptr
 new tighter imgui wrapper More...
 
SLNodeStats _stats2D
 Statistic numbers for 2D nodes. More...
 
SLNodeStats _stats3D
 Statistic numbers for 3D nodes. More...
 
SLbool _gotPainted
 flag if this sceneview got painted More...
 
SLRenderType _renderType
 rendering type (GL,RT,PT) More...
 
SLbool _doDepthTest
 Flag if depth test is turned on. More...
 
SLbool _doMultiSampling
 Flag if multisampling is on. More...
 
SLbool _doFrustumCulling
 Flag if view frustum culling is on. More...
 
SLbool _doAlphaSorting
 Flag if alpha sorting in blending is on. More...
 
SLbool _doWaitOnIdle
 Flag for Event waiting. More...
 
SLbool _isFirstFrame
 Flag if it is the first frame rendering. More...
 
SLDrawBits _drawBits
 Sceneview level drawing flags. More...
 
SLfloat _shadowMapTimeMS
 time for drawing the shadow maps in ms More...
 
SLfloat _cullTimeMS
 time for culling in ms More...
 
SLfloat _draw3DTimeMS
 time for 3D drawing in ms More...
 
SLfloat _draw2DTimeMS
 time for 2D drawing in ms More...
 
SLbool _mouseDownL
 Flag if left mouse button is pressed. More...
 
SLbool _mouseDownR
 Flag if right mouse button is pressed. More...
 
SLbool _mouseDownM
 Flag if middle mouse button is pressed. More...
 
SLKey _mouseMod
 mouse modifier key on key down More...
 
SLint _touchDowns
 finger touch down count More...
 
SLVec2i _touch [3]
 up to 3 finger touch coordinates More...
 
SLGLVertexArrayExt _vaoTouch
 Buffer for touch pos. rendering. More...
 
SLGLVertexArrayExt _vaoCursor
 Virtual cursor for stereo rendering. More...
 
SLint _scrW
 Screen width in pixels. More...
 
SLint _scrH
 Screen height in pixels. More...
 
SLint _scrWdiv2
 Screen half width in pixels. More...
 
SLint _scrHdiv2
 Screen half height in pixels. More...
 
SLfloat _scrWdivH
 Screen side aspect ratio. More...
 
int _dpi
 dots per inch of screen More...
 
SLVec2i _viewportRatio
 ratio of viewport More...
 
SLViewportAlign _viewportAlign
 alignment of viewport More...
 
SLRecti _viewportRect
 rectangle of viewport More...
 
SLbool _viewportSameAsVideo
 Adapt viewport aspect to the input video. More...
 
SLbool _screenCaptureIsRequested
 Flag if screen capture is requested. More...
 
SLint _screenCaptureWaitFrames
 Frames to delay the screen capture. More...
 
SLGLOculusFB _oculusFB
 Oculus framebuffer. More...
 
std::unordered_set< SLMaterial * > _visibleMaterials3D
 visible materials 3D per frame More...
 
std::unordered_set< SLMaterial * > _visibleMaterials2D
 visible materials 2D per frame More...
 
SLVNode _nodesOpaque2D
 Vector of visible opaque nodes not in _visibleMaterials2D rendered in 2D. More...
 
SLVNode _nodesBlended2D
 Vector of visible blended nodes not in _visibleMaterials2D rendered in 2D. More...
 
SLVNode _nodesOpaque3D
 Vector of visible opaque nodes not in _visibleMaterials3D rendered in 3D. More...
 
SLVNode _nodesBlended3D
 Vector of visible blended nodes not in _visibleMaterials3D rendered in 3D. More...
 
SLVNode _nodesOverdrawn
 Vector of helper nodes drawn over all others. More...
 
SLRaytracer _raytracer
 Whitted style raytracer. More...
 
SLbool _stopRT
 Flag to stop the RT. More...
 
SLPathtracer _pathtracer
 Pathtracer. More...
 
SLbool _stopPT
 Flag to stop the PT. More...
 
SLInputManager_inputManager
 
AvgFloat _shadowMapTimesMS
 Averaged time for drawing the shadow maps in ms. More...
 
AvgFloat _cullTimesMS
 Averaged time for culling in ms. More...
 
AvgFloat _draw3DTimesMS
 Averaged time for 3D drawing in ms. More...
 
AvgFloat _draw2DTimesMS
 Averaged time for 2D drawing in ms. More...
 
- Protected Attributes inherited from SLObject
SLstring _name
 name of an object More...
 
SLstring _url
 uniform resource locator More...
 

Detailed Description

SLSceneView derived class for a node transform test application that demonstrates all transform possibilities in SLNode. The SLSceneView class is inherited because we override here the default event-handling for the keyboard (onKeyPress and onKeyRelease)

Definition at line 30 of file AppNodeSceneView.h.

Constructor & Destructor Documentation

◆ AppNodeSceneView()

AppNodeSceneView::AppNodeSceneView ( SLScene s,
int  dpi,
SLInputManager inputManager 
)

AppNodeSceneView inherits the base class SLSceneView and overrides some eventhandler. Most events such as all mouse and keyboard events from the OS is forwarded to SLSceneview. SLSceneview implements a default behaviour. If you want a different or additional behaviour for a certain eventhandler you have to sub- class SLSceneView and override the eventhandler.

Definition at line 31 of file AppNodeSceneView.cpp.

34  : SLSceneView(s, dpi, inputManager),
36  _continuousInput(true),
38  _curObject(nullptr),
40 {
41  for (bool& ks : _keyStates)
42  ks = false;
43 
44  _pivotPos.set(0, 0, 0);
45 }
@ TranslationMode
@ TS_parent
Definition: SLEnums.h:209
@ K_none
Definition: SLEnums.h:17
SLNode * _curObject
current object to transform
TransformMode _curMode
current transform mode
SLKey _modifiers
pressed modifier keys
bool _keyStates[65536]
key press states of all keys
bool _continuousInput
flag for continuous input processing
SLVec3f _pivotPos
position of the pivot point
SLTransformSpace _curSpace
current transform space
The SLScene class represents the top level instance holding the scene structure.
Definition: SLScene.h:47
SLint dpi() const
Definition: SLSceneView.h:175
SLSceneView(SLScene *s, int dpi, SLInputManager &inputManager)
SLSceneView default constructor.
Definition: SLSceneView.cpp:37
void set(const T X, const T Y, const T Z)
Definition: SLVec3.h:59

◆ ~AppNodeSceneView()

AppNodeSceneView::~AppNodeSceneView ( )

Definition at line 47 of file AppNodeSceneView.cpp.

48 {
49 }

Member Function Documentation

◆ onContinuousKeyPress()

SLbool AppNodeSceneView::onContinuousKeyPress ( SLKey  key)

Definition at line 137 of file AppNodeSceneView.cpp.

138 {
139  if (!_continuousInput)
140  _keyStates[key] = false;
141 
142  if (_curMode == TranslationMode)
143  {
144  switch (key)
145  {
146  case 'W': translateObject(SLVec3f(0, 0, -1)); return true;
147  case 'S': translateObject(SLVec3f(0, 0, 1)); return true;
148  case 'A': translateObject(SLVec3f(-1, 0, 0)); return true;
149  case 'D': translateObject(SLVec3f(1, 0, 0)); return true;
150  case 'Q': translateObject(SLVec3f(0, 1, 0)); return true;
151  case 'E': translateObject(SLVec3f(0, -1, 0)); return true;
152  }
153  }
154  else if (_curMode == RotationMode)
155  {
156  switch (key)
157  {
158  case 'W': rotateObject(SLVec3f(-1, 0, 0)); return true;
159  case 'S': rotateObject(SLVec3f(1, 0, 0)); return true;
160  case 'A': rotateObject(SLVec3f(0, 1, 0)); return true;
161  case 'D': rotateObject(SLVec3f(0, -1, 0)); return true;
162  case 'Q': rotateObject(SLVec3f(0, 0, 1)); return true;
163  case 'E': rotateObject(SLVec3f(0, 0, -1)); return true;
164  }
165  }
166  else if (_curMode == RotationAroundMode)
167  {
168  if (_modifiers & K_shift)
169  {
170  switch (key)
171  {
172  case 'W': translatePivot(SLVec3f(0, 0, -1)); return true;
173  case 'S': translatePivot(SLVec3f(0, 0, 1)); return true;
174  case 'A': translatePivot(SLVec3f(-1, 0, 0)); return true;
175  case 'D': translatePivot(SLVec3f(1, 0, 0)); return true;
176  case 'Q': translatePivot(SLVec3f(0, 1, 0)); return true;
177  case 'E': translatePivot(SLVec3f(0, -1, 0)); return true;
178  }
179  }
180  else
181  {
182  switch (key)
183  {
184  case 'W': rotateObjectAroundPivot(SLVec3f(-1, 0, 0)); return true;
185  case 'S': rotateObjectAroundPivot(SLVec3f(1, 0, 0)); return true;
186  case 'A': rotateObjectAroundPivot(SLVec3f(0, -1, 0)); return true;
187  case 'D': rotateObjectAroundPivot(SLVec3f(0, 1, 0)); return true;
188  case 'Q': rotateObjectAroundPivot(SLVec3f(0, 0, 1)); return true;
189  case 'E': rotateObjectAroundPivot(SLVec3f(0, 0, -1)); return true;
190  }
191  }
192  }
193  else if (_curMode == LookAtMode)
194  {
195  switch (key)
196  {
197  case 'W': translatePivot(SLVec3f(0, 0, -1)); break;
198  case 'S': translatePivot(SLVec3f(0, 0, 1)); break;
199  case 'A': translatePivot(SLVec3f(-1, 0, 0)); break;
200  case 'D': translatePivot(SLVec3f(1, 0, 0)); break;
201  case 'Q': translatePivot(SLVec3f(0, 1, 0)); break;
202  case 'E': translatePivot(SLVec3f(0, -1, 0)); break;
203  }
204 
205  // if we look at a point in local space then the local space will change.
206  // we want to keep the old look at position in world space though so that
207  // the user can confirm that his object is in fact looking at the point it should.
208  if (_curSpace == TS_object)
209  {
210  SLVec3f pivotWorldPos = _curObject->updateAndGetWM() * _pivotPos;
212  _pivotPos = _curObject->updateAndGetWMI() * pivotWorldPos;
213  }
214  else // else just look at the point
216 
217  return true;
218  }
219  return false;
220 }
@ RotationMode
@ RotationAroundMode
@ LookAtMode
@ TS_object
Definition: SLEnums.h:210
@ K_shift
Definition: SLEnums.h:62
SLVec3< SLfloat > SLVec3f
Definition: SLVec3.h:318
void rotateObject(const SLVec3f &val) const
void translateObject(SLVec3f vec) const
void translatePivot(SLVec3f vec)
void rotateObjectAroundPivot(SLVec3f val) const
const SLMat4f & updateAndGetWM() const
Definition: SLNode.cpp:703
const SLMat4f & updateAndGetWMI() const
Definition: SLNode.cpp:714
void lookAt(SLfloat targetX, SLfloat targetY, SLfloat targetZ, SLfloat upX=0, SLfloat upY=1, SLfloat upZ=0, SLTransformSpace relativeTo=TS_world)
Definition: SLNode.h:652
static SLVec3 AXISY
Definition: SLVec3.h:298

◆ onKeyPress()

SLbool AppNodeSceneView::onKeyPress ( const SLKey  key,
const SLKey  mod 
)
virtual

SLSceneView::onKeyPress gets get called whenever a key is pressed. Before passing the command to the eventhandlers the main key commands are handled by forwarding them to onCommand.

Reimplemented from SLSceneView.

Definition at line 222 of file AppNodeSceneView.cpp.

223 {
224  _keyStates[key] = true;
225  _modifiers = mod;
226 
227  switch (key)
228  {
229  // general input
230  case '1': _curMode = TranslationMode; break;
231  case '2': _curMode = RotationMode; break;
232  case '3': _curMode = RotationAroundMode; break;
233  case '4': _curMode = LookAtMode; break;
234 
235  // select parent object
236  case K_F1:
239  _curObject->mesh());
240  break;
241  case K_F2: _continuousInput = !_continuousInput; break;
242  case 'R': reset(); break;
243  case 'Y':
244  case 'Z': _curSpace = TS_object; break;
245  case 'X': _curSpace = TS_parent; break;
246  case 'C': _curSpace = TS_world; break;
247  }
248 
249  updateInfoText();
250  updateCurOrigin();
251 
252  return false;
253 }
@ TS_world
Definition: SLEnums.h:208
@ K_F2
Definition: SLEnums.h:50
@ K_F1
Definition: SLEnums.h:49
static SLScene * scene
Pointer to the one and only SLScene instance.
Definition: AppCommon.h:61
SLNode * _moveBoxChild
little child cube
SLNode * _moveBox
big parent cube
SLMesh * mesh()
Definition: SLNode.h:304
void selectNodeMesh(SLNode *nodeToSelect, SLMesh *meshToSelect)
Handles the full mesh selection from double-clicks.
Definition: SLScene.cpp:234
T mod(T a, T b)
Definition: Utils.h:250

◆ onKeyRelease()

SLbool AppNodeSceneView::onKeyRelease ( const SLKey  key,
const SLKey  mod 
)
virtual

SLSceneView::onKeyRelease get called whenever a key is released.

Reimplemented from SLSceneView.

Definition at line 255 of file AppNodeSceneView.cpp.

256 {
257  _keyStates[key] = false;
258  _modifiers = mod;
259 
260  return false;
261 }

◆ postSceneLoad()

void AppNodeSceneView::postSceneLoad ( )
virtual

Reimplemented from SLSceneView.

Definition at line 51 of file AppNodeSceneView.cpp.

52 {
53  _moveBox = _s->root3D()->findChild<SLNode>("Parent");
54  _moveBoxChild = _s->root3D()->findChild<SLNode>("Child");
55  _axesNode = _s->root3D()->findChild<SLNode>("Axes");
56 
57  if (!_curObject)
58  {
61  }
62 
65 }
SLNode * _axesNode
node for axis mesh
SLNode represents a node in a hierarchical scene graph.
Definition: SLNode.h:147
void root3D(SLNode *root3D)
Definition: SLScene.h:78
SLScene * _s
Pointer to the scene observed by this scene view.
Definition: SLSceneView.h:224

◆ preDraw()

void AppNodeSceneView::preDraw ( )
virtual

Reimplemented from SLSceneView.

Definition at line 67 of file AppNodeSceneView.cpp.

68 {
69  static SLfloat lastTime = GlobalTimer::timeS();
70  SLfloat currentTime = GlobalTimer::timeS();
71  _deltaTime = currentTime - lastTime;
72  lastTime = currentTime;
73 
74  if (_keyStates['W'])
75  if (_deltaTime > 0.1f)
76  cout << _deltaTime << endl;
77 
78  bool updated = false;
79  for (int i = 0; i < 65536; ++i)
80  {
81  if (_keyStates[i])
82  updated = onContinuousKeyPress((SLKey)i);
83  }
84 
85  if (updated)
86  {
89  }
90 }
float SLfloat
Definition: SL.h:173
SLKey
Keyboard key codes enumeration.
Definition: SLEnums.h:16
SLbool onContinuousKeyPress(SLKey key)
SLfloat _deltaTime
delta time of a frame
static float timeS()
Definition: GlobalTimer.cpp:20

◆ reset()

void AppNodeSceneView::reset ( )

Definition at line 92 of file AppNodeSceneView.cpp.

93 {
94  _pivotPos.set(0, 0, 0);
97 }
void resetToInitialState()
Definition: SLNode.cpp:1092

◆ rotateObject()

void AppNodeSceneView::rotateObject ( const SLVec3f val) const

Definition at line 109 of file AppNodeSceneView.cpp.

110 {
111  SLfloat angle = 22.5;
112  if (_continuousInput)
113  angle *= _deltaTime;
114 
115  _curObject->rotate(angle, val, _curSpace);
116 }
void rotate(const SLQuat4f &rot, SLTransformSpace relativeTo=TS_object)
Definition: SLNode.cpp:945

◆ rotateObjectAroundPivot()

void AppNodeSceneView::rotateObjectAroundPivot ( SLVec3f  val) const

Definition at line 118 of file AppNodeSceneView.cpp.

119 {
120  SLfloat angle = 22.5;
121  if (_continuousInput)
122  angle *= _deltaTime;
123 
125 }
void rotateAround(const SLVec3f &point, SLVec3f &axis, SLfloat angleDeg, SLTransformSpace relativeTo=TS_world)
Definition: SLNode.cpp:979

◆ translateObject()

void AppNodeSceneView::translateObject ( SLVec3f  vec) const

Definition at line 99 of file AppNodeSceneView.cpp.

100 {
101  if (_continuousInput)
102  val *= _deltaTime;
103  else
104  val *= 0.1f;
105 
107 }
void translate(const SLVec3f &vec, SLTransformSpace relativeTo=TS_object)
Definition: SLNode.cpp:906

◆ translatePivot()

void AppNodeSceneView::translatePivot ( SLVec3f  vec)

Definition at line 127 of file AppNodeSceneView.cpp.

128 {
129  if (_continuousInput)
130  val *= _deltaTime;
131  else
132  val *= 0.1f;
133 
134  _pivotPos += val;
135 }

◆ updateCurOrigin()

void AppNodeSceneView::updateCurOrigin ( )

Definition at line 263 of file AppNodeSceneView.cpp.

264 {
265  switch (_curSpace)
266  {
267  case TS_world:
270  break;
271 
272  case TS_parent:
273  _curOrigin.setMatrix(_curObject->parent()->updateAndGetWM());
274  _axesNode->om(_curObject->parent()->updateAndGetWM());
275  break;
276 
277  case TS_object:
280  break;
281  }
282 
283  // if in rotation mode, move the axis to the objects origin, but keep the orientation
285  {
287  }
288  // look at nd rotate around mode both move the pivot relative to the current system
290  {
292  }
293 
294  _curOrigin;
295 }
SLMat4f _curOrigin
current origin of relative space (orientation and position of axes)
SLVec3< T > translation() const
Definition: SLMat4.h:184
void setMatrix(const SLMat4 &A)
Set matrix by other 4x4 matrix.
Definition: SLMat4.h:335
void identity()
Sets the identity matrix.
Definition: SLMat4.h:1333
void translation(const SLVec3f &pos, SLTransformSpace relativeTo=TS_parent)
Definition: SLNode.cpp:828
void parent(SLNode *p)
Definition: SLNode.cpp:600
void om(const SLMat4f &mat)
Definition: SLNode.h:276
T y
Definition: SLVec3.h:43
T x
Definition: SLVec3.h:43
T z
Definition: SLVec3.h:43

◆ updateInfoText()

void AppNodeSceneView::updateInfoText ( )

Definition at line 297 of file AppNodeSceneView.cpp.

298 {
299  SLchar m[2550]; // message character array
300  m[0] = 0; // set zero length
301 
302  SLstring keyBinds;
303  keyBinds = "Key bindings: \n";
304  keyBinds += "F1: toggle current object \n";
305  keyBinds += "F2: toggle continuous input \n\n";
306  keyBinds += "1: translation mode \n";
307  keyBinds += "2: rotation mode \n";
308  keyBinds += "3: rotate around point mode \n";
309  keyBinds += "4: look at mode \n\n";
310 
311  keyBinds += "Y: Set relative space to Object\n";
312  keyBinds += "X: Set relative space to Parent\n";
313  keyBinds += "C: Set relative space to World\n\n";
314 
315  SLstring space;
316  switch (_curSpace)
317  {
318  case TS_object: space = "TS_Object"; break;
319  case TS_parent: space = "TS_Parent"; break;
320  case TS_world: space = "TS_World"; break;
321  }
322 
323  SLstring mode;
324  switch (_curMode)
325  {
326  case TranslationMode:
327  mode = "Translate";
328  keyBinds += "W: forward in " + space + " space \n";
329  keyBinds += "S: backward in " + space + " space \n";
330  keyBinds += "A: left in " + space + " space \n";
331  keyBinds += "D: right in " + space + " space \n";
332  keyBinds += "Q: up in " + space + " space \n";
333  keyBinds += "E: down in " + space + " space \n";
334  break;
335  case RotationMode:
336  mode = "Rotate";
337  keyBinds += "W: rotate around -X in " + space + "\n";
338  keyBinds += "S: rotate around X in " + space + "\n";
339  keyBinds += "A: rotate around Y in " + space + "\n";
340  keyBinds += "D: rotate around -Y in " + space + "\n";
341  keyBinds += "Q: rotate around Z in " + space + "\n";
342  keyBinds += "E: rotate around -Z in " + space + "\n";
343  break;
344  case RotationAroundMode:
345  mode = "RotateAround";
346  keyBinds += "W: rotate around -X in " + space + "\n";
347  keyBinds += "S: rotate around X in " + space + "\n";
348  keyBinds += "A: rotate around -Y in " + space + "\n";
349  keyBinds += "D: rotate around Y in " + space + "\n";
350  keyBinds += "Q: rotate around Z in " + space + "\n";
351  keyBinds += "E: rotate around -Z in " + space + "\n\n";
352 
353  keyBinds += "Shift-W: pivot forward in " + space + "\n";
354  keyBinds += "Shift-S: pivot left in " + space + "\n";
355  keyBinds += "Shift-A: pivot backward in " + space + "\n";
356  keyBinds += "Shift-D: pivot right in " + space + "\n";
357  keyBinds += "Shift-Q: pivot up in " + space + "\n";
358  keyBinds += "Shift-E: pivot down in " + space + "\n";
359  break;
360  case LookAtMode:
361  mode = "LookAt";
362  keyBinds += "W: move lookAt point forward in " + space + "\n";
363  keyBinds += "S: move lookAt point left in " + space + "\n";
364  keyBinds += "A: move lookAt point backward in " + space + "\n";
365  keyBinds += "D: move lookAt point right in " + space + "\n";
366  keyBinds += "Q: move lookAt point up in " + space + "\n";
367  keyBinds += "E: move lookAt point down in " + space + "\n";
368  break;
369  }
370 
371  keyBinds += "\nR: Reset \n";
372  snprintf(m + strlen(m), sizeof(m), "%s", keyBinds.c_str());
373 
374  SLTexFont* f = SLAssetManager::getFont(1.2f, dpi());
376 }
char SLchar
Definition: SL.h:162
string SLstring
Definition: SL.h:158
static WAI::ModeOrbSlam2 * mode
Definition: WAIInterface.cpp:5
static SLstring infoText
Definition: AppNodeGui.h:36
static SLTexFont * getFont(SLfloat heightMM, SLint dpi)
returns nearest font for a given height in mm
Texture Font class inherits SLGLTexture for alpha blended font rendering.
Definition: SLTexFont.h:40

Member Data Documentation

◆ _axesNode

SLNode* AppNodeSceneView::_axesNode

node for axis mesh

Definition at line 58 of file AppNodeSceneView.h.

◆ _continuousInput

bool AppNodeSceneView::_continuousInput

flag for continuous input processing

Definition at line 62 of file AppNodeSceneView.h.

◆ _curMode

TransformMode AppNodeSceneView::_curMode

current transform mode

Definition at line 65 of file AppNodeSceneView.h.

◆ _curObject

SLNode* AppNodeSceneView::_curObject

current object to transform

Definition at line 66 of file AppNodeSceneView.h.

◆ _curOrigin

SLMat4f AppNodeSceneView::_curOrigin

current origin of relative space (orientation and position of axes)

Definition at line 53 of file AppNodeSceneView.h.

◆ _curSpace

SLTransformSpace AppNodeSceneView::_curSpace

current transform space

Definition at line 67 of file AppNodeSceneView.h.

◆ _deltaTime

SLfloat AppNodeSceneView::_deltaTime

delta time of a frame

Definition at line 64 of file AppNodeSceneView.h.

◆ _keyStates

bool AppNodeSceneView::_keyStates[65536]

key press states of all keys

Definition at line 60 of file AppNodeSceneView.h.

◆ _modifiers

SLKey AppNodeSceneView::_modifiers

pressed modifier keys

Definition at line 61 of file AppNodeSceneView.h.

◆ _moveBox

SLNode* AppNodeSceneView::_moveBox

big parent cube

Definition at line 55 of file AppNodeSceneView.h.

◆ _moveBoxChild

SLNode* AppNodeSceneView::_moveBoxChild

little child cube

Definition at line 56 of file AppNodeSceneView.h.

◆ _pivotPos

SLVec3f AppNodeSceneView::_pivotPos

position of the pivot point

Definition at line 57 of file AppNodeSceneView.h.


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