OpenSceneGraph 3.6.5
Transform
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSG_TRANSFORM
15#define OSG_TRANSFORM 1
16
17#include <osg/Group>
18#include <osg/Matrix>
19
20#ifndef GL_RESCALE_NORMAL
21#define GL_RESCALE_NORMAL 0x803A
22#endif
23
24#ifndef GL_NORMALIZE
25#define GL_NORMALIZE 0x0BA1
26#endif
27
28namespace osg {
29
30
31
35extern OSG_EXPORT Matrix computeLocalToWorld(const NodePath& nodePath, bool ignoreCameras = true);
36
40extern OSG_EXPORT Matrix computeWorldToLocal(const NodePath& nodePath, bool ignoreCameras = true);
41
46extern OSG_EXPORT Matrix computeLocalToEye(const Matrix& modelview, const NodePath& nodePath, bool ignoreCameras = true);
47
52extern OSG_EXPORT Matrix computeEyeToLocal(const Matrix& modelview, const NodePath& nodePath, bool ignoreCameras = true);
53
54
75{
76 public :
77
79
82
84
85 virtual Transform* asTransform() { return this; }
86 virtual const Transform* asTransform() const { return this; }
87
88 virtual MatrixTransform* asMatrixTransform() { return 0; }
89 virtual const MatrixTransform* asMatrixTransform() const { return 0; }
90
92 virtual const PositionAttitudeTransform* asPositionAttitudeTransform() const { return 0; }
93
94 virtual AutoTransform* asAutoTransform() { return 0; }
95 virtual const AutoTransform* asAutoTransform() const { return 0; }
96
103
123
125
126 virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
127 {
129 {
130 return false;
131 }
132 else // absolute
133 {
134 matrix.makeIdentity();
135 return true;
136 }
137 }
138
139 virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
140 {
142 {
143 return false;
144 }
145 else // absolute
146 {
147 matrix.makeIdentity();
148 return true;
149 }
150 }
151
158
159 protected :
160
161 virtual ~Transform();
162
163
165
166};
167
168}
169
170#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
OSG_EXPORT Matrix computeEyeToLocal(const Matrix &modelview, const NodePath &nodePath, bool ignoreCameras=true)
Compute the matrix which transforms objects in eye coords to local coords, by accumulating the Transf...
BoundingSphered BoundingSphere
Definition BoundingSphere:308
Matrixd Matrix
Definition Matrix:27
std::vector< Node * > NodePath
A vector of Nodes pointers which is used to describe the path from a root node to a descendant.
Definition Node:47
OSG_EXPORT Matrix computeLocalToEye(const Matrix &modelview, const NodePath &nodePath, bool ignoreCameras=true)
Compute the matrix which transforms objects in local coords to eye coords, by accumulating the Transf...
OSG_EXPORT Matrix computeLocalToWorld(const NodePath &nodePath, bool ignoreCameras=true)
Compute the matrix which transforms objects in local coords to world coords, by accumulating the Tran...
OSG_EXPORT Matrix computeWorldToLocal(const NodePath &nodePath, bool ignoreCameras=true)
Compute the matrix which transforms objects in world coords to local coords, by accumulating the Tran...
AutoTransform is a derived form of Transform that automatically scales or rotates to keep its childre...
Definition AutoTransform:28
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
void makeIdentity()
MatrixTransform - is a subclass of Transform which has an osg::Matrix which represents a 4x4 transfor...
Definition MatrixTransform:26
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
PositionAttitudeTransform - is a Transform.
Definition PositionAttitudeTransform:29
ReferenceFrame _referenceFrame
Definition Transform:164
META_Node(osg, Transform)
Transform(const Transform &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
virtual bool computeWorldToLocalMatrix(Matrix &matrix, NodeVisitor *) const
Definition Transform:139
virtual const AutoTransform * asAutoTransform() const
Definition Transform:95
virtual AutoTransform * asAutoTransform()
Definition Transform:94
virtual ~Transform()
virtual const MatrixTransform * asMatrixTransform() const
Definition Transform:89
virtual const Transform * asTransform() const
convert 'const this' into a const Transform pointer if Node is a Transform, otherwise return 0.
Definition Transform:86
virtual Transform * asTransform()
Convert 'this' into a Transform pointer if Node is a Transform, otherwise return 0.
Definition Transform:85
virtual PositionAttitudeTransform * asPositionAttitudeTransform()
Definition Transform:91
virtual BoundingSphere computeBound() const
Overrides Group's computeBound.
virtual MatrixTransform * asMatrixTransform()
Definition Transform:88
ReferenceFrame getReferenceFrame() const
Definition Transform:124
virtual bool computeLocalToWorldMatrix(Matrix &matrix, NodeVisitor *) const
Definition Transform:126
virtual const PositionAttitudeTransform * asPositionAttitudeTransform() const
Definition Transform:92
ReferenceFrame
Definition Transform:98
@ RELATIVE_RF
Definition Transform:99
@ ABSOLUTE_RF_INHERIT_VIEWPOINT
Definition Transform:101
@ ABSOLUTE_RF
Definition Transform:100
void setReferenceFrame(ReferenceFrame rf)
Set the transform's ReferenceFrame, either to be relative to its parent reference frame,...
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.