]> git.mxchange.org Git - simgear.git/blob - simgear/scene/model/SGPickAnimation.hxx
Work around apparent OSG 3.2.0 normal binding bug.
[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 #include <simgear/misc/strutils.hxx>
27
28 // forward decls
29 class SGPickCallback;
30 class SGSceneUserData;
31
32 //////////////////////////////////////////////////////////////////////
33 // Pick animation
34 //////////////////////////////////////////////////////////////////////
35
36 class SGPickAnimation : public SGAnimation {
37 public:
38   SGPickAnimation(const SGPropertyNode* configNode,
39                   SGPropertyNode* modelRoot);
40     
41   // override so we can treat object-name specially
42   virtual void apply(osg::Group& group);
43     
44   void apply(osg::Node* node);
45 protected:
46
47       
48   virtual osg::Group* createMainGroup(osg::Group* pr);
49   
50   virtual void setupCallbacks(SGSceneUserData* ud, osg::Group* parent);
51 private:
52   class PickCallback;
53   class VncCallback;
54   
55   string_list _proxyNames;
56 };
57
58
59 class SGKnobAnimation : public SGPickAnimation
60 {
61 public:
62     SGKnobAnimation(const SGPropertyNode* configNode,
63                     SGPropertyNode* modelRoot);
64
65     /**
66      * by default mouse wheel up corresponds to increment (CW)
67      * and mouse-wheel down corresponds to decrement (CCW).
68      * Since no one can agree on that, make it a global toggle.
69      */
70     static void setAlternateMouseWheelDirection(bool aToggle);
71     
72     /**
73      * by default mouse is dragged left-right to change knobs.
74      * set this to true to default to up-down. Individual knobs
75      * can overrider this,
76      */
77     static void setAlternateDragAxis(bool aToggle);
78     
79     
80     /**
81      * Scale the drag sensitivity. This provides a global hook for
82      * the user to scale the senstivity of dragging according to
83      * personal preference.
84      */
85     static void setDragSensitivity(double aFactor);
86     
87     
88 protected:
89     virtual osg::Group* createMainGroup(osg::Group* pr);
90       
91     virtual void setupCallbacks(SGSceneUserData* ud, osg::Group* parent);
92     
93 private:
94     class UpdateCallback;
95     
96     SGVec3d _axis;
97     SGVec3d _center;
98     SGSharedPtr<SGExpressiond const> _animationValue;
99 };
100
101 class SGSliderAnimation : public SGPickAnimation
102 {
103 public:
104     SGSliderAnimation(const SGPropertyNode* configNode,
105                     SGPropertyNode* modelRoot);
106     
107     
108 protected:
109     virtual osg::Group* createMainGroup(osg::Group* pr);
110     
111     virtual void setupCallbacks(SGSceneUserData* ud, osg::Group* parent);
112     
113 private:
114     class UpdateCallback;
115     
116     SGVec3d _axis;
117     SGSharedPtr<SGExpressiond const> _animationValue;
118 };
119
120 #endif // of SG_SCENE_PICK_ANIMATION_HXX
121