]> git.mxchange.org Git - simgear.git/blob - simgear/scene/model/SGTrackToAnimation.hxx
Work around apparent OSG 3.2.0 normal binding bug.
[simgear.git] / simgear / scene / model / SGTrackToAnimation.hxx
1 // TrackTo animation
2 //
3 // http://wiki.blender.org/index.php/Doc:2.6/Manual/Constraints/Tracking/Locked_Track
4 // TODO: http://wiki.blender.org/index.php/Doc:2.6/Manual/Constraints/Tracking/Track_To
5 //
6 // Copyright (C) 2013  Thomas Geymayer <tomgey@gmail.com>
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // Library General Public License for more details.
17 //
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
21
22 #ifndef SG_TRACK_TO_ANIMATION_HXX_
23 #define SG_TRACK_TO_ANIMATION_HXX_
24
25 #include <simgear/scene/model/animation.hxx>
26
27 /**
28  * Animation to let an object always track another object. An optional second
29  * slave object can be specified which is rotate to always fit the space between
30  * the root object and the target object. This can be used to eg. create a gear
31  * scissor animation.
32  */
33 class SGTrackToAnimation:
34   public SGAnimation
35 {
36   public:
37     SGTrackToAnimation( osg::Node* node,
38                         const SGPropertyNode* configNode,
39                         SGPropertyNode* modelRoot );
40
41     virtual osg::Group* createAnimationGroup(osg::Group& parent);
42
43   protected:
44     class UpdateCallback;
45
46     osg::Group     *_target_group,
47                    *_slave_group;
48
49     void log(sgDebugPriority p, const std::string& msg) const;
50 };
51
52 #endif /* SG_TRACK_TO_ANIMATION_HXX_ */