2002-07-17 04:07:32 +08:00
|
|
|
//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
|
2002-06-27 18:50:19 +08:00
|
|
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
|
|
|
//as published by the Free Software Foundation.
|
|
|
|
|
2002-09-20 22:51:59 +08:00
|
|
|
#ifndef OSG_PRIMTIVESET
|
|
|
|
#define OSG_PRIMTIVESET 1
|
2002-06-27 18:50:19 +08:00
|
|
|
|
|
|
|
#include <osg/Drawable>
|
|
|
|
|
|
|
|
namespace osg {
|
|
|
|
|
2002-07-08 01:42:34 +08:00
|
|
|
#ifndef _MSC_VER
|
|
|
|
|
|
|
|
typedef std::vector<GLsizei> VectorSizei;
|
|
|
|
typedef std::vector<GLubyte> VectorUByte;
|
|
|
|
typedef std::vector<GLushort> VectorUShort;
|
|
|
|
typedef std::vector<GLuint> VectorUInt;
|
|
|
|
|
|
|
|
#else // _MSC_VER
|
|
|
|
|
2002-07-08 06:12:51 +08:00
|
|
|
// Following Vector wrapper classes are work arounds for MS linker problems with
|
|
|
|
// multiply implemented methods.
|
|
|
|
//
|
|
|
|
// An alternative, sent in by Clay Fowler, is workaround in VS to prevent the problem:
|
|
|
|
// the following changes have to be made to the project to make it compile,
|
|
|
|
// but NO changes are required to the actual source code:
|
|
|
|
// In the osgUtil project, go to the project properties, select the Linker/Command Line property page,
|
|
|
|
// and add the following switch in the "Additional Options" field:
|
|
|
|
// FORCE:MULTIPLE
|
|
|
|
|
2002-07-08 01:42:34 +08:00
|
|
|
class VectorSizei: public std::vector<GLsizei> {
|
|
|
|
typedef std::vector<value_type> inherited;
|
|
|
|
public:
|
|
|
|
VectorSizei(): inherited() {}
|
|
|
|
explicit VectorSizei(size_type n): inherited(n) {}
|
|
|
|
VectorSizei(const VectorSizei ©): inherited(copy) {}
|
2002-07-11 19:36:25 +08:00
|
|
|
//VectorSizei(value_type *beg_, value_type *end_): inherited(beg_, end_) {}
|
2002-07-08 01:42:34 +08:00
|
|
|
template<class InputIterator>
|
|
|
|
VectorSizei(InputIterator beg_, InputIterator end_): inherited(beg_, end_) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class VectorUByte: public std::vector<GLubyte> {
|
|
|
|
typedef std::vector<value_type> inherited;
|
|
|
|
public:
|
|
|
|
VectorUByte(): inherited() {}
|
|
|
|
explicit VectorUByte(size_type n): inherited(n) {}
|
|
|
|
VectorUByte(const VectorUByte ©): inherited(copy) {}
|
2002-07-11 19:36:25 +08:00
|
|
|
//VectorUByte(value_type *beg_, value_type *end_): inherited(beg_, end_) {}
|
2002-07-08 01:42:34 +08:00
|
|
|
template<class InputIterator>
|
|
|
|
VectorUByte(InputIterator beg_, InputIterator end_): inherited(beg_, end_) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class VectorUShort: public std::vector<GLushort> {
|
|
|
|
typedef std::vector<value_type> inherited;
|
|
|
|
public:
|
|
|
|
VectorUShort(): inherited() {}
|
|
|
|
explicit VectorUShort(size_type n): inherited(n) {}
|
|
|
|
VectorUShort(const VectorUShort ©): inherited(copy) {}
|
2002-07-11 19:36:25 +08:00
|
|
|
//VectorUShort(value_type *beg_, value_type *end_): inherited(beg_, end_) {}
|
2002-07-08 01:42:34 +08:00
|
|
|
template<class InputIterator>
|
|
|
|
VectorUShort(InputIterator beg_, InputIterator end_): inherited(beg_, end_) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class VectorUInt: public std::vector<GLuint> {
|
|
|
|
typedef std::vector<value_type> inherited;
|
|
|
|
public:
|
|
|
|
VectorUInt(): inherited() {}
|
|
|
|
explicit VectorUInt(size_type n): inherited(n) {}
|
|
|
|
VectorUInt(const VectorUInt ©): inherited(copy) {}
|
2002-07-11 19:36:25 +08:00
|
|
|
//VectorUInt(value_type *beg_, value_type *end_): inherited(beg_, end_) {}
|
2002-07-08 01:42:34 +08:00
|
|
|
template<class InputIterator>
|
|
|
|
VectorUInt(InputIterator beg_, InputIterator end_): inherited(beg_, end_) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2002-09-20 22:51:59 +08:00
|
|
|
class PrimitiveSet : public Object
|
2002-06-27 18:50:19 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2002-06-27 21:15:34 +08:00
|
|
|
enum Type
|
|
|
|
{
|
2002-06-28 16:47:23 +08:00
|
|
|
PrimitiveType,
|
|
|
|
DrawArraysPrimitiveType,
|
2002-07-07 22:40:41 +08:00
|
|
|
DrawArrayLengthsPrimitiveType,
|
|
|
|
DrawElementsUBytePrimitiveType,
|
|
|
|
DrawElementsUShortPrimitiveType,
|
|
|
|
DrawElementsUIntPrimitiveType
|
2002-06-27 21:15:34 +08:00
|
|
|
};
|
|
|
|
|
2002-06-27 18:50:19 +08:00
|
|
|
enum Mode
|
|
|
|
{
|
|
|
|
POINTS = GL_POINTS,
|
|
|
|
LINES = GL_LINES,
|
|
|
|
LINE_STRIP = GL_LINE_STRIP,
|
|
|
|
LINE_LOOP = GL_LINE_LOOP,
|
|
|
|
TRIANGLES = GL_TRIANGLES,
|
|
|
|
TRIANGLE_STRIP = GL_TRIANGLE_STRIP,
|
|
|
|
TRIANGLE_FAN = GL_TRIANGLE_FAN,
|
|
|
|
QUADS = GL_QUADS,
|
|
|
|
QUAD_STRIP = GL_QUAD_STRIP,
|
|
|
|
POLYGON = GL_POLYGON
|
|
|
|
};
|
|
|
|
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(Type primType=PrimitiveType,GLenum mode=0):
|
2002-06-27 18:50:19 +08:00
|
|
|
_primitiveType(primType),
|
|
|
|
_mode(mode) {}
|
|
|
|
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(const PrimitiveSet& prim,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
2002-06-27 18:50:19 +08:00
|
|
|
Object(prim,copyop),
|
|
|
|
_primitiveType(prim._primitiveType),
|
|
|
|
_mode(prim._mode) {}
|
|
|
|
|
2002-09-20 22:51:59 +08:00
|
|
|
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const PrimitiveSet*>(obj)!=NULL; }
|
2002-06-27 18:50:19 +08:00
|
|
|
virtual const char* libraryName() const { return "osg"; }
|
2002-09-20 22:51:59 +08:00
|
|
|
virtual const char* className() const { return "PrimitiveSet"; }
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2002-06-27 21:15:34 +08:00
|
|
|
Type getType() const { return _primitiveType; }
|
2002-06-27 18:50:19 +08:00
|
|
|
|
|
|
|
void setMode(GLenum mode) { _mode = mode; }
|
|
|
|
GLenum getMode() const { return _mode; }
|
|
|
|
|
|
|
|
virtual void draw() const = 0;
|
|
|
|
|
2002-11-06 18:24:33 +08:00
|
|
|
virtual void accept(Drawable::PrimitiveFunctor& functor) const = 0;
|
2002-07-18 08:53:03 +08:00
|
|
|
|
2002-10-09 23:43:56 +08:00
|
|
|
virtual unsigned int index(unsigned int pos) const = 0;
|
|
|
|
virtual unsigned int getNumIndices() const = 0;
|
2002-07-18 08:53:03 +08:00
|
|
|
virtual void offsetIndices(int offset) = 0;
|
2002-10-09 23:43:56 +08:00
|
|
|
|
|
|
|
virtual unsigned int getNumPrimitives() const
|
|
|
|
{
|
|
|
|
switch(_mode)
|
|
|
|
{
|
|
|
|
case(POINTS): return getNumIndices();
|
|
|
|
case(LINES): return getNumIndices()/2;
|
|
|
|
case(TRIANGLES): return getNumIndices()/3;
|
|
|
|
case(QUADS): return getNumIndices()/4;
|
|
|
|
case(LINE_STRIP):
|
|
|
|
case(LINE_LOOP):
|
|
|
|
case(TRIANGLE_STRIP):
|
|
|
|
case(TRIANGLE_FAN):
|
|
|
|
case(QUAD_STRIP):
|
|
|
|
case(POLYGON): return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2002-06-27 18:50:19 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2003-01-10 17:25:42 +08:00
|
|
|
virtual ~PrimitiveSet() {}
|
|
|
|
|
2002-06-27 21:15:34 +08:00
|
|
|
Type _primitiveType;
|
2002-06-27 18:50:19 +08:00
|
|
|
GLenum _mode;
|
|
|
|
};
|
|
|
|
|
2002-09-20 22:51:59 +08:00
|
|
|
class SG_EXPORT DrawArrays : public PrimitiveSet
|
2002-06-27 18:50:19 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
DrawArrays(GLenum mode=0):
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawArraysPrimitiveType,mode),
|
2002-07-07 22:40:41 +08:00
|
|
|
_first(0),
|
|
|
|
_count(0) {}
|
2002-06-27 18:50:19 +08:00
|
|
|
|
|
|
|
DrawArrays(GLenum mode, GLint first, GLsizei count):
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawArraysPrimitiveType,mode),
|
2002-06-27 18:50:19 +08:00
|
|
|
_first(first),
|
|
|
|
_count(count) {}
|
|
|
|
|
|
|
|
DrawArrays(const DrawArrays& da,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(da,copyop),
|
2002-06-27 18:50:19 +08:00
|
|
|
_first(da._first),
|
|
|
|
_count(da._count) {}
|
|
|
|
|
2002-12-16 21:40:58 +08:00
|
|
|
virtual Object* cloneType() const { return new DrawArrays(); }
|
|
|
|
virtual Object* clone(const CopyOp& copyop) const { return new DrawArrays(*this,copyop); }
|
2002-06-27 18:50:19 +08:00
|
|
|
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawArrays*>(obj)!=NULL; }
|
|
|
|
virtual const char* libraryName() const { return "osg"; }
|
|
|
|
virtual const char* className() const { return "DrawArrays"; }
|
|
|
|
|
|
|
|
|
|
|
|
void set(GLenum mode,GLint first, GLsizei count)
|
|
|
|
{
|
|
|
|
_mode = mode;
|
|
|
|
_first = first;
|
|
|
|
_count = count;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setFirst(GLint first) { _first = first; }
|
|
|
|
GLint getFirst() const { return _first; }
|
|
|
|
|
|
|
|
void setCount(GLsizei count) { _count = count; }
|
|
|
|
GLsizei getCount() const { return _count; }
|
|
|
|
|
2002-06-27 21:15:34 +08:00
|
|
|
virtual void draw() const;
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2002-11-06 18:24:33 +08:00
|
|
|
virtual void accept(Drawable::PrimitiveFunctor& functor) const;
|
2002-06-27 21:15:34 +08:00
|
|
|
|
2002-10-09 23:43:56 +08:00
|
|
|
virtual unsigned int getNumIndices() const { return _count; }
|
|
|
|
virtual unsigned int index(unsigned int pos) const { return _first+pos; }
|
2002-07-18 08:53:03 +08:00
|
|
|
virtual void offsetIndices(int offset) { _first += offset; }
|
|
|
|
|
2002-06-27 21:15:34 +08:00
|
|
|
protected:
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2003-01-10 17:25:42 +08:00
|
|
|
virtual ~DrawArrays() {}
|
|
|
|
|
2002-06-27 18:50:19 +08:00
|
|
|
GLint _first;
|
|
|
|
GLsizei _count;
|
|
|
|
};
|
|
|
|
|
2002-09-20 22:51:59 +08:00
|
|
|
class SG_EXPORT DrawArrayLengths : public PrimitiveSet, public VectorSizei
|
2002-06-27 18:50:19 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2002-07-07 22:40:41 +08:00
|
|
|
DrawArrayLengths(GLenum mode=0):
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
|
2002-07-07 22:40:41 +08:00
|
|
|
_first(0) {}
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2002-07-07 22:40:41 +08:00
|
|
|
DrawArrayLengths(const DrawArrayLengths& dal,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(dal,copyop),
|
2002-07-07 22:40:41 +08:00
|
|
|
VectorSizei(dal),
|
|
|
|
_first(dal._first) {}
|
|
|
|
|
|
|
|
DrawArrayLengths(GLenum mode, GLint first, unsigned int no, GLsizei* ptr) :
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
|
2002-07-07 22:40:41 +08:00
|
|
|
VectorSizei(ptr,ptr+no),
|
|
|
|
_first(first) {}
|
|
|
|
|
|
|
|
DrawArrayLengths(GLenum mode,GLint first, unsigned int no) :
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
|
2002-07-07 22:40:41 +08:00
|
|
|
VectorSizei(no),
|
|
|
|
_first(first) {}
|
|
|
|
|
2003-01-15 19:29:30 +08:00
|
|
|
DrawArrayLengths(GLenum mode,GLint first) :
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
|
2003-01-15 19:29:30 +08:00
|
|
|
VectorSizei(),
|
2002-07-07 22:40:41 +08:00
|
|
|
_first(first) {}
|
|
|
|
|
2003-01-15 19:29:30 +08:00
|
|
|
|
2002-12-16 21:40:58 +08:00
|
|
|
virtual Object* cloneType() const { return new DrawArrayLengths(); }
|
|
|
|
virtual Object* clone(const CopyOp& copyop) const { return new DrawArrayLengths(*this,copyop); }
|
2002-07-07 22:40:41 +08:00
|
|
|
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawArrayLengths*>(obj)!=NULL; }
|
|
|
|
virtual const char* libraryName() const { return "osg"; }
|
|
|
|
virtual const char* className() const { return "DrawArrayLengths"; }
|
|
|
|
|
|
|
|
|
|
|
|
void setFirst(GLint first) { _first = first; }
|
|
|
|
GLint getFirst() const { return _first; }
|
|
|
|
|
|
|
|
virtual void draw() const;
|
|
|
|
|
2002-11-06 18:24:33 +08:00
|
|
|
virtual void accept(Drawable::PrimitiveFunctor& functor) const;
|
2002-07-07 22:40:41 +08:00
|
|
|
|
2002-10-09 23:43:56 +08:00
|
|
|
virtual unsigned int getNumIndices() const;
|
|
|
|
virtual unsigned int index(unsigned int pos) const { return _first+pos; }
|
2002-07-18 08:53:03 +08:00
|
|
|
virtual void offsetIndices(int offset) { _first += offset; }
|
|
|
|
|
2002-10-09 23:43:56 +08:00
|
|
|
virtual unsigned int getNumPrimitives() const
|
|
|
|
{
|
|
|
|
switch(_mode)
|
|
|
|
{
|
|
|
|
case(POINTS): return getNumIndices();
|
|
|
|
case(LINES): return getNumIndices()/2;
|
|
|
|
case(TRIANGLES): return getNumIndices()/3;
|
|
|
|
case(QUADS): return getNumIndices()/4;
|
|
|
|
case(LINE_STRIP):
|
|
|
|
case(LINE_LOOP):
|
|
|
|
case(TRIANGLE_STRIP):
|
|
|
|
case(TRIANGLE_FAN):
|
|
|
|
case(QUAD_STRIP):
|
|
|
|
case(POLYGON): return size();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2002-09-04 04:12:29 +08:00
|
|
|
|
2002-07-07 22:40:41 +08:00
|
|
|
protected:
|
|
|
|
|
2003-01-10 17:25:42 +08:00
|
|
|
virtual ~DrawArrayLengths() {}
|
|
|
|
|
2002-07-07 22:40:41 +08:00
|
|
|
GLint _first;
|
|
|
|
};
|
|
|
|
|
2002-09-20 22:51:59 +08:00
|
|
|
class SG_EXPORT DrawElementsUByte : public PrimitiveSet, public VectorUByte
|
2002-07-07 22:40:41 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
DrawElementsUByte(GLenum mode=0):
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawElementsUBytePrimitiveType,mode) {}
|
2002-07-07 22:40:41 +08:00
|
|
|
|
|
|
|
DrawElementsUByte(const DrawElementsUByte& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(array,copyop),
|
2002-07-07 22:40:41 +08:00
|
|
|
VectorUByte(array) {}
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2002-07-11 16:28:09 +08:00
|
|
|
DrawElementsUByte(GLenum mode,unsigned int no,GLubyte* ptr) :
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawElementsUBytePrimitiveType,mode),
|
2002-07-07 22:40:41 +08:00
|
|
|
VectorUByte(ptr,ptr+no) {}
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2002-07-07 22:40:41 +08:00
|
|
|
DrawElementsUByte(GLenum mode,unsigned int no) :
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawElementsUBytePrimitiveType,mode),
|
2002-07-07 22:40:41 +08:00
|
|
|
VectorUByte(no) {}
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2002-12-16 21:40:58 +08:00
|
|
|
virtual Object* cloneType() const { return new DrawElementsUByte(); }
|
|
|
|
virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUByte(*this,copyop); }
|
2002-07-07 22:40:41 +08:00
|
|
|
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUByte*>(obj)!=NULL; }
|
2002-06-27 18:50:19 +08:00
|
|
|
virtual const char* libraryName() const { return "osg"; }
|
2002-07-07 22:40:41 +08:00
|
|
|
virtual const char* className() const { return "DrawElementsUByte"; }
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2002-06-27 21:15:34 +08:00
|
|
|
virtual void draw() const ;
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2002-11-06 18:24:33 +08:00
|
|
|
virtual void accept(Drawable::PrimitiveFunctor& functor) const;
|
2002-07-18 08:53:03 +08:00
|
|
|
|
2002-10-09 23:43:56 +08:00
|
|
|
virtual unsigned int getNumIndices() const { return size(); }
|
|
|
|
virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
|
2002-07-18 08:53:03 +08:00
|
|
|
virtual void offsetIndices(int offset);
|
2003-01-10 17:25:42 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual ~DrawElementsUByte() {}
|
2002-06-27 21:15:34 +08:00
|
|
|
};
|
|
|
|
|
2002-07-04 22:49:37 +08:00
|
|
|
|
2002-09-20 22:51:59 +08:00
|
|
|
class SG_EXPORT DrawElementsUShort : public PrimitiveSet, public VectorUShort
|
2002-06-27 21:15:34 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2002-07-07 22:40:41 +08:00
|
|
|
DrawElementsUShort(GLenum mode=0):
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawElementsUShortPrimitiveType,mode) {}
|
2002-06-27 21:15:34 +08:00
|
|
|
|
2002-07-07 22:40:41 +08:00
|
|
|
DrawElementsUShort(const DrawElementsUShort& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(array,copyop),
|
2002-07-07 22:40:41 +08:00
|
|
|
VectorUShort(array) {}
|
2002-06-27 21:15:34 +08:00
|
|
|
|
2002-07-11 16:28:09 +08:00
|
|
|
DrawElementsUShort(GLenum mode,unsigned int no,GLushort* ptr) :
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawElementsUShortPrimitiveType,mode),
|
2002-07-07 22:40:41 +08:00
|
|
|
VectorUShort(ptr,ptr+no) {}
|
2002-06-27 21:15:34 +08:00
|
|
|
|
2002-07-07 22:40:41 +08:00
|
|
|
DrawElementsUShort(GLenum mode,unsigned int no) :
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawElementsUShortPrimitiveType,mode),
|
2002-07-07 22:40:41 +08:00
|
|
|
VectorUShort(no) {}
|
2002-06-27 21:15:34 +08:00
|
|
|
|
|
|
|
template <class InputIterator>
|
2002-07-07 22:40:41 +08:00
|
|
|
DrawElementsUShort(GLenum mode, InputIterator first,InputIterator last) :
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawElementsUShortPrimitiveType,mode),
|
2002-07-07 22:40:41 +08:00
|
|
|
VectorUShort(first,last) {}
|
2002-06-27 21:15:34 +08:00
|
|
|
|
2002-12-16 21:40:58 +08:00
|
|
|
virtual Object* cloneType() const { return new DrawElementsUShort(); }
|
|
|
|
virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUShort(*this,copyop); }
|
2002-07-07 22:40:41 +08:00
|
|
|
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUShort*>(obj)!=NULL; }
|
2002-06-27 21:15:34 +08:00
|
|
|
virtual const char* libraryName() const { return "osg"; }
|
2002-07-07 22:40:41 +08:00
|
|
|
virtual const char* className() const { return "DrawElementsUShort"; }
|
2002-06-27 21:15:34 +08:00
|
|
|
|
|
|
|
virtual void draw() const;
|
|
|
|
|
2002-11-06 18:24:33 +08:00
|
|
|
virtual void accept(Drawable::PrimitiveFunctor& functor) const;
|
2002-07-18 08:53:03 +08:00
|
|
|
|
2002-10-09 23:43:56 +08:00
|
|
|
virtual unsigned int getNumIndices() const { return size(); }
|
|
|
|
virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
|
2002-07-18 08:53:03 +08:00
|
|
|
virtual void offsetIndices(int offset);
|
2003-01-10 17:25:42 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual ~DrawElementsUShort() {}
|
2002-06-27 21:15:34 +08:00
|
|
|
};
|
|
|
|
|
2002-09-20 22:51:59 +08:00
|
|
|
class SG_EXPORT DrawElementsUInt : public PrimitiveSet, public VectorUInt
|
2002-06-27 21:15:34 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2002-07-07 22:40:41 +08:00
|
|
|
DrawElementsUInt(GLenum mode=0):
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawElementsUIntPrimitiveType,mode) {}
|
2002-06-27 21:15:34 +08:00
|
|
|
|
2002-07-07 22:40:41 +08:00
|
|
|
DrawElementsUInt(const DrawElementsUInt& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(array,copyop),
|
2002-07-07 22:40:41 +08:00
|
|
|
VectorUInt(array) {}
|
2002-06-27 21:15:34 +08:00
|
|
|
|
2002-07-11 16:28:09 +08:00
|
|
|
DrawElementsUInt(GLenum mode,unsigned int no,GLuint* ptr) :
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawElementsUIntPrimitiveType,mode),
|
2002-07-07 22:40:41 +08:00
|
|
|
VectorUInt(ptr,ptr+no) {}
|
2002-06-27 21:15:34 +08:00
|
|
|
|
2002-07-07 22:40:41 +08:00
|
|
|
DrawElementsUInt(GLenum mode,unsigned int no) :
|
2002-09-20 22:51:59 +08:00
|
|
|
PrimitiveSet(DrawElementsUIntPrimitiveType,mode),
|
2002-07-07 22:40:41 +08:00
|
|
|
VectorUInt(no) {}
|
2002-06-27 21:15:34 +08:00
|
|
|
|
2002-12-16 21:40:58 +08:00
|
|
|
virtual Object* cloneType() const { return new DrawElementsUInt(); }
|
|
|
|
virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUInt(*this,copyop); }
|
2002-07-07 22:40:41 +08:00
|
|
|
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUInt*>(obj)!=NULL; }
|
2002-06-27 21:15:34 +08:00
|
|
|
virtual const char* libraryName() const { return "osg"; }
|
2002-07-07 22:40:41 +08:00
|
|
|
virtual const char* className() const { return "DrawElementsUInt"; }
|
2002-06-27 21:15:34 +08:00
|
|
|
|
|
|
|
virtual void draw() const;
|
|
|
|
|
2002-11-06 18:24:33 +08:00
|
|
|
virtual void accept(Drawable::PrimitiveFunctor& functor) const;
|
2002-06-27 18:50:19 +08:00
|
|
|
|
2002-10-09 23:43:56 +08:00
|
|
|
virtual unsigned int getNumIndices() const { return size(); }
|
|
|
|
virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
|
2002-07-18 08:53:03 +08:00
|
|
|
virtual void offsetIndices(int offset);
|
2003-01-10 17:25:42 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual ~DrawElementsUInt() {}
|
2002-06-27 18:50:19 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|