config-osg.h
Go to the documentation of this file.
1 //
2 // config-osg.h
3 // gepetto-viewer
4 //
5 // Created by Justin Carpentier on 06/02/2014.
6 // Modified by Mathieu Geisert in November 2014.
7 // Copyright (c) 2014 LAAS-CNRS. All rights reserved.
8 //
9 
10 #ifndef DynAndGraph_config_h
11 #define DynAndGraph_config_h
12 
13 #include <QMetaType>
14 
15 #include <osg/Shape>
16 #include <osg/ShapeDrawable>
17 #include <osg/Geometry>
18 
19 #include <osg/Geode>
20 #include <osg/PositionAttitudeTransform>
21 #include <osg/AutoTransform>
22 #include <osg/MatrixTransform>
23 #include <osg/Node>
24 #include <osg/Group>
25 #include <osg/Switch>
26 #include <osg/ClearNode>
27 #include <osg/LineWidth>
28 
29 #include <osg/AlphaFunc>
30 #include <osg/BlendFunc>
31 #include <osg/StateSet>
32 #include <osg/Depth>
33 
34 #include <osg/State>
35 #include <osg/StateSet>
36 #include <osg/Light>
37 #include <osg/LightSource>
38 
39 #include <osg/Material>
40 
41 #include <osg/Camera>
42 #include <osg/Viewport>
43 #include <osgViewer/Viewer>
44 #include <osgViewer/ViewerBase>
45 #include <osg/GraphicsContext>
46 
47 #include <osg/PolygonMode>
48 
49 #include <gepetto/viewer/fwd.h>
50 #include <gepetto/viewer/macros.h>
51 
52 namespace osg
53 {
54 
55  DEF_CLASS_SMART_PTR(Geode)
56 
57  DEF_OSG_CLASS_REF_PTR(Sphere)
60  DEF_OSG_CLASS_REF_PTR(Cylinder)
61  DEF_OSG_CLASS_REF_PTR(Capsule)
62  DEF_OSG_CLASS_REF_PTR(ShapeDrawable)
63  DEF_OSG_CLASS_REF_PTR(Geometry)
64  DEF_OSG_CLASS_REF_PTR(LineWidth)
65 
67  DEF_OSG_CLASS_REF_PTR(PositionAttitudeTransform)
68  DEF_OSG_CLASS_REF_PTR(AutoTransform)
69  DEF_OSG_CLASS_REF_PTR(MatrixTransform)
71  DEF_OSG_CLASS_REF_PTR(LightSource)
72 
75  DEF_OSG_CLASS_REF_PTR(Switch)
76  DEF_OSG_CLASS_REF_PTR(ClearNode)
77 
79 
80  DEF_OSG_CLASS_REF_PTR(AlphaFunc)
81  DEF_OSG_CLASS_REF_PTR(BlendFunc)
82  DEF_OSG_CLASS_REF_PTR(StateSet)
83 
85  DEF_OSG_CLASS_REF_PTR(StateSet)
86 
87  DEF_OSG_CLASS_REF_PTR(Material)
88 
89  DEF_OSG_CLASS_REF_PTR(Camera)
90  DEF_OSG_CLASS_REF_PTR(Viewport)
91  DEF_OSG_CLASS_REF_PTR(GraphicsContext)
92 
93  DEF_OSG_CLASS_REF_PTR(Vec3Array)
94  DEF_OSG_CLASS_REF_PTR(Vec4Array)
95 
96  DEF_OSG_CLASS_REF_PTR(PolygonMode)
97 
98  typedef ::osg::ref_ptr< GraphicsContext::Traits > TraitsRefPtr;
99 
100 } /* namespace osg */
101 
102 namespace osgViewer
103 {
104  DEF_OSG_CLASS_REF_PTR(Viewer)
105 
106 } /* namespace osgViewer */
107 
108 typedef ::osg::Vec2f osgVector2;
109 typedef ::osg::Vec3f osgVector3;
110 typedef ::osg::Vec4f osgVector4;
111 
112 typedef ::osg::Quat osgQuat;
113 
114 namespace gepetto {
115 namespace viewer {
116 
118  {
122  };
123 
125  {
128  };
129 
131  {
132  FILL = 0,
135  };
136 
137  enum FaceMode
138  {
139  FACE = 0,
142  };
143 
145  {
151  explicit Configuration(const float* a, bool XYZW)
152  : position(a[0],a[1],a[2])
153  , quat(a[(XYZW ? 3 : 4)],
154  a[(XYZW ? 4 : 5)],
155  a[(XYZW ? 5 : 6)],
156  a[(XYZW ? 6 : 3)]) {}
157  Configuration(const osgVector3& p, const osgQuat& q) : position(p), quat(q) {}
158 
159  bool operator== (const Configuration& other) const
160  {
161  return position == other.position && quat == other.quat;
162  }
163 
164  bool operator!= (const Configuration& other) const
165  {
166  return position != other.position || quat != other.quat;
167  }
168 
169  bool valid() const
170  {
171  return position.valid() && quat.asVec4().valid();
172  }
173  };
174 
175 } /* namespace viewer */
176 } /* namespace gepetto */
177 
178 Q_DECLARE_METATYPE(osgVector2)
179 Q_DECLARE_METATYPE(osgVector3)
180 Q_DECLARE_METATYPE(osgVector4)
181 Q_DECLARE_METATYPE(gepetto::viewer::Configuration)
182 
183 #endif
Definition: config-osg.h:121
FaceMode
Definition: config-osg.h:137
#define DEF_OSG_CLASS_REF_PTR(className)
Definition: macros.h:57
::osg::Vec3f osgVector3
Definition: config-osg.h:109
::osg::ref_ptr< GraphicsContext::Traits > TraitsRefPtr
Definition: config-osg.h:98
::osg::Quat osgQuat
Definition: config-osg.h:112
Definition: config-osg.h:102
Definition: config-osg.h:119
Definition: config-osg.h:141
::osg::Vec2f osgVector2
Definition: config-osg.h:108
::osg::Vec4f osgVector4
Definition: config-osg.h:110
VisibilityMode
Definition: config-osg.h:117
Definition: config-osg.h:134
bool valid() const
Definition: config-osg.h:169
Definition: config-osg.h:127
Definition: config-osg.h:126
Definition: config-osg.h:139
Definition: config-osg.h:133
Definition: action-search-bar.hh:27
osgQuat quat
Definition: config-osg.h:147
LightingMode
Definition: config-osg.h:124
Definition: config-osg.h:132
Definition: config-osg.h:120
Definition: config-osg.h:144
#define DEF_CLASS_SMART_PTR(className)
Definition: macros.h:50
Configuration(const osgVector3 &p, const osgQuat &q)
Definition: config-osg.h:157
Definition: config-osg.h:140
Definition: config-osg.h:52
osgVector3 position
Definition: config-osg.h:146
Configuration(const float *a, bool XYZW)
Definition: config-osg.h:151
WireFrameMode
Definition: config-osg.h:130
Configuration()
Definition: config-osg.h:148