Renamed osg::Primitive to osg::PrimitiveSet which better reflect what it
encapsulates. Added new osg::IndexGeometry implemention, *not* complete yet. Changed the rest of the OSG to handle the renaming og Primitive to PrimitiveSet.
This commit is contained in:
@@ -19,7 +19,7 @@ class StateAttribute;
|
||||
class Node;
|
||||
class Drawable;
|
||||
class Array;
|
||||
class Primitive;
|
||||
class PrimitiveSet;
|
||||
|
||||
/** Copy Op(erator) used to control the whether shallow or deep copy is used
|
||||
* during copy construction and clone operation.*/
|
||||
@@ -56,8 +56,8 @@ class SG_EXPORT CopyOp
|
||||
virtual StateAttribute* operator() (const StateAttribute* attr) const;
|
||||
virtual Texture* operator() (const Texture* text) const;
|
||||
virtual Image* operator() (const Image* image) const;
|
||||
virtual Array* operator() (const Array* image) const;
|
||||
virtual Primitive* operator() (const Primitive* image) const;
|
||||
virtual Array* operator() (const Array* array) const;
|
||||
virtual PrimitiveSet* operator() (const PrimitiveSet* primitives) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/Array>
|
||||
#include <osg/Primitive>
|
||||
#include <osg/PrimitiveSet>
|
||||
|
||||
namespace osg {
|
||||
|
||||
@@ -90,17 +90,17 @@ class SG_EXPORT Geometry : public Drawable
|
||||
const TexCoordArrayList& getTexCoordArrayList() const { return _texCoordList; }
|
||||
|
||||
|
||||
typedef std::vector< ref_ptr<Primitive> > PrimitiveList;
|
||||
typedef std::vector< ref_ptr<PrimitiveSet> > PrimitiveList;
|
||||
|
||||
void setPrimitiveList(const PrimitiveList& primitives) { _primitives = primitives; dirtyDisplayList(); }
|
||||
PrimitiveList& getPrimitiveList() { return _primitives; }
|
||||
const PrimitiveList& getPrimitiveList() const { return _primitives; }
|
||||
|
||||
unsigned int getNumPrimitives() const { return _primitives.size(); }
|
||||
Primitive* getPrimitive(unsigned int pos) { return _primitives[pos].get(); }
|
||||
const Primitive* getPrimitive(unsigned int pos) const { return _primitives[pos].get(); }
|
||||
PrimitiveSet* getPrimitive(unsigned int pos) { return _primitives[pos].get(); }
|
||||
const PrimitiveSet* getPrimitive(unsigned int pos) const { return _primitives[pos].get(); }
|
||||
|
||||
void addPrimitive(Primitive* primitive) { if (primitive) _primitives.push_back(primitive); dirtyDisplayList(); }
|
||||
void addPrimitive(PrimitiveSet* primitive) { if (primitive) _primitives.push_back(primitive); dirtyDisplayList(); }
|
||||
|
||||
|
||||
bool verifyBindings() const;
|
||||
|
||||
185
include/osg/IndexedGeometry
Normal file
185
include/osg/IndexedGeometry
Normal file
@@ -0,0 +1,185 @@
|
||||
//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
|
||||
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
||||
//as published by the Free Software Foundation.
|
||||
|
||||
#ifndef OSG_GEOMETRY
|
||||
#define OSG_GEOMETRY 1
|
||||
|
||||
#include <osg/Drawable>
|
||||
#include <osg/Vec2>
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/Array>
|
||||
#include <osg/PrimitiveSet>
|
||||
|
||||
namespace osg {
|
||||
|
||||
|
||||
class SG_EXPORT IndexedGeometry : public Drawable
|
||||
{
|
||||
public:
|
||||
|
||||
IndexedGeometry();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
IndexedGeometry(const IndexedGeometry& geometry,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
virtual Object* cloneType() const { return osgNew IndexedGeometry(); }
|
||||
virtual Object* clone(const CopyOp& copyop) const { return osgNew IndexedGeometry(*this,copyop); }
|
||||
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const IndexedGeometry*>(obj)!=NULL; }
|
||||
virtual const char* libraryName() const { return "osg"; }
|
||||
virtual const char* className() const { return "IndexedGeometry"; }
|
||||
|
||||
virtual IndexedGeometry* asIndexedGeometry() { return this; }
|
||||
virtual const IndexedGeometry* asIndexedGeometry() const { return this; }
|
||||
|
||||
enum AttributeBinding
|
||||
{
|
||||
BIND_OFF=0,
|
||||
BIND_OVERALL,
|
||||
BIND_PER_PRIMITIVE_SET,
|
||||
BIND_PER_PRIMITIVE,
|
||||
BIND_PER_VERTEX
|
||||
};
|
||||
|
||||
void setVertexArray(Vec3Array* array) { _vertexArray = array; dirtyDisplayList(); dirtyBound(); }
|
||||
Vec3Array* getVertexArray() { return _vertexArray.get(); }
|
||||
const Vec3Array* getVertexArray() const { return _vertexArray.get(); }
|
||||
|
||||
void setVertexIndices(Array* array) { _vertexIndices = array; dirtyDisplayList(); dirtyBound(); }
|
||||
Array* getVertexIndices() { return _vertexIndices.get(); }
|
||||
const Array* getVertexIndices() const { return _vertexIndices.get(); }
|
||||
|
||||
|
||||
void setNormalBinding(AttributeBinding ab) { _normalBinding = ab; dirtyDisplayList(); }
|
||||
AttributeBinding getNormalBinding() const { return _normalBinding; }
|
||||
|
||||
void setNormalArray(Vec3Array* array) { _normalArray = array; if (!_normalArray.valid()) _normalBinding=BIND_OFF; dirtyDisplayList(); }
|
||||
Vec3Array* getNormalArray() { return _normalArray.get(); }
|
||||
const Vec3Array* getNormalArray() const { return _normalArray.get(); }
|
||||
|
||||
void setNormalIndices(Array* array) { _normalIndices = array; dirtyDisplayList(); }
|
||||
Array* getNormalIndices() { return _normalIndices.get(); }
|
||||
const Array* getNormalIndices() const { return _normalIndices.get(); }
|
||||
|
||||
|
||||
void setColorBinding(AttributeBinding ab) { _colorBinding = ab; }
|
||||
AttributeBinding getColorBinding() const { return _colorBinding; }
|
||||
|
||||
void setColorArray(Array* array) { _colorArray = array; if (!_colorArray.valid()) _colorBinding=BIND_OFF; dirtyDisplayList(); }
|
||||
Array* getColorArray() { return _colorArray.get(); }
|
||||
const Array* getColorArray() const { return _colorArray.get(); }
|
||||
|
||||
void setColorIndices(Array* array) { _colorIndices = array; dirtyDisplayList(); }
|
||||
Array* getColorIndices() { return _colorIndices.get(); }
|
||||
const Array* getColorIndices() const { return _colorIndices.get(); }
|
||||
|
||||
|
||||
void setSecondaryColorBinding(AttributeBinding ab) { _secondaryColorBinding = ab; }
|
||||
AttributeBinding getSecondaryColorBinding() const { return _secondaryColorBinding; }
|
||||
|
||||
void setSecondaryColorArray(Array* array) { _secondaryColorArray = array; if (!_secondaryColorArray.valid()) _secondaryColorBinding=BIND_OFF; dirtyDisplayList(); }
|
||||
Array* getSecondaryColorArray() { return _secondaryColorArray.get(); }
|
||||
const Array* getSecondaryColorArray() const { return _secondaryColorArray.get(); }
|
||||
|
||||
void setSecondaryColorIndices(Array* array) { _secondaryColorIndices = array; dirtyDisplayList(); }
|
||||
Array* getSecondaryColorIndices() { return _secondaryColorIndices.get(); }
|
||||
const Array* getSecondaryColorIndices() const { return _secondaryColorIndices.get(); }
|
||||
|
||||
|
||||
void setFogCoordBinding(AttributeBinding ab) { _fogCoordBinding = ab; }
|
||||
AttributeBinding getFogCoordBinding() const { return _fogCoordBinding; }
|
||||
|
||||
void setFogCoordArray(FloatArray* array) { _fogCoordArray = array; if (!_fogCoordArray.valid()) _fogCoordBinding=BIND_OFF; dirtyDisplayList(); }
|
||||
FloatArray* getFogCoordArray() { return _fogCoordArray.get(); }
|
||||
const FloatArray* getFogCoordArray() const { return _fogCoordArray.get(); }
|
||||
|
||||
|
||||
void setFogCoordIndices(Array* array) { _fogCoordIndices = array; dirtyDisplayList(); }
|
||||
Array* getFogCoordIndices() { return _fogCoordIndices.get(); }
|
||||
const Array* getFogCoordIndices() const { return _fogCoordIndices.get(); }
|
||||
|
||||
|
||||
|
||||
typedef std::pair< ref_ptr<Array>, ref_ptr<Array> > TexCoordArrayPair;
|
||||
typedef std::vector< TexCoordArrayPair > TexCoordArrayList;
|
||||
|
||||
|
||||
void setTexCoordArray(unsigned int unit,Array*);
|
||||
Array* getTexCoordArray(unsigned int unit);
|
||||
const Array* getTexCoordArray(unsigned int unit) const;
|
||||
|
||||
void setTexCoordIndices(unsigned int unit,Array*);
|
||||
Array* getTexCoordIndices(unsigned int unit);
|
||||
const Array* getTexCoordIndices(unsigned int unit) const;
|
||||
|
||||
unsigned int getNumTexCoordArrays() const { return _texCoordList.size(); }
|
||||
TexCoordArrayList& getTexCoordArrayList() { return _texCoordList; }
|
||||
const TexCoordArrayList& getTexCoordArrayList() const { return _texCoordList; }
|
||||
|
||||
|
||||
typedef std::vector< ref_ptr<PrimitiveSet> > PrimitiveSetList;
|
||||
|
||||
void setPrimitiveSetList(const PrimitiveSetList& primitives) { _primitives = primitives; dirtyDisplayList(); dirtyBound(); }
|
||||
PrimitiveSetList& getPrimitiveSetList() { return _primitives; }
|
||||
const PrimitiveSetList& getPrimitiveSetList() const { return _primitives; }
|
||||
|
||||
unsigned int getNumPrimitiveSet() const { return _primitives.size(); }
|
||||
PrimitiveSet* getPrimitiveSet(unsigned int pos) { return _primitives[pos].get(); }
|
||||
const PrimitiveSet* getPrimitiveSet(unsigned int pos) const { return _primitives[pos].get(); }
|
||||
|
||||
void addPrimitiveSet(PrimitiveSet* primitive) { if (primitive) _primitives.push_back(primitive); dirtyDisplayList(); dirtyBound(); }
|
||||
|
||||
|
||||
bool verifyBindings() const;
|
||||
|
||||
void computeCorrectBindingsAndArraySizes();
|
||||
|
||||
|
||||
/** draw IndexedGeometry 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 IndexedGeometry for user-drawn objects.
|
||||
*/
|
||||
virtual void drawImmediateMode(State& state);
|
||||
|
||||
/** accept an AttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.*/
|
||||
virtual void accept(AttributeFunctor& af);
|
||||
|
||||
/** accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has.*/
|
||||
virtual void accept(PrimitiveFunctor& pf);
|
||||
|
||||
protected:
|
||||
|
||||
IndexedGeometry& operator = (const IndexedGeometry&) { return *this;}
|
||||
|
||||
virtual ~IndexedGeometry();
|
||||
|
||||
PrimitiveSetList _primitives;
|
||||
|
||||
ref_ptr<Vec3Array> _vertexArray;
|
||||
ref_ptr<Array> _vertexIndices;
|
||||
|
||||
AttributeBinding _normalBinding;
|
||||
ref_ptr<Vec3Array> _normalArray;
|
||||
ref_ptr<Array> _normalIndices;
|
||||
|
||||
AttributeBinding _colorBinding;
|
||||
ref_ptr<Array> _colorArray;
|
||||
ref_ptr<Array> _colorIndices;
|
||||
|
||||
AttributeBinding _secondaryColorBinding;
|
||||
ref_ptr<Array> _secondaryColorArray;
|
||||
ref_ptr<Array> _secondaryColorIndices;
|
||||
|
||||
AttributeBinding _fogCoordBinding;
|
||||
ref_ptr<FloatArray> _fogCoordArray;
|
||||
ref_ptr<Array> _fogCoordIndices;
|
||||
|
||||
TexCoordArrayList _texCoordList;
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -2,8 +2,8 @@
|
||||
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
||||
//as published by the Free Software Foundation.
|
||||
|
||||
#ifndef OSG_PRIMTIVE
|
||||
#define OSG_PRIMTIVE 1
|
||||
#ifndef OSG_PRIMTIVESET
|
||||
#define OSG_PRIMTIVESET 1
|
||||
|
||||
#include <osg/Drawable>
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
#endif
|
||||
|
||||
|
||||
class Primitive : public Object
|
||||
class PrimitiveSet : public Object
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -103,18 +103,18 @@ class Primitive : public Object
|
||||
POLYGON = GL_POLYGON
|
||||
};
|
||||
|
||||
Primitive(Type primType=PrimitiveType,GLenum mode=0):
|
||||
PrimitiveSet(Type primType=PrimitiveType,GLenum mode=0):
|
||||
_primitiveType(primType),
|
||||
_mode(mode) {}
|
||||
|
||||
Primitive(const Primitive& prim,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
PrimitiveSet(const PrimitiveSet& prim,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
Object(prim,copyop),
|
||||
_primitiveType(prim._primitiveType),
|
||||
_mode(prim._mode) {}
|
||||
|
||||
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Primitive*>(obj)!=NULL; }
|
||||
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const PrimitiveSet*>(obj)!=NULL; }
|
||||
virtual const char* libraryName() const { return "osg"; }
|
||||
virtual const char* className() const { return "Primitive"; }
|
||||
virtual const char* className() const { return "PrimitiveSet"; }
|
||||
|
||||
Type getType() const { return _primitiveType; }
|
||||
|
||||
@@ -135,22 +135,26 @@ class Primitive : public Object
|
||||
GLenum _mode;
|
||||
};
|
||||
|
||||
class SG_EXPORT DrawArrays : public Primitive
|
||||
// temporary addition for backwards compatiblity.
|
||||
typedef PrimitiveSet Primitive;
|
||||
|
||||
|
||||
class SG_EXPORT DrawArrays : public PrimitiveSet
|
||||
{
|
||||
public:
|
||||
|
||||
DrawArrays(GLenum mode=0):
|
||||
Primitive(DrawArraysPrimitiveType,mode),
|
||||
PrimitiveSet(DrawArraysPrimitiveType,mode),
|
||||
_first(0),
|
||||
_count(0) {}
|
||||
|
||||
DrawArrays(GLenum mode, GLint first, GLsizei count):
|
||||
Primitive(DrawArraysPrimitiveType,mode),
|
||||
PrimitiveSet(DrawArraysPrimitiveType,mode),
|
||||
_first(first),
|
||||
_count(count) {}
|
||||
|
||||
DrawArrays(const DrawArrays& da,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
Primitive(da,copyop),
|
||||
PrimitiveSet(da,copyop),
|
||||
_first(da._first),
|
||||
_count(da._count) {}
|
||||
|
||||
@@ -188,32 +192,32 @@ class SG_EXPORT DrawArrays : public Primitive
|
||||
GLsizei _count;
|
||||
};
|
||||
|
||||
class SG_EXPORT DrawArrayLengths : public Primitive, public VectorSizei
|
||||
class SG_EXPORT DrawArrayLengths : public PrimitiveSet, public VectorSizei
|
||||
{
|
||||
public:
|
||||
|
||||
DrawArrayLengths(GLenum mode=0):
|
||||
Primitive(DrawArrayLengthsPrimitiveType,mode),
|
||||
PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
|
||||
_first(0) {}
|
||||
|
||||
DrawArrayLengths(const DrawArrayLengths& dal,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
Primitive(dal,copyop),
|
||||
PrimitiveSet(dal,copyop),
|
||||
VectorSizei(dal),
|
||||
_first(dal._first) {}
|
||||
|
||||
DrawArrayLengths(GLenum mode, GLint first, unsigned int no, GLsizei* ptr) :
|
||||
Primitive(DrawArrayLengthsPrimitiveType,mode),
|
||||
PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
|
||||
VectorSizei(ptr,ptr+no),
|
||||
_first(first) {}
|
||||
|
||||
DrawArrayLengths(GLenum mode,GLint first, unsigned int no) :
|
||||
Primitive(DrawArrayLengthsPrimitiveType,mode),
|
||||
PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
|
||||
VectorSizei(no),
|
||||
_first(first) {}
|
||||
|
||||
template <class InputIterator>
|
||||
DrawArrayLengths(GLenum mode, GLint first, InputIterator firstItr,InputIterator lastItr) :
|
||||
Primitive(DrawArrayLengthsPrimitiveType,mode),
|
||||
PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
|
||||
VectorSizei(firstItr,lastItr),
|
||||
_first(first) {}
|
||||
|
||||
@@ -240,28 +244,28 @@ class SG_EXPORT DrawArrayLengths : public Primitive, public VectorSizei
|
||||
GLint _first;
|
||||
};
|
||||
|
||||
class SG_EXPORT DrawElementsUByte : public Primitive, public VectorUByte
|
||||
class SG_EXPORT DrawElementsUByte : public PrimitiveSet, public VectorUByte
|
||||
{
|
||||
public:
|
||||
|
||||
DrawElementsUByte(GLenum mode=0):
|
||||
Primitive(DrawElementsUBytePrimitiveType,mode) {}
|
||||
PrimitiveSet(DrawElementsUBytePrimitiveType,mode) {}
|
||||
|
||||
DrawElementsUByte(const DrawElementsUByte& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
Primitive(array,copyop),
|
||||
PrimitiveSet(array,copyop),
|
||||
VectorUByte(array) {}
|
||||
|
||||
DrawElementsUByte(GLenum mode,unsigned int no,GLubyte* ptr) :
|
||||
Primitive(DrawElementsUBytePrimitiveType,mode),
|
||||
PrimitiveSet(DrawElementsUBytePrimitiveType,mode),
|
||||
VectorUByte(ptr,ptr+no) {}
|
||||
|
||||
DrawElementsUByte(GLenum mode,unsigned int no) :
|
||||
Primitive(DrawElementsUBytePrimitiveType,mode),
|
||||
PrimitiveSet(DrawElementsUBytePrimitiveType,mode),
|
||||
VectorUByte(no) {}
|
||||
|
||||
template <class InputIterator>
|
||||
DrawElementsUByte(GLenum mode, InputIterator first,InputIterator last) :
|
||||
Primitive(DrawElementsUBytePrimitiveType,mode),
|
||||
PrimitiveSet(DrawElementsUBytePrimitiveType,mode),
|
||||
VectorUByte(first,last) {}
|
||||
|
||||
virtual Object* cloneType() const { return osgNew DrawElementsUByte(); }
|
||||
@@ -280,28 +284,28 @@ class SG_EXPORT DrawElementsUByte : public Primitive, public VectorUByte
|
||||
};
|
||||
|
||||
|
||||
class SG_EXPORT DrawElementsUShort : public Primitive, public VectorUShort
|
||||
class SG_EXPORT DrawElementsUShort : public PrimitiveSet, public VectorUShort
|
||||
{
|
||||
public:
|
||||
|
||||
DrawElementsUShort(GLenum mode=0):
|
||||
Primitive(DrawElementsUShortPrimitiveType,mode) {}
|
||||
PrimitiveSet(DrawElementsUShortPrimitiveType,mode) {}
|
||||
|
||||
DrawElementsUShort(const DrawElementsUShort& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
Primitive(array,copyop),
|
||||
PrimitiveSet(array,copyop),
|
||||
VectorUShort(array) {}
|
||||
|
||||
DrawElementsUShort(GLenum mode,unsigned int no,GLushort* ptr) :
|
||||
Primitive(DrawElementsUShortPrimitiveType,mode),
|
||||
PrimitiveSet(DrawElementsUShortPrimitiveType,mode),
|
||||
VectorUShort(ptr,ptr+no) {}
|
||||
|
||||
DrawElementsUShort(GLenum mode,unsigned int no) :
|
||||
Primitive(DrawElementsUShortPrimitiveType,mode),
|
||||
PrimitiveSet(DrawElementsUShortPrimitiveType,mode),
|
||||
VectorUShort(no) {}
|
||||
|
||||
template <class InputIterator>
|
||||
DrawElementsUShort(GLenum mode, InputIterator first,InputIterator last) :
|
||||
Primitive(DrawElementsUShortPrimitiveType,mode),
|
||||
PrimitiveSet(DrawElementsUShortPrimitiveType,mode),
|
||||
VectorUShort(first,last) {}
|
||||
|
||||
virtual Object* cloneType() const { return osgNew DrawElementsUShort(); }
|
||||
@@ -319,28 +323,28 @@ class SG_EXPORT DrawElementsUShort : public Primitive, public VectorUShort
|
||||
virtual unsigned int getNumIndices() { return size(); }
|
||||
};
|
||||
|
||||
class SG_EXPORT DrawElementsUInt : public Primitive, public VectorUInt
|
||||
class SG_EXPORT DrawElementsUInt : public PrimitiveSet, public VectorUInt
|
||||
{
|
||||
public:
|
||||
|
||||
DrawElementsUInt(GLenum mode=0):
|
||||
Primitive(DrawElementsUIntPrimitiveType,mode) {}
|
||||
PrimitiveSet(DrawElementsUIntPrimitiveType,mode) {}
|
||||
|
||||
DrawElementsUInt(const DrawElementsUInt& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
Primitive(array,copyop),
|
||||
PrimitiveSet(array,copyop),
|
||||
VectorUInt(array) {}
|
||||
|
||||
DrawElementsUInt(GLenum mode,unsigned int no,GLuint* ptr) :
|
||||
Primitive(DrawElementsUIntPrimitiveType,mode),
|
||||
PrimitiveSet(DrawElementsUIntPrimitiveType,mode),
|
||||
VectorUInt(ptr,ptr+no) {}
|
||||
|
||||
DrawElementsUInt(GLenum mode,unsigned int no) :
|
||||
Primitive(DrawElementsUIntPrimitiveType,mode),
|
||||
PrimitiveSet(DrawElementsUIntPrimitiveType,mode),
|
||||
VectorUInt(no) {}
|
||||
|
||||
template <class InputIterator>
|
||||
DrawElementsUInt(GLenum mode, InputIterator first,InputIterator last) :
|
||||
Primitive(DrawElementsUIntPrimitiveType,mode),
|
||||
PrimitiveSet(DrawElementsUIntPrimitiveType,mode),
|
||||
VectorUInt(first,last) {}
|
||||
|
||||
virtual Object* cloneType() const { return osgNew DrawElementsUInt(); }
|
||||
@@ -358,11 +362,6 @@ class SG_EXPORT DrawElementsUInt : public Primitive, public VectorUInt
|
||||
virtual unsigned int getNumIndices() { return size(); }
|
||||
};
|
||||
|
||||
// backwards compatibility with first incarnation of DrawElements nameing convention.
|
||||
typedef DrawElementsUByte UByteDrawElements;
|
||||
typedef DrawElementsUShort UShortDrawElements;
|
||||
typedef DrawElementsUInt UIntDrawElements;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -190,7 +190,7 @@ class SG_EXPORT StateSet : public Object
|
||||
void setRenderBinDetails(int binNum,const std::string& binName,RenderBinMode mode=USE_RENDERBIN_DETAILS);
|
||||
|
||||
/** set the render bin details to inherit.*/
|
||||
void setRendingBinToInherit();
|
||||
void setRenderBinToInherit();
|
||||
|
||||
/** get the render bin mode.*/
|
||||
inline RenderBinMode getRenderBinMode() const { return _binMode; }
|
||||
|
||||
@@ -57,87 +57,87 @@ requests, translating them into calls to the windowing API.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
|
||||
\namespace osgGA::CmdLineArgs
|
||||
|
||||
A collection of utilities for processing command line arguments.
|
||||
|
||||
An osgGA::CmdLineArgs::Processor class is provided, which implements a chain
|
||||
of responsibilty for handline command line arguments. Each item in the chain
|
||||
is a subclass of the abstract osgGA::CmdLineArgs::ArgHandler. A number
|
||||
of ArgHandlers are provided, though the user if free to implement their
|
||||
own subclasses for specific needs (e.g. to validate an argument which
|
||||
takes an integer which must be in a specific range).
|
||||
|
||||
Let's look at an example...
|
||||
|
||||
<h2>Example</h2>
|
||||
|
||||
\code
|
||||
|
||||
#include <osgGA/CmdLineArgs>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
using namespace osg;
|
||||
using namespace osgGA::CmdLineArgs;
|
||||
|
||||
// Create some handlers
|
||||
ref_ptr<BoolHandler> helpSwitch(new BoolHandler("[-h]","\t\tPrint this help and exit","-h"));
|
||||
ref_ptr<BoolHandler> verboseSwitch(new BoolHandler("[-v]","\t\tActivate verbose output","-v"));
|
||||
ref_ptr<SwitchStringHandler> configFile(
|
||||
new SwitchStringHandler("[-config <configfile>",
|
||||
"\t\tSpecify a config file to load"), "-config");
|
||||
|
||||
Processor clp;
|
||||
clp.push_back(helpSwitch.get());
|
||||
clp.push_back(verboseSwitch.get());
|
||||
clp.push_back(configFile.get());
|
||||
|
||||
try{
|
||||
clp.process(argc,argv);
|
||||
}
|
||||
catch(ArgHandlerX& e){
|
||||
cerr<<e.what()<<endl;
|
||||
clp.printUsage(cerr);
|
||||
exit(1);
|
||||
}
|
||||
catch(...){
|
||||
cerr<<"Unknown exception caught while processing command line arguments."<<endl;
|
||||
clp.printUsage(cerr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(helpSwitch->wasSpecified()){
|
||||
clp.printHelp(cerr);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if(verboseSwitch->wasSpecified()){
|
||||
// Activate verbosity...
|
||||
}
|
||||
|
||||
if(configFile->wasSpecified()){
|
||||
loadConfigFile(configFile->getString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
\endcode
|
||||
|
||||
The processor takes each argument on the command line in turn, and passes it
|
||||
to the ArgHandler chain. Each ArgHandler is given the opportunity to handle
|
||||
an argument and - if it requires - any subsequent arguments until the
|
||||
end of the argument list (it can do this by incrementing the ArgIterator
|
||||
passed to it. If an ArgHandler handles an argument (e.g. it's looking for
|
||||
and recognises the argument '-h'), it returns true and further processing of
|
||||
the argument stops. If an argument is not handled it is passed to the next
|
||||
handler in the chain, and so on, until it is either handled, or it drops off
|
||||
the end of the chain.
|
||||
|
||||
A number of pre-written ArgHandlers are supplied. User's may use these
|
||||
directly, may write their own, or may extend a pre-written ArgHandler to
|
||||
customise it for their specific needs.
|
||||
|
||||
*/
|
||||
// /**
|
||||
//
|
||||
// \namespace osgGA::CmdLineArgs
|
||||
//
|
||||
// A collection of utilities for processing command line arguments.
|
||||
//
|
||||
// An osgGA::CmdLineArgs::Processor class is provided, which implements a chain
|
||||
// of responsibilty for handline command line arguments. Each item in the chain
|
||||
// is a subclass of the abstract osgGA::CmdLineArgs::ArgHandler. A number
|
||||
// of ArgHandlers are provided, though the user if free to implement their
|
||||
// own subclasses for specific needs (e.g. to validate an argument which
|
||||
// takes an integer which must be in a specific range).
|
||||
//
|
||||
// Let's look at an example...
|
||||
//
|
||||
// <h2>Example</h2>
|
||||
//
|
||||
// \code
|
||||
//
|
||||
// #include <osgGA/CmdLineArgs>
|
||||
//
|
||||
// int main(int argc, char* argv[])
|
||||
// {
|
||||
// using namespace osg;
|
||||
// using namespace osgGA::CmdLineArgs;
|
||||
//
|
||||
// // Create some handlers
|
||||
// ref_ptr<BoolHandler> helpSwitch(new BoolHandler("[-h]","\t\tPrint this help and exit","-h"));
|
||||
// ref_ptr<BoolHandler> verboseSwitch(new BoolHandler("[-v]","\t\tActivate verbose output","-v"));
|
||||
// ref_ptr<SwitchStringHandler> configFile(
|
||||
// new SwitchStringHandler("[-config <configfile>",
|
||||
// "\t\tSpecify a config file to load"), "-config");
|
||||
//
|
||||
// Processor clp;
|
||||
// clp.push_back(helpSwitch.get());
|
||||
// clp.push_back(verboseSwitch.get());
|
||||
// clp.push_back(configFile.get());
|
||||
//
|
||||
// try{
|
||||
// clp.process(argc,argv);
|
||||
// }
|
||||
// catch(ArgHandlerX& e){
|
||||
// cerr<<e.what()<<endl;
|
||||
// clp.printUsage(cerr);
|
||||
// exit(1);
|
||||
// }
|
||||
// catch(...){
|
||||
// cerr<<"Unknown exception caught while processing command line arguments."<<endl;
|
||||
// clp.printUsage(cerr);
|
||||
// exit(1);
|
||||
// }
|
||||
//
|
||||
// if(helpSwitch->wasSpecified()){
|
||||
// clp.printHelp(cerr);
|
||||
// exit(0);
|
||||
// }
|
||||
//
|
||||
// if(verboseSwitch->wasSpecified()){
|
||||
// // Activate verbosity...
|
||||
// }
|
||||
//
|
||||
// if(configFile->wasSpecified()){
|
||||
// loadConfigFile(configFile->getString());
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// \endcode
|
||||
//
|
||||
// The processor takes each argument on the command line in turn, and passes it
|
||||
// to the ArgHandler chain. Each ArgHandler is given the opportunity to handle
|
||||
// an argument and - if it requires - any subsequent arguments until the
|
||||
// end of the argument list (it can do this by incrementing the ArgIterator
|
||||
// passed to it. If an ArgHandler handles an argument (e.g. it's looking for
|
||||
// and recognises the argument '-h'), it returns true and further processing of
|
||||
// the argument stops. If an argument is not handled it is passed to the next
|
||||
// handler in the chain, and so on, until it is either handled, or it drops off
|
||||
// the end of the chain.
|
||||
//
|
||||
// A number of pre-written ArgHandlers are supplied. User's may use these
|
||||
// directly, may write their own, or may extend a pre-written ArgHandler to
|
||||
// customise it for their specific needs.
|
||||
//
|
||||
// */
|
||||
|
||||
Reference in New Issue
Block a user