vrecko
virtual reality framework
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
vrecko
Vrecko - the Virtual Reality Engine
Dynamic Art module
L-system plant modeler - module for Vrecko
Head Up Display module
Space Partitioning - module for Vrecko
Todo List
Deprecated List
Namespaces
Classes
Files
File List
include
base
helpers
vrecko
vreckoAP
ArtificialWorld
behindO
Boids
CableEditor
CameraMovement
CameraPath
CarSim
ConnectEditor
ConstrainedMovement
DynamicArt
EditorController
EditorQAbilities
FFDEditor
Filter
games
Garden
GUI
HeadTracking
HelloWorld
HUD
InputConnector
LightsEditor
Menu
AP_Menu.h
DynamicMenu.h
DynamicMenu_XMLPart.h
osgQ_QSection.h
osgQ_QShapeDrawable.h
Nature
navigation
ObjectUtils
ODE
RoomEdit
ShootingSimulation
SpacePartitioning
TextOutput
vreckoDP
vreckoUtils
src
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
osgQ_QSection.h
Go to the documentation of this file.
1
#ifndef OSGQ_QSECTION
2
#define OSGQ_QSECTION
3
4
#include <osg/Shape>
5
6
namespace
osgQ {
7
8
class
QSection
;
9
10
class
QShapeVisitor
11
{
12
public
:
13
QShapeVisitor
() {}
14
virtual
~QShapeVisitor
() {}
15
virtual
void
apply
(
const
QSection
&) {}
16
};
17
18
19
class
QConstShapeVisitor
:
public
osg::ConstShapeVisitor
20
{
21
public
:
22
QConstShapeVisitor
() {}
23
virtual
~QConstShapeVisitor
() {}
24
virtual
void
apply
(
const
QSection
&) {}
25
};
26
27
class
QSection
:
public
osg::Shape
28
{
29
public
:
30
31
QSection
():
32
_center
(0.0f,0.0f,0.0f),
33
_outerRadius
(1.0f),
34
_innerRadius
(0.5f),
35
_angleFrom
(osg::
PI
/ 4.0f),
36
_angleTo
(osg::
PI
* 3.0f / 4.0f),
37
_outerAngleAddition
(0.0f),
38
_height
(1.0f) {}
39
40
QSection
(
const
osg::Vec3& center,
float
innerRadius,
float
outerRadius,
41
float
angleFrom,
float
angleTo,
float
outerAngleAddition,
float
height):
42
_center
(center),
43
_outerRadius
(outerRadius),
44
_innerRadius
(innerRadius),
45
_angleFrom
(angleFrom),
46
_angleTo
(angleTo),
47
_outerAngleAddition
(0.0f),
48
_height
(height) {}
49
50
QSection
(
const
QSection
& qsection,
const
osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
51
osg::Shape(qsection,copyop),
52
_center
(qsection.
_center
),
53
_outerRadius
(qsection.
_outerRadius
),
54
_innerRadius
(qsection.
_innerRadius
),
55
_angleFrom
(qsection.
_angleFrom
),
56
_angleTo
(qsection.
_angleTo
),
57
_outerAngleAddition
(qsection.
_outerAngleAddition
),
58
_height
(qsection.
_height
),
59
_rotation
(qsection.
_rotation
) {}
60
61
62
virtual
osg::Object*
cloneType
()
const
{
return
new
QSection
(); }
63
virtual
osg::Object*
clone
(
const
osg::CopyOp& copyop)
const
{
return
new
QSection
(*
this
,copyop); }
64
virtual
bool
isSameKindAs
(
const
osg::Object* obj)
const
{
return
dynamic_cast<
const
QSection
*
>
(obj)!=NULL; }
65
virtual
const
char
*
libraryName
()
const
{
return
"osgq"
; }
66
virtual
const
char
*
className
()
const
{
return
"QSection"
; }
67
68
virtual
void
accept
(osg::ShapeVisitor& sv) { (
dynamic_cast<
QShapeVisitor
*
>
(&sv))->apply(*
this
); }
69
virtual
void
accept
(osg::ConstShapeVisitor& csv)
const
{ (
dynamic_cast<
QConstShapeVisitor
*
>
(&csv))->apply(*
this
); }
70
71
// virtual void accept(QShapeVisitor& sv) { sv.apply(*this); }
72
// virtual void accept(QConstShapeVisitor& csv) const { csv.apply(*this); }
73
74
inline
bool
valid
()
const
{
return
((
_innerRadius
>=0.0f) && (
_outerRadius
>=
_innerRadius
) && (
_angleFrom
<=
_angleTo
)); }
75
76
inline
void
set
(
const
osg::Vec3& center,
float
outerRadius,
float
innerRadius,
77
float
angleFrom,
float
angleTo,
float
outerAngleAddition,
float
height)
78
{
79
_center
= center;
80
_outerRadius
= outerRadius;
81
_innerRadius
= innerRadius;
82
_angleFrom
= angleFrom;
83
_angleTo
= angleTo;
84
_outerAngleAddition
= outerAngleAddition;
85
_height
= height;
86
}
87
88
inline
void
setCenter
(
const
osg::Vec3& center) {
_center
= center; }
89
inline
const
osg::Vec3&
getCenter
()
const
{
return
_center
; }
90
91
inline
void
setOuterRadius
(
float
outerRadius) {
_outerRadius
= outerRadius; }
92
inline
float
getOuterRadius
()
const
{
return
_outerRadius
; }
93
94
inline
void
setInnerRadius
(
float
innerRadius) {
_innerRadius
= innerRadius; }
95
inline
float
getInnerRadius
()
const
{
return
_innerRadius
; }
96
97
inline
void
setAngleFrom
(
float
angleFrom) {
_angleFrom
= angleFrom; }
98
inline
float
getAngleFrom
()
const
{
return
_angleFrom
; }
99
100
inline
void
setAngleTo
(
float
angleTo) {
_angleTo
= angleTo; }
101
inline
float
getAngleTo
()
const
{
return
_angleTo
; }
102
103
inline
void
setOuterAngleAddition
(
float
outerAngleAddition) {
_outerAngleAddition
= outerAngleAddition; }
104
// half of this addition will be added to [angleFrom] and half of it to [angleTo]
105
// (only on the outer side of the section)
106
inline
float
getOuterAngleAddition
()
const
{
return
_outerAngleAddition
; }
107
108
inline
void
setHeight
(
float
height) {
_height
= height; }
109
inline
float
getHeight
()
const
{
return
_height
; }
110
111
inline
void
setRotation
(
const
osg::Quat& quat) {
_rotation
= quat; }
112
inline
const
osg::Quat&
getRotation
()
const
{
return
_rotation
; }
113
inline
osg::Matrix
computeRotationMatrix
()
const
{
return
osg::Matrix(
_rotation
); }
114
bool
zeroRotation
()
const
{
return
_rotation
.zeroRotation(); }
115
116
inline
int
computeNumberOfSegments
()
const
;
117
118
protected
:
119
virtual
~QSection
() {}
120
121
osg::Vec3
_center
;
122
float
_outerRadius
;
123
float
_innerRadius
;
124
float
_angleFrom
;
125
float
_angleTo
;
126
float
_outerAngleAddition
;
127
float
_height
;
128
osg::Quat
_rotation
;
129
};
130
131
132
int
QSection::computeNumberOfSegments
()
const
133
{
134
int
n = (int) (
_outerRadius
* (
_angleTo
-
_angleFrom
) * (20.0f /
osg::PI
));
135
return
(n < 0) ? 0 : n;
136
}
137
138
}
139
140
#endif
include
vreckoAP
Menu
osgQ_QSection.h
Generated on Tue Feb 19 2013 10:23:44 for vrecko by
1.8.3.1