OpenSceneGraph 3.6.5
PrimitiveSet
Go to the documentation of this file.
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
28#include <osg/BufferObject>
29
30#include <vector>
31
32#define OSG_HAS_MULTIDRAWARRAYS
33
34namespace osg {
35
40
41class State;
42
54{
55public:
56
57 virtual ~PrimitiveFunctor() {}
58
62 virtual void setVertexArray(unsigned int count,const Vec2* vertices) = 0;
63
67 virtual void setVertexArray(unsigned int count,const Vec3* vertices) = 0;
68
72 virtual void setVertexArray(unsigned int count,const Vec4* vertices) = 0;
73
77 virtual void setVertexArray(unsigned int count,const Vec2d* vertices) = 0;
78
82 virtual void setVertexArray(unsigned int count,const Vec3d* vertices) = 0;
83
87 virtual void setVertexArray(unsigned int count,const Vec4d* vertices) = 0;
88
90 virtual void drawArrays(GLenum mode,GLint first,GLsizei count) = 0;
91
93 virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) = 0;
94
96 virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) = 0;
97
99 virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) = 0;
100};
101
103{
104public:
105
107
108 virtual void setVertexArray(unsigned int count,const Vec2* vertices) = 0;
109 virtual void setVertexArray(unsigned int count,const Vec3* vertices) = 0;
110 virtual void setVertexArray(unsigned int count,const Vec4* vertices) = 0;
111
112 virtual void setVertexArray(unsigned int count,const Vec2d* vertices) = 0;
113 virtual void setVertexArray(unsigned int count,const Vec3d* vertices) = 0;
114 virtual void setVertexArray(unsigned int count,const Vec4d* vertices) = 0;
115
116 virtual void drawArrays(GLenum mode,GLint first,GLsizei count) = 0;
117 virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) = 0;
118 virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) = 0;
119 virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) = 0;
120};
121
122class DrawElements;
123
125{
126 public:
127
146
165
166 PrimitiveSet(Type primType=PrimitiveType,GLenum mode=0, int numInstances=0):
167 _primitiveType(primType),
168 _numInstances(numInstances),
169 _mode(mode) {}
170
172 BufferData(prim,copyop),
175 _mode(prim._mode) {}
176
177 virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const PrimitiveSet*>(obj)!=NULL; }
178 virtual const char* libraryName() const { return "osg"; }
179 virtual const char* className() const { return "PrimitiveSet"; }
180
181 Type getType() const { return _primitiveType; }
182
183 virtual osg::PrimitiveSet* asPrimitiveSet() { return this; }
184 virtual const osg::PrimitiveSet* asPrimitiveSet() const { return this; }
185
186 virtual const GLvoid* getDataPointer() const { return 0; }
187 virtual unsigned int getTotalDataSize() const { return 0; }
188 virtual bool supportsBufferObject() const { return false; }
189
190 virtual DrawElements* getDrawElements() { return 0; }
191 virtual const DrawElements* getDrawElements() const { return 0; }
192
193 void setNumInstances(int n) { _numInstances = n; }
194 int getNumInstances() const { return _numInstances; }
195
196 void setMode(GLenum mode) { _mode = mode; }
197 GLenum getMode() const { return _mode; }
198
199 virtual void draw(State& state, bool useVertexBufferObjects) const = 0;
200
201 virtual void accept(PrimitiveFunctor& functor) const = 0;
202 virtual void accept(PrimitiveIndexFunctor& functor) const = 0;
203
204 virtual unsigned int index(unsigned int pos) const = 0;
205 virtual unsigned int getNumIndices() const = 0;
206 virtual void offsetIndices(int offset) = 0;
207
208 virtual unsigned int getNumPrimitives() const;
209
210 virtual void computeRange() const {}
211
212 protected:
213
214 virtual ~PrimitiveSet() {}
215
218 GLenum _mode;
219};
220
222{
223 public:
224
225 DrawArrays(GLenum mode=0):
227 _first(0),
228 _count(0) {}
229
230 DrawArrays(GLenum mode, GLint first, GLsizei count, int numInstances=0):
231 PrimitiveSet(DrawArraysPrimitiveType, mode, numInstances),
232 _first(first),
233 _count(count) {}
234
236 PrimitiveSet(da,copyop),
237 _first(da._first),
238 _count(da._count) {}
239
240 virtual Object* cloneType() const { return new DrawArrays(); }
241 virtual Object* clone(const CopyOp& copyop) const { return new DrawArrays(*this,copyop); }
242 virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawArrays*>(obj)!=NULL; }
243 virtual const char* libraryName() const { return "osg"; }
244 virtual const char* className() const { return "DrawArrays"; }
245
246
247 void set(GLenum mode,GLint first, GLsizei count)
248 {
249 _mode = mode;
250 _first = first;
251 _count = count;
252 }
253
254 void setFirst(GLint first) { _first = first; }
255 GLint getFirst() const { return _first; }
256
257 void setCount(GLsizei count) { _count = count; }
258 GLsizei getCount() const { return _count; }
259
260 virtual void draw(State& state, bool useVertexBufferObjects) const;
261
262 virtual void accept(PrimitiveFunctor& functor) const;
263 virtual void accept(PrimitiveIndexFunctor& functor) const;
264
265 virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(_count); }
266 virtual unsigned int index(unsigned int pos) const { return static_cast<unsigned int>(_first)+pos; }
267 virtual void offsetIndices(int offset) { _first += offset; }
268
269 protected:
270
271 virtual ~DrawArrays() {}
272
273 GLint _first;
274 GLsizei _count;
275};
276
278{
279 public:
280
282
286
288 PrimitiveSet(dal,copyop),
289 vector_type(dal),
290 _first(dal._first) {}
291
292 DrawArrayLengths(GLenum mode, GLint first, unsigned int no, GLsizei* ptr) :
294 vector_type(ptr,ptr+no),
295 _first(first) {}
296
297 DrawArrayLengths(GLenum mode,GLint first, unsigned int no) :
299 vector_type(no),
300 _first(first) {}
301
302 DrawArrayLengths(GLenum mode,GLint first) :
304 vector_type(),
305 _first(first) {}
306
307
308 virtual Object* cloneType() const { return new DrawArrayLengths(); }
309 virtual Object* clone(const CopyOp& copyop) const { return new DrawArrayLengths(*this,copyop); }
310 virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawArrayLengths*>(obj)!=NULL; }
311 virtual const char* libraryName() const { return "osg"; }
312 virtual const char* className() const { return "DrawArrayLengths"; }
313
314
315 void setFirst(GLint first) { _first = first; }
316 GLint getFirst() const { return _first; }
317
318 virtual void draw(State& state, bool useVertexBufferObjects) const;
319
320 virtual void accept(PrimitiveFunctor& functor) const;
321 virtual void accept(PrimitiveIndexFunctor& functor) const;
322
323 virtual unsigned int getNumIndices() const;
324 virtual unsigned int index(unsigned int pos) const { return _first+pos; }
325 virtual void offsetIndices(int offset) { _first += offset; }
326
327 virtual unsigned int getNumPrimitives() const;
328
329 protected:
330
331 virtual ~DrawArrayLengths() {}
332
333 GLint _first;
334};
335
337{
338 public:
339
340 DrawElements(Type primType=PrimitiveType, GLenum mode=0, int numInstances=0):
341 PrimitiveSet(primType,mode, numInstances) {}
342
344 PrimitiveSet(copy,copyop) {}
345
346
347 virtual DrawElements* getDrawElements() { return this; }
348 virtual const DrawElements* getDrawElements() const { return this; }
349
352
355
357 inline const osg::ElementBufferObject* getElementBufferObject() const { return dynamic_cast<const osg::ElementBufferObject*>(_bufferObject.get()); }
358
359 virtual GLenum getDataType() = 0;
360 virtual void resizeElements(unsigned int numIndices) = 0;
361 virtual void reserveElements(unsigned int numIndices) = 0;
362 virtual void setElement(unsigned int, unsigned int) = 0;
363 virtual unsigned int getElement(unsigned int) = 0;
364 virtual void addElement(unsigned int) = 0;
365
366 protected:
367
368 virtual ~DrawElements() {}
369};
370
372{
373 public:
374
376
379
381 DrawElements(array,copyop),
382 vector_type(array) {}
383
390 DrawElementsUByte(GLenum mode, unsigned int no, const GLubyte* ptr, int numInstances=0) :
392 vector_type(ptr,ptr+no) {}
393
398 DrawElementsUByte(GLenum mode, unsigned int no) :
400 vector_type(no) {}
401
402 virtual Object* cloneType() const { return new DrawElementsUByte(); }
403 virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUByte(*this,copyop); }
404 virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUByte*>(obj)!=NULL; }
405 virtual const char* libraryName() const { return "osg"; }
406 virtual const char* className() const { return "DrawElementsUByte"; }
407
408 virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); }
409 virtual unsigned int getTotalDataSize() const { return static_cast<unsigned int>(size()); }
410 virtual bool supportsBufferObject() const { return false; }
411
412 virtual void draw(State& state, bool useVertexBufferObjects) const ;
413
414 virtual void accept(PrimitiveFunctor& functor) const;
415 virtual void accept(PrimitiveIndexFunctor& functor) const;
416
417 virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
418 virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
419 virtual void offsetIndices(int offset);
420
421 virtual GLenum getDataType() { return GL_UNSIGNED_BYTE; }
422 virtual void resizeElements(unsigned int numIndices) { resize(numIndices); }
423 virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); }
424 virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; }
425 virtual unsigned int getElement(unsigned int i) { return (*this)[i]; }
426 virtual void addElement(unsigned int v) { push_back(GLubyte(v)); }
427
428 protected:
429
431};
432
433
435{
436 public:
437
439
442
444 DrawElements(array,copyop),
445 vector_type(array) {}
446
453 DrawElementsUShort(GLenum mode, unsigned int no, const GLushort* ptr, int numInstances=0) :
455 vector_type(ptr,ptr+no) {}
456
461 DrawElementsUShort(GLenum mode, unsigned int no) :
463 vector_type(no) {}
464
465 template <class InputIterator>
466 DrawElementsUShort(GLenum mode, InputIterator first,InputIterator last) :
468 vector_type(first,last) {}
469
470 virtual Object* cloneType() const { return new DrawElementsUShort(); }
471 virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUShort(*this,copyop); }
472 virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUShort*>(obj)!=NULL; }
473 virtual const char* libraryName() const { return "osg"; }
474 virtual const char* className() const { return "DrawElementsUShort"; }
475
476 virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); }
477 virtual unsigned int getTotalDataSize() const { return 2u*static_cast<unsigned int>(size()); }
478 virtual bool supportsBufferObject() const { return false; }
479
480 virtual void draw(State& state, bool useVertexBufferObjects) const;
481
482 virtual void accept(PrimitiveFunctor& functor) const;
483 virtual void accept(PrimitiveIndexFunctor& functor) const;
484
485 virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
486 virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
487 virtual void offsetIndices(int offset);
488
489 virtual GLenum getDataType() { return GL_UNSIGNED_SHORT; }
490 virtual void resizeElements(unsigned int numIndices) { resize(numIndices); }
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
499};
500
502{
503 public:
504
506
509
511 DrawElements(array,copyop),
512 vector_type(array) {}
513
520 DrawElementsUInt(GLenum mode, unsigned int no, const GLuint* ptr, int numInstances=0) :
522 vector_type(ptr,ptr+no) {}
523
528 DrawElementsUInt(GLenum mode, unsigned int no) :
530 vector_type(no) {}
531
532 template <class InputIterator>
533 DrawElementsUInt(GLenum mode, InputIterator first,InputIterator last) :
535 vector_type(first,last) {}
536
537 virtual Object* cloneType() const { return new DrawElementsUInt(); }
538 virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUInt(*this,copyop); }
539 virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUInt*>(obj)!=NULL; }
540 virtual const char* libraryName() const { return "osg"; }
541 virtual const char* className() const { return "DrawElementsUInt"; }
542
543 virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); }
544 virtual unsigned int getTotalDataSize() const { return 4u*static_cast<unsigned int>(size()); }
545 virtual bool supportsBufferObject() const { return false; }
546
547 virtual void draw(State& state, bool useVertexBufferObjects) const;
548
549 virtual void accept(PrimitiveFunctor& functor) const;
550 virtual void accept(PrimitiveIndexFunctor& functor) const;
551
552 virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
553 virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
554 virtual void offsetIndices(int offset);
555
556 virtual GLenum getDataType() { return GL_UNSIGNED_INT; }
557 virtual void resizeElements(unsigned int numIndices) { resize(numIndices); }
558 virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); }
559 virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; }
560 virtual unsigned int getElement(unsigned int i) { return (*this)[i]; }
561 virtual void addElement(unsigned int v) { push_back(GLuint(v)); }
562
563 protected:
564
566};
567
568#ifdef OSG_HAS_MULTIDRAWARRAYS
570{
571public:
572
575
577 osg::PrimitiveSet(dal,copyop),
578 _firsts(dal._firsts),
579 _counts(dal._counts) {}
580
581 virtual osg::Object* cloneType() const { return new MultiDrawArrays(); }
582 virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new MultiDrawArrays(*this,copyop); }
583 virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const MultiDrawArrays*>(obj)!=NULL; }
584 virtual const char* libraryName() const { return "osg"; }
585 virtual const char* className() const { return "MultiDrawArrays"; }
586
587
588 virtual void draw(osg::State& state, bool useVertexBufferObjects) const;
589
590 virtual void accept(PrimitiveFunctor& functor) const;
591 virtual void accept(PrimitiveIndexFunctor& functor) const;
592
593 virtual unsigned int getNumIndices() const;
594 virtual unsigned int index(unsigned int pos) const;
595 virtual void offsetIndices(int offset);
596
597 virtual unsigned int getNumPrimitives() const;
598
599 typedef std::vector<GLint> Firsts;
600 void setFirsts(const Firsts& firsts) { _firsts = firsts; }
601 Firsts& getFirsts() { return _firsts; }
602 const Firsts& getFirsts() const { return _firsts; }
603
604 typedef std::vector<GLsizei> Counts;
605 void setCounts(const Counts& firsts) { _counts = firsts; }
606 Counts& getCounts() { return _counts; }
607 const Counts& getCounts() const { return _counts; }
608
609 void add(GLint first, GLsizei count);
610
611protected:
612
615};
616#endif
617
618
619}
620
621#endif
#define GL_LINES_ADJACENCY
Definition GLDefines:208
#define GL_TRIANGLE_STRIP_ADJACENCY
Definition GLDefines:211
#define GL_TRIANGLES_ADJACENCY
Definition GLDefines:210
#define GL_LINE_STRIP_ADJACENCY
Definition GLDefines:209
#define GL_PATCHES
Definition GLDefines:221
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Vec2f Vec2
Definition Vec2:21
Vec3f Vec3
Definition Vec3:21
MixinVector< GLsizei > VectorGLsizei
Definition PrimitiveSet:36
MixinVector< GLuint > VectorGLuint
Definition PrimitiveSet:39
MixinVector< GLushort > VectorGLushort
Definition PrimitiveSet:38
Vec4f Vec4
Definition Vec4:21
MixinVector< GLubyte > VectorGLubyte
Definition PrimitiveSet:37
BufferData()
Definition BufferObject:498
osg::ref_ptr< BufferObject > _bufferObject
Definition BufferObject:590
void setBufferObject(BufferObject *bufferObject)
Definition BufferObject:622
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
MixinVector is a base class that allows inheritance to be used to easily emulate derivation from std:...
Definition MixinVector:29
size_type size() const
Definition MixinVector:92
void resize(size_type new_size, const value_type &fill_value=value_type())
Definition MixinVector:85
const_reference front() const
Definition MixinVector:138
void reserve(size_type new_capacity)
Definition MixinVector:86
void push_back(const value_type &value)
Definition MixinVector:117
bool empty() const
Definition MixinVector:91
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
A PrimitiveFunctor is used (in conjunction with osg::Drawable::accept (PrimitiveFunctor&)) to get acc...
Definition PrimitiveSet:54
virtual void setVertexArray(unsigned int count, const Vec3d *vertices)=0
Sets the array of vertices used to describe the primitives.
virtual void drawArrays(GLenum mode, GLint first, GLsizei count)=0
Mimics the OpenGL glDrawArrays() function.
virtual void drawElements(GLenum mode, GLsizei count, const GLuint *indices)=0
Mimics the OpenGL glDrawElements() function.
virtual void drawElements(GLenum mode, GLsizei count, const GLubyte *indices)=0
Mimics the OpenGL glDrawElements() function.
virtual void setVertexArray(unsigned int count, const Vec2d *vertices)=0
Sets the array of vertices used to describe the primitives.
virtual void drawElements(GLenum mode, GLsizei count, const GLushort *indices)=0
Mimics the OpenGL glDrawElements() function.
virtual ~PrimitiveFunctor()
Definition PrimitiveSet:57
virtual void setVertexArray(unsigned int count, const Vec2 *vertices)=0
Sets the array of vertices used to describe the primitives.
virtual void setVertexArray(unsigned int count, const Vec3 *vertices)=0
Sets the array of vertices used to describe the primitives.
virtual void setVertexArray(unsigned int count, const Vec4 *vertices)=0
Sets the array of vertices used to describe the primitives.
virtual void setVertexArray(unsigned int count, const Vec4d *vertices)=0
Sets the array of vertices used to describe the primitives.
Definition PrimitiveSet:103
virtual void setVertexArray(unsigned int count, const Vec4d *vertices)=0
virtual void setVertexArray(unsigned int count, const Vec3d *vertices)=0
virtual ~PrimitiveIndexFunctor()
Definition PrimitiveSet:106
virtual void setVertexArray(unsigned int count, const Vec3 *vertices)=0
virtual void drawArrays(GLenum mode, GLint first, GLsizei count)=0
virtual void drawElements(GLenum mode, GLsizei count, const GLushort *indices)=0
virtual void drawElements(GLenum mode, GLsizei count, const GLubyte *indices)=0
virtual void drawElements(GLenum mode, GLsizei count, const GLuint *indices)=0
virtual void setVertexArray(unsigned int count, const Vec2d *vertices)=0
virtual void setVertexArray(unsigned int count, const Vec4 *vertices)=0
virtual void setVertexArray(unsigned int count, const Vec2 *vertices)=0
Definition PrimitiveSet:125
virtual const GLvoid * getDataPointer() const
Definition PrimitiveSet:186
int getNumInstances() const
Definition PrimitiveSet:194
virtual bool isSameKindAs(const Object *obj) const
Definition PrimitiveSet:177
virtual osg::PrimitiveSet * asPrimitiveSet()
Definition PrimitiveSet:183
virtual unsigned int getNumIndices() const =0
virtual ~PrimitiveSet()
Definition PrimitiveSet:214
virtual DrawElements * getDrawElements()
Definition PrimitiveSet:190
int _numInstances
Definition PrimitiveSet:217
virtual const osg::PrimitiveSet * asPrimitiveSet() const
Definition PrimitiveSet:184
Type _primitiveType
Definition PrimitiveSet:216
virtual unsigned int getTotalDataSize() const
Definition PrimitiveSet:187
Type getType() const
Definition PrimitiveSet:181
virtual unsigned int index(unsigned int pos) const =0
void setMode(GLenum mode)
Definition PrimitiveSet:196
Mode
Definition PrimitiveSet:148
@ QUADS
Definition PrimitiveSet:156
@ TRIANGLE_STRIP
Definition PrimitiveSet:154
@ PATCHES
Definition PrimitiveSet:163
@ TRIANGLE_FAN
Definition PrimitiveSet:155
@ QUAD_STRIP
Definition PrimitiveSet:157
@ TRIANGLES_ADJACENCY
Definition PrimitiveSet:161
@ LINE_STRIP_ADJACENCY
Definition PrimitiveSet:160
@ TRIANGLE_STRIP_ADJACENCY
Definition PrimitiveSet:162
@ LINE_STRIP
Definition PrimitiveSet:151
@ LINES
Definition PrimitiveSet:150
@ POINTS
Definition PrimitiveSet:149
@ LINE_LOOP
Definition PrimitiveSet:152
@ TRIANGLES
Definition PrimitiveSet:153
@ LINES_ADJACENCY
Definition PrimitiveSet:159
@ POLYGON
Definition PrimitiveSet:158
GLenum _mode
Definition PrimitiveSet:218
virtual void computeRange() const
Definition PrimitiveSet:210
virtual void offsetIndices(int offset)=0
Type
Definition PrimitiveSet:129
@ DrawElementsUByteIndirectPrimitiveType
Definition PrimitiveSet:138
@ DrawArrayLengthsPrimitiveType
Definition PrimitiveSet:132
@ MultiDrawElementsUByteIndirectPrimitiveType
Definition PrimitiveSet:142
@ MultiDrawArraysPrimitiveType
Definition PrimitiveSet:136
@ DrawElementsUIntPrimitiveType
Definition PrimitiveSet:135
@ DrawElementsUShortPrimitiveType
Definition PrimitiveSet:134
@ DrawArraysPrimitiveType
Definition PrimitiveSet:131
@ PrimitiveType
Definition PrimitiveSet:130
@ DrawArraysIndirectPrimitiveType
Definition PrimitiveSet:137
@ MultiDrawElementsUIntIndirectPrimitiveType
Definition PrimitiveSet:144
@ DrawElementsUBytePrimitiveType
Definition PrimitiveSet:133
@ DrawElementsUIntIndirectPrimitiveType
Definition PrimitiveSet:140
@ DrawElementsUShortIndirectPrimitiveType
Definition PrimitiveSet:139
@ MultiDrawElementsUShortIndirectPrimitiveType
Definition PrimitiveSet:143
@ MultiDrawArraysIndirectPrimitiveType
Definition PrimitiveSet:141
virtual unsigned int getNumPrimitives() const
virtual const DrawElements * getDrawElements() const
Definition PrimitiveSet:191
void setNumInstances(int n)
Definition PrimitiveSet:193
virtual bool supportsBufferObject() const
Definition PrimitiveSet:188
PrimitiveSet(Type primType=PrimitiveType, GLenum mode=0, int numInstances=0)
Definition PrimitiveSet:166
virtual void accept(PrimitiveIndexFunctor &functor) const =0
virtual const char * libraryName() const
return the name of the object's library.
Definition PrimitiveSet:178
virtual void draw(State &state, bool useVertexBufferObjects) const =0
virtual const char * className() const
return the name of the object's class type.
Definition PrimitiveSet:179
GLenum getMode() const
Definition PrimitiveSet:197
PrimitiveSet(const PrimitiveSet &prim, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSet:171
virtual void accept(PrimitiveFunctor &functor) const =0
virtual const char * libraryName() const
return the name of the object's library.
Definition PrimitiveSet:243
virtual void accept(PrimitiveFunctor &functor) const
virtual bool isSameKindAs(const Object *obj) const
Definition PrimitiveSet:242
virtual void draw(State &state, bool useVertexBufferObjects) const
virtual ~DrawArrays()
Definition PrimitiveSet:271
virtual const char * className() const
return the name of the object's class type.
Definition PrimitiveSet:244
virtual void accept(PrimitiveIndexFunctor &functor) const
void setCount(GLsizei count)
Definition PrimitiveSet:257
GLint _first
Definition PrimitiveSet:273
virtual unsigned int index(unsigned int pos) const
Definition PrimitiveSet:266
void setFirst(GLint first)
Definition PrimitiveSet:254
virtual Object * cloneType() const
Clone the type of an object, with Object* return type.
Definition PrimitiveSet:240
GLsizei _count
Definition PrimitiveSet:274
virtual void offsetIndices(int offset)
Definition PrimitiveSet:267
DrawArrays(const DrawArrays &da, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSet:235
DrawArrays(GLenum mode, GLint first, GLsizei count, int numInstances=0)
Definition PrimitiveSet:230
GLsizei getCount() const
Definition PrimitiveSet:258
GLint getFirst() const
Definition PrimitiveSet:255
virtual Object * clone(const CopyOp &copyop) const
Clone an object, with Object* return type.
Definition PrimitiveSet:241
virtual unsigned int getNumIndices() const
Definition PrimitiveSet:265
void set(GLenum mode, GLint first, GLsizei count)
Definition PrimitiveSet:247
DrawArrays(GLenum mode=0)
Definition PrimitiveSet:225
DrawArrayLengths(const DrawArrayLengths &dal, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSet:287
virtual unsigned int getNumPrimitives() const
virtual unsigned int index(unsigned int pos) const
Definition PrimitiveSet:324
virtual void offsetIndices(int offset)
Definition PrimitiveSet:325
DrawArrayLengths(GLenum mode, GLint first, unsigned int no)
Definition PrimitiveSet:297
DrawArrayLengths(GLenum mode, GLint first)
Definition PrimitiveSet:302
virtual Object * clone(const CopyOp &copyop) const
Clone an object, with Object* return type.
Definition PrimitiveSet:309
DrawArrayLengths(GLenum mode=0)
Definition PrimitiveSet:283
virtual void accept(PrimitiveIndexFunctor &functor) const
virtual bool isSameKindAs(const Object *obj) const
Definition PrimitiveSet:310
DrawArrayLengths(GLenum mode, GLint first, unsigned int no, GLsizei *ptr)
Definition PrimitiveSet:292
virtual const char * className() const
return the name of the object's class type.
Definition PrimitiveSet:312
virtual void draw(State &state, bool useVertexBufferObjects) const
virtual void accept(PrimitiveFunctor &functor) const
virtual unsigned int getNumIndices() const
GLint getFirst() const
Definition PrimitiveSet:316
virtual Object * cloneType() const
Clone the type of an object, with Object* return type.
Definition PrimitiveSet:308
virtual const char * libraryName() const
return the name of the object's library.
Definition PrimitiveSet:311
GLint _first
Definition PrimitiveSet:333
VectorGLsizei vector_type
Definition PrimitiveSet:281
void setFirst(GLint first)
Definition PrimitiveSet:315
virtual ~DrawArrayLengths()
Definition PrimitiveSet:331
Definition PrimitiveSet:337
DrawElements(const DrawElements &copy, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSet:343
DrawElements(Type primType=PrimitiveType, GLenum mode=0, int numInstances=0)
Definition PrimitiveSet:340
virtual void resizeElements(unsigned int numIndices)=0
virtual ~DrawElements()
Definition PrimitiveSet:368
virtual const DrawElements * getDrawElements() const
Definition PrimitiveSet:348
void setElementBufferObject(osg::ElementBufferObject *ebo)
Set the ElementBufferObject.
Definition PrimitiveSet:351
virtual DrawElements * getDrawElements()
Definition PrimitiveSet:347
virtual void setElement(unsigned int, unsigned int)=0
osg::ElementBufferObject * getElementBufferObject()
Get the ElementBufferObject.
Definition PrimitiveSet:354
const osg::ElementBufferObject * getElementBufferObject() const
Get the const ElementBufferObject.
Definition PrimitiveSet:357
virtual unsigned int getElement(unsigned int)=0
virtual void addElement(unsigned int)=0
virtual void reserveElements(unsigned int numIndices)=0
virtual GLenum getDataType()=0
virtual bool isSameKindAs(const Object *obj) const
Definition PrimitiveSet:404
virtual unsigned int getElement(unsigned int i)
Definition PrimitiveSet:425
virtual void accept(PrimitiveIndexFunctor &functor) const
virtual const char * className() const
return the name of the object's class type.
Definition PrimitiveSet:406
VectorGLubyte vector_type
Definition PrimitiveSet:375
virtual void setElement(unsigned int i, unsigned int v)
Definition PrimitiveSet:424
virtual unsigned int getTotalDataSize() const
Definition PrimitiveSet:409
virtual GLenum getDataType()
Definition PrimitiveSet:421
virtual Object * cloneType() const
Clone the type of an object, with Object* return type.
Definition PrimitiveSet:402
virtual void reserveElements(unsigned int numIndices)
Definition PrimitiveSet:423
virtual bool supportsBufferObject() const
Definition PrimitiveSet:410
DrawElementsUByte(const DrawElementsUByte &array, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSet:380
virtual void addElement(unsigned int v)
Definition PrimitiveSet:426
virtual void resizeElements(unsigned int numIndices)
Definition PrimitiveSet:422
virtual unsigned int index(unsigned int pos) const
Definition PrimitiveSet:418
DrawElementsUByte(GLenum mode=0)
Definition PrimitiveSet:377
virtual void draw(State &state, bool useVertexBufferObjects) const
virtual const GLvoid * getDataPointer() const
Definition PrimitiveSet:408
virtual void offsetIndices(int offset)
virtual unsigned int getNumIndices() const
Definition PrimitiveSet:417
virtual const char * libraryName() const
return the name of the object's library.
Definition PrimitiveSet:405
DrawElementsUByte(GLenum mode, unsigned int no)
Definition PrimitiveSet:398
virtual ~DrawElementsUByte()
virtual void accept(PrimitiveFunctor &functor) const
virtual Object * clone(const CopyOp &copyop) const
Clone an object, with Object* return type.
Definition PrimitiveSet:403
DrawElementsUByte(GLenum mode, unsigned int no, const GLubyte *ptr, int numInstances=0)
Definition PrimitiveSet:390
virtual GLenum getDataType()
Definition PrimitiveSet:489
virtual void reserveElements(unsigned int numIndices)
Definition PrimitiveSet:491
virtual unsigned int getNumIndices() const
Definition PrimitiveSet:485
DrawElementsUShort(GLenum mode, InputIterator first, InputIterator last)
Definition PrimitiveSet:466
virtual void setElement(unsigned int i, unsigned int v)
Definition PrimitiveSet:492
VectorGLushort vector_type
Definition PrimitiveSet:438
virtual void resizeElements(unsigned int numIndices)
Definition PrimitiveSet:490
virtual void accept(PrimitiveFunctor &functor) const
virtual const char * className() const
return the name of the object's class type.
Definition PrimitiveSet:474
virtual void offsetIndices(int offset)
virtual unsigned int getElement(unsigned int i)
Definition PrimitiveSet:493
DrawElementsUShort(GLenum mode, unsigned int no)
Definition PrimitiveSet:461
virtual const char * libraryName() const
return the name of the object's library.
Definition PrimitiveSet:473
virtual bool supportsBufferObject() const
Definition PrimitiveSet:478
DrawElementsUShort(GLenum mode=0)
Definition PrimitiveSet:440
virtual void addElement(unsigned int v)
Definition PrimitiveSet:494
virtual const GLvoid * getDataPointer() const
Definition PrimitiveSet:476
DrawElementsUShort(const DrawElementsUShort &array, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSet:443
virtual void accept(PrimitiveIndexFunctor &functor) const
virtual Object * clone(const CopyOp &copyop) const
Clone an object, with Object* return type.
Definition PrimitiveSet:471
virtual bool isSameKindAs(const Object *obj) const
Definition PrimitiveSet:472
virtual Object * cloneType() const
Clone the type of an object, with Object* return type.
Definition PrimitiveSet:470
virtual void draw(State &state, bool useVertexBufferObjects) const
virtual unsigned int getTotalDataSize() const
Definition PrimitiveSet:477
virtual unsigned int index(unsigned int pos) const
Definition PrimitiveSet:486
DrawElementsUShort(GLenum mode, unsigned int no, const GLushort *ptr, int numInstances=0)
Definition PrimitiveSet:453
DrawElementsUInt(const DrawElementsUInt &array, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSet:510
virtual Object * clone(const CopyOp &copyop) const
Clone an object, with Object* return type.
Definition PrimitiveSet:538
virtual void setElement(unsigned int i, unsigned int v)
Definition PrimitiveSet:559
VectorGLuint vector_type
Definition PrimitiveSet:505
virtual void reserveElements(unsigned int numIndices)
Definition PrimitiveSet:558
virtual void draw(State &state, bool useVertexBufferObjects) const
virtual void accept(PrimitiveFunctor &functor) const
virtual void offsetIndices(int offset)
virtual unsigned int getNumIndices() const
Definition PrimitiveSet:552
virtual unsigned int getTotalDataSize() const
Definition PrimitiveSet:544
virtual bool supportsBufferObject() const
Definition PrimitiveSet:545
virtual void resizeElements(unsigned int numIndices)
Definition PrimitiveSet:557
virtual const GLvoid * getDataPointer() const
Definition PrimitiveSet:543
virtual Object * cloneType() const
Clone the type of an object, with Object* return type.
Definition PrimitiveSet:537
DrawElementsUInt(GLenum mode, InputIterator first, InputIterator last)
Definition PrimitiveSet:533
DrawElementsUInt(GLenum mode, unsigned int no)
Definition PrimitiveSet:528
virtual void accept(PrimitiveIndexFunctor &functor) const
virtual bool isSameKindAs(const Object *obj) const
Definition PrimitiveSet:539
DrawElementsUInt(GLenum mode=0)
Definition PrimitiveSet:507
DrawElementsUInt(GLenum mode, unsigned int no, const GLuint *ptr, int numInstances=0)
Definition PrimitiveSet:520
virtual ~DrawElementsUInt()
virtual void addElement(unsigned int v)
Definition PrimitiveSet:561
virtual const char * className() const
return the name of the object's class type.
Definition PrimitiveSet:541
virtual const char * libraryName() const
return the name of the object's library.
Definition PrimitiveSet:540
virtual unsigned int index(unsigned int pos) const
Definition PrimitiveSet:553
virtual GLenum getDataType()
Definition PrimitiveSet:556
virtual unsigned int getElement(unsigned int i)
Definition PrimitiveSet:560
virtual const char * libraryName() const
return the name of the object's library.
Definition PrimitiveSet:584
virtual const char * className() const
return the name of the object's class type.
Definition PrimitiveSet:585
std::vector< GLsizei > Counts
Definition PrimitiveSet:604
void setFirsts(const Firsts &firsts)
Definition PrimitiveSet:600
std::vector< GLint > Firsts
Definition PrimitiveSet:599
virtual unsigned int index(unsigned int pos) const
MultiDrawArrays(const MultiDrawArrays &dal, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSet:576
Firsts & getFirsts()
Definition PrimitiveSet:601
virtual void accept(PrimitiveIndexFunctor &functor) const
virtual osg::Object * clone(const osg::CopyOp &copyop) const
Clone an object, with Object* return type.
Definition PrimitiveSet:582
MultiDrawArrays(GLenum mode=0)
Definition PrimitiveSet:573
void setCounts(const Counts &firsts)
Definition PrimitiveSet:605
virtual unsigned int getNumIndices() const
virtual void accept(PrimitiveFunctor &functor) const
const Firsts & getFirsts() const
Definition PrimitiveSet:602
Counts _counts
Definition PrimitiveSet:614
const Counts & getCounts() const
Definition PrimitiveSet:607
Counts & getCounts()
Definition PrimitiveSet:606
virtual void draw(osg::State &state, bool useVertexBufferObjects) const
virtual osg::Object * cloneType() const
Clone the type of an object, with Object* return type.
Definition PrimitiveSet:581
Firsts _firsts
Definition PrimitiveSet:613
virtual bool isSameKindAs(const osg::Object *obj) const
Definition PrimitiveSet:583
virtual void offsetIndices(int offset)
void add(GLint first, GLsizei count)
virtual unsigned int getNumPrimitives() const
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
General purpose double pair, uses include representation of texture coordinates.
Definition Vec2d:29
General purpose double triple for use as vertices, vectors and normals.
Definition Vec3d:30
General purpose double quad.
Definition Vec4d:29
#define NULL
Definition Export:55
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.