~saiarcot895/ubuntu/trusty/openscenegraph/armhf-support

« back to all changes in this revision

Viewing changes to OpenSceneGraph/include/osg/AutoTransform

  • Committer: Bazaar Package Importer
  • Author(s): Loic Dachary (OuoU)
  • Date: 2009-03-23 14:08:20 UTC
  • mfrom: (1.1.7 upstream) (2.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20090323140820-i4j3jozdlhyn4lre
rules prevent lib64 with -D LIB_POSTFIX="" (Closes: #517671)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 
 
1
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2
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 
 
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
5
 * (at your option) any later version.  The full license is in LICENSE file
6
6
 * included with this distribution, and on the openscenegraph.org website.
7
 
 * 
 
7
 *
8
8
 * This library is distributed in the hope that it will be useful,
9
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
 * OpenSceneGraph Public License for more details.
12
12
*/
13
13
 
29
29
    public :
30
30
        AutoTransform();
31
31
 
32
 
        AutoTransform(const AutoTransform& pat,const CopyOp& copyop=CopyOp::SHALLOW_COPY);            
 
32
        AutoTransform(const AutoTransform& pat,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
33
33
 
34
34
        virtual osg::Object* cloneType() const { return new AutoTransform (); }
35
35
        virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new AutoTransform (*this,copyop); }
42
42
        virtual AutoTransform* asAutoTransform() { return this; }
43
43
        virtual const AutoTransform* asAutoTransform() const { return this; }
44
44
 
45
 
        inline void setPosition(const Vec3& pos) { _position = pos; _matrixDirty=true; dirtyBound(); }
46
 
        inline const Vec3& getPosition() const { return _position; }
 
45
        inline void setPosition(const Vec3d& pos) { _position = pos; _matrixDirty=true; dirtyBound(); }
 
46
        inline const Vec3d& getPosition() const { return _position; }
47
47
 
48
48
 
49
49
        inline void setRotation(const Quat& quat) { _rotation = quat; _matrixDirty=true; dirtyBound(); }
50
50
        inline const Quat& getRotation() const { return _rotation; }
51
 
        
52
 
        inline void setScale(float scale) { setScale(osg::Vec3(scale,scale,scale)); }
53
 
 
54
 
        void setScale(const Vec3& scale);
55
 
        inline const Vec3& getScale() const { return _scale; }
56
 
        
57
 
        void setMinimumScale(float minimumScale) { _minimumScale = minimumScale; }
58
 
        float getMinimumScale() const { return _minimumScale; }
59
 
 
60
 
        void setMaximumScale(float maximumScale) { _maximumScale = maximumScale; }
61
 
        float getMaximumScale() const { return _maximumScale; }
62
 
 
63
 
        inline void setPivotPoint(const Vec3& pivot) { _pivotPoint = pivot; _matrixDirty=true; dirtyBound(); }
64
 
        inline const Vec3& getPivotPoint() const { return _pivotPoint; }
65
 
        
 
51
 
 
52
        inline void setScale(double scale) { setScale(osg::Vec3(scale,scale,scale)); }
 
53
 
 
54
        void setScale(const Vec3d& scale);
 
55
        inline const Vec3d& getScale() const { return _scale; }
 
56
 
 
57
        void setMinimumScale(double minimumScale) { _minimumScale = minimumScale; }
 
58
        double getMinimumScale() const { return _minimumScale; }
 
59
 
 
60
        void setMaximumScale(double maximumScale) { _maximumScale = maximumScale; }
 
61
        double getMaximumScale() const { return _maximumScale; }
 
62
 
 
63
        inline void setPivotPoint(const Vec3d& pivot) { _pivotPoint = pivot; _matrixDirty=true; dirtyBound(); }
 
64
        inline const Vec3d& getPivotPoint() const { return _pivotPoint; }
 
65
 
66
66
 
67
67
        void setAutoUpdateEyeMovementTolerance(float tolerance) { _autoUpdateEyeMovementTolerance = tolerance; }
68
68
        float getAutoUpdateEyeMovementTolerance() const { return _autoUpdateEyeMovementTolerance; }
74
74
            ROTATE_TO_SCREEN,
75
75
            ROTATE_TO_CAMERA
76
76
        };
77
 
        
 
77
 
78
78
        void setAutoRotateMode(AutoRotateMode mode) { _autoRotateMode = mode; _firstTimeToInitEyePoint = true; }
79
79
 
80
80
        AutoRotateMode getAutoRotateMode() const { return _autoRotateMode; }
83
83
 
84
84
        bool getAutoScaleToScreen() const { return _autoScaleToScreen; }
85
85
 
86
 
        void setAutoScaleTransistionWidthRatio(float ratio) { _autoScaleTransitionWidthRatio = ratio; }
87
 
        float getAutoScaleTransistionWidthRatio() const { return _autoScaleTransitionWidthRatio; }
 
86
        void setAutoScaleTransitionWidthRatio(float ratio) { _autoScaleTransitionWidthRatio = ratio; }
 
87
        float getAutoScaleTransitionWidthRatio() const { return _autoScaleTransitionWidthRatio; }
88
88
 
89
89
 
90
90
        virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor* nv) const;
95
95
 
96
96
 
97
97
    protected :
98
 
            
 
98
 
99
99
        virtual ~AutoTransform() {}
100
100
 
101
 
        Vec3                            _position;
102
 
        Vec3                            _pivotPoint;
103
 
        float                           _autoUpdateEyeMovementTolerance;
 
101
        Vec3d                           _position;
 
102
        Vec3d                           _pivotPoint;
 
103
        double                          _autoUpdateEyeMovementTolerance;
104
104
 
105
105
        AutoRotateMode                  _autoRotateMode;
106
106
 
107
107
        bool                            _autoScaleToScreen;
108
 
        
 
108
 
109
109
        mutable Quat                    _rotation;
110
 
        mutable Vec3                    _scale;
 
110
        mutable Vec3d                   _scale;
111
111
        mutable bool                    _firstTimeToInitEyePoint;
112
112
        mutable osg::Vec3               _previousEyePoint;
113
113
        mutable osg::Vec3               _previousLocalUp;
114
114
        mutable Viewport::value_type    _previousWidth;
115
 
        mutable Viewport::value_type    _previousHeight;        
116
 
        mutable osg::Matrix             _previousProjection;
117
 
        mutable osg::Vec3               _previousPosition;
118
 
        
119
 
        float                           _minimumScale;
120
 
        float                           _maximumScale;
121
 
        float                           _autoScaleTransitionWidthRatio;
 
115
        mutable Viewport::value_type    _previousHeight;
 
116
        mutable osg::Matrixd            _previousProjection;
 
117
        mutable osg::Vec3d              _previousPosition;
 
118
 
 
119
        double                          _minimumScale;
 
120
        double                          _maximumScale;
 
121
        double                          _autoScaleTransitionWidthRatio;
122
122
 
123
123
        void computeMatrix() const;
124
124
 
125
 
        mutable bool        _matrixDirty;
126
 
        mutable osg::Matrix _cachedMatrix;
 
125
        mutable bool                    _matrixDirty;
 
126
        mutable osg::Matrixd            _cachedMatrix;
127
127
};
128
128
 
129
129
}