openscenegraph
Drawable
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_DRAWABLE
15#define OSG_DRAWABLE 1
16
17#include <osg/BoundingBox>
18#include <osg/Shape>
19#include <osg/BufferObject>
20#include <osg/PrimitiveSet>
21#include <osg/RenderInfo>
22#include <osg/Group>
23
24
25#ifndef GL_NV_occlusion_query
26
27 #define GL_OCCLUSION_TEST_HP 0x8165
28 #define GL_OCCLUSION_TEST_RESULT_HP 0x8166
29 #define GL_PIXEL_COUNTER_BITS_NV 0x8864
30 #define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865
31 #define GL_PIXEL_COUNT_NV 0x8866
32 #define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867
33
34#endif
35
36#ifndef GL_ARB_occlusion_query
37
38 #define GL_SAMPLES_PASSED_ARB 0x8914
39 #define GL_QUERY_COUNTER_BITS_ARB 0x8864
40 #define GL_CURRENT_QUERY_ARB 0x8865
41 #define GL_QUERY_RESULT_ARB 0x8866
42 #define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
43
44#endif
45
46
47#ifndef GL_TIME_ELAPSED
48 #define GL_TIME_ELAPSED 0x88BF
49 #define GL_TIMESTAMP 0x8E28
50#endif
51
52#ifndef GL_QUERY_RESULT
53 #define GL_QUERY_RESULT 0x8866
54 #define GL_QUERY_RESULT_AVAILABLE 0x8867
55#endif
56
57
58#define INLINE_DRAWABLE_DRAW
59
60namespace osg {
61
62
63class Vec2f;
64class Vec3f;
65class Vec4f;
66class Vec4ub;
67class Geometry;
68class NodeVisitor;
69class ArrayDispatchers;
70
88class OSG_EXPORT Drawable : public Node
89{
90 public:
91
93
95 Drawable(const Drawable& drawable,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
96
98
101 virtual Drawable* asDrawable() { return this; }
102
105 virtual const Drawable* asDrawable() const { return this; }
106
108 virtual void computeDataVariance();
109
112 MatrixList getWorldMatrices(const osg::Node* haltTraversalAtNode=0) const;
113
114
116 void setInitialBound(const osg::BoundingBox& bbox) { _initialBoundingBox = bbox; dirtyBound(); }
117
119 const BoundingBox& getInitialBound() const { return _initialBoundingBox; }
120
121 inline const BoundingSphere& getBound() const
122 {
123 if(!_boundingSphereComputed) getBoundingBox();
124 return _boundingSphere;
125 }
126
130 inline const BoundingBox& getBoundingBox() const
131 {
132 if(!_boundingSphereComputed)
133 {
134 _boundingBox = _initialBoundingBox;
135
136 if (_computeBoundingBoxCallback.valid())
137 _boundingBox.expandBy(_computeBoundingBoxCallback->computeBound(*this));
138 else
139 _boundingBox.expandBy(computeBoundingBox());
140
141 if(_boundingBox.valid()){
142 _boundingSphere.set(_boundingBox.center(), _boundingBox.radius());
143 } else {
144 _boundingSphere.init();
145 }
146
147 _boundingSphereComputed = true;
148 }
149
150 return _boundingBox;
151 }
152
153
156
159
172
174 void setComputeBoundingBoxCallback(ComputeBoundingBoxCallback* callback) { _computeBoundingBoxCallback = callback; }
175
177 ComputeBoundingBoxCallback* getComputeBoundingBoxCallback() { return _computeBoundingBoxCallback.get(); }
178
180 const ComputeBoundingBoxCallback* getComputeBoundingBoxCallback() const { return _computeBoundingBoxCallback.get(); }
181
182
188 virtual void setShape(Shape* shape) { _shape = shape; }
189
190 template<class T> void setShape(const ref_ptr<T>& shape) { setShape(shape.get()); }
191
193 inline Shape* getShape() { return _shape.get(); }
194
196 inline const Shape* getShape() const { return _shape.get(); }
197
198
199
207 void setSupportsDisplayList(bool flag);
208
210 inline bool getSupportsDisplayList() const { return _supportsDisplayList; }
211
212
216 void setUseDisplayList(bool flag);
217
219 inline bool getUseDisplayList() const { return _useDisplayList; }
220
222 inline GLuint& getDisplayList(unsigned int contextID) const { return _globjList[contextID]; }
223
226 virtual void setUseVertexBufferObjects(bool flag);
227
229 inline bool getUseVertexBufferObjects() const { return _useVertexBufferObjects; }
230
231
233 void setUseVertexArrayObject(bool flag);
234
236 bool getUseVertexArrayObject() const { return _useVertexArrayObject; }
237
238#ifdef OSG_USE_DEPRECATED_API
240 inline void dirtyDisplayList()
241 {
242 dirtyGLObjects();
243 }
244#endif
245
247 virtual void dirtyGLObjects();
248
249
252 virtual unsigned int getGLObjectSizeHint() const { return 0; }
253
254
255
265#ifdef INLINE_DRAWABLE_DRAW
266 inline void draw(RenderInfo& renderInfo) const;
267#else
268 void draw(RenderInfo& renderInfo) const;
269#endif
270
271 inline void drawInner(RenderInfo& renderInfo) const
272 {
273 if (_drawCallback.valid())
274 _drawCallback->drawImplementation(renderInfo,this);
275 else
276 drawImplementation(renderInfo);
277 }
278
279
283 virtual void compileGLObjects(RenderInfo& renderInfo) const;
284
285
302
303
305 void setCreateVertexArrayStateCallback(CreateVertexArrayStateCallback* cb) { _createVertexArrayStateCallback = cb; }
306
308 CreateVertexArrayStateCallback* getCreateVertexArrayStateCallback() { return _createVertexArrayStateCallback.get(); }
309
311 const CreateVertexArrayStateCallback* getCreateVertexArrayStateCallback() const { return _createVertexArrayStateCallback.get(); }
312
313
316 {
317 if (_createVertexArrayStateCallback.valid()) return _createVertexArrayStateCallback->createVertexArrayStateImplementation(renderInfo, this);
318 else return createVertexArrayStateImplementation(renderInfo);
319 }
320
323
324 void setVertexArrayStateList(VertexArrayStateList& vasl) { _vertexArrayStateList = vasl; }
325
326 VertexArrayStateList& getVertexArrayStateList() { return _vertexArrayStateList; }
327
328 const VertexArrayStateList& getVertexArrayStateList() const { return _vertexArrayStateList; }
329
330
331
333 virtual void setThreadSafeRefUnref(bool threadSafe);
334
336 virtual void resizeGLObjectBuffers(unsigned int maxSize);
337
341 virtual void releaseGLObjects(State* state=0) const;
342
343 // for backwards compatibility as local implementations are now found in osg namespace within the include/osg/Callback header
347
353 struct DrawCallback : public virtual osg::Object
354 {
356
357 DrawCallback(const DrawCallback& org,const CopyOp& copyop):
358 Object(org, copyop) {}
359
361
363 virtual void drawImplementation(osg::RenderInfo& /*renderInfo*/,const osg::Drawable* /*drawable*/) const {}
364 };
365
367 virtual void setDrawCallback(DrawCallback* dc) { _drawCallback=dc; dirtyGLObjects(); }
368
370 DrawCallback* getDrawCallback() { return _drawCallback.get(); }
371
373 const DrawCallback* getDrawCallback() const { return _drawCallback.get(); }
374
380 virtual void drawImplementation(RenderInfo& /*renderInfo*/) const {}
381
382
384 static GLuint generateDisplayList(unsigned int contextID, unsigned int sizeHint = 0);
385
390 static void deleteDisplayList(unsigned int contextID,GLuint globj, unsigned int sizeHint = 0);
391
393 static void setMinimumNumberOfDisplayListsToRetainInCache(unsigned int minimum);
394
397
398
399
400 typedef unsigned int AttributeType;
401
403 {
404 VERTICES = 0,
405 WEIGHTS = 1,
406 NORMALS = 2,
407 COLORS = 3,
408 SECONDARY_COLORS = 4,
409 FOG_COORDS = 5,
410 ATTRIBUTE_6 = 6,
411 ATTRIBUTE_7 = 7,
412 TEXTURE_COORDS = 8,
413 TEXTURE_COORDS_0 = TEXTURE_COORDS,
414 TEXTURE_COORDS_1 = TEXTURE_COORDS_0+1,
415 TEXTURE_COORDS_2 = TEXTURE_COORDS_0+2,
416 TEXTURE_COORDS_3 = TEXTURE_COORDS_0+3,
417 TEXTURE_COORDS_4 = TEXTURE_COORDS_0+4,
418 TEXTURE_COORDS_5 = TEXTURE_COORDS_0+5,
419 TEXTURE_COORDS_6 = TEXTURE_COORDS_0+6,
420 TEXTURE_COORDS_7 = TEXTURE_COORDS_0+7
421 // only eight texture coord examples provided here, but underlying code can handle any no of texture units,
422 // simply co them as (TEXTURE_COORDS_0+unit).
423 };
424
426 {
427 public:
428 virtual ~AttributeFunctor() {}
429
430 virtual void apply(AttributeType,unsigned int,GLbyte*) {}
431 virtual void apply(AttributeType,unsigned int,GLshort*) {}
432 virtual void apply(AttributeType,unsigned int,GLint*) {}
433
434 virtual void apply(AttributeType,unsigned int,GLubyte*) {}
435 virtual void apply(AttributeType,unsigned int,GLushort*) {}
436 virtual void apply(AttributeType,unsigned int,GLuint*) {}
437
438 virtual void apply(AttributeType,unsigned int,float*) {}
439 virtual void apply(AttributeType,unsigned int,Vec2*) {}
440 virtual void apply(AttributeType,unsigned int,Vec3*) {}
441 virtual void apply(AttributeType,unsigned int,Vec4*) {}
442 virtual void apply(AttributeType,unsigned int,Vec4ub*) {}
443
444 virtual void apply(AttributeType,unsigned int,double*) {}
445 virtual void apply(AttributeType,unsigned int,Vec2d*) {}
446 virtual void apply(AttributeType,unsigned int,Vec3d*) {}
447 virtual void apply(AttributeType,unsigned int,Vec4d*) {}
448 };
449
450
452 virtual bool supports(const AttributeFunctor&) const { return false; }
453
457 virtual void accept(AttributeFunctor&) {}
458
459
461 {
462 public:
463
465
466 virtual void apply(AttributeType,unsigned int,const GLbyte*) {}
467 virtual void apply(AttributeType,unsigned int,const GLshort*) {}
468 virtual void apply(AttributeType,unsigned int,const GLint*) {}
469
470 virtual void apply(AttributeType,unsigned int,const GLubyte*) {}
471 virtual void apply(AttributeType,unsigned int,const GLushort*) {}
472 virtual void apply(AttributeType,unsigned int,const GLuint*) {}
473
474 virtual void apply(AttributeType,unsigned int,const float*) {}
475 virtual void apply(AttributeType,unsigned int,const Vec2*) {}
476 virtual void apply(AttributeType,unsigned int,const Vec3*) {}
477 virtual void apply(AttributeType,unsigned int,const Vec4*) {}
478 virtual void apply(AttributeType,unsigned int,const Vec4ub*) {}
479
480 virtual void apply(AttributeType,unsigned int,const double*) {}
481 virtual void apply(AttributeType,unsigned int,const Vec2d*) {}
482 virtual void apply(AttributeType,unsigned int,const Vec3d*) {}
483 virtual void apply(AttributeType,unsigned int,const Vec4d*) {}
484 };
485
487 virtual bool supports(const ConstAttributeFunctor&) const { return false; }
488
492 virtual void accept(ConstAttributeFunctor&) const {}
493
494
495
497 virtual bool supports(const PrimitiveFunctor&) const { return false; }
498
503 virtual void accept(PrimitiveFunctor&) const {}
504
506 virtual bool supports(const PrimitiveIndexFunctor&) const { return false; }
507
512 virtual void accept(PrimitiveIndexFunctor&) const {}
513
514 protected:
515
516 Drawable& operator = (const Drawable&) { return *this;}
517
518 virtual ~Drawable();
519
521 void setBound(const BoundingBox& bb) const;
522
523 friend class Node;
524 friend class Geode;
525 friend class StateSet;
526
530
532
538
541
543
546};
547
548#ifdef INLINE_DRAWABLE_DRAW
549inline void Drawable::draw(RenderInfo& renderInfo) const
550{
551 State& state = *renderInfo.getState();
552 bool useVertexArrayObject = state.useVertexArrayObject(_useVertexArrayObject);
553 if (useVertexArrayObject)
554 {
555 unsigned int contextID = renderInfo.getContextID();
556
557 VertexArrayState* vas = _vertexArrayStateList[contextID].get();
558 if (!vas)
559 {
560 _vertexArrayStateList[contextID] = vas = createVertexArrayState(renderInfo);
561 }
562 else
563 {
564 // vas->setRequiresSetArrays(getDataVariance()==osg::Object::DYNAMIC);
565 }
566
567 State::SetCurrentVertexArrayStateProxy setVASProxy(state, vas);
568
569 state.bindVertexArrayObject(vas);
570
571 drawInner(renderInfo);
572
574
575 return;
576 }
577
578 // TODO, add check against whether VAO is active and supported
579 if (state.getCurrentVertexArrayState())
580 {
581 //OSG_NOTICE<<"state.getCurrentVertexArrayState()->getVertexArrayObject()="<< state.getCurrentVertexArrayState()->getVertexArrayObject()<<std::endl;
583 }
584
585
586#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
588 {
589 // get the contextID (user defined ID of 0 upwards) for the
590 // current OpenGL context.
591 unsigned int contextID = renderInfo.getContextID();
592
593 // get the globj for the current contextID.
594 GLuint& globj = _globjList[contextID];
595
596 if( globj == 0 )
597 {
598 // compile the display list
599 globj = generateDisplayList(contextID, getGLObjectSizeHint());
600 glNewList( globj, GL_COMPILE );
601
602 drawInner(renderInfo);
603
604 glEndList();
605 }
606
607 // call the display list
608 glCallList( globj);
609 }
610 else
611#endif
612 {
613 // if state.previousVertexArrayState() is different than currentVertexArrayState bind current
614
615 // OSG_NOTICE<<"Fallback drawInner()........................"<<std::endl;
616
617 drawInner(renderInfo);
618 }
619}
620#endif
621
623{
624 public:
625
629
631
632 virtual void apply(ByteArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
633 virtual void apply(ShortArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
634 virtual void apply(IntArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
635 virtual void apply(UByteArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
636 virtual void apply(UShortArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
637 virtual void apply(UIntArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
638 virtual void apply(Vec4ubArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
639 virtual void apply(FloatArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
640 virtual void apply(Vec2Array& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
641 virtual void apply(Vec3Array& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
642 virtual void apply(Vec4Array& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
643 virtual void apply(DoubleArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
644 virtual void apply(Vec2dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
645 virtual void apply(Vec3dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
646 virtual void apply(Vec4dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
647
648
649 inline void applyArray(Drawable::AttributeType type,Array* array)
650 {
651 if (array)
652 {
653 _type = type;
654 array->accept(*this);
655 }
656 }
657
658 protected:
659
663};
664
666{
667 public:
668
672
674
675 virtual void apply(const ByteArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
676 virtual void apply(const ShortArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
677 virtual void apply(const IntArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
678 virtual void apply(const UByteArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
679 virtual void apply(const UShortArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
680 virtual void apply(const UIntArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
681 virtual void apply(const Vec4ubArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
682 virtual void apply(const FloatArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
683 virtual void apply(const Vec2Array& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
684 virtual void apply(const Vec3Array& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
685 virtual void apply(const Vec4Array& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
686 virtual void apply(const DoubleArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
687 virtual void apply(const Vec2dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
688 virtual void apply(const Vec3dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
689 virtual void apply(const Vec4dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
690
691
692 inline void applyArray(Drawable::AttributeType type,const Array* array)
693 {
694 if (array)
695 {
696 _type = type;
697 array->accept(*this);
698 }
699 }
700
701protected:
702
704
707};
708
709}
710
711#endif
Definition Array:465
Definition Array:61
virtual void accept(ArrayVisitor &)=0
Definition Drawable:623
void applyArray(Drawable::AttributeType type, Array *array)
Definition Drawable:649
virtual void apply(Vec3dArray &array)
Definition Drawable:645
Drawable::AttributeFunctor & _af
Definition Drawable:661
AttributeFunctorArrayVisitor(Drawable::AttributeFunctor &af)
Definition Drawable:626
virtual void apply(Vec4dArray &array)
Definition Drawable:646
virtual void apply(UByteArray &array)
Definition Drawable:635
virtual ~AttributeFunctorArrayVisitor()
Definition Drawable:630
virtual void apply(ByteArray &array)
Definition Drawable:632
virtual void apply(UIntArray &array)
Definition Drawable:637
AttributeFunctorArrayVisitor & operator=(const AttributeFunctorArrayVisitor &)
Definition Drawable:660
virtual void apply(ShortArray &array)
Definition Drawable:633
virtual void apply(IntArray &array)
Definition Drawable:634
virtual void apply(Vec2dArray &array)
Definition Drawable:644
Drawable::AttributeType _type
Definition Drawable:662
virtual void apply(DoubleArray &array)
Definition Drawable:643
virtual void apply(FloatArray &array)
Definition Drawable:639
virtual void apply(Vec4Array &array)
Definition Drawable:642
virtual void apply(Vec3Array &array)
Definition Drawable:641
virtual void apply(Vec2Array &array)
Definition Drawable:640
virtual void apply(Vec4ubArray &array)
Definition Drawable:638
virtual void apply(UShortArray &array)
Definition Drawable:636
Definition BoundingBox:34
void expandBy(const vec_type &v)
Definition BoundingBox:156
Definition BoundingSphere:35
Definition Array:524
Drawable::ConstAttributeFunctor & _af
Definition Drawable:705
virtual void apply(const Vec2dArray &array)
Definition Drawable:687
ConstAttributeFunctorArrayVisitor(Drawable::ConstAttributeFunctor &af)
Definition Drawable:669
virtual void apply(const FloatArray &array)
Definition Drawable:682
virtual void apply(const Vec3dArray &array)
Definition Drawable:688
virtual void apply(const UByteArray &array)
Definition Drawable:678
virtual void apply(const Vec4dArray &array)
Definition Drawable:689
virtual void apply(const Vec2Array &array)
Definition Drawable:683
void applyArray(Drawable::AttributeType type, const Array *array)
Definition Drawable:692
virtual ~ConstAttributeFunctorArrayVisitor()
Definition Drawable:673
virtual void apply(const UIntArray &array)
Definition Drawable:680
virtual void apply(const IntArray &array)
Definition Drawable:677
virtual void apply(const DoubleArray &array)
Definition Drawable:686
virtual void apply(const UShortArray &array)
Definition Drawable:679
ConstAttributeFunctorArrayVisitor & operator=(const ConstAttributeFunctorArrayVisitor &)
Definition Drawable:703
virtual void apply(const ShortArray &array)
Definition Drawable:676
Drawable::AttributeType _type
Definition Drawable:706
virtual void apply(const Vec4ubArray &array)
Definition Drawable:681
virtual void apply(const ByteArray &array)
Definition Drawable:675
virtual void apply(const Vec3Array &array)
Definition Drawable:684
virtual void apply(const Vec4Array &array)
Definition Drawable:685
Definition CopyOp:41
Definition Callback:341
Definition Callback:320
Definition Callback:298
Definition Drawable:426
virtual void apply(AttributeType, unsigned int, Vec4 *)
Definition Drawable:441
virtual void apply(AttributeType, unsigned int, GLbyte *)
Definition Drawable:430
virtual void apply(AttributeType, unsigned int, float *)
Definition Drawable:438
virtual void apply(AttributeType, unsigned int, GLushort *)
Definition Drawable:435
virtual void apply(AttributeType, unsigned int, GLint *)
Definition Drawable:432
virtual void apply(AttributeType, unsigned int, GLuint *)
Definition Drawable:436
virtual void apply(AttributeType, unsigned int, Vec3d *)
Definition Drawable:446
virtual void apply(AttributeType, unsigned int, double *)
Definition Drawable:444
virtual void apply(AttributeType, unsigned int, Vec4ub *)
Definition Drawable:442
virtual void apply(AttributeType, unsigned int, GLshort *)
Definition Drawable:431
virtual ~AttributeFunctor()
Definition Drawable:428
virtual void apply(AttributeType, unsigned int, Vec2 *)
Definition Drawable:439
virtual void apply(AttributeType, unsigned int, Vec2d *)
Definition Drawable:445
virtual void apply(AttributeType, unsigned int, Vec3 *)
Definition Drawable:440
virtual void apply(AttributeType, unsigned int, GLubyte *)
Definition Drawable:434
virtual void apply(AttributeType, unsigned int, Vec4d *)
Definition Drawable:447
virtual void apply(AttributeType, unsigned int, const Vec4d *)
Definition Drawable:483
virtual void apply(AttributeType, unsigned int, const GLushort *)
Definition Drawable:471
virtual ~ConstAttributeFunctor()
Definition Drawable:464
virtual void apply(AttributeType, unsigned int, const Vec4ub *)
Definition Drawable:478
virtual void apply(AttributeType, unsigned int, const GLshort *)
Definition Drawable:467
virtual void apply(AttributeType, unsigned int, const Vec2 *)
Definition Drawable:475
virtual void apply(AttributeType, unsigned int, const Vec3d *)
Definition Drawable:482
virtual void apply(AttributeType, unsigned int, const float *)
Definition Drawable:474
virtual void apply(AttributeType, unsigned int, const Vec3 *)
Definition Drawable:476
virtual void apply(AttributeType, unsigned int, const GLbyte *)
Definition Drawable:466
virtual void apply(AttributeType, unsigned int, const double *)
Definition Drawable:480
virtual void apply(AttributeType, unsigned int, const GLint *)
Definition Drawable:468
virtual void apply(AttributeType, unsigned int, const GLubyte *)
Definition Drawable:470
virtual void apply(AttributeType, unsigned int, const Vec4 *)
Definition Drawable:477
virtual void apply(AttributeType, unsigned int, const Vec2d *)
Definition Drawable:481
virtual void apply(AttributeType, unsigned int, const GLuint *)
Definition Drawable:472
Definition Drawable:89
virtual void accept(PrimitiveFunctor &) const
Definition Drawable:503
virtual bool supports(const PrimitiveIndexFunctor &) const
Definition Drawable:506
void setComputeBoundingBoxCallback(ComputeBoundingBoxCallback *callback)
Definition Drawable:174
virtual bool supports(const AttributeFunctor &) const
Definition Drawable:452
void setShape(const ref_ptr< T > &shape)
Definition Drawable:190
ref_ptr< Shape > _shape
Definition Drawable:531
const BoundingBox & getInitialBound() const
Definition Drawable:119
virtual void compileGLObjects(RenderInfo &renderInfo) const
virtual bool supports(const PrimitiveFunctor &) const
Definition Drawable:497
static GLuint generateDisplayList(unsigned int contextID, unsigned int sizeHint=0)
Drawable(const Drawable &drawable, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
virtual void accept(AttributeFunctor &)
Definition Drawable:457
virtual void dirtyGLObjects()
virtual void releaseGLObjects(State *state=0) const
virtual void resizeGLObjectBuffers(unsigned int maxSize)
virtual bool supports(const ConstAttributeFunctor &) const
Definition Drawable:487
virtual ~Drawable()
virtual void setShape(Shape *shape)
Definition Drawable:188
bool getSupportsDisplayList() const
Definition Drawable:210
DrawCallback * getDrawCallback()
Definition Drawable:370
const VertexArrayStateList & getVertexArrayStateList() const
Definition Drawable:328
const Shape * getShape() const
Definition Drawable:196
CreateVertexArrayStateCallback * getCreateVertexArrayStateCallback()
Definition Drawable:308
void setBound(const BoundingBox &bb) const
bool _useVertexArrayObject
Definition Drawable:537
static void deleteDisplayList(unsigned int contextID, GLuint globj, unsigned int sizeHint=0)
void drawInner(RenderInfo &renderInfo) const
Definition Drawable:271
const ComputeBoundingBoxCallback * getComputeBoundingBoxCallback() const
Definition Drawable:180
virtual unsigned int getGLObjectSizeHint() const
Definition Drawable:252
ref_ptr< DrawCallback > _drawCallback
Definition Drawable:544
void setUseVertexArrayObject(bool flag)
VertexArrayStateList _vertexArrayStateList
Definition Drawable:542
const CreateVertexArrayStateCallback * getCreateVertexArrayStateCallback() const
Definition Drawable:311
DrawableCullCallback CullCallback
Definition Drawable:346
BoundingBox _boundingBox
Definition Drawable:529
VertexArrayState * createVertexArrayState(RenderInfo &renderInfo) const
Definition Drawable:315
ref_ptr< CreateVertexArrayStateCallback > _createVertexArrayStateCallback
Definition Drawable:545
META_Node(osg, Drawable)
GLuint & getDisplayList(unsigned int contextID) const
Definition Drawable:222
bool getUseDisplayList() const
Definition Drawable:219
void setUseDisplayList(bool flag)
DrawableEventCallback EventCallback
Definition Drawable:345
virtual BoundingBox computeBoundingBox() const
BoundingBox _initialBoundingBox
Definition Drawable:527
void setInitialBound(const osg::BoundingBox &bbox)
Definition Drawable:116
bool getUseVertexArrayObject() const
Definition Drawable:236
virtual void setThreadSafeRefUnref(bool threadSafe)
const BoundingBox & getBoundingBox() const
Definition Drawable:130
static unsigned int getMinimumNumberOfDisplayListsToRetainInCache()
GLObjectList _globjList
Definition Drawable:540
void draw(RenderInfo &renderInfo) const
Definition Drawable:549
virtual void setUseVertexBufferObjects(bool flag)
virtual void accept(ConstAttributeFunctor &) const
Definition Drawable:492
ComputeBoundingBoxCallback * getComputeBoundingBoxCallback()
Definition Drawable:177
void setVertexArrayStateList(VertexArrayStateList &vasl)
Definition Drawable:324
bool _supportsDisplayList
Definition Drawable:533
virtual const Drawable * asDrawable() const
Definition Drawable:105
const BoundingSphere & getBound() const
Definition Drawable:121
bool _useDisplayList
Definition Drawable:534
virtual void setDrawCallback(DrawCallback *dc)
Definition Drawable:367
VertexArrayStateList & getVertexArrayStateList()
Definition Drawable:326
virtual BoundingSphere computeBound() const
virtual void drawImplementation(RenderInfo &) const
Definition Drawable:380
AttributeTypes
Definition Drawable:403
unsigned int AttributeType
Definition Drawable:400
void setCreateVertexArrayStateCallback(CreateVertexArrayStateCallback *cb)
Definition Drawable:305
bool _useVertexBufferObjects
Definition Drawable:536
const DrawCallback * getDrawCallback() const
Definition Drawable:373
void setSupportsDisplayList(bool flag)
MatrixList getWorldMatrices(const osg::Node *haltTraversalAtNode=0) const
DrawableUpdateCallback UpdateCallback
Definition Drawable:344
static void setMinimumNumberOfDisplayListsToRetainInCache(unsigned int minimum)
ref_ptr< ComputeBoundingBoxCallback > _computeBoundingBoxCallback
Definition Drawable:528
bool getUseVertexBufferObjects() const
Definition Drawable:229
bool _supportsVertexBufferObjects
Definition Drawable:535
virtual void accept(PrimitiveIndexFunctor &) const
Definition Drawable:512
virtual Drawable * asDrawable()
Definition Drawable:101
virtual VertexArrayState * createVertexArrayStateImplementation(RenderInfo &renderInfo) const
virtual void computeDataVariance()
Shape * getShape()
Definition Drawable:193
osg::buffered_value< GLuint > GLObjectList
Definition Drawable:539
Definition Geode:29
size_type size() const
Definition MixinVector:92
const_reference front() const
Definition MixinVector:138
bool empty() const
Definition MixinVector:91
Definition Node:72
Definition Object:61
@ DYNAMIC
Definition Object:218
DataVariance getDataVariance() const
Definition Object:231
Definition PrimitiveSet:54
Definition PrimitiveSet:103
Definition RenderInfo:28
State * getState()
Definition RenderInfo:58
unsigned int getContextID() const
Definition RenderInfo:55
Definition Shape:49
Definition StateSet:46
Definition State:80
bool useVertexBufferObject(bool useVBO) const
Definition State:790
VertexArrayState * getCurrentVertexArrayState() const
Definition State:547
bool useVertexArrayObject(bool useVAO) const
Definition State:793
void bindVertexArrayObject(const VertexArrayState *vas)
Definition State:633
A concrete array holding elements of type T.
Definition Array:243
Definition Array:341
Definition Vec2d:29
Definition Vec2f:29
Definition Vec3d:30
Definition Vec3f:29
Definition Vec4d:29
Definition Vec4f:28
Definition Vec4ub:28
Definition VertexArrayState:219
Definition VertexArrayState:25
void setRequiresSetArrays(bool flag)
Definition VertexArrayState:176
Definition buffered_value:27
Definition ref_ptr:32
T * get() const
Definition ref_ptr:117
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
std::vector< Matrix > MatrixList
Definition Node:53
#define OSG_EXPORT
Definition osg/Export:39
ComputeBoundingBoxCallback()
Definition Drawable:163
virtual BoundingBox computeBound(const osg::Drawable &) const
Definition Drawable:170
ComputeBoundingBoxCallback(const ComputeBoundingBoxCallback &org, const CopyOp &copyop)
Definition Drawable:165
META_Object(osg, ComputeBoundingBoxCallback)
CreateVertexArrayStateCallback()
Definition Drawable:289
CreateVertexArrayStateCallback(const CreateVertexArrayStateCallback &rhs, const CopyOp &copyop)
Definition Drawable:291
META_Object(osg, CreateVertexArrayStateCallback)
virtual osg::VertexArrayState * createVertexArrayStateImplementation(osg::RenderInfo &renderInfo, const osg::Drawable *drawable) const
Definition Drawable:297
Definition Drawable:354
META_Object(osg, DrawCallback)
DrawCallback(const DrawCallback &org, const CopyOp &copyop)
Definition Drawable:357
virtual void drawImplementation(osg::RenderInfo &, const osg::Drawable *) const
Definition Drawable:363
DrawCallback()
Definition Drawable:355