H3D API  2.4.1
TransformInfo.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __TRANSFORMINFO_H__
30 #define __TRANSFORMINFO_H__
31 
32 #include <H3D/X3DChildNode.h>
33 #include <H3D/SFMatrix4f.h>
35 
36 namespace H3D {
37 
71  class H3DAPI_API TransformInfo :
72  public X3DChildNode,
73  public H3DDisplayListObject {
74  public:
75 
76  class H3DAPI_API Matrix4fInverse: public SFMatrix4f {
77  virtual void update() {
78  const Matrix4f &m =
79  static_cast< SFMatrix4f* >(event.ptr)->getValue();
80  value = m.inverse();
81  }
82  };
83  // matrix4f type matrix which accept modelView matrix and return
84  // its inverse transposed matrix
85  class H3DAPI_API Matrix4fInverseTranspose : public SFMatrix4f{
86  virtual void update ( ){
87  const Matrix4f &m =
88  static_cast<SFMatrix4f*>(event.ptr)->getValue ( );
89  value = m.inverse ( ).transpose ( );
90  }
91  };
92 
94  TransformInfo( Inst< SFNode > _metadata = 0,
95  Inst< SFMatrix4f > _accForwardMatrix = 0,
96  Inst< SFMatrix4f > _accInverseMatrix = 0,
97  Inst< DisplayList > _displayList = 0,
98  Inst< SFBool > _outputGLMatrices = 0,
99  Inst< SFMatrix4f > _glModelViewMatrix = 0,
100  Inst< Matrix4fInverse > _glModelViewMatrixInverse = 0,
101  Inst< SFMatrix4f > _glProjectionMatrix = 0,
102  Inst< Matrix4fInverse > _glProjectionMatrixInverse = 0,
103  Inst< Matrix4fInverseTranspose > _glModelViewMatrixInverseTranspose = 0 );
104 
106  virtual void traverseSG( TraverseInfo &ti );
107 
108  virtual void render();
109 
115  H3DUniquePtr< SFMatrix4f > accForwardMatrix;
116 
122  H3DUniquePtr< SFMatrix4f > accInverseMatrix;
123 
131  H3DUniquePtr< SFBool > outputGLMatrices;
132 
137  H3DUniquePtr< SFMatrix4f > glModelViewMatrix;
138 
142  H3DUniquePtr< Matrix4fInverse > glModelViewMatrixInverse;
143 
148  H3DUniquePtr< SFMatrix4f > glProjectionMatrix;
149 
153  H3DUniquePtr< Matrix4fInverse > glProjectionMatrixInverse;
154 
157  H3DUniquePtr< Matrix4fInverseTranspose > glModelViewMatrixInverseTranspose;
158 
161  };
162 }
163 
164 #endif
Header file for H3DDisplayListObject.
Contains the SFMatrix4f field class.
Header file for X3DChildNode, X3D scene-graph node.
This abstract interface class is the base class for all node types that wants to create an OpenGL dis...
Definition: H3DDisplayListObject.h:54
The SFMatrix4f field contains a Matrix4f.
Definition: SFMatrix4f.h:41
The TransformInfo node provides information about the coordinate space it resides in in the scene gra...
Definition: TransformInfo.h:73
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: TransformInfo.h:160
H3DUniquePtr< SFBool > outputGLMatrices
Determines if the OpenGL matrix fields should be updated or not (the fields starting with gl).
Definition: TransformInfo.h:131
H3DUniquePtr< Matrix4fInverse > glProjectionMatrixInverse
The inverse matrix of glProjectionMatrix.
Definition: TransformInfo.h:153
H3DUniquePtr< Matrix4fInverse > glModelViewMatrixInverse
The inverse matrix of glModelViewMatrix.
Definition: TransformInfo.h:142
H3DUniquePtr< Matrix4fInverseTranspose > glModelViewMatrixInverseTranspose
The inverse transposed matrix of glModelViewMatrix, used to transform normal from object space to vie...
Definition: TransformInfo.h:157
H3DUniquePtr< SFMatrix4f > accForwardMatrix
The accForwardMatrix field is the matrix that transforms from the local coordinate space where this N...
Definition: TransformInfo.h:115
H3DUniquePtr< SFMatrix4f > glProjectionMatrix
The OpenGL GL_PROJECTION_MATRIX at the current point of the transform hierarchy.
Definition: TransformInfo.h:148
H3DUniquePtr< SFMatrix4f > glModelViewMatrix
The OpenGL GL_MODELVIEW_MATRIX at the current point of the transform hierarchy.
Definition: TransformInfo.h:137
H3DUniquePtr< SFMatrix4f > accInverseMatrix
The accInverseMatrix field is the matrix that transforms from the global coordinate space to the coor...
Definition: TransformInfo.h:122
TraverseInfo is a structure that is passed along when traversing the scene graph.
Definition: TraverseInfo.h:57
This abstract node type indicates that the concrete nodes which are instantiated based on it may be u...
Definition: X3DChildNode.h:42
Type getValue(const char *s, const char *&rest)
Function that reads characters from a char * and converts them to a given type.
Definition: X3DFieldConversion.h:134
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194