From Leandro Motta Barros, doxygen comments
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -23,145 +23,158 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** Describe several hints that can be passed to a tesselator (like the one used
|
||||
* by \c ShapeDrawable) as a mean to try to influence the way it works.
|
||||
*/
|
||||
class TessellationHints : public Object
|
||||
{
|
||||
public:
|
||||
|
||||
TessellationHints():
|
||||
_TessellationMode(USE_SHAPE_DEFAULTS),
|
||||
_detailRatio(1.0f),
|
||||
_targetNumFaces(100),
|
||||
_createFrontFace(true),
|
||||
_createBackFace(false),
|
||||
_createNormals(true),
|
||||
_createTextureCoords(false),
|
||||
_createTop(true),
|
||||
_createBody(true),
|
||||
_createBottom(true) {}
|
||||
|
||||
TessellationHints():
|
||||
_TessellationMode(USE_SHAPE_DEFAULTS),
|
||||
_detailRatio(1.0f),
|
||||
_targetNumFaces(100),
|
||||
_createFrontFace(true),
|
||||
_createBackFace(false),
|
||||
_createNormals(true),
|
||||
_createTextureCoords(false),
|
||||
_createTop(true),
|
||||
_createBody(true),
|
||||
_createBottom(true) {}
|
||||
|
||||
TessellationHints(const TessellationHints& tess, const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
Object(tess,copyop),
|
||||
_TessellationMode(tess._TessellationMode),
|
||||
|
||||
TessellationHints(const TessellationHints& tess, const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
Object(tess,copyop),
|
||||
_TessellationMode(tess._TessellationMode),
|
||||
_detailRatio(tess._detailRatio),
|
||||
_targetNumFaces(tess._targetNumFaces),
|
||||
_createFrontFace(tess._createFrontFace),
|
||||
_createBackFace(tess._createBackFace),
|
||||
_createNormals(tess._createNormals),
|
||||
_createTextureCoords(tess._createTextureCoords),
|
||||
_createTop(tess._createTop),
|
||||
_createBody(tess._createBody),
|
||||
_createBottom(tess._createBottom) {}
|
||||
_targetNumFaces(tess._targetNumFaces),
|
||||
_createFrontFace(tess._createFrontFace),
|
||||
_createBackFace(tess._createBackFace),
|
||||
_createNormals(tess._createNormals),
|
||||
_createTextureCoords(tess._createTextureCoords),
|
||||
_createTop(tess._createTop),
|
||||
_createBody(tess._createBody),
|
||||
_createBottom(tess._createBottom) {}
|
||||
|
||||
META_Object(osg,TessellationHints);
|
||||
|
||||
|
||||
enum TessellationMode
|
||||
{
|
||||
USE_SHAPE_DEFAULTS,
|
||||
USE_TARGET_NUM_FACES
|
||||
};
|
||||
META_Object(osg,TessellationHints);
|
||||
|
||||
inline void setTessellationMode(TessellationMode mode) { _TessellationMode=mode; }
|
||||
inline TessellationMode getTessellationMode() const { return _TessellationMode; }
|
||||
|
||||
enum TessellationMode
|
||||
{
|
||||
USE_SHAPE_DEFAULTS,
|
||||
USE_TARGET_NUM_FACES
|
||||
};
|
||||
|
||||
inline void setTessellationMode(TessellationMode mode) { _TessellationMode=mode; }
|
||||
inline TessellationMode getTessellationMode() const { return _TessellationMode; }
|
||||
|
||||
inline void setDetailRatio(float ratio) { _detailRatio = ratio; }
|
||||
inline float getDetailRatio() const { return _detailRatio; }
|
||||
|
||||
inline void setTargetNumFaces(unsigned int target) { _targetNumFaces=target; }
|
||||
inline unsigned int getTargetNumFaces() const { return _targetNumFaces; }
|
||||
inline void setTargetNumFaces(unsigned int target) { _targetNumFaces=target; }
|
||||
inline unsigned int getTargetNumFaces() const { return _targetNumFaces; }
|
||||
|
||||
inline void setCreateFrontFace(bool on) { _createFrontFace=on; }
|
||||
inline bool getCreateFrontFace() const { return _createFrontFace; }
|
||||
inline void setCreateFrontFace(bool on) { _createFrontFace=on; }
|
||||
inline bool getCreateFrontFace() const { return _createFrontFace; }
|
||||
|
||||
inline void setCreateBackFace(bool on) { _createBackFace=on; }
|
||||
inline bool getCreateBackFace() const { return _createBackFace; }
|
||||
inline void setCreateBackFace(bool on) { _createBackFace=on; }
|
||||
inline bool getCreateBackFace() const { return _createBackFace; }
|
||||
|
||||
inline void setCreateNormals(bool on) { _createNormals=on; }
|
||||
inline bool getCreateNormals() const { return _createNormals; }
|
||||
inline void setCreateNormals(bool on) { _createNormals=on; }
|
||||
inline bool getCreateNormals() const { return _createNormals; }
|
||||
|
||||
inline void setCreateTextureCoords(bool on) { _createTextureCoords=on; }
|
||||
inline bool getCreateTextureCoords() const { return _createTextureCoords; }
|
||||
inline void setCreateTextureCoords(bool on) { _createTextureCoords=on; }
|
||||
inline bool getCreateTextureCoords() const { return _createTextureCoords; }
|
||||
|
||||
inline void setCreateTop(bool on) { _createTop=on; }
|
||||
inline bool getCreateTop() const { return _createTop; }
|
||||
inline void setCreateTop(bool on) { _createTop=on; }
|
||||
inline bool getCreateTop() const { return _createTop; }
|
||||
|
||||
inline void setCreateBody(bool on) { _createBody=on; }
|
||||
inline bool getCreateBody() const { return _createBody; }
|
||||
inline void setCreateBody(bool on) { _createBody=on; }
|
||||
inline bool getCreateBody() const { return _createBody; }
|
||||
|
||||
inline void setCreateBottom(bool on) { _createBottom=on; }
|
||||
inline bool getCreateBottom() const { return _createBottom; }
|
||||
inline void setCreateBottom(bool on) { _createBottom=on; }
|
||||
inline bool getCreateBottom() const { return _createBottom; }
|
||||
|
||||
protected:
|
||||
|
||||
~TessellationHints() {}
|
||||
|
||||
|
||||
TessellationMode _TessellationMode;
|
||||
~TessellationHints() {}
|
||||
|
||||
|
||||
TessellationMode _TessellationMode;
|
||||
|
||||
float _detailRatio;
|
||||
unsigned int _targetNumFaces;
|
||||
unsigned int _targetNumFaces;
|
||||
|
||||
bool _createFrontFace;
|
||||
bool _createBackFace;
|
||||
bool _createNormals;
|
||||
bool _createTextureCoords;
|
||||
bool _createFrontFace;
|
||||
bool _createBackFace;
|
||||
bool _createNormals;
|
||||
bool _createTextureCoords;
|
||||
|
||||
bool _createTop;
|
||||
bool _createBody;
|
||||
bool _createBottom;
|
||||
bool _createTop;
|
||||
bool _createBody;
|
||||
bool _createBottom;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** Allow the use of <tt>Shape</tt>s as <tt>Drawable</tt>s, so that they can
|
||||
* be rendered with reduced effort. The implementation of \c ShapeDrawable is
|
||||
* not geared to efficiency; it's better to think of it as a convenience to
|
||||
* render <tt>Shape</tt>s easily (perhaps for test or debugging purposes) than
|
||||
* as the right way to render basic shapes in some efficiency-critical section
|
||||
* of code.
|
||||
* @todo \c ShapeDrawable currently doesn't render <tt>InfinitePlane</tt>s.
|
||||
*/
|
||||
class SG_EXPORT ShapeDrawable : public Drawable
|
||||
{
|
||||
public:
|
||||
|
||||
ShapeDrawable();
|
||||
|
||||
ShapeDrawable(Shape* shape,TessellationHints* hints=0);
|
||||
ShapeDrawable(Shape* shape, TessellationHints* hints=0);
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
ShapeDrawable(const ShapeDrawable& pg,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
|
||||
virtual Object* cloneType() const { return new ShapeDrawable(); }
|
||||
virtual Object* clone(const CopyOp& copyop) const { return new ShapeDrawable(*this,copyop); }
|
||||
virtual Object* clone(const CopyOp& copyop) const { return new ShapeDrawable(*this,copyop); }
|
||||
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const ShapeDrawable*>(obj)!=NULL; }
|
||||
virtual const char* libraryName() const { return "osg"; }
|
||||
virtual const char* className() const { return "ShapeDrawable"; }
|
||||
|
||||
/** set the color of the shape.*/
|
||||
/** Set the color of the shape.*/
|
||||
void setColor(const Vec4& color) { _color = color; }
|
||||
|
||||
/** get the color of the shape.*/
|
||||
|
||||
/** Get the color of the shape.*/
|
||||
const Vec4& getColor() const { return _color; }
|
||||
|
||||
void setTessellationHints(TessellationHints* hints) { _tessellationHints = hints; }
|
||||
|
||||
TessellationHints* getTessellationHints() { return _tessellationHints.get(); }
|
||||
const TessellationHints* getTessellationHints() const { return _tessellationHints.get(); }
|
||||
void setTessellationHints(TessellationHints* hints) { _tessellationHints = hints; }
|
||||
|
||||
TessellationHints* getTessellationHints() { return _tessellationHints.get(); }
|
||||
const TessellationHints* getTessellationHints() const { return _tessellationHints.get(); }
|
||||
|
||||
|
||||
|
||||
/** draw ShapeDrawable directly ignoring an OpenGL display list which could be attached.
|
||||
* This is the internal draw method which does the drawing itself,
|
||||
* and is the method to override when deriving from ShapeDrawable for user-drawn objects.
|
||||
*/
|
||||
/** Draw ShapeDrawable directly ignoring an OpenGL display list which
|
||||
* could be attached. This is the internal draw method which does the
|
||||
* drawing itself, and is the method to override when deriving from
|
||||
* ShapeDrawable for user-drawn objects.
|
||||
*/
|
||||
virtual void drawImplementation(State& state) const;
|
||||
|
||||
/** return false, osg::ShapeDrawable does not support accept(AttributeFunctor&).*/
|
||||
/** Return false, osg::ShapeDrawable does not support accept(AttributeFunctor&).*/
|
||||
virtual bool supports(AttributeFunctor&) const { return false; }
|
||||
|
||||
/** return true, osg::ShapeDrawable does support accept(ConstAttributeFunctor&).*/
|
||||
/** Return true, osg::ShapeDrawable does support accept(ConstAttributeFunctor&).*/
|
||||
virtual bool supports(ConstAttributeFunctor&) const { return true; }
|
||||
|
||||
/** accept a ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.*/
|
||||
/** Accept a ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.*/
|
||||
virtual void accept(ConstAttributeFunctor& af) const;
|
||||
|
||||
/** return true, osg::ShapeDrawable does support accept(PrimitiveFunctor&) .*/
|
||||
/** Return true, osg::ShapeDrawable does support accept(PrimitiveFunctor&) .*/
|
||||
virtual bool supports(PrimitiveFunctor&) const { return true; }
|
||||
|
||||
/** accept a PrimtiveFunctor and call its methods to tell it about the internal primitives that this Drawable has.*/
|
||||
/** Accept a PrimitiveFunctor and call its methods to tell it about the internal primitives that this Drawable has.*/
|
||||
virtual void accept(PrimitiveFunctor& pf) const;
|
||||
|
||||
protected:
|
||||
@@ -169,12 +182,12 @@ class SG_EXPORT ShapeDrawable : public Drawable
|
||||
ShapeDrawable& operator = (const ShapeDrawable&) { return *this;}
|
||||
|
||||
virtual ~ShapeDrawable();
|
||||
|
||||
|
||||
virtual bool computeBound() const;
|
||||
|
||||
|
||||
Vec4 _color;
|
||||
|
||||
ref_ptr<TessellationHints> _tessellationHints;
|
||||
ref_ptr<TessellationHints> _tessellationHints;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user