27class ConstShapeVisitor;
35#define META_Shape(library,name) \
36 virtual Object* cloneType() const { return new name(); } \
37 virtual Object* clone(const CopyOp& copyop) const { return new name (*this,copyop); } \
38 virtual bool isSameKindAs(const 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(ShapeVisitor& sv) { sv.apply(*this); } \
42 virtual void accept(ConstShapeVisitor& csv) const { csv.apply(*this); }
73 virtual const char*
className()
const {
return "Shape"; }
159 Shape(sphere,copyop),
167 inline void set(
const Vec3& center,
float radius)
200 Box(
const Vec3& center,
float lengthX,
float lengthY,
float lengthZ):
252 Cone(
const Vec3& center,
float radius,
float height):
268 inline void set(
const Vec3& center,
float radius,
float height)
318 Shape(cylinder,copyop),
328 inline void set(
const Vec3& center,
float radius,
float height)
374 Shape(capsule,copyop),
384 inline void set(
const Vec3& center,
float radius,
float height)
494 void allocate(
unsigned int numColumns,
unsigned int numRows);
540 inline void setHeight(
unsigned int c,
unsigned int r,
float value)
552 inline float getHeight(
unsigned int c,
unsigned int r)
const
636 for (
unsigned int childNo=0;childNo<
_children.size();++childNo)
638 if (
_children[childNo]==shape)
return childNo;
640 return static_cast<unsigned int>(
_children.size());
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Vec2f Vec2
Definition Vec2:21
TemplateArray< Vec3, Array::Vec3ArrayType, 3, GL_FLOAT > Vec3Array
Definition Array:449
Vec3f Vec3
Definition Vec3:21
TemplateArray< GLfloat, Array::FloatArrayType, 1, GL_FLOAT > FloatArray
Definition Array:421
HeightField Grid
Definition Shape:586
Matrixd Matrix
Definition Matrix:27
Vec4f Vec4
Definition Vec4:21
OSG_EXPORT Geometry * convertShapeToGeometry(const Shape &shape, const TessellationHints *hints)
Binding
The scope of applicability of the values in this array.
Definition Array:130
@ BIND_OVERALL
Definition Array:133
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Object()
Construct an object.
Definition Object:69
Plane()
Default constructor.
Definition Plane:58
A quaternion class.
Definition Quat:30
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
T * get() const
Definition ref_ptr:117
Base class for all shape types.
Definition Shape:49
virtual const char * libraryName() const
return the name of the attribute's library.
Definition Shape:70
virtual void accept(ShapeVisitor &)=0
accept a non const shape visitor which can be used on non const shape objects.
virtual bool isSameKindAs(const Object *obj) const
return true if this and obj are of the same kind of object.
Definition Shape:67
Shape(const Shape &sa, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Definition Shape:54
virtual Object * clone(const CopyOp &) const =0
Clone an attribute, with Object* return type.
virtual void accept(ConstShapeVisitor &) const =0
accept a const shape visitor which can be used on const shape objects.
virtual Object * cloneType() const =0
Clone the type of an attribute, with Object* return type.
virtual const char * className() const
return the name of the attribute's class type.
Definition Shape:73
Shape()
Definition Shape:52
virtual void apply(Cylinder &)
Definition Shape:113
virtual void apply(Capsule &)
Definition Shape:114
ShapeVisitor()
Definition Shape:106
virtual void apply(TriangleMesh &)
Definition Shape:117
virtual void apply(Cone &)
Definition Shape:112
virtual void apply(CompositeShape &)
Definition Shape:121
virtual void apply(InfinitePlane &)
Definition Shape:115
virtual void apply(ConvexHull &)
Definition Shape:118
virtual void apply(Shape &)
Definition Shape:109
virtual void apply(Sphere &)
Definition Shape:110
virtual void apply(HeightField &)
Definition Shape:119
virtual void apply(Box &)
Definition Shape:111
virtual void apply(const ConvexHull &)
Definition Shape:140
virtual void apply(const Sphere &)
Definition Shape:132
virtual ~ConstShapeVisitor()
ConstShapeVisitor()
Definition Shape:128
virtual void apply(const Cylinder &)
Definition Shape:135
virtual void apply(const Box &)
Definition Shape:133
virtual void apply(const HeightField &)
Definition Shape:141
virtual void apply(const Capsule &)
Definition Shape:136
virtual void apply(const CompositeShape &)
Definition Shape:143
virtual void apply(const InfinitePlane &)
Definition Shape:137
virtual void apply(const Cone &)
Definition Shape:134
virtual void apply(const TriangleMesh &)
Definition Shape:139
virtual void apply(const Shape &)
Definition Shape:131
float _radius
Definition Shape:184
bool valid() const
Definition Shape:165
const Vec3 & getCenter() const
Definition Shape:174
Vec3 _center
Definition Shape:183
float getRadius() const
Definition Shape:177
Sphere(const Sphere &sphere, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Definition Shape:158
Sphere(const Vec3 ¢er, float radius)
Definition Shape:154
void set(const Vec3 ¢er, float radius)
Definition Shape:167
void setRadius(float radius)
Definition Shape:176
void setCenter(const Vec3 ¢er)
Definition Shape:173
Sphere()
Definition Shape:150
const Vec3 & getHalfLengths() const
Definition Shape:224
const Vec3 & getCenter() const
Definition Shape:221
Vec3 _center
Definition Shape:235
void setCenter(const Vec3 ¢er)
Definition Shape:220
bool zeroRotation() const
Definition Shape:229
Box(const Box &box, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Definition Shape:204
void setRotation(const Quat &quat)
Definition Shape:226
Quat _rotation
Definition Shape:237
void set(const Vec3 ¢er, const Vec3 &halfLengths)
Definition Shape:214
const Quat & getRotation() const
Definition Shape:227
Box(const Vec3 ¢er, float lengthX, float lengthY, float lengthZ)
Definition Shape:200
Box()
Definition Shape:192
Box(const Vec3 ¢er, float width)
Definition Shape:196
Matrix computeRotationMatrix() const
Definition Shape:228
Vec3 _halfLengths
Definition Shape:236
bool valid() const
Definition Shape:212
void setHalfLengths(const Vec3 &halfLengths)
Definition Shape:223
float getHeight() const
Definition Shape:282
float _radius
Definition Shape:297
bool valid() const
Definition Shape:266
Vec3 _center
Definition Shape:296
float getBaseOffset() const
Definition Shape:290
const Vec3 & getCenter() const
Definition Shape:276
Quat _rotation
Definition Shape:300
float getBaseOffsetFactor() const
Definition Shape:289
void setRadius(float radius)
Definition Shape:278
void setHeight(float height)
Definition Shape:281
bool zeroRotation() const
Definition Shape:287
const Quat & getRotation() const
Definition Shape:285
Cone(const Cone &cone, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Definition Shape:257
Matrix computeRotationMatrix() const
Definition Shape:286
float _height
Definition Shape:298
float getRadius() const
Definition Shape:279
void set(const Vec3 ¢er, float radius, float height)
Definition Shape:268
Cone()
Definition Shape:247
void setRotation(const Quat &quat)
Definition Shape:284
Cone(const Vec3 ¢er, float radius, float height)
Definition Shape:252
void setCenter(const Vec3 ¢er)
Definition Shape:275
void setRadius(float radius)
Definition Shape:338
META_Shape(osg, Cylinder)
void set(const Vec3 ¢er, float radius, float height)
Definition Shape:328
float _height
Definition Shape:355
Vec3 _center
Definition Shape:353
float _radius
Definition Shape:354
bool valid() const
Definition Shape:326
Matrix computeRotationMatrix() const
Definition Shape:346
float getHeight() const
Definition Shape:342
const Quat & getRotation() const
Definition Shape:345
Cylinder()
Definition Shape:307
void setHeight(float height)
Definition Shape:341
void setCenter(const Vec3 ¢er)
Definition Shape:335
void setRotation(const Quat &quat)
Definition Shape:344
float getRadius() const
Definition Shape:339
Quat _rotation
Definition Shape:356
Cylinder(const Cylinder &cylinder, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Definition Shape:317
const Vec3 & getCenter() const
Definition Shape:336
Cylinder(const Vec3 ¢er, float radius, float height)
Definition Shape:312
bool zeroRotation() const
Definition Shape:347
const Quat & getRotation() const
Definition Shape:401
void setRadius(float radius)
Definition Shape:394
Matrix computeRotationMatrix() const
Definition Shape:402
void setHeight(float height)
Definition Shape:397
bool zeroRotation() const
Definition Shape:403
bool valid() const
Definition Shape:382
float _radius
Definition Shape:410
Capsule(const Vec3 ¢er, float radius, float height)
Definition Shape:368
void set(const Vec3 ¢er, float radius, float height)
Definition Shape:384
Quat _rotation
Definition Shape:412
const Vec3 & getCenter() const
Definition Shape:392
void setCenter(const Vec3 ¢er)
Definition Shape:391
float getRadius() const
Definition Shape:395
Capsule()
Definition Shape:363
Capsule(const Capsule &capsule, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Definition Shape:373
float getHeight() const
Definition Shape:398
Vec3 _center
Definition Shape:409
void setRotation(const Quat &quat)
Definition Shape:400
float _height
Definition Shape:411
Deprecated.
Definition Shape:417
InfinitePlane(const InfinitePlane &plane, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Definition Shape:421
InfinitePlane()
Definition Shape:419
META_Shape(osg, InfinitePlane)
Deprecated.
Definition Shape:434
void setVertices(Vec3Array *vertices)
Definition Shape:447
META_Shape(osg, TriangleMesh)
void setIndices(IndexArray *indices)
Definition Shape:452
ref_ptr< Vec3Array > _vertices
Definition Shape:460
const IndexArray * getIndices() const
Definition Shape:454
TriangleMesh()
Definition Shape:437
TriangleMesh(const TriangleMesh &mesh, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Definition Shape:439
ref_ptr< IndexArray > _indices
Definition Shape:461
const Vec3Array * getVertices() const
Definition Shape:449
IndexArray * getIndices()
Definition Shape:453
Vec3Array * getVertices()
Definition Shape:448
Deprecated.
Definition Shape:467
ConvexHull()
Definition Shape:470
ConvexHull(const ConvexHull &hull, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Definition Shape:472
META_Shape(osg, ConvexHull)
std::vector< float > HeightList
Definition Shape:492
float getXInterval() const
Definition Shape:503
Quat _rotation
Definition Shape:581
Vec3 _origin
Definition Shape:574
void setRotation(const Quat &quat)
Definition Shape:534
ref_ptr< FloatArray > _heights
Definition Shape:582
float _skirtHeight
Definition Shape:578
HeightField(const HeightField &mesh, const CopyOp ©op=CopyOp::SHALLOW_COPY)
unsigned int getNumRows() const
Definition Shape:497
void setBorderWidth(unsigned int borderWidth)
Set the width in number of cells in from the edge that the height field should be rendered from.
Definition Shape:529
void setOrigin(const Vec3 &origin)
Definition Shape:499
const FloatArray * getFloatArray() const
Get the const FloatArray height data.
Definition Shape:512
float & getHeight(unsigned int c, unsigned int r)
Definition Shape:546
void allocate(unsigned int numColumns, unsigned int numRows)
float getYInterval() const
Definition Shape:506
bool zeroRotation() const
Definition Shape:537
unsigned int _rows
Definition Shape:572
META_Shape(osg, HeightField)
unsigned int _borderWidth
Definition Shape:579
void setSkirtHeight(float skirtHeight)
Set the height of the skirt to render around the edge of HeightField.
Definition Shape:521
Vec3 getVertex(unsigned int c, unsigned int r) const
Definition Shape:557
unsigned int getNumColumns() const
Definition Shape:496
void setYInterval(float dy)
Definition Shape:505
float _dx
Definition Shape:575
HeightList & getHeightList()
Definition Shape:514
unsigned int getBorderWidth() const
Get the width in number of cells in from the edge that the height field should be rendered from.
Definition Shape:532
Matrix computeRotationMatrix() const
Definition Shape:536
float getSkirtHeight() const
Get the height of the skirt to render around the edge of HeightField.
Definition Shape:524
const HeightList & getHeightList() const
Definition Shape:516
Vec3 getNormal(unsigned int c, unsigned int r) const
void setHeight(unsigned int c, unsigned int r, float value)
Definition Shape:540
Vec2 getHeightDelta(unsigned int c, unsigned int r) const
const Quat & getRotation() const
Definition Shape:535
float _dy
Definition Shape:576
const Vec3 & getOrigin() const
Definition Shape:500
FloatArray * getFloatArray()
Get the FloatArray height data.
Definition Shape:509
float getHeight(unsigned int c, unsigned int r) const
Definition Shape:552
void setXInterval(float dx)
Definition Shape:502
unsigned int _columns
Definition Shape:572
Deprecated.
Definition Shape:591
ChildList _children
Definition Shape:649
CompositeShape()
Definition Shape:598
void setShape(Shape *shape)
Set the shape that encloses all of the children.
Definition Shape:607
Shape * getShape()
Get the shape that encloses all of the children.
Definition Shape:610
std::vector< ref_ptr< Shape > > ChildList
Definition Shape:596
virtual ~CompositeShape()
const Shape * getShape() const
Get the const shape that encloses all of the children.
Definition Shape:613
unsigned int findChildNo(Shape *shape) const
find the index number of child, if child is not found then it returns getNumChildren(),...
Definition Shape:634
void addChild(Shape *shape)
Add a child to the list.
Definition Shape:625
void removeChild(unsigned int i)
remove a child from the list.
Definition Shape:630
CompositeShape(const CompositeShape &cs, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Definition Shape:600
void addChild(const ref_ptr< T > &child)
Definition Shape:627
const Shape * getChild(unsigned int i) const
Get a const child.
Definition Shape:622
META_Shape(osg, CompositeShape)
ref_ptr< Shape > _shape
Definition Shape:648
unsigned int getNumChildren() const
Get the number of children of this composite shape.
Definition Shape:616
Shape * getChild(unsigned int i)
Get a child.
Definition Shape:619
Describe several hints that can be passed to a Tessellator (like the one used by ShapeDrawable) as a ...
Definition Shape:658
unsigned int getTargetNumFaces() const
Definition Shape:703
void setDetailRatio(float ratio)
Definition Shape:699
bool getCreateTop() const
Definition Shape:718
bool getCreateBottom() const
Definition Shape:724
void setCreateFrontFace(bool on)
Definition Shape:705
void setTargetNumFaces(unsigned int target)
Definition Shape:702
void setCreateTextureCoords(bool on)
Definition Shape:714
bool getCreateBody() const
Definition Shape:721
TessellationHints()
Definition Shape:661
bool _createTextureCoords
Definition Shape:739
TessellationMode _TessellationMode
Definition Shape:731
bool _createTop
Definition Shape:741
bool getCreateBackFace() const
Definition Shape:709
unsigned int _targetNumFaces
Definition Shape:734
void setTessellationMode(TessellationMode mode)
Definition Shape:696
bool _createBody
Definition Shape:742
TessellationMode getTessellationMode() const
Definition Shape:697
~TessellationHints()
Definition Shape:728
TessellationHints(const TessellationHints &tess, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Definition Shape:674
void setCreateBody(bool on)
Definition Shape:720
bool _createBackFace
Definition Shape:737
bool getCreateTextureCoords() const
Definition Shape:715
bool getCreateNormals() const
Definition Shape:712
TessellationMode
Definition Shape:691
@ USE_TARGET_NUM_FACES
Definition Shape:693
@ USE_SHAPE_DEFAULTS
Definition Shape:692
bool _createBottom
Definition Shape:743
void setCreateBackFace(bool on)
Definition Shape:708
META_Object(osg, TessellationHints)
void setCreateNormals(bool on)
Definition Shape:711
float _detailRatio
Definition Shape:733
void setCreateTop(bool on)
Definition Shape:717
void setCreateBottom(bool on)
Definition Shape:723
bool getCreateFrontFace() const
Definition Shape:706
float getDetailRatio() const
Definition Shape:700
bool _createNormals
Definition Shape:738
bool _createFrontFace
Definition Shape:736
ref_ptr< Vec3Array > _vertices
Definition Shape:797
Matrixd _inverse
Definition Shape:804
void Vertex(const Vec3f &v)
ref_ptr< Vec3Array > _normals
Definition Shape:798
const TessellationHints * _hints
Definition Shape:795
virtual void apply(const Sphere &)
SphereHalf
Definition Shape:788
@ SphereBottomHalf
Definition Shape:788
@ SphereTopHalf
Definition Shape:788
ref_ptr< Vec2Array > _texcoords
Definition Shape:799
virtual void apply(const Cone &)
void TexCoord(const Vec2f &tc)
Definition Shape:773
void Normal3f(float x, float y, float z)
Definition Shape:771
virtual void apply(const ConvexHull &)
virtual void apply(const HeightField &)
virtual void apply(const CompositeShape &)
BuildShapeGeometryVisitor(Geometry *geometry, const TessellationHints *hints)
void TexCoord2f(float x, float y)
Definition Shape:774
virtual void apply(const Capsule &)
virtual void apply(const InfinitePlane &)
void drawCylinderBody(unsigned int numSegments, float radius, float height)
Geometry * _geometry
Definition Shape:794
void Normal(const Vec3f &v)
Definition Shape:770
Matrixd _matrix
Definition Shape:803
virtual void apply(const Cylinder &)
void setMatrix(const Matrixd &m)
virtual void apply(const Box &)
void Vertex3f(float x, float y, float z)
Definition Shape:777
unsigned int _start_index
Definition Shape:802
virtual void apply(const TriangleMesh &)
GLenum _mode
Definition Shape:801
void drawHalfSphere(unsigned int numSegments, unsigned int numRows, float radius, SphereHalf which, float zOffset=0.0f)
General purpose float pair.
Definition Vec2f:29
General purpose float triple for use as vertices, vectors and normals.
Definition Vec3f:29
#define NULL
Definition Export:55
#define OSG_EXPORT
Definition Export:39