OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Shape.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12 */
13 
14 #ifndef OSG_SHAPE
15 #define OSG_SHAPE 1
16 
17 #include <osg/Object>
18 #include <osg/Vec3>
19 #include <osg/Quat>
20 #include <osg/Plane>
21 #include <osg/Array>
22 
23 namespace osg {
24 
25 // forward declare visitors.
26 class ShapeVisitor;
27 class ConstShapeVisitor;
28 
29 
35 #define META_Shape(library,name) \
36  virtual osg::Object* cloneType() const { return new name(); } \
37  virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new name (*this,copyop); } \
38  virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const name *>(obj)!=NULL; } \
39  virtual const char* libraryName() const { return #library; } \
40  virtual const char* className() const { return #name; } \
41  virtual void accept(osg::ShapeVisitor& sv) { sv.apply(*this); } \
42  virtual void accept(osg::ConstShapeVisitor& csv) const { csv.apply(*this); }
43 
48 class OSG_EXPORT Shape : public Object
49 {
50  public:
51 
52  Shape() {}
53 
54  Shape(const Shape& sa,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
55  Object(sa,copyop) {}
56 
59  virtual Object* cloneType() const = 0;
60 
63  virtual Object* clone(const CopyOp&) const = 0;
64 
65 
67  virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Shape*>(obj)!=NULL; }
68 
70  virtual const char* libraryName() const { return "osg"; }
71 
73  virtual const char* className() const { return "Shape"; }
74 
77  virtual void accept(ShapeVisitor&)=0;
78 
81  virtual void accept(ConstShapeVisitor&) const =0;
82 
83  protected:
84 
85  virtual ~Shape();
86 };
87 
88 // forward declarations of Shape types.
89 class Sphere;
90 class Box;
91 class Cone;
92 class Cylinder;
93 class Capsule;
94 class InfinitePlane;
95 
96 class TriangleMesh;
97 class ConvexHull;
98 class HeightField;
99 
100 class CompositeShape;
101 
103 {
104  public:
105 
107  virtual ~ShapeVisitor();
108 
109  virtual void apply(Shape&) {}
110  virtual void apply(Sphere&) {}
111  virtual void apply(Box&) {}
112  virtual void apply(Cone&) {}
113  virtual void apply(Cylinder&) {}
114  virtual void apply(Capsule&) {}
115  virtual void apply(InfinitePlane&) {}
116 
117  virtual void apply(TriangleMesh&) {}
118  virtual void apply(ConvexHull&) {}
119  virtual void apply(HeightField&) {}
120 
121  virtual void apply(CompositeShape&) {}
122 };
123 
125 {
126  public:
127 
129  virtual ~ConstShapeVisitor();
130 
131  virtual void apply(const Shape&) {}
132  virtual void apply(const Sphere&) {}
133  virtual void apply(const Box&) {}
134  virtual void apply(const Cone&) {}
135  virtual void apply(const Cylinder&) {}
136  virtual void apply(const Capsule&) {}
137  virtual void apply(const InfinitePlane&) {}
138 
139  virtual void apply(const TriangleMesh&) {}
140  virtual void apply(const ConvexHull&) {}
141  virtual void apply(const HeightField&) {}
142 
143  virtual void apply(const CompositeShape&) {}
144 };
145 
146 class OSG_EXPORT Sphere : public Shape
147 {
148  public:
149 
151  _center(0.0f,0.0f,0.0f),
152  _radius(1.0f) {}
153 
154  Sphere(const osg::Vec3& center,float radius):
155  _center(center),
156  _radius(radius) {}
157 
158  Sphere(const Sphere& sphere,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
159  Shape(sphere,copyop),
160  _center(sphere._center),
161  _radius(sphere._radius) {}
162 
164 
165  inline bool valid() const { return _radius>=0.0f; }
166 
167  inline void set(const Vec3& center,float radius)
168  {
169  _center = center;
170  _radius = radius;
171  }
172 
173  inline void setCenter(const Vec3& center) { _center = center; }
174  inline const Vec3& getCenter() const { return _center; }
175 
176  inline void setRadius(float radius) { _radius = radius; }
177  inline float getRadius() const { return _radius; }
178 
179  protected:
180 
181  virtual ~Sphere();
182 
184  float _radius;
185 
186 };
187 
188 class OSG_EXPORT Box : public Shape
189 {
190  public:
191 
192  Box():
193  _center(0.0f,0.0f,0.0f),
194  _halfLengths(0.5f,0.5f,0.5f) {}
195 
196  Box(const osg::Vec3& center,float width):
197  _center(center),
198  _halfLengths(width*0.5f,width*0.5f,width*0.5f) {}
199 
200  Box(const osg::Vec3& center,float lengthX,float lengthY, float lengthZ):
201  _center(center),
202  _halfLengths(lengthX*0.5f,lengthY*0.5f,lengthZ*0.5f) {}
203 
204  Box(const Box& box,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
205  Shape(box,copyop),
206  _center(box._center),
207  _halfLengths(box._halfLengths),
208  _rotation(box._rotation) {}
209 
210  META_Shape(osg, Box);
211 
212  inline bool valid() const { return _halfLengths.x()>=0.0f; }
213 
214  inline void set(const Vec3& center,const Vec3& halfLengths)
215  {
216  _center = center;
217  _halfLengths = halfLengths;
218  }
219 
220  inline void setCenter(const Vec3& center) { _center = center; }
221  inline const Vec3& getCenter() const { return _center; }
222 
223  inline void setHalfLengths(const Vec3& halfLengths) { _halfLengths = halfLengths; }
224  inline const Vec3& getHalfLengths() const { return _halfLengths; }
225 
226  inline void setRotation(const Quat& quat) { _rotation = quat; }
227  inline const Quat& getRotation() const { return _rotation; }
228  inline Matrix computeRotationMatrix() const { return Matrix(_rotation); }
229  inline bool zeroRotation() const { return _rotation.zeroRotation(); }
230 
231  protected:
232 
233  virtual ~Box();
234 
238 
239 };
240 
241 
242 
243 class OSG_EXPORT Cone : public Shape
244 {
245  public:
246 
247  Cone():
248  _center(0.0f,0.0f,0.0f),
249  _radius(1.0f),
250  _height(1.0f) {}
251 
252  Cone(const osg::Vec3& center,float radius,float height):
253  _center(center),
254  _radius(radius),
255  _height(height) {}
256 
257  Cone(const Cone& cone,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
258  Shape(cone,copyop),
259  _center(cone._center),
260  _radius(cone._radius),
261  _height(cone._height),
262  _rotation(cone._rotation) {}
263 
264  META_Shape(osg, Cone);
265 
266  inline bool valid() const { return _radius>=0.0f; }
267 
268  inline void set(const Vec3& center,float radius, float height)
269  {
270  _center = center;
271  _radius = radius;
272  _height = height;
273  }
274 
275  inline void setCenter(const Vec3& center) { _center = center; }
276  inline const Vec3& getCenter() const { return _center; }
277 
278  inline void setRadius(float radius) { _radius = radius; }
279  inline float getRadius() const { return _radius; }
280 
281  inline void setHeight(float height) { _height = height; }
282  inline float getHeight() const { return _height; }
283 
284  inline void setRotation(const Quat& quat) { _rotation = quat; }
285  inline const Quat& getRotation() const { return _rotation; }
286  inline Matrix computeRotationMatrix() const { return Matrix(_rotation); }
287  inline bool zeroRotation() const { return _rotation.zeroRotation(); }
288 
289  inline float getBaseOffsetFactor() const { return 0.25f; }
290  inline float getBaseOffset() const { return -getBaseOffsetFactor()*getHeight(); }
291 
292  protected:
293 
294  virtual ~Cone();
295 
297  float _radius;
298  float _height;
299 
301 };
302 
303 class OSG_EXPORT Cylinder : public Shape
304 {
305  public:
306 
308  _center(0.0f,0.0f,0.0f),
309  _radius(1.0f),
310  _height(1.0f) {}
311 
312  Cylinder(const osg::Vec3& center,float radius,float height):
313  _center(center),
314  _radius(radius),
315  _height(height) {}
316 
317  Cylinder(const Cylinder& cylinder,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
318  Shape(cylinder,copyop),
319  _center(cylinder._center),
320  _radius(cylinder._radius),
321  _height(cylinder._height),
322  _rotation(cylinder._rotation) {}
323 
325 
326  inline bool valid() const { return _radius>=0.0f; }
327 
328  inline void set(const Vec3& center,float radius, float height)
329  {
330  _center = center;
331  _radius = radius;
332  _height = height;
333  }
334 
335  inline void setCenter(const Vec3& center) { _center = center; }
336  inline const Vec3& getCenter() const { return _center; }
337 
338  inline void setRadius(float radius) { _radius = radius; }
339  inline float getRadius() const { return _radius; }
340 
341  inline void setHeight(float height) { _height = height; }
342  inline float getHeight() const { return _height; }
343 
344  inline void setRotation(const Quat& quat) { _rotation = quat; }
345  inline const Quat& getRotation() const { return _rotation; }
346  inline Matrix computeRotationMatrix() const { return Matrix(_rotation); }
347  bool zeroRotation() const { return _rotation.zeroRotation(); }
348 
349  protected:
350 
351  virtual ~Cylinder();
352 
354  float _radius;
355  float _height;
357 };
358 
359 class OSG_EXPORT Capsule : public Shape
360 {
361  public:
362 
364  _center(0.0f,0.0f,0.0f),
365  _radius(1.0f),
366  _height(1.0f) {}
367 
368  Capsule(const osg::Vec3& center,float radius,float height):
369  _center(center),
370  _radius(radius),
371  _height(height) {}
372 
373  Capsule(const Capsule& capsule,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
374  Shape(capsule,copyop),
375  _center(capsule._center),
376  _radius(capsule._radius),
377  _height(capsule._height),
378  _rotation(capsule._rotation) {}
379 
381 
382  inline bool valid() const { return _radius>=0.0f; }
383 
384  inline void set(const Vec3& center,float radius, float height)
385  {
386  _center = center;
387  _radius = radius;
388  _height = height;
389  }
390 
391  inline void setCenter(const Vec3& center) { _center = center; }
392  inline const Vec3& getCenter() const { return _center; }
393 
394  inline void setRadius(float radius) { _radius = radius; }
395  inline float getRadius() const { return _radius; }
396 
397  inline void setHeight(float height) { _height = height; }
398  inline float getHeight() const { return _height; }
399 
400  inline void setRotation(const Quat& quat) { _rotation = quat; }
401  inline const Quat& getRotation() const { return _rotation; }
402  inline Matrix computeRotationMatrix() const { return Matrix(_rotation); }
403  bool zeroRotation() const { return _rotation.zeroRotation(); }
404 
405  protected:
406 
407  virtual ~Capsule();
408 
410  float _radius;
411  float _height;
413 };
414 
415 class OSG_EXPORT InfinitePlane : public Shape, public Plane
416 {
417  public:
419 
421  Shape(plane,copyop),
422  Plane(plane) {}
423 
425 
426  protected:
427 
428  virtual ~InfinitePlane();
429 };
430 
434 {
435  public:
436 
438 
440  Shape(mesh,copyop),
441  _vertices(mesh._vertices),
442  _indices(mesh._indices) {}
443 
445 
446 
447  void setVertices(Vec3Array* vertices) { _vertices = vertices; }
448  Vec3Array* getVertices() { return _vertices.get(); }
449  const Vec3Array* getVertices() const { return _vertices.get(); }
450 
451 
452  void setIndices(IndexArray* indices) { _indices = indices; }
453  IndexArray* getIndices() { return _indices.get(); }
454  const IndexArray* getIndices() const { return _indices.get(); }
455 
456  protected:
457 
458  virtual ~TriangleMesh();
459 
462 
463 };
464 
466 {
467  public:
468 
470 
471  ConvexHull(const ConvexHull& hull,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
472  TriangleMesh(hull,copyop) {}
473 
475 
476  protected:
477 
478  virtual ~ConvexHull();
479 };
480 
482 {
483  public:
484 
485  HeightField();
486 
487  HeightField(const HeightField& mesh,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
488 
490 
491  typedef std::vector<float> HeightList;
492 
493  void allocate(unsigned int numColumns,unsigned int numRows);
494 
495  inline unsigned int getNumColumns() const { return _columns; }
496  inline unsigned int getNumRows() const { return _rows; }
497 
498  inline void setOrigin(const osg::Vec3& origin) { _origin = origin; }
499  inline const osg::Vec3& getOrigin() const { return _origin; }
500 
501  inline void setXInterval(float dx) { _dx = dx; }
502  inline float getXInterval() const { return _dx; }
503 
504  inline void setYInterval(float dy) { _dy = dy; }
505  inline float getYInterval() const { return _dy; }
506 
508  osg::FloatArray* getFloatArray() { return _heights.get(); }
509 
511  const osg::FloatArray* getFloatArray() const { return _heights.get(); }
512 
513  HeightList& getHeightList() { return _heights->asVector(); }
514 
515  const HeightList& getHeightList() const { return _heights->asVector(); }
516 
520  void setSkirtHeight(float skirtHeight) { _skirtHeight = skirtHeight; }
521 
523  float getSkirtHeight() const { return _skirtHeight; }
524 
528  void setBorderWidth(unsigned int borderWidth) { _borderWidth = borderWidth; }
529 
531  unsigned int getBorderWidth() const { return _borderWidth; }
532 
533  inline void setRotation(const Quat& quat) { _rotation = quat; }
534  inline const Quat& getRotation() const { return _rotation; }
535  inline Matrix computeRotationMatrix() const { return Matrix(_rotation); }
536  inline bool zeroRotation() const { return _rotation.zeroRotation(); }
537 
538  /* set a single height point in the height field */
539  inline void setHeight(unsigned int c,unsigned int r,float value)
540  {
541  (*_heights)[c+r*_columns] = value;
542  }
543 
544  /* Get address of single height point in the height field, allows user to change. */
545  inline float& getHeight(unsigned int c,unsigned int r)
546  {
547  return (*_heights)[c+r*_columns];
548  }
549 
550  /* Get value of single height point in the height field, not editable. */
551  inline float getHeight(unsigned int c,unsigned int r) const
552  {
553  return (*_heights)[c+r*_columns];
554  }
555 
556  inline Vec3 getVertex(unsigned int c,unsigned int r) const
557  {
558  return Vec3(_origin.x()+getXInterval()*(float)c,
559  _origin.y()+getYInterval()*(float)r,
560  _origin.z()+(*_heights)[c+r*_columns]);
561  }
562 
563  Vec3 getNormal(unsigned int c,unsigned int r) const;
564 
565  Vec2 getHeightDelta(unsigned int c,unsigned int r) const;
566 
567  protected:
568 
569  virtual ~HeightField();
570 
571  unsigned int _columns,_rows;
572 
573  osg::Vec3 _origin; // _origin is the min value of the X and Y coordinates.
574  float _dx;
575  float _dy;
576 
578  unsigned int _borderWidth;
579 
582 
583 };
584 
586 
587 
589 {
590  public:
591 
592 
593 
594  typedef std::vector< ref_ptr<Shape> > ChildList;
595 
597 
599  Shape(cs,copyop),
600  _children(cs._children) {}
601 
603 
605  void setShape(Shape* shape) { _shape = shape; }
606 
608  Shape* getShape() { return _shape.get(); }
609 
611  const Shape* getShape() const { return _shape.get(); }
612 
614  unsigned int getNumChildren() const { return static_cast<unsigned int>(_children.size()); }
615 
617  Shape* getChild(unsigned int i) { return _children[i].get(); }
618 
620  const Shape* getChild(unsigned int i) const { return _children[i].get(); }
621 
623  void addChild(Shape* shape) { _children.push_back(shape); }
624 
626  void removeChild(unsigned int i) { _children.erase(_children.begin()+i); }
627 
630  unsigned int findChildNo(Shape* shape) const
631  {
632  for (unsigned int childNo=0;childNo<_children.size();++childNo)
633  {
634  if (_children[childNo]==shape) return childNo;
635  }
636  return static_cast<unsigned int>(_children.size()); // node not found.
637 
638  }
639 
640  protected:
641 
642  virtual ~CompositeShape();
643 
645  ChildList _children;
646 
647 };
648 
649 }
650 
651 #endif
unsigned int _borderWidth
Definition: Shape.h:578
Matrix computeRotationMatrix() const
Definition: Shape.h:228
#define OSG_EXPORT
Definition: Export.h:43
const osg::FloatArray * getFloatArray() const
Definition: Shape.h:511
Cone(const Cone &cone, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: Shape.h:257
void setIndices(IndexArray *indices)
Definition: Shape.h:452
unsigned int findChildNo(Shape *shape) const
Definition: Shape.h:630
void setCenter(const Vec3 &center)
Definition: Shape.h:275
const osg::Vec3 & getOrigin() const
Definition: Shape.h:499
float getRadius() const
Definition: Shape.h:279
virtual void apply(const Sphere &)
Definition: Shape.h:132
bool zeroRotation() const
Definition: Shape.h:347
#define NULL
Definition: Export.h:59
float _radius
Definition: Shape.h:184
const Vec3 & getHalfLengths() const
Definition: Shape.h:224
void setCenter(const Vec3 &center)
Definition: Shape.h:391
std::vector< ref_ptr< Shape > > ChildList
Definition: Shape.h:594
Shape()
Definition: Shape.h:52
void setRadius(float radius)
Definition: Shape.h:394
virtual void apply(Cylinder &)
Definition: Shape.h:113
float _radius
Definition: Shape.h:297
virtual void apply(const Cylinder &)
Definition: Shape.h:135
void setRotation(const Quat &quat)
Definition: Shape.h:400
const Shape * getChild(unsigned int i) const
Definition: Shape.h:620
float _skirtHeight
Definition: Shape.h:577
Box()
Definition: Shape.h:192
void removeChild(unsigned int i)
Definition: Shape.h:626
Vec3 _center
Definition: Shape.h:409
void setHeight(float height)
Definition: Shape.h:341
Capsule(const osg::Vec3 &center, float radius, float height)
Definition: Shape.h:368
float getRadius() const
Definition: Shape.h:177
osg::Vec3 _origin
Definition: Shape.h:573
virtual void apply(Box &)
Definition: Shape.h:111
Cylinder(const Cylinder &cylinder, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: Shape.h:317
Matrix computeRotationMatrix() const
Definition: Shape.h:535
float getYInterval() const
Definition: Shape.h:505
bool valid() const
Definition: Shape.h:326
Quat _rotation
Definition: Shape.h:412
void setRadius(float radius)
Definition: Shape.h:278
virtual void apply(const ConvexHull &)
Definition: Shape.h:140
virtual void apply(InfinitePlane &)
Definition: Shape.h:115
float getRadius() const
Definition: Shape.h:395
Capsule(const Capsule &capsule, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: Shape.h:373
HeightList & getHeightList()
Definition: Shape.h:513
unsigned int _rows
Definition: Shape.h:571
HeightField Grid
Definition: Shape.h:585
void set(const Vec3 &center, float radius, float height)
Definition: Shape.h:384
float getHeight(unsigned int c, unsigned int r) const
Definition: Shape.h:551
void setRotation(const Quat &quat)
Definition: Shape.h:344
void setHeight(unsigned int c, unsigned int r, float value)
Definition: Shape.h:539
Matrix computeRotationMatrix() const
Definition: Shape.h:402
float getSkirtHeight() const
Definition: Shape.h:523
bool valid() const
Definition: Shape.h:165
Sphere()
Definition: Shape.h:150
const Quat & getRotation() const
Definition: Shape.h:401
std::vector< float > HeightList
Definition: Shape.h:491
void setHeight(float height)
Definition: Shape.h:281
bool valid() const
Definition: Shape.h:382
void setRotation(const Quat &quat)
Definition: Shape.h:226
virtual void apply(Cone &)
Definition: Shape.h:112
Box(const osg::Vec3 &center, float width)
Definition: Shape.h:196
Sphere(const Sphere &sphere, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: Shape.h:158
T * clone(const T *t, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
Definition: Object.h:242
Vec3 _center
Definition: Shape.h:296
unsigned int getBorderWidth() const
Definition: Shape.h:531
virtual void apply(CompositeShape &)
Definition: Shape.h:121
void set(const Vec3 &center, float radius, float height)
Definition: Shape.h:328
Quat _rotation
Definition: Shape.h:237
const Vec3 & getCenter() const
Definition: Shape.h:174
void set(const Vec3 &center, float radius)
Definition: Shape.h:167
void setYInterval(float dy)
Definition: Shape.h:504
unsigned int getNumChildren() const
Definition: Shape.h:614
bool zeroRotation() const
Definition: Shape.h:287
float & getHeight(unsigned int c, unsigned int r)
Definition: Shape.h:545
Quat _rotation
Definition: Shape.h:300
GLint GLenum GLsizei width
Definition: GLU.h:71
Matrix computeRotationMatrix() const
Definition: Shape.h:286
void set(const Vec3 &center, const Vec3 &halfLengths)
Definition: Shape.h:214
ChildList _children
Definition: Shape.h:645
float getBaseOffsetFactor() const
Definition: Shape.h:289
Vec3f Vec3
Definition: Vec3.h:21
bool valid() const
Definition: Shape.h:266
Shape * getChild(unsigned int i)
Definition: Shape.h:617
float _height
Definition: Shape.h:355
void setRadius(float radius)
Definition: Shape.h:176
void setCenter(const Vec3 &center)
Definition: Shape.h:220
const IndexArray * getIndices() const
Definition: Shape.h:454
ConvexHull(const ConvexHull &hull, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: Shape.h:471
void addChild(Shape *shape)
Definition: Shape.h:623
T * cloneType(const T *t)
Definition: Object.h:284
ref_ptr< Shape > _shape
Definition: Shape.h:644
Quat _rotation
Definition: Shape.h:356
void setXInterval(float dx)
Definition: Shape.h:501
Cone(const osg::Vec3 &center, float radius, float height)
Definition: Shape.h:252
Vec3 _halfLengths
Definition: Shape.h:236
Cone()
Definition: Shape.h:247
virtual void apply(const InfinitePlane &)
Definition: Shape.h:137
const HeightList & getHeightList() const
Definition: Shape.h:515
Shape * getShape()
Definition: Shape.h:608
const Quat & getRotation() const
Definition: Shape.h:285
float getHeight() const
Definition: Shape.h:398
bool zeroRotation() const
Definition: Shape.h:229
const Vec3 & getCenter() const
Definition: Shape.h:392
virtual void apply(const Cone &)
Definition: Shape.h:134
osg::ref_ptr< osg::FloatArray > _heights
Definition: Shape.h:581
virtual void apply(const TriangleMesh &)
Definition: Shape.h:139
void setOrigin(const osg::Vec3 &origin)
Definition: Shape.h:498
virtual void apply(const Box &)
Definition: Shape.h:133
ref_ptr< IndexArray > _indices
Definition: Shape.h:461
Box(const Box &box, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: Shape.h:204
void setShape(Shape *shape)
Definition: Shape.h:605
osg::FloatArray * getFloatArray()
Definition: Shape.h:508
const Quat & getRotation() const
Definition: Shape.h:534
const Vec3Array * getVertices() const
Definition: Shape.h:449
GLint GLenum GLsizei GLsizei height
Definition: GLU.h:71
void setCenter(const Vec3 &center)
Definition: Shape.h:335
virtual void apply(ConvexHull &)
Definition: Shape.h:118
void setRotation(const Quat &quat)
Definition: Shape.h:533
Vec3 getVertex(unsigned int c, unsigned int r) const
Definition: Shape.h:556
A plane class. It can be used to represent an infinite plane.
Definition: Plane.h:33
Shape(const Shape &sa, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: Shape.h:54
virtual void apply(const HeightField &)
Definition: Shape.h:141
Cylinder(const osg::Vec3 &center, float radius, float height)
Definition: Shape.h:312
Box(const osg::Vec3 &center, float lengthX, float lengthY, float lengthZ)
Definition: Shape.h:200
Sphere(const osg::Vec3 &center, float radius)
Definition: Shape.h:154
float _radius
Definition: Shape.h:354
const Quat & getRotation() const
Definition: Shape.h:345
IndexArray * getIndices()
Definition: Shape.h:453
#define META_Shape(library, name)
Definition: Shape.h:35
virtual void apply(const CompositeShape &)
Definition: Shape.h:143
void setCenter(const Vec3 &center)
Definition: Shape.h:173
float getBaseOffset() const
Definition: Shape.h:290
const Quat & getRotation() const
Definition: Shape.h:227
virtual const char * libraryName() const
Definition: Shape.h:70
Definition: AlphaFunc.h:19
float _radius
Definition: Shape.h:410
void setHeight(float height)
Definition: Shape.h:397
virtual void apply(Capsule &)
Definition: Shape.h:114
float _height
Definition: Shape.h:411
float getXInterval() const
Definition: Shape.h:502
unsigned int getNumColumns() const
Definition: Shape.h:495
void setBorderWidth(unsigned int borderWidth)
Definition: Shape.h:528
virtual void apply(Shape &)
Definition: Shape.h:109
Matrix computeRotationMatrix() const
Definition: Shape.h:346
const Vec3 & getCenter() const
Definition: Shape.h:221
InfinitePlane(const InfinitePlane &plane, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: Shape.h:420
virtual const char * className() const
Definition: Shape.h:73
void setHalfLengths(const Vec3 &halfLengths)
Definition: Shape.h:223
void setRadius(float radius)
Definition: Shape.h:338
CompositeShape(const CompositeShape &cs, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: Shape.h:598
ref_ptr< Vec3Array > _vertices
Definition: Shape.h:460
Vec3 _center
Definition: Shape.h:183
void setRotation(const Quat &quat)
Definition: Shape.h:284
TriangleMesh(const TriangleMesh &mesh, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: Shape.h:439
Quat _rotation
Definition: Shape.h:580
Vec3Array * getVertices()
Definition: Shape.h:448
Definition: Quat.h:29
void set(const Vec3 &center, float radius, float height)
Definition: Shape.h:268
float _height
Definition: Shape.h:298
bool valid() const
Definition: Shape.h:212
void setVertices(Vec3Array *vertices)
Definition: Shape.h:447
virtual bool isSameKindAs(const Object *obj) const
Definition: Shape.h:67
const Shape * getShape() const
Definition: Shape.h:611
virtual void apply(const Shape &)
Definition: Shape.h:131
virtual void apply(TriangleMesh &)
Definition: Shape.h:117
unsigned int getNumRows() const
Definition: Shape.h:496
bool zeroRotation() const
Definition: Shape.h:403
void setSkirtHeight(float skirtHeight)
Definition: Shape.h:520
float getRadius() const
Definition: Shape.h:339
const Vec3 & getCenter() const
Definition: Shape.h:276
const Vec3 & getCenter() const
Definition: Shape.h:336
float getHeight() const
Definition: Shape.h:282
float getHeight() const
Definition: Shape.h:342
bool zeroRotation() const
Definition: Shape.h:536
Matrixd Matrix
Definition: Matrix.h:27
virtual void apply(HeightField &)
Definition: Shape.h:119
virtual void apply(Sphere &)
Definition: Shape.h:110
Vec3 _center
Definition: Shape.h:353
virtual void apply(const Capsule &)
Definition: Shape.h:136
Vec3 _center
Definition: Shape.h:235