]> git.mxchange.org Git - simgear.git/blob - simgear/scene/model/SGPickAnimation.hxx
Work on knob/slider animations.
[simgear.git] / simgear / scene / model / SGPickAnimation.hxx
1 /* -*-c++-*-
2  *
3  * Copyright (C) 2013 James Turner
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18  * MA 02110-1301, USA.
19  *
20  */
21      
22 #ifndef SG_SCENE_PICK_ANIMATION_HXX
23 #define SG_SCENE_PICK_ANIMATION_HXX
24
25 #include <simgear/scene/model/animation.hxx>
26
27 // forward decls
28 class SGPickCallback;
29
30 //////////////////////////////////////////////////////////////////////
31 // Pick animation
32 //////////////////////////////////////////////////////////////////////
33
34 class SGPickAnimation : public SGAnimation {
35 public:
36   SGPickAnimation(const SGPropertyNode* configNode,
37                   SGPropertyNode* modelRoot);
38   virtual osg::Group* createAnimationGroup(osg::Group& parent);
39     
40     
41 protected:
42     void innerSetupPickGroup(osg::Group* commonGroup, osg::Group& parent);
43     
44 private:
45   class PickCallback;
46   class VncCallback;
47 };
48
49
50 class SGKnobAnimation : public SGPickAnimation
51 {
52 public:
53     SGKnobAnimation(const SGPropertyNode* configNode,
54                     SGPropertyNode* modelRoot);
55     virtual osg::Group* createAnimationGroup(osg::Group& parent);
56
57     /**
58      * by default mouse wheel up corresponds to increment (CW)
59      * and mouse-wheel down corresponds to decrement (CCW).
60      * Since no one can agree on that, make it a global toggle.
61      */
62     static void setAlternateMouseWheelDirection(bool aToggle);
63     
64     /**
65      * by default mouse is dragged left-right to change knobs.
66      * set this to true to default to up-down. Individual knobs
67      * can overrider this,
68      */
69     static void setAlternateDragAxis(bool aToggle);
70 private:
71     class UpdateCallback;
72     
73     SGVec3d _axis;
74     SGVec3d _center;
75     SGSharedPtr<SGExpressiond const> _animationValue;
76 };
77
78 class SGSliderAnimation : public SGPickAnimation
79 {
80 public:
81     SGSliderAnimation(const SGPropertyNode* configNode,
82                     SGPropertyNode* modelRoot);
83     virtual osg::Group* createAnimationGroup(osg::Group& parent);
84     
85 private:
86     class UpdateCallback;
87     
88     SGVec3d _axis;
89     SGSharedPtr<SGExpressiond const> _animationValue;
90 };
91
92 #endif // of SG_SCENE_PICK_ANIMATION_HXX
93