root/OpenSceneGraph/trunk/include/osg/PrimitiveSet @ 12360

Revision 12360, 22.2 kB (checked in by robert, 4 years ago)

Fixed Coverity reported issues.

CID 10392: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _maxIndex is not initialized in this constructor nor in any functions that it calls.
Non-static class member _minIndex is not initialized in this constructor nor in any functions that it calls.

CID 10454: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _maxIndex is not initialized in this constructor nor in any functions that it calls.
Non-static class member _minIndex is not initialized in this constructor nor in any functions that it calls.

CID 10505: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _maxIndex is not initialized in this constructor nor in any functions that it calls.
Non-static class member _minIndex is not initialized in this constructor nor in any functions that it calls.

CID 10919: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _maxIndex is not initialized in this constructor nor in any functions that it calls.
Non-static class member _minIndex is not initialized in this constructor nor in any functions that it calls.

CID 10920: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _maxIndex is not initialized in this constructor nor in any functions that it calls.
Non-static class member _minIndex is not initialized in this constructor nor in any functions that it calls.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
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_PRIMITIVESET
15#define OSG_PRIMITIVESET 1
16
17#include <osg/GL>
18#include <osg/Object>
19#include <osg/buffered_value>
20#include <osg/Vec2>
21#include <osg/Vec3>
22#include <osg/Vec4>
23#include <osg/Vec2d>
24#include <osg/Vec3d>
25#include <osg/Vec4d>
26#include <osg/MixinVector>
27#include <osg/GL2Extensions>
28
29#include <osg/BufferObject>
30
31#include <vector>
32
33namespace osg {
34
35typedef MixinVector<GLsizei> VectorGLsizei;
36typedef MixinVector<GLubyte> VectorGLubyte;
37typedef MixinVector<GLushort> VectorGLushort;
38typedef MixinVector<GLuint> VectorGLuint;
39
40class State;
41
42/** A \c PrimitiveFunctor is used (in conjunction with
43 *  <tt>osg::Drawable::accept (PrimitiveFunctor&)</tt>) to get access to the
44 *  primitives that compose the things drawn by OSG.
45 *  <p>If \c osg::Drawable::accept() is called with a \c PrimitiveFunctor
46 *  parameter, the \c Drawable will "pretend" it is drawing itself, but instead
47 *  of calling real OpenGL functions, it will call <tt>PrimitiveFunctor</tt>'s
48 *  member functions that "mimic" the OpenGL calls.
49 *  <p>Concrete subclasses of \c PrimitiveFunctor must implement these methods
50 *  so that they performs whatever they want.
51 */
52class PrimitiveFunctor
53{
54public:
55
56    virtual ~PrimitiveFunctor() {}
57
58    /** Sets the array of vertices used to describe the primitives. Somehow
59     *  mimics the OpenGL \c glVertexPointer() function.
60     */
61    virtual void setVertexArray(unsigned int count,const Vec2* vertices) = 0;
62
63    /** Sets the array of vertices used to describe the primitives. Somehow
64     *  mimics the OpenGL \c glVertexPointer() function.
65     */
66    virtual void setVertexArray(unsigned int count,const Vec3* vertices) = 0;
67
68    /** Sets the array of vertices used to describe the primitives. Somehow
69     *  mimics the OpenGL \c glVertexPointer() function.
70     */
71    virtual void setVertexArray(unsigned int count,const Vec4* vertices) = 0;
72
73    /** Sets the array of vertices used to describe the primitives. Somehow
74     *  mimics the OpenGL \c glVertexPointer() function.
75     */
76    virtual void setVertexArray(unsigned int count,const Vec2d* vertices) = 0;
77
78    /** Sets the array of vertices used to describe the primitives. Somehow
79     *  mimics the OpenGL \c glVertexPointer() function.
80     */
81    virtual void setVertexArray(unsigned int count,const Vec3d* vertices) = 0;
82
83    /** Sets the array of vertices used to describe the primitives. Somehow
84     *  mimics the OpenGL \c glVertexPointer() function.
85     */
86    virtual void setVertexArray(unsigned int count,const Vec4d* vertices) = 0;
87
88    /// Mimics the OpenGL \c glDrawArrays() function.
89    virtual void drawArrays(GLenum mode,GLint first,GLsizei count) = 0;
90
91    /// Mimics the OpenGL \c glDrawElements() function.
92    virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) = 0;
93
94    /// Mimics the OpenGL \c glDrawElements() function.
95    virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) = 0;
96
97    /// Mimics the OpenGL \c glDrawElements() function.
98    virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) = 0;
99
100    /// Mimics the OpenGL \c glBegin() function.
101    virtual void begin(GLenum mode) = 0;
102
103    /// Mimics the OpenGL \c glVertex() "family of functions".
104    virtual void vertex(const Vec2& vert) = 0;
105
106    /// Mimics the OpenGL \c glVertex() "family of functions".
107    virtual void vertex(const Vec3& vert) = 0;
108
109    /// Mimics the OpenGL \c glVertex() "family of functions".
110    virtual void vertex(const Vec4& vert) = 0;
111
112    /// Mimics the OpenGL \c glVertex() "family of functions".
113    virtual void vertex(float x,float y) = 0;
114
115    /// Mimics the OpenGL \c glVertex() "family of functions".
116    virtual void vertex(float x,float y,float z) = 0;
117
118    /// Mimics the OpenGL \c glVertex() "family of functions".
119    virtual void vertex(float x,float y,float z,float w) = 0;
120
121    /// Mimics the OpenGL \c glEnd() function.
122    virtual void end() = 0;
123};
124
125class PrimitiveIndexFunctor
126{
127public:
128
129    virtual ~PrimitiveIndexFunctor() {}
130
131    virtual void setVertexArray(unsigned int count,const Vec2* vertices) = 0;
132    virtual void setVertexArray(unsigned int count,const Vec3* vertices) = 0;
133    virtual void setVertexArray(unsigned int count,const Vec4* vertices) = 0;
134
135    virtual void setVertexArray(unsigned int count,const Vec2d* vertices) = 0;
136    virtual void setVertexArray(unsigned int count,const Vec3d* vertices) = 0;
137    virtual void setVertexArray(unsigned int count,const Vec4d* vertices) = 0;
138
139    virtual void drawArrays(GLenum mode,GLint first,GLsizei count) = 0;
140    virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) = 0;
141    virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) = 0;
142    virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) = 0;
143
144    virtual void begin(GLenum mode) = 0;
145    virtual void vertex(unsigned int pos) = 0;
146    virtual void end() = 0;
147};
148
149class DrawElements;
150
151class OSG_EXPORT PrimitiveSet : public BufferData
152{
153    public:
154   
155        enum Type
156        {
157            PrimitiveType,
158            DrawArraysPrimitiveType,
159            DrawArrayLengthsPrimitiveType,
160            DrawElementsUBytePrimitiveType,
161            DrawElementsUShortPrimitiveType,
162            DrawElementsUIntPrimitiveType
163        };
164
165        enum Mode
166        {
167            POINTS = GL_POINTS,
168            LINES = GL_LINES,
169            LINE_STRIP = GL_LINE_STRIP,
170            LINE_LOOP = GL_LINE_LOOP,
171            TRIANGLES = GL_TRIANGLES,
172            TRIANGLE_STRIP = GL_TRIANGLE_STRIP,
173            TRIANGLE_FAN = GL_TRIANGLE_FAN,
174            QUADS = GL_QUADS,
175            QUAD_STRIP = GL_QUAD_STRIP,
176            POLYGON = GL_POLYGON,
177            LINES_ADJACENCY = GL_LINES_ADJACENCY_EXT,
178            LINE_STRIP_ADJACENCY = GL_LINE_STRIP_ADJACENCY_EXT,
179            TRIANGLES_ADJACENCY = GL_TRIANGLES_ADJACENCY_EXT,
180            TRIANGLE_STRIP_ADJACENCY = GL_TRIANGLE_STRIP_ADJACENCY_EXT,
181            PATCHES = GL_PATCHES
182        };
183
184        PrimitiveSet(Type primType=PrimitiveType,GLenum mode=0, int numInstances=0):
185            _primitiveType(primType),
186            _numInstances(numInstances),
187            _mode(mode) {}
188   
189        PrimitiveSet(const PrimitiveSet& prim,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
190            BufferData(prim,copyop),
191            _primitiveType(prim._primitiveType),
192            _numInstances(prim._numInstances),
193            _mode(prim._mode) {}
194
195        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const PrimitiveSet*>(obj)!=NULL; }
196        virtual const char* libraryName() const { return "osg"; }
197        virtual const char* className() const { return "PrimitiveSet"; }
198       
199        Type                    getType() const { return _primitiveType; }
200        virtual const GLvoid*   getDataPointer() const { return 0; }
201        virtual unsigned int    getTotalDataSize() const { return 0; }
202        virtual bool            supportsBufferObject() const { return false; }
203
204        virtual DrawElements* getDrawElements() { return 0; }
205        virtual const DrawElements* getDrawElements() const { return 0; }
206           
207        void setNumInstances(int n) { _numInstances = n; }
208        int getNumInstances() const { return _numInstances; }
209
210        void setMode(GLenum mode) { _mode = mode; }
211        GLenum getMode() const { return _mode; }
212
213        virtual void draw(State& state, bool useVertexBufferObjects) const = 0;
214       
215        virtual void accept(PrimitiveFunctor& functor) const = 0;
216        virtual void accept(PrimitiveIndexFunctor& functor) const = 0;
217       
218        virtual unsigned int index(unsigned int pos) const = 0;
219        virtual unsigned int getNumIndices() const = 0;
220        virtual void offsetIndices(int offset) = 0;
221
222        virtual unsigned int getNumPrimitives() const;
223
224        virtual void computeRange() const {}
225
226    protected:
227
228        virtual ~PrimitiveSet() {}
229
230        Type            _primitiveType;
231        int             _numInstances;
232        GLenum          _mode;
233};
234
235class OSG_EXPORT DrawArrays : public PrimitiveSet
236{
237    public:
238
239        DrawArrays(GLenum mode=0):
240            PrimitiveSet(DrawArraysPrimitiveType,mode),
241            _first(0),
242            _count(0) {}
243   
244        DrawArrays(GLenum mode, GLint first, GLsizei count, int numInstances=0):
245            PrimitiveSet(DrawArraysPrimitiveType, mode, numInstances),
246            _first(first),
247            _count(count) {}
248
249        DrawArrays(const DrawArrays& da,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
250            PrimitiveSet(da,copyop),
251            _first(da._first),
252            _count(da._count) {}
253
254        virtual Object* cloneType() const { return new DrawArrays(); }
255        virtual Object* clone(const CopyOp& copyop) const { return new DrawArrays(*this,copyop); }       
256        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawArrays*>(obj)!=NULL; }
257        virtual const char* libraryName() const { return "osg"; }
258        virtual const char* className() const { return "DrawArrays"; }
259       
260
261        void set(GLenum mode,GLint first, GLsizei count)
262        {
263            _mode = mode;
264            _first = first;
265            _count = count;
266        }
267
268        void setFirst(GLint first) { _first = first; }
269        GLint getFirst() const { return _first; }
270       
271        void setCount(GLsizei count) { _count = count; }
272        GLsizei getCount() const { return _count; }
273
274        virtual void draw(State& state, bool useVertexBufferObjects) const;
275       
276        virtual void accept(PrimitiveFunctor& functor) const;
277        virtual void accept(PrimitiveIndexFunctor& functor) const;
278       
279        virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(_count); }
280        virtual unsigned int index(unsigned int pos) const { return static_cast<unsigned int>(_first)+pos; }
281        virtual void offsetIndices(int offset) { _first += offset; }
282
283    protected:
284
285        virtual ~DrawArrays() {}
286
287        GLint   _first;
288        GLsizei _count;
289};
290
291class OSG_EXPORT DrawArrayLengths : public PrimitiveSet, public VectorGLsizei
292{
293    public:
294
295        typedef VectorGLsizei vector_type;
296
297        DrawArrayLengths(GLenum mode=0):
298            PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
299            _first(0) {}
300   
301        DrawArrayLengths(const DrawArrayLengths& dal,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
302            PrimitiveSet(dal,copyop),
303            vector_type(dal),
304            _first(dal._first) {}
305
306        DrawArrayLengths(GLenum mode, GLint first, unsigned int no, GLsizei* ptr) :
307            PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
308            vector_type(ptr,ptr+no),
309            _first(first) {}
310
311        DrawArrayLengths(GLenum mode,GLint first, unsigned int no) :
312            PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
313            vector_type(no),
314            _first(first) {}
315
316        DrawArrayLengths(GLenum mode,GLint first) :
317            PrimitiveSet(DrawArrayLengthsPrimitiveType,mode),
318            vector_type(),
319            _first(first) {}
320
321
322        virtual Object* cloneType() const { return new DrawArrayLengths(); }
323        virtual Object* clone(const CopyOp& copyop) const { return new DrawArrayLengths(*this,copyop); }       
324        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawArrayLengths*>(obj)!=NULL; }
325        virtual const char* libraryName() const { return "osg"; }
326        virtual const char* className() const { return "DrawArrayLengths"; }
327       
328
329        void setFirst(GLint first) { _first = first; }
330        GLint getFirst() const { return _first; }
331       
332        virtual void draw(State& state, bool useVertexBufferObjects) const;
333       
334        virtual void accept(PrimitiveFunctor& functor) const;
335        virtual void accept(PrimitiveIndexFunctor& functor) const;
336       
337        virtual unsigned int getNumIndices() const;
338        virtual unsigned int index(unsigned int pos) const { return _first+pos; }
339        virtual void offsetIndices(int offset) { _first += offset; }
340
341        virtual unsigned int getNumPrimitives() const;
342
343    protected:
344
345        virtual ~DrawArrayLengths() {}
346
347        GLint   _first;
348};
349
350class DrawElements : public PrimitiveSet
351{
352    public:
353       
354        DrawElements(Type primType=PrimitiveType, GLenum mode=0, int numInstances=0):
355            PrimitiveSet(primType,mode, numInstances) {}
356   
357        DrawElements(const DrawElements& copy,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
358            PrimitiveSet(copy,copyop) {}
359
360
361        virtual DrawElements* getDrawElements() { return this; }
362        virtual const DrawElements* getDrawElements() const { return this; }
363
364        /** Set the ElementBufferObject.*/
365        inline void setElementBufferObject(osg::ElementBufferObject* ebo) { setBufferObject(ebo); }
366
367        /** Get the ElementBufferObject. If no EBO is assigned returns NULL*/
368        inline osg::ElementBufferObject* getElementBufferObject() { return dynamic_cast<osg::ElementBufferObject*>(_bufferObject.get()); }
369
370        /** Get the const ElementBufferObject. If no EBO is assigned returns NULL*/
371        inline const osg::ElementBufferObject* getElementBufferObject() const { return dynamic_cast<const osg::ElementBufferObject*>(_bufferObject.get()); }
372
373        virtual void reserveElements(unsigned int numIndices) = 0;
374        virtual void setElement(unsigned int, unsigned int) = 0;
375        virtual unsigned int getElement(unsigned int) = 0;
376        virtual void addElement(unsigned int) = 0;
377
378    protected:
379
380        virtual ~DrawElements() {}
381};
382
383class OSG_EXPORT DrawElementsUByte : public DrawElements, public VectorGLubyte
384{
385    public:
386   
387        typedef VectorGLubyte vector_type;
388
389        DrawElementsUByte(GLenum mode=0):
390            DrawElements(DrawElementsUBytePrimitiveType,mode) {}
391   
392        DrawElementsUByte(const DrawElementsUByte& array, const CopyOp& copyop=CopyOp::SHALLOW_COPY):
393            DrawElements(array,copyop),
394            vector_type(array) {}
395
396        /**
397         * \param no Number of intended elements. This will be the size of the underlying vector.
398         */
399        DrawElementsUByte(GLenum mode, unsigned int no, const GLubyte* ptr, int numInstances=0) :
400            DrawElements(DrawElementsUBytePrimitiveType,mode,numInstances),
401            vector_type(ptr,ptr+no) {}
402
403        /**
404         * \param no Number of intended elements. This will be the size of the underlying vector.
405         */
406        DrawElementsUByte(GLenum mode, unsigned int no) :
407            DrawElements(DrawElementsUBytePrimitiveType,mode),
408            vector_type(no) {}
409
410        virtual Object* cloneType() const { return new DrawElementsUByte(); }
411        virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUByte(*this,copyop); }       
412        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUByte*>(obj)!=NULL; }
413        virtual const char* libraryName() const { return "osg"; }
414        virtual const char* className() const { return "DrawElementsUByte"; }
415
416        virtual const GLvoid*   getDataPointer() const { return empty()?0:&front(); }
417        virtual unsigned int    getTotalDataSize() const { return static_cast<unsigned int>(size()); }
418        virtual bool            supportsBufferObject() const { return false; }
419
420        virtual void draw(State& state, bool useVertexBufferObjects) const ;
421       
422        virtual void accept(PrimitiveFunctor& functor) const;
423        virtual void accept(PrimitiveIndexFunctor& functor) const;
424
425        virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
426        virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
427        virtual void offsetIndices(int offset);
428       
429        virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); }
430        virtual void setElement(unsigned int i, unsigned int v)  { (*this)[i] = v; }
431        virtual unsigned int getElement(unsigned int i) { return (*this)[i]; }
432        virtual void addElement(unsigned int v) { push_back(GLubyte(v)); }
433
434    protected:
435
436        virtual ~DrawElementsUByte();
437};
438
439
440class OSG_EXPORT DrawElementsUShort : public DrawElements, public VectorGLushort
441{
442    public:
443
444        typedef VectorGLushort vector_type;
445
446        DrawElementsUShort(GLenum mode=0):
447            DrawElements(DrawElementsUShortPrimitiveType,mode) {}
448   
449        DrawElementsUShort(const DrawElementsUShort& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
450            DrawElements(array,copyop),
451            vector_type(array) {}
452
453        /**
454         * \param no Number of intended elements. This will be the size of the underlying vector.
455         */
456        DrawElementsUShort(GLenum mode, unsigned int no, const GLushort* ptr, int numInstances=0) :
457            DrawElements(DrawElementsUShortPrimitiveType,mode,numInstances),
458            vector_type(ptr,ptr+no) {}
459
460        /**
461         * \param no Number of intended elements. This will be the size of the underlying vector.
462         */
463        DrawElementsUShort(GLenum mode, unsigned int no) :
464            DrawElements(DrawElementsUShortPrimitiveType,mode),
465            vector_type(no) {}
466
467        template <class InputIterator>
468        DrawElementsUShort(GLenum mode, InputIterator first,InputIterator last) :
469            DrawElements(DrawElementsUShortPrimitiveType,mode),
470            vector_type(first,last) {}
471
472        virtual Object* cloneType() const { return new DrawElementsUShort(); }
473        virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUShort(*this,copyop); }       
474        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUShort*>(obj)!=NULL; }
475        virtual const char* libraryName() const { return "osg"; }
476        virtual const char* className() const { return "DrawElementsUShort"; }
477
478        virtual const GLvoid*   getDataPointer() const { return empty()?0:&front(); }
479        virtual unsigned int    getTotalDataSize() const { return 2u*static_cast<unsigned int>(size()); }
480        virtual bool            supportsBufferObject() const { return false; }
481
482        virtual void draw(State& state, bool useVertexBufferObjects) const;
483       
484        virtual void accept(PrimitiveFunctor& functor) const;
485        virtual void accept(PrimitiveIndexFunctor& functor) const;
486
487        virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
488        virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
489        virtual void offsetIndices(int offset);
490
491        virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); }
492        virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; }
493        virtual unsigned int getElement(unsigned int i) { return (*this)[i]; }
494        virtual void addElement(unsigned int v) { push_back(GLushort(v)); }
495
496    protected:
497
498        virtual ~DrawElementsUShort();
499};
500
501class OSG_EXPORT DrawElementsUInt : public DrawElements, public VectorGLuint
502{
503    public:
504
505        typedef VectorGLuint vector_type;
506
507        DrawElementsUInt(GLenum mode=0):
508            DrawElements(DrawElementsUIntPrimitiveType,mode) {}
509   
510        DrawElementsUInt(const DrawElementsUInt& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
511            DrawElements(array,copyop),
512            vector_type(array) {}
513
514        /**
515         * \param mode One of osg::PrimitiveSet::Mode. Determines the type of primitives used.
516         * \param no Number of intended elements. This will be the size of the underlying vector.
517         */
518        DrawElementsUInt(GLenum mode, unsigned int no, const GLuint* ptr, int numInstances=0) :
519            DrawElements(DrawElementsUIntPrimitiveType,mode,numInstances),
520            vector_type(ptr,ptr+no) {}
521
522        /**
523         * \param no Number of intended elements. This will be the size of the underlying vector.
524         */
525        DrawElementsUInt(GLenum mode, unsigned int no) :
526            DrawElements(DrawElementsUIntPrimitiveType,mode),
527            vector_type(no) {}
528
529        template <class InputIterator>
530        DrawElementsUInt(GLenum mode, InputIterator first,InputIterator last) :
531            DrawElements(DrawElementsUIntPrimitiveType,mode),
532            vector_type(first,last) {}
533
534        virtual Object* cloneType() const { return new DrawElementsUInt(); }
535        virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUInt(*this,copyop); }       
536        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUInt*>(obj)!=NULL; }
537        virtual const char* libraryName() const { return "osg"; }
538        virtual const char* className() const { return "DrawElementsUInt"; }
539
540        virtual const GLvoid*   getDataPointer() const { return empty()?0:&front(); }
541        virtual unsigned int    getTotalDataSize() const { return 4u*static_cast<unsigned int>(size()); }
542        virtual bool            supportsBufferObject() const { return false; }
543
544        virtual void draw(State& state, bool useVertexBufferObjects) const;
545       
546        virtual void accept(PrimitiveFunctor& functor) const;
547        virtual void accept(PrimitiveIndexFunctor& functor) const;
548
549        virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
550        virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
551        virtual void offsetIndices(int offset);
552
553        virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); }
554        virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; }
555        virtual unsigned int getElement(unsigned int i) { return (*this)[i]; }
556        virtual void addElement(unsigned int v) { push_back(GLuint(v)); }
557
558    protected:
559
560        virtual ~DrawElementsUInt();
561};
562
563}
564
565#endif
Note: See TracBrowser for help on using the browser.