GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/gepetto/viewer/config-osg.h Lines: 9 11 81.8 %
Date: 2020-05-14 11:23:33 Branches: 7 20 35.0 %

Line Branch Exec Source
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)
58
    DEF_OSG_CLASS_REF_PTR(Box)
59
    DEF_OSG_CLASS_REF_PTR(Cone)
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
66
    DEF_OSG_CLASS_REF_PTR(Geode)
67
    DEF_OSG_CLASS_REF_PTR(PositionAttitudeTransform)
68
    DEF_OSG_CLASS_REF_PTR(AutoTransform)
69
    DEF_OSG_CLASS_REF_PTR(MatrixTransform)
70
    DEF_OSG_CLASS_REF_PTR(Light)
71
    DEF_OSG_CLASS_REF_PTR(LightSource)
72
73
    DEF_OSG_CLASS_REF_PTR(Node)
74
    DEF_OSG_CLASS_REF_PTR(Group)
75
    DEF_OSG_CLASS_REF_PTR(Switch)
76
    DEF_OSG_CLASS_REF_PTR(ClearNode)
77
78
    DEF_OSG_CLASS_REF_PTR(Depth)
79
80
    DEF_OSG_CLASS_REF_PTR(AlphaFunc)
81
    DEF_OSG_CLASS_REF_PTR(BlendFunc)
82
    DEF_OSG_CLASS_REF_PTR(StateSet)
83
84
    DEF_OSG_CLASS_REF_PTR(State)
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
117
    enum VisibilityMode
118
    {
119
        VISIBILITY_OFF = 0,
120
        VISIBILITY_ON = 1,
121
        ALWAYS_ON_TOP
122
    };
123
124
    enum LightingMode
125
    {
126
        LIGHT_INFLUENCE_OFF = 0,
127
        LIGHT_INFLUENCE_ON = 1
128
    };
129
130
    enum WireFrameMode
131
    {
132
        FILL = 0,
133
        WIREFRAME,
134
        FILL_AND_WIREFRAME
135
    };
136
137
    enum FaceMode
138
    {
139
        FACE = 0,
140
        EDGE,
141
        FACE_AND_EDGE
142
    };
143
144
7
    struct Configuration
145
    {
146
        osgVector3 position;
147
        osgQuat quat;
148
5
        Configuration() {}
149
        /// \param XYZW when false, the 4 last parameters are a quaternion (w,x,y,z)
150
        ///             otherwise, a quaternion (x,y,z,w)
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
4
        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
7
        bool operator!= (const Configuration& other) const
165
        {
166

7
          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
1
Q_DECLARE_METATYPE(osgVector2)
179
1
Q_DECLARE_METATYPE(osgVector3)
180
1
Q_DECLARE_METATYPE(osgVector4)
181
1
Q_DECLARE_METATYPE(gepetto::viewer::Configuration)
182
183
#endif