openscenegraph
include
osgSim
DOFTransform
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 OSGSIM_DOFTRANSFORM
15
#define OSGSIM_DOFTRANSFORM 1
16
17
//base class:
18
#include <
osg/Transform
>
19
20
#include <
osgSim/Export
>
21
22
namespace
osgSim
{
23
25
class
OSGSIM_EXPORT
DOFTransform
:
public
osg::Transform
26
{
27
public
:
29
DOFTransform
();
30
32
DOFTransform
(
const
DOFTransform
& dof,
const
osg::CopyOp
& copyop=
osg::CopyOp::SHALLOW_COPY
);
33
34
META_Node
(
osgSim
,
DOFTransform
);
35
36
virtual
void
traverse
(
osg::NodeVisitor
& nv);
37
38
39
void
setMinHPR
(
const
osg::Vec3
& hpr) { _minHPR = hpr;}
40
const
osg::Vec3
&
getMinHPR
()
const
{
return
_minHPR;}
41
42
void
setMaxHPR
(
const
osg::Vec3
& hpr) {_maxHPR = hpr;}
43
const
osg::Vec3
&
getMaxHPR
()
const
{
return
_maxHPR;}
44
45
void
setIncrementHPR
(
const
osg::Vec3
& hpr) {_incrementHPR = hpr;}
46
const
osg::Vec3
&
getIncrementHPR
()
const
{
return
_incrementHPR;}
47
48
void
setCurrentHPR
(
const
osg::Vec3
& hpr) {_currentHPR = hpr; dirtyBound(); }
49
const
osg::Vec3
&
getCurrentHPR
()
const
{
return
_currentHPR;}
50
51
void
updateCurrentHPR
(
const
osg::Vec3
& hpr);
52
53
54
void
setMinTranslate
(
const
osg::Vec3
& translate) {_minTranslate = translate; }
55
const
osg::Vec3
&
getMinTranslate
()
const
{
return
_minTranslate;}
56
57
void
setMaxTranslate
(
const
osg::Vec3
& translate) {_maxTranslate = translate; }
58
const
osg::Vec3
&
getMaxTranslate
()
const
{
return
_maxTranslate;}
59
60
void
setIncrementTranslate
(
const
osg::Vec3
& translate) { _incrementTranslate = translate; }
61
const
osg::Vec3
&
getIncrementTranslate
()
const
{
return
_incrementTranslate;}
62
63
void
setCurrentTranslate
(
const
osg::Vec3
& translate){ _currentTranslate = translate; dirtyBound(); }
64
inline
const
osg::Vec3
&
getCurrentTranslate
()
const
{
return
_currentTranslate;}
65
66
void
updateCurrentTranslate
(
const
osg::Vec3
& translate);
67
68
69
void
setMinScale
(
const
osg::Vec3
& scale) { _minScale = scale;}
70
const
osg::Vec3
&
getMinScale
()
const
{
return
_minScale;}
71
72
void
setMaxScale
(
const
osg::Vec3
& scale) { _maxScale = scale;}
73
const
osg::Vec3
&
getMaxScale
()
const
{
return
_maxScale;}
74
75
void
setIncrementScale
(
const
osg::Vec3
& scale) { _incrementScale = scale;}
76
const
osg::Vec3
&
getIncrementScale
()
const
{
return
_incrementScale;}
77
78
void
setCurrentScale
(
const
osg::Vec3
& scale) { _currentScale = scale; dirtyBound(); }
79
inline
const
osg::Vec3
&
getCurrentScale
()
const
{
return
_currentScale;}
80
81
void
updateCurrentScale
(
const
osg::Vec3
& scale);
82
83
84
void
setPutMatrix
(
const
osg::Matrix
& put) { _Put = put; dirtyBound(); }
85
inline
const
osg::Matrix
&
getPutMatrix
()
const
{
return
_Put;}
86
87
void
setInversePutMatrix
(
const
osg::Matrix
& inversePut) { _inversePut = inversePut; dirtyBound(); }
88
inline
const
osg::Matrix
&
getInversePutMatrix
()
const
{
return
_inversePut;}
89
90
void
setLimitationFlags
(
unsigned
long
flags) { _limitationFlags = flags;}
91
inline
unsigned
long
getLimitationFlags
()
const
{
return
_limitationFlags;}
92
93
enum
MultOrder
94
{
95
PRH
,
96
PHR
,
97
HPR
,
98
HRP
,
99
RPH
,
100
RHP
101
};
102
103
void
setHPRMultOrder
(
MultOrder
order) { _multOrder = order; }
104
inline
MultOrder
getHPRMultOrder
()
const
{
return
_multOrder;}
105
106
void
setAnimationOn
(
bool
do_animate);
107
inline
bool
getAnimationOn
()
const
{
return
_animationOn; }
108
109
void
animate
(
float
deltaTime);
110
111
virtual
bool
computeLocalToWorldMatrix
(
osg::Matrix
& matrix,
osg::NodeVisitor
* nv)
const
;
112
113
virtual
bool
computeWorldToLocalMatrix
(
osg::Matrix
& matrix,
osg::NodeVisitor
* nv)
const
;
114
115
protected
:
116
117
virtual
~DOFTransform
() {}
118
119
unsigned
int
_previousTraversalNumber
;
120
double
_previousTime
;
121
122
osg::Vec3
_minHPR
;
123
osg::Vec3
_maxHPR
;
124
osg::Vec3
_currentHPR
;
125
osg::Vec3
_incrementHPR
;
126
127
osg::Vec3
_minTranslate
;
128
osg::Vec3
_maxTranslate
;
129
osg::Vec3
_currentTranslate
;
130
osg::Vec3
_incrementTranslate
;
131
132
osg::Vec3
_minScale
;
133
osg::Vec3
_maxScale
;
134
osg::Vec3
_currentScale
;
135
osg::Vec3
_incrementScale
;
136
137
osg::Matrix
_Put
;
138
osg::Matrix
_inversePut
;
139
140
unsigned
long
_limitationFlags
;
141
/* bits from left to right
142
0 = x translation limited (2^31)
143
1 = y translation limited (2^30)
144
2 = z translation limited (2^29)
145
3 = pitch limited (2^28)
146
4 = roll limited (2^27)
147
5 = yaw limited (2^26)
148
6 = x scale limited (2^25)
149
7 = y scale limited (2^24)
150
8 = z scale limited (2^23)
151
152
else reserved
153
*/
154
155
bool
_animationOn
;
168
unsigned
short
_increasingFlags
;
169
170
MultOrder
_multOrder
;
171
172
};
173
174
}
175
#endif
Transform
osgSim::DOFTransform
Definition
DOFTransform:26
osgSim::DOFTransform::setPutMatrix
void setPutMatrix(const osg::Matrix &put)
Definition
DOFTransform:84
osgSim::DOFTransform::traverse
virtual void traverse(osg::NodeVisitor &nv)
osgSim::DOFTransform::DOFTransform
DOFTransform()
osgSim::DOFTransform::DOFTransform
DOFTransform(const DOFTransform &dof, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
osgSim::DOFTransform::_maxTranslate
osg::Vec3 _maxTranslate
Definition
DOFTransform:128
osgSim::DOFTransform::_currentHPR
osg::Vec3 _currentHPR
Definition
DOFTransform:124
osgSim::DOFTransform::setLimitationFlags
void setLimitationFlags(unsigned long flags)
Definition
DOFTransform:90
osgSim::DOFTransform::setAnimationOn
void setAnimationOn(bool do_animate)
osgSim::DOFTransform::getIncrementTranslate
const osg::Vec3 & getIncrementTranslate() const
Definition
DOFTransform:61
osgSim::DOFTransform::setMaxTranslate
void setMaxTranslate(const osg::Vec3 &translate)
Definition
DOFTransform:57
osgSim::DOFTransform::~DOFTransform
virtual ~DOFTransform()
Definition
DOFTransform:117
osgSim::DOFTransform::_minTranslate
osg::Vec3 _minTranslate
Definition
DOFTransform:127
osgSim::DOFTransform::setMinScale
void setMinScale(const osg::Vec3 &scale)
Definition
DOFTransform:69
osgSim::DOFTransform::getLimitationFlags
unsigned long getLimitationFlags() const
Definition
DOFTransform:91
osgSim::DOFTransform::setIncrementTranslate
void setIncrementTranslate(const osg::Vec3 &translate)
Definition
DOFTransform:60
osgSim::DOFTransform::setHPRMultOrder
void setHPRMultOrder(MultOrder order)
Definition
DOFTransform:103
osgSim::DOFTransform::animate
void animate(float deltaTime)
osgSim::DOFTransform::_currentScale
osg::Vec3 _currentScale
Definition
DOFTransform:134
osgSim::DOFTransform::getMinTranslate
const osg::Vec3 & getMinTranslate() const
Definition
DOFTransform:55
osgSim::DOFTransform::getCurrentTranslate
const osg::Vec3 & getCurrentTranslate() const
Definition
DOFTransform:64
osgSim::DOFTransform::getMaxHPR
const osg::Vec3 & getMaxHPR() const
Definition
DOFTransform:43
osgSim::DOFTransform::setInversePutMatrix
void setInversePutMatrix(const osg::Matrix &inversePut)
Definition
DOFTransform:87
osgSim::DOFTransform::setCurrentScale
void setCurrentScale(const osg::Vec3 &scale)
Definition
DOFTransform:78
osgSim::DOFTransform::setIncrementHPR
void setIncrementHPR(const osg::Vec3 &hpr)
Definition
DOFTransform:45
osgSim::DOFTransform::setCurrentTranslate
void setCurrentTranslate(const osg::Vec3 &translate)
Definition
DOFTransform:63
osgSim::DOFTransform::setMaxScale
void setMaxScale(const osg::Vec3 &scale)
Definition
DOFTransform:72
osgSim::DOFTransform::getIncrementScale
const osg::Vec3 & getIncrementScale() const
Definition
DOFTransform:76
osgSim::DOFTransform::_maxScale
osg::Vec3 _maxScale
Definition
DOFTransform:133
osgSim::DOFTransform::getMaxTranslate
const osg::Vec3 & getMaxTranslate() const
Definition
DOFTransform:58
osgSim::DOFTransform::getAnimationOn
bool getAnimationOn() const
Definition
DOFTransform:107
osgSim::DOFTransform::getHPRMultOrder
MultOrder getHPRMultOrder() const
Definition
DOFTransform:104
osgSim::DOFTransform::getIncrementHPR
const osg::Vec3 & getIncrementHPR() const
Definition
DOFTransform:46
osgSim::DOFTransform::_previousTraversalNumber
unsigned int _previousTraversalNumber
Definition
DOFTransform:119
osgSim::DOFTransform::_inversePut
osg::Matrix _inversePut
Definition
DOFTransform:138
osgSim::DOFTransform::_incrementHPR
osg::Vec3 _incrementHPR
Definition
DOFTransform:125
osgSim::DOFTransform::getPutMatrix
const osg::Matrix & getPutMatrix() const
Definition
DOFTransform:85
osgSim::DOFTransform::getInversePutMatrix
const osg::Matrix & getInversePutMatrix() const
Definition
DOFTransform:88
osgSim::DOFTransform::_multOrder
MultOrder _multOrder
Definition
DOFTransform:170
osgSim::DOFTransform::setCurrentHPR
void setCurrentHPR(const osg::Vec3 &hpr)
Definition
DOFTransform:48
osgSim::DOFTransform::updateCurrentScale
void updateCurrentScale(const osg::Vec3 &scale)
osgSim::DOFTransform::getMaxScale
const osg::Vec3 & getMaxScale() const
Definition
DOFTransform:73
osgSim::DOFTransform::_incrementScale
osg::Vec3 _incrementScale
Definition
DOFTransform:135
osgSim::DOFTransform::_maxHPR
osg::Vec3 _maxHPR
Definition
DOFTransform:123
osgSim::DOFTransform::computeWorldToLocalMatrix
virtual bool computeWorldToLocalMatrix(osg::Matrix &matrix, osg::NodeVisitor *nv) const
osgSim::DOFTransform::setMinTranslate
void setMinTranslate(const osg::Vec3 &translate)
Definition
DOFTransform:54
osgSim::DOFTransform::META_Node
META_Node(osgSim, DOFTransform)
osgSim::DOFTransform::computeLocalToWorldMatrix
virtual bool computeLocalToWorldMatrix(osg::Matrix &matrix, osg::NodeVisitor *nv) const
osgSim::DOFTransform::MultOrder
MultOrder
Definition
DOFTransform:94
osgSim::DOFTransform::HPR
@ HPR
Definition
DOFTransform:97
osgSim::DOFTransform::RPH
@ RPH
Definition
DOFTransform:99
osgSim::DOFTransform::HRP
@ HRP
Definition
DOFTransform:98
osgSim::DOFTransform::PRH
@ PRH
Definition
DOFTransform:95
osgSim::DOFTransform::PHR
@ PHR
Definition
DOFTransform:96
osgSim::DOFTransform::_animationOn
bool _animationOn
Definition
DOFTransform:155
osgSim::DOFTransform::getCurrentScale
const osg::Vec3 & getCurrentScale() const
Definition
DOFTransform:79
osgSim::DOFTransform::setIncrementScale
void setIncrementScale(const osg::Vec3 &scale)
Definition
DOFTransform:75
osgSim::DOFTransform::_limitationFlags
unsigned long _limitationFlags
Definition
DOFTransform:140
osgSim::DOFTransform::_incrementTranslate
osg::Vec3 _incrementTranslate
Definition
DOFTransform:130
osgSim::DOFTransform::_minScale
osg::Vec3 _minScale
Definition
DOFTransform:132
osgSim::DOFTransform::getMinHPR
const osg::Vec3 & getMinHPR() const
Definition
DOFTransform:40
osgSim::DOFTransform::getMinScale
const osg::Vec3 & getMinScale() const
Definition
DOFTransform:70
osgSim::DOFTransform::setMinHPR
void setMinHPR(const osg::Vec3 &hpr)
Definition
DOFTransform:39
osgSim::DOFTransform::_minHPR
osg::Vec3 _minHPR
Definition
DOFTransform:122
osgSim::DOFTransform::_currentTranslate
osg::Vec3 _currentTranslate
Definition
DOFTransform:129
osgSim::DOFTransform::_Put
osg::Matrix _Put
Definition
DOFTransform:137
osgSim::DOFTransform::updateCurrentHPR
void updateCurrentHPR(const osg::Vec3 &hpr)
osgSim::DOFTransform::_increasingFlags
unsigned short _increasingFlags
Definition
DOFTransform:168
osgSim::DOFTransform::_previousTime
double _previousTime
Definition
DOFTransform:120
osgSim::DOFTransform::updateCurrentTranslate
void updateCurrentTranslate(const osg::Vec3 &translate)
osgSim::DOFTransform::setMaxHPR
void setMaxHPR(const osg::Vec3 &hpr)
Definition
DOFTransform:42
osgSim::DOFTransform::getCurrentHPR
const osg::Vec3 & getCurrentHPR() const
Definition
DOFTransform:49
osg::CopyOp
Definition
CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition
CopyOp:47
osg::Matrixd
Definition
Matrixd:27
osg::NodeVisitor
Definition
NodeVisitor:82
osg::Transform
Definition
Transform:75
osg::Vec3f
Definition
Vec3f:29
osgSim
Definition
BlinkSequence:27
Export
OSGSIM_EXPORT
#define OSGSIM_EXPORT
Definition
osgSim/Export:38
Generated by
1.9.8