OpenSceneGraph 3.6.5
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
117
120
121 inline const BoundingSphere& getBound() const
122 {
124 return _boundingSphere;
125 }
126
130 inline const BoundingBox& getBoundingBox() const
131 {
133 {
135
136 if (_computeBoundingBoxCallback.valid())
137 _boundingBox.expandBy(_computeBoundingBoxCallback->computeBound(*this));
138 else
140
141 if(_boundingBox.valid()){
142 _boundingSphere.set(_boundingBox.center(), _boundingBox.radius());
143 } else {
144 _boundingSphere.init();
145 }
146
148 }
149
150 return _boundingBox;
151 }
152
153
156
159
172
175
178
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
230
231
233 void setUseVertexArrayObject(bool flag);
234
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
306
309
312
313
316 {
317 if (_createVertexArrayStateCallback.valid()) return _createVertexArrayStateCallback->createVertexArrayStateImplementation(renderInfo, this);
318 else return createVertexArrayStateImplementation(renderInfo);
319 }
320
323
325
327
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
368
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
394
397
398
399
400 typedef unsigned int AttributeType;
401
403 {
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
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
TemplateIndexArray< GLuint, Array::UIntArrayType, 1, GL_UNSIGNED_INT > UIntArray
Definition Array:419
TemplateArray< Vec2, Array::Vec2ArrayType, 2, GL_FLOAT > Vec2Array
Definition Array:448
TemplateArray< Vec4, Array::Vec4ArrayType, 4, GL_FLOAT > Vec4Array
Definition Array:450
std::vector< Matrix > MatrixList
A vector of NodePath, typically used to describe all the paths from a node to the potential root node...
Definition Node:53
TemplateIndexArray< GLshort, Array::ShortArrayType, 1, GL_SHORT > ShortArray
Definition Array:414
Vec2f Vec2
Definition Vec2:21
TemplateArray< Vec3d, Array::Vec3dArrayType, 3, GL_DOUBLE > Vec3dArray
Definition Array:453
TemplateArray< Vec3, Array::Vec3ArrayType, 3, GL_FLOAT > Vec3Array
Definition Array:449
Vec3f Vec3
Definition Vec3:21
TemplateArray< GLfloat, Array::FloatArrayType, 1, GL_FLOAT > FloatArray
Definition Array:421
BoundingBoxd BoundingBox
Definition BoundingBox:257
TemplateIndexArray< GLushort, Array::UShortArrayType, 1, GL_UNSIGNED_SHORT > UShortArray
Definition Array:418
TemplateArray< GLdouble, Array::DoubleArrayType, 1, GL_DOUBLE > DoubleArray
Definition Array:422
TemplateArray< Vec4d, Array::Vec4dArrayType, 4, GL_DOUBLE > Vec4dArray
Definition Array:454
BoundingSphered BoundingSphere
Definition BoundingSphere:308
TemplateIndexArray< GLbyte, Array::ByteArrayType, 1, GL_BYTE > ByteArray
Definition Array:413
Vec4f Vec4
Definition Vec4:21
T minimum(T lhs, T rhs)
return the minimum of two values, equivalent to std::min.
Definition Math:78
TemplateArray< Vec2d, Array::Vec2dArrayType, 2, GL_DOUBLE > Vec2dArray
Definition Array:452
TemplateIndexArray< GLubyte, Array::UByteArrayType, 1, GL_UNSIGNED_BYTE > UByteArray
Definition Array:417
TemplateArray< Vec4ub, Array::Vec4ubArrayType, 4, GL_UNSIGNED_BYTE > Vec4ubArray
Definition Array:438
TemplateIndexArray< GLint, Array::IntArrayType, 1, GL_INT > IntArray
Definition Array:415
Definition Array:61
virtual void accept(ArrayVisitor &)=0
ArrayVisitor()
Definition Array:467
ConstArrayVisitor()
Definition Array:526
Implements a simple buffered value for values that need to be buffered on a per graphics context basi...
Definition buffered_value:27
Definition Callback:298
Definition Callback:320
Definition Callback:341
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
Pure virtual base class for drawable geometry.
Definition Drawable:89
friend class StateSet
Definition Drawable:525
virtual void accept(PrimitiveFunctor &) const
Accept a PrimitiveFunctor and call its methods to tell it about the internal primitives that this Dra...
Definition Drawable:503
virtual bool supports(const PrimitiveIndexFunctor &) const
Return true if the Drawable subclass supports accept(PrimitiveIndexFunctor&).
Definition Drawable:506
void setComputeBoundingBoxCallback(ComputeBoundingBoxCallback *callback)
Set the compute bound callback to override the default computeBound.
Definition Drawable:174
virtual bool supports(const AttributeFunctor &) const
Return true if the Drawable subclass supports accept(AttributeFunctor&).
Definition Drawable:452
void setShape(const ref_ptr< T > &shape)
Definition Drawable:190
ref_ptr< Shape > _shape
Definition Drawable:531
const BoundingBox & getInitialBound() const
Set the initial bounding volume to use when computing the overall bounding volume.
Definition Drawable:119
virtual void compileGLObjects(RenderInfo &renderInfo) const
Immediately compile this Drawable into an OpenGL Display List/VertexBufferObjects.
virtual bool supports(const PrimitiveFunctor &) const
Return true if the Drawable subclass supports accept(PrimitiveFunctor&).
Definition Drawable:497
static GLuint generateDisplayList(unsigned int contextID, unsigned int sizeHint=0)
Return a OpenGL display list handle a newly generated or reused from display list cache.
Drawable(const Drawable &drawable, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
virtual void accept(AttributeFunctor &)
accept an AttributeFunctor and call its methods to tell it about the internal attributes that this Dr...
Definition Drawable:457
virtual void dirtyGLObjects()
Force a recompile on next draw() of any OpenGL objects associated with this geoset.
virtual void releaseGLObjects(State *state=0) const
If State is non-zero, this function releases OpenGL objects for the specified graphics context.
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Resize any per context GLObject buffers to specified size.
virtual bool supports(const ConstAttributeFunctor &) const
Return true if the Drawable subclass supports accept(ConstAttributeFunctor&).
Definition Drawable:487
virtual ~Drawable()
virtual void setShape(Shape *shape)
Set the Shape of the Drawable.
Definition Drawable:188
bool getSupportsDisplayList() const
Get whether display lists are supported for this drawable instance.
Definition Drawable:210
DrawCallback * getDrawCallback()
Get the non const DrawCallback.
Definition Drawable:370
const VertexArrayStateList & getVertexArrayStateList() const
Definition Drawable:328
const Shape * getShape() const
Get the const Shape of the const Drawable.
Definition Drawable:196
CreateVertexArrayStateCallback * getCreateVertexArrayStateCallback()
Get the callback that overrides the default Drawable::createCreateVertexArrayStateImplementation().
Definition Drawable:308
void setBound(const BoundingBox &bb) const
set the bounding box .
bool _useVertexArrayObject
Definition Drawable:537
static void deleteDisplayList(unsigned int contextID, GLuint globj, unsigned int sizeHint=0)
Use deleteDisplayList instead of glDeleteList to allow OpenGL display list to be cached until they ca...
void drawInner(RenderInfo &renderInfo) const
Definition Drawable:271
const ComputeBoundingBoxCallback * getComputeBoundingBoxCallback() const
Get the const compute bound callback.
Definition Drawable:180
virtual unsigned int getGLObjectSizeHint() const
Return the estimated size of GLObjects (display lists/vertex buffer objects) that are associated with...
Definition Drawable:252
ref_ptr< DrawCallback > _drawCallback
Definition Drawable:544
void setUseVertexArrayObject(bool flag)
Set whether to use a local VertexArrayObject for this Drawable.
VertexArrayStateList _vertexArrayStateList
Definition Drawable:542
const CreateVertexArrayStateCallback * getCreateVertexArrayStateCallback() const
Get the const callback that overrides the default Drawable::createCreateVertexArrayStateImplementatio...
Definition Drawable:311
DrawableCullCallback CullCallback
Definition Drawable:346
BoundingBox _boundingBox
Definition Drawable:529
VertexArrayState * createVertexArrayState(RenderInfo &renderInfo) const
Create the VertexArrayState object used to track vertex array and vertex array object state.
Definition Drawable:315
ref_ptr< CreateVertexArrayStateCallback > _createVertexArrayStateCallback
Definition Drawable:545
META_Node(osg, Drawable)
GLuint & getDisplayList(unsigned int contextID) const
Return OpenGL display list for specified contextID.
Definition Drawable:222
friend class Node
Definition Drawable:523
bool getUseDisplayList() const
Return whether OpenGL display lists are being used for rendering.
Definition Drawable:219
void setUseDisplayList(bool flag)
When set to true, force the draw method to use OpenGL Display List for rendering.
DrawableEventCallback EventCallback
Definition Drawable:345
virtual BoundingBox computeBoundingBox() const
Compute the bounding box around Drawables's geometry.
BoundingBox _initialBoundingBox
Definition Drawable:527
void setInitialBound(const osg::BoundingBox &bbox)
Set the initial bounding volume to use when computing the overall bounding volume.
Definition Drawable:116
bool getUseVertexArrayObject() const
Return whether to use a local VertexArrayObject for this Drawable.
Definition Drawable:236
virtual void setThreadSafeRefUnref(bool threadSafe)
Set whether to use a mutex to ensure ref() and unref() are thread safe.
const BoundingBox & getBoundingBox() const
Get BoundingBox of Drawable.
Definition Drawable:130
static unsigned int getMinimumNumberOfDisplayListsToRetainInCache()
Get the minimum number of display lists to retain in the deleted display list cache.
GLObjectList _globjList
Definition Drawable:540
friend class Geode
Definition Drawable:524
void draw(RenderInfo &renderInfo) const
Draw OpenGL primitives.
Definition Drawable:549
virtual void setUseVertexBufferObjects(bool flag)
When set to true, ignore the setUseDisplayList() settings, and hints to the drawImplementation method...
virtual void accept(ConstAttributeFunctor &) const
Accept an AttributeFunctor and call its methods to tell it about the internal attributes that this Dr...
Definition Drawable:492
ComputeBoundingBoxCallback * getComputeBoundingBoxCallback()
Get the compute bound callback.
Definition Drawable:177
void setVertexArrayStateList(VertexArrayStateList &vasl)
Definition Drawable:324
bool _supportsDisplayList
Definition Drawable:533
virtual const Drawable * asDrawable() const
convert 'const this' into a const Drawable pointer if Object is a Drawable, otherwise return 0.
Definition Drawable:105
const BoundingSphere & getBound() const
Definition Drawable:121
bool _useDisplayList
Definition Drawable:534
virtual void setDrawCallback(DrawCallback *dc)
Set the DrawCallback which allows users to attach customize the drawing of existing Drawable object.
Definition Drawable:367
VertexArrayStateList & getVertexArrayStateList()
Definition Drawable:326
virtual BoundingSphere computeBound() const
Compute the bounding sphere around Drawables's geometry.
virtual void drawImplementation(RenderInfo &) const
drawImplementation(RenderInfo&) is a pure virtual method for the actual implementation of OpenGL draw...
Definition Drawable:380
AttributeTypes
Definition Drawable:403
@ WEIGHTS
Definition Drawable:405
@ NORMALS
Definition Drawable:406
@ TEXTURE_COORDS_3
Definition Drawable:416
@ COLORS
Definition Drawable:407
@ TEXTURE_COORDS_2
Definition Drawable:415
@ TEXTURE_COORDS
Definition Drawable:412
@ TEXTURE_COORDS_1
Definition Drawable:414
@ TEXTURE_COORDS_5
Definition Drawable:418
@ TEXTURE_COORDS_4
Definition Drawable:417
@ TEXTURE_COORDS_0
Definition Drawable:413
@ ATTRIBUTE_7
Definition Drawable:411
@ FOG_COORDS
Definition Drawable:409
@ SECONDARY_COLORS
Definition Drawable:408
@ ATTRIBUTE_6
Definition Drawable:410
@ TEXTURE_COORDS_6
Definition Drawable:419
@ TEXTURE_COORDS_7
Definition Drawable:420
@ VERTICES
Definition Drawable:404
unsigned int AttributeType
Definition Drawable:400
void setCreateVertexArrayStateCallback(CreateVertexArrayStateCallback *cb)
Set the callback to override the default Drawable::createCreateVertexArrayStateImplementation().
Definition Drawable:305
bool _useVertexBufferObjects
Definition Drawable:536
const DrawCallback * getDrawCallback() const
Get the const DrawCallback.
Definition Drawable:373
void setSupportsDisplayList(bool flag)
Set the drawable so that it can or cannot be used in conjunction with OpenGL display lists.
MatrixList getWorldMatrices(const osg::Node *haltTraversalAtNode=0) const
Get the list of matrices that transform this node from local coordinates to world coordinates.
DrawableUpdateCallback UpdateCallback
Definition Drawable:344
static void setMinimumNumberOfDisplayListsToRetainInCache(unsigned int minimum)
Set the minimum number of display lists to retain in the deleted display list cache.
ref_ptr< ComputeBoundingBoxCallback > _computeBoundingBoxCallback
Definition Drawable:528
bool getUseVertexBufferObjects() const
Return whether OpenGL vertex buffer objects should be used when supported by OpenGL driver.
Definition Drawable:229
bool _supportsVertexBufferObjects
Definition Drawable:535
virtual void accept(PrimitiveIndexFunctor &) const
Accept a PrimitiveIndexFunctor and call its methods to tell it about the internal primitives that thi...
Definition Drawable:512
virtual Drawable * asDrawable()
Convert 'this' into a Drawable pointer if Object is a Drawable, otherwise return 0.
Definition Drawable:101
virtual VertexArrayState * createVertexArrayStateImplementation(RenderInfo &renderInfo) const
Implementation of Create the VertexArrayState object.
virtual void computeDataVariance()
Compute the DataVariance based on an assessment of callback etc.
Shape * getShape()
Get the Shape of the Drawable.
Definition Drawable:193
osg::buffered_value< GLuint > GLObjectList
Definition Drawable:539
Callback to allow users to override the default computation of bounding volume.
Definition Drawable:162
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)
Callback class for overriding the default Drawable::createCreateVertexArrayStateImplementation().
Definition Drawable:288
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
do customized createVertexArrayState .
Definition Drawable:297
Callback attached to an Drawable which allows the users to customize the drawing of an exist Drawable...
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
do customized draw code.
Definition Drawable:363
DrawCallback()
Definition Drawable:355
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
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
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
size_type size() const
Definition MixinVector:92
const_reference front() const
Definition MixinVector:138
bool empty() const
Definition MixinVector:91
Base class for all internal nodes in the scene graph.
Definition Node:72
void dirtyBound()
Mark this node's bounding sphere dirty.
bool _boundingSphereComputed
Definition Node:497
BoundingSphere _boundingSphere
Definition Node:496
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
Object()
Construct an object.
Definition Object:69
@ DYNAMIC
Definition Object:218
DataVariance getDataVariance() const
Get the data variance of this object.
Definition Object:231
A PrimitiveFunctor is used (in conjunction with osg::Drawable::accept (PrimitiveFunctor&)) to get acc...
Definition PrimitiveSet:54
Definition PrimitiveSet:103
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
T * get() const
Definition ref_ptr:117
Definition RenderInfo:28
State * getState()
Definition RenderInfo:58
unsigned int getContextID() const
Definition RenderInfo:55
Base class for all shape types.
Definition Shape:49
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
bool useVertexBufferObject(bool useVBO) const
Definition State:790
VertexArrayState * getCurrentVertexArrayState() const
Get the CurrentVetexArrayState object that take which vertex arrays are bound.
Definition State:547
bool useVertexArrayObject(bool useVAO) const
Definition State:793
void bindVertexArrayObject(const VertexArrayState *vas)
Definition State:633
Proxy helper class for applyig a VertexArrayState in a local scope, with the preivous value being res...
Definition State:537
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
General purpose float quad.
Definition Vec4ub:28
Definition VertexArrayState:25
void setRequiresSetArrays(bool flag)
Definition VertexArrayState:176
Definition VertexArrayState:219
#define OSG_EXPORT
Definition Export:39

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