SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
AppNodeSceneView.h
Go to the documentation of this file.
1 /**
2  * \file AppNodeSceneView.h
3  * \brief Node transform test app to demonstrates all transforms of SLNode
4  * \date July 2015
5  * \remarks Please use clangformat to format the code. See more code style on
6  * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
7  * \authors Marc Wacker, Marcus Hudritsch
8  * \copyright http://opensource.org/licenses/GPL-3.0
9 */
10 
11 #include <SLSceneView.h>
12 #include <SLScene.h>
13 
14 //-----------------------------------------------------------------------------
16 {
21 };
22 
23 //-----------------------------------------------------------------------------
24 /*!
25  SLSceneView derived class for a node transform test application that
26  demonstrates all transform possibilities in SLNode. The SLSceneView class is
27  inherited because we override here the default event-handling for the keyboard
28  (onKeyPress and onKeyRelease)
29 */
31 {
32 public:
33  AppNodeSceneView(SLScene* s, int dpi, SLInputManager& inputManager);
35 
36  // From SLSceneView overwritten
37  void preDraw();
38  void postSceneLoad();
39  SLbool onKeyPress(const SLKey key, const SLKey mod);
40  SLbool onKeyRelease(const SLKey key, const SLKey mod);
41 
42  void reset();
43  void translateObject(SLVec3f vec) const;
44  void rotateObject(const SLVec3f& val) const;
45  void rotateObjectAroundPivot(SLVec3f val) const;
46  void translatePivot(SLVec3f vec);
47 
49 
50  void updateCurOrigin();
51  void updateInfoText();
52 
53  SLMat4f _curOrigin; //!< current origin of relative space (orientation and position of axes)
54 
55  SLNode* _moveBox; //!< big parent cube
56  SLNode* _moveBoxChild; //!< little child cube
57  SLVec3f _pivotPos; //!< position of the pivot point
58  SLNode* _axesNode; //!< node for axis mesh
59 
60  bool _keyStates[65536]; //!< key press states of all keys
61  SLKey _modifiers; //!< pressed modifier keys
62  bool _continuousInput; //!< flag for continuous input processing
63 
64  SLfloat _deltaTime; //!< delta time of a frame
65  TransformMode _curMode; //!< current transform mode
66  SLNode* _curObject; //!< current object to transform
67  SLTransformSpace _curSpace; //!< current transform space
68 };
69 //-----------------------------------------------------------------------------
TransformMode
@ RotationMode
@ RotationAroundMode
@ LookAtMode
@ TranslationMode
float SLfloat
Definition: SL.h:173
bool SLbool
Definition: SL.h:175
SLTransformSpace
Describes the relative space a transformation is applied in.
Definition: SLEnums.h:206
SLKey
Keyboard key codes enumeration.
Definition: SLEnums.h:16
void rotateObject(const SLVec3f &val) const
SLNode * _curObject
current object to transform
SLNode * _moveBoxChild
little child cube
TransformMode _curMode
current transform mode
SLNode * _moveBox
big parent cube
void translateObject(SLVec3f vec) const
SLbool onContinuousKeyPress(SLKey key)
AppNodeSceneView(SLScene *s, int dpi, SLInputManager &inputManager)
SLKey _modifiers
pressed modifier keys
bool _keyStates[65536]
key press states of all keys
void translatePivot(SLVec3f vec)
SLbool onKeyPress(const SLKey key, const SLKey mod)
SLNode * _axesNode
node for axis mesh
SLMat4f _curOrigin
current origin of relative space (orientation and position of axes)
SLbool onKeyRelease(const SLKey key, const SLKey mod)
bool _continuousInput
flag for continuous input processing
void rotateObjectAroundPivot(SLVec3f val) const
SLVec3f _pivotPos
position of the pivot point
SLTransformSpace _curSpace
current transform space
SLfloat _deltaTime
delta time of a frame
SLInputManager. manages system input and custom input devices.
SLNode represents a node in a hierarchical scene graph.
Definition: SLNode.h:147
The SLScene class represents the top level instance holding the scene structure.
Definition: SLScene.h:47
SceneView class represents a dynamic real time 3D view onto the scene.
Definition: SLSceneView.h:69
SLint dpi() const
Definition: SLSceneView.h:175
T mod(T a, T b)
Definition: Utils.h:250