OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Drawable.h
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 namespace osg {
59 
60 
61 class Vec2f;
62 class Vec3f;
63 class Vec4f;
64 class Vec4ub;
65 class Geometry;
66 class NodeVisitor;
67 class ArrayDispatchers;
68 
69 // this is defined to alter the way display lists are compiled inside the
70 // the draw method, it has been found that the NVidia drivers fail completely
71 // to optimize COMPILE_AND_EXECUTE in fact make it go slower than for no display
72 // lists, but optimize a separate COMPILE very well?! Define it as default
73 // the use of a separate COMPILE, then glCallList rather than use COMPILE_AND_EXECUTE.
74 
75 #define USE_SEPARATE_COMPILE_AND_EXECUTE
76 
94 class OSG_EXPORT Drawable : public Node
95 {
96  public:
97 
99  static unsigned int s_numberNewDrawablesInLastFrame;
101 
102  Drawable();
103 
105  Drawable(const Drawable& drawable,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
106 
108 
109  virtual Drawable* asDrawable() { return this; }
110  virtual const Drawable* asDrawable() const { return this; }
111 
113  virtual void computeDataVariance();
114 
117  MatrixList getWorldMatrices(const osg::Node* haltTraversalAtNode=0) const;
118 
119 
121  void setInitialBound(const osg::BoundingBox& bbox) { _initialBound = bbox; dirtyBound(); }
122 
124  const BoundingBox& getInitialBound() const { return _initialBound; }
125 
126  inline const BoundingSphere& getBound() const
127  {
128  if(!_boundingSphereComputed) getBoundingBox();
129  return _boundingSphere;
130  }
131 
135  inline const BoundingBox& getBoundingBox() const
136  {
137  if(!_boundingSphereComputed)
138  {
139  _boundingBox = _initialBound;
140 
141  if (_computeBoundCallback.valid())
142  _boundingBox.expandBy(_computeBoundCallback->computeBound(*this));
143  else
144  _boundingBox.expandBy(computeBoundingBox());
145 
146  if(_boundingBox.valid()){
147  _boundingSphere.set(_boundingBox.center(), _boundingBox.radius());
148  } else {
149  _boundingSphere.init();
150  }
151 
152  _boundingSphereComputed = true;
153  }
154 
155  return _boundingBox;
156  }
157 
158 
160  virtual BoundingSphere computeBound() const;
161 
163  virtual BoundingBox computeBoundingBox() const;
164 
167  {
169 
171 
173 
174  virtual BoundingBox computeBound(const osg::Drawable&) const { return BoundingBox(); }
175  };
176 
178  void setComputeBoundingBoxCallback(ComputeBoundingBoxCallback* callback) { _computeBoundCallback = callback; }
179 
181  ComputeBoundingBoxCallback* getComputeBoundingBoxCallback() { return _computeBoundCallback.get(); }
182 
184  const ComputeBoundingBoxCallback* getComputeBoundingBoxCallback() const { return _computeBoundCallback.get(); }
185 
186 
192  inline void setShape(Shape* shape) { _shape = shape; }
193 
195  inline Shape* getShape() { return _shape.get(); }
196 
198  inline const Shape* getShape() const { return _shape.get(); }
199 
200 
201 
209  void setSupportsDisplayList(bool flag);
210 
212  inline bool getSupportsDisplayList() const { return _supportsDisplayList; }
213 
214 
218  void setUseDisplayList(bool flag);
219 
221  inline bool getUseDisplayList() const { return _useDisplayList; }
222 
224  inline GLuint& getDisplayList(unsigned int contextID) const { return _globjList[contextID]; }
225 
228  virtual void setUseVertexBufferObjects(bool flag);
229 
231  inline bool getUseVertexBufferObjects() const { return _useVertexBufferObjects; }
232 
233 
235  virtual void dirtyDisplayList();
236 
237 
240  virtual unsigned int getGLObjectSizeHint() const { return 0; }
241 
242 
243 
253  inline void draw(RenderInfo& renderInfo) const;
254 
258  virtual void compileGLObjects(RenderInfo& renderInfo) const;
259 
261  virtual void setThreadSafeRefUnref(bool threadSafe);
262 
264  virtual void resizeGLObjectBuffers(unsigned int maxSize);
265 
269  virtual void releaseGLObjects(State* state=0) const;
270 
271  struct OSG_EXPORT UpdateCallback : public virtual Callback
272  {
274 
276 
278 
280  virtual bool run(osg::Object* object, osg::Object* data);
281 
284  };
285 
286 
287  struct OSG_EXPORT EventCallback : public virtual Callback
288  {
290 
292 
294 
296  virtual bool run(osg::Object* object, osg::Object* data);
297 
300  };
301 
302  struct CullCallback : public virtual Callback
303  {
305 
306  CullCallback(const CullCallback&,const CopyOp&) {}
307 
309 
310  // just use the standard run implementation to passes run onto any nested callbacks.
311  using Callback::run;
312 
314  virtual bool cull(osg::NodeVisitor*, osg::Drawable*, osg::State*) const { return false; }
315 
317  virtual bool cull(osg::NodeVisitor* nv, osg::Drawable* drawable, osg::RenderInfo* renderInfo) const { return cull(nv, drawable, renderInfo? renderInfo->getState():0); }
318  };
319 
320 
326  struct DrawCallback : public virtual osg::Object
327  {
329 
330  DrawCallback(const DrawCallback&,const CopyOp&) {}
331 
333 
335  virtual void drawImplementation(osg::RenderInfo& /*renderInfo*/,const osg::Drawable* /*drawable*/) const {}
336  };
337 
339  virtual void setDrawCallback(DrawCallback* dc) { _drawCallback=dc; dirtyDisplayList(); }
340 
342  DrawCallback* getDrawCallback() { return _drawCallback.get(); }
343 
345  const DrawCallback* getDrawCallback() const { return _drawCallback.get(); }
346 
352  virtual void drawImplementation(RenderInfo& /*renderInfo*/) const {}
353 
354 
356  static GLuint generateDisplayList(unsigned int contextID, unsigned int sizeHint = 0);
357 
359  static void setMinimumNumberOfDisplayListsToRetainInCache(unsigned int minimum);
360 
362  static unsigned int getMinimumNumberOfDisplayListsToRetainInCache();
363 
368  static void deleteDisplayList(unsigned int contextID,GLuint globj, unsigned int sizeHint = 0);
369 
372  static void flushAllDeletedDisplayLists(unsigned int contextID);
373 
378  static void discardAllDeletedDisplayLists(unsigned int contextID);
379 
382  static void flushDeletedDisplayLists(unsigned int contextID,double& availableTime);
383 
384  typedef unsigned int AttributeType;
385 
387  {
388  VERTICES = 0,
389  WEIGHTS = 1,
390  NORMALS = 2,
391  COLORS = 3,
392  SECONDARY_COLORS = 4,
393  FOG_COORDS = 5,
394  ATTRIBUTE_6 = 6,
395  ATTRIBUTE_7 = 7,
396  TEXTURE_COORDS = 8,
397  TEXTURE_COORDS_0 = TEXTURE_COORDS,
398  TEXTURE_COORDS_1 = TEXTURE_COORDS_0+1,
399  TEXTURE_COORDS_2 = TEXTURE_COORDS_0+2,
400  TEXTURE_COORDS_3 = TEXTURE_COORDS_0+3,
401  TEXTURE_COORDS_4 = TEXTURE_COORDS_0+4,
402  TEXTURE_COORDS_5 = TEXTURE_COORDS_0+5,
403  TEXTURE_COORDS_6 = TEXTURE_COORDS_0+6,
404  TEXTURE_COORDS_7 = TEXTURE_COORDS_0+7
405  // only eight texture coord examples provided here, but underlying code can handle any no of texture units,
406  // simply co them as (TEXTURE_COORDS_0+unit).
407  };
408 
410  {
411  public:
412  virtual ~AttributeFunctor() {}
413 
414  virtual void apply(AttributeType,unsigned int,GLbyte*) {}
415  virtual void apply(AttributeType,unsigned int,GLshort*) {}
416  virtual void apply(AttributeType,unsigned int,GLint*) {}
417 
418  virtual void apply(AttributeType,unsigned int,GLubyte*) {}
419  virtual void apply(AttributeType,unsigned int,GLushort*) {}
420  virtual void apply(AttributeType,unsigned int,GLuint*) {}
421 
422  virtual void apply(AttributeType,unsigned int,float*) {}
423  virtual void apply(AttributeType,unsigned int,Vec2*) {}
424  virtual void apply(AttributeType,unsigned int,Vec3*) {}
425  virtual void apply(AttributeType,unsigned int,Vec4*) {}
426  virtual void apply(AttributeType,unsigned int,Vec4ub*) {}
427 
428  virtual void apply(AttributeType,unsigned int,double*) {}
429  virtual void apply(AttributeType,unsigned int,Vec2d*) {}
430  virtual void apply(AttributeType,unsigned int,Vec3d*) {}
431  virtual void apply(AttributeType,unsigned int,Vec4d*) {}
432  };
433 
434 
436  virtual bool supports(const AttributeFunctor&) const { return false; }
437 
441  virtual void accept(AttributeFunctor&) {}
442 
443 
445  {
446  public:
447 
449 
450  virtual void apply(AttributeType,unsigned int,const GLbyte*) {}
451  virtual void apply(AttributeType,unsigned int,const GLshort*) {}
452  virtual void apply(AttributeType,unsigned int,const GLint*) {}
453 
454  virtual void apply(AttributeType,unsigned int,const GLubyte*) {}
455  virtual void apply(AttributeType,unsigned int,const GLushort*) {}
456  virtual void apply(AttributeType,unsigned int,const GLuint*) {}
457 
458  virtual void apply(AttributeType,unsigned int,const float*) {}
459  virtual void apply(AttributeType,unsigned int,const Vec2*) {}
460  virtual void apply(AttributeType,unsigned int,const Vec3*) {}
461  virtual void apply(AttributeType,unsigned int,const Vec4*) {}
462  virtual void apply(AttributeType,unsigned int,const Vec4ub*) {}
463 
464  virtual void apply(AttributeType,unsigned int,const double*) {}
465  virtual void apply(AttributeType,unsigned int,const Vec2d*) {}
466  virtual void apply(AttributeType,unsigned int,const Vec3d*) {}
467  virtual void apply(AttributeType,unsigned int,const Vec4d*) {}
468  };
469 
471  virtual bool supports(const ConstAttributeFunctor&) const { return false; }
472 
476  virtual void accept(ConstAttributeFunctor&) const {}
477 
478 
479 
481  virtual bool supports(const PrimitiveFunctor&) const { return false; }
482 
487  virtual void accept(PrimitiveFunctor&) const {}
488 
490  virtual bool supports(const PrimitiveIndexFunctor&) const { return false; }
491 
496  virtual void accept(PrimitiveIndexFunctor&) const {}
497 
498  protected:
499 
500  Drawable& operator = (const Drawable&) { return *this;}
501 
502  virtual ~Drawable();
503 
505  void setBound(const BoundingBox& bb) const;
506 
507  friend class Node;
508  friend class Geode;
509  friend class StateSet;
510 
514  mutable bool _boundingBoxComputed;
515 
517 
522 
524  mutable GLObjectList _globjList;
525 
528 
531 };
532 
533 inline void Drawable::draw(RenderInfo& renderInfo) const
534 {
535 #ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
537  {
538  // get the contextID (user defined ID of 0 upwards) for the
539  // current OpenGL context.
540  unsigned int contextID = renderInfo.getContextID();
541 
542  // get the globj for the current contextID.
543  GLuint& globj = _globjList[contextID];
544 
545  // call the globj if already set otherwise compile and execute.
546  if( globj != 0 )
547  {
548  glCallList( globj );
549  }
550  else if (_useDisplayList)
551  {
552 #ifdef USE_SEPARATE_COMPILE_AND_EXECUTE
553  globj = generateDisplayList(contextID, getGLObjectSizeHint());
554  glNewList( globj, GL_COMPILE );
555  if (_drawCallback.valid())
556  _drawCallback->drawImplementation(renderInfo,this);
557  else
558  drawImplementation(renderInfo);
559  glEndList();
560 
561  glCallList( globj);
562 #else
563  globj = generateDisplayList(contextID, getGLObjectSizeHint());
564  glNewList( globj, GL_COMPILE_AND_EXECUTE );
565  if (_drawCallback.valid())
566  _drawCallback->drawImplementation(renderInfo,this);
567  else
568  drawImplementation(renderInfo);
569  glEndList();
570 #endif
571  }
572 
573  return;
574 
575  }
576 #endif
577 
578  // draw object as nature intended..
579  if (_drawCallback.valid())
580  _drawCallback->drawImplementation(renderInfo,this);
581  else
582  drawImplementation(renderInfo);
583 }
584 
586 {
587  public:
588 
590  _af(af),
591  _type(0) {}
592 
594 
595  virtual void apply(ByteArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
596  virtual void apply(ShortArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
597  virtual void apply(IntArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
598  virtual void apply(UByteArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
599  virtual void apply(UShortArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
600  virtual void apply(UIntArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
601  virtual void apply(Vec4ubArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
602  virtual void apply(FloatArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
603  virtual void apply(Vec2Array& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
604  virtual void apply(Vec3Array& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
605  virtual void apply(Vec4Array& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
606  virtual void apply(DoubleArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
607  virtual void apply(Vec2dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
608  virtual void apply(Vec3dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
609  virtual void apply(Vec4dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
610 
611 
613  {
614  if (array)
615  {
616  _type = type;
617  array->accept(*this);
618  }
619  }
620 
621  protected:
622 
626 };
627 
629 {
630  public:
631 
633  _af(af),
634  _type(0) {}
635 
637 
638  virtual void apply(const ByteArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
639  virtual void apply(const ShortArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
640  virtual void apply(const IntArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
641  virtual void apply(const UByteArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
642  virtual void apply(const UShortArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
643  virtual void apply(const UIntArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
644  virtual void apply(const Vec4ubArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
645  virtual void apply(const FloatArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
646  virtual void apply(const Vec2Array& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
647  virtual void apply(const Vec3Array& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
648  virtual void apply(const Vec4Array& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
649  virtual void apply(const DoubleArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
650  virtual void apply(const Vec2dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
651  virtual void apply(const Vec3dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
652  virtual void apply(const Vec4dArray& array) { if (!array.empty()) _af.apply(_type,array.size(),&(array.front())); }
653 
654 
655  inline void applyArray(Drawable::AttributeType type,const Array* array)
656  {
657  if (array)
658  {
659  _type = type;
660  array->accept(*this);
661  }
662  }
663 
664 protected:
665 
667 
670 };
671 
672 }
673 
674 #endif
GLuint & getDisplayList(unsigned int contextID) const
Definition: Drawable.h:224
virtual void accept(PrimitiveIndexFunctor &) const
Definition: Drawable.h:496
bool _boundingBoxComputed
Definition: Drawable.h:514
#define OSG_EXPORT
Definition: Export.h:43
virtual void apply(AttributeType, unsigned int, GLushort *)
Definition: Drawable.h:419
virtual void apply(Vec3dArray &array)
Definition: Drawable.h:608
BoundingBox _initialBound
Definition: Drawable.h:511
ref_ptr< EventCallback > _drawableEventCallback
Definition: Drawable.h:527
virtual void setDrawCallback(DrawCallback *dc)
Definition: Drawable.h:339
virtual void apply(AttributeType, unsigned int, GLubyte *)
Definition: Drawable.h:418
bool _useDisplayList
Definition: Drawable.h:519
osg::buffered_value< GLuint > GLObjectList
Definition: Drawable.h:523
unsigned int AttributeType
Definition: Drawable.h:384
ConstAttributeFunctorArrayVisitor & operator=(const ConstAttributeFunctorArrayVisitor &)
Definition: Drawable.h:666
virtual void apply(Vec4ubArray &array)
Definition: Drawable.h:601
static unsigned int s_numberNewDrawablesInLastFrame
Definition: Drawable.h:99
ref_ptr< Shape > _shape
Definition: Drawable.h:516
DrawCallback(const DrawCallback &, const CopyOp &)
Definition: Drawable.h:330
virtual void update(osg::NodeVisitor *, osg::Drawable *)
Definition: Drawable.h:283
virtual void apply(AttributeType, unsigned int, const float *)
Definition: Drawable.h:458
virtual void apply(const UShortArray &array)
Definition: Drawable.h:642
AttributeFunctorArrayVisitor & operator=(const AttributeFunctorArrayVisitor &)
Definition: Drawable.h:623
virtual void apply(AttributeType, unsigned int, const GLushort *)
Definition: Drawable.h:455
virtual void apply(UShortArray &array)
Definition: Drawable.h:599
ref_ptr< ComputeBoundingBoxCallback > _computeBoundCallback
Definition: Drawable.h:512
virtual void apply(const ByteArray &array)
Definition: Drawable.h:638
virtual void apply(AttributeType, unsigned int, const GLint *)
Definition: Drawable.h:452
virtual void apply(const UByteArray &array)
Definition: Drawable.h:641
void setComputeBoundingBoxCallback(ComputeBoundingBoxCallback *callback)
Definition: Drawable.h:178
void draw(RenderInfo &renderInfo) const
Definition: Drawable.h:533
virtual void apply(AttributeType, unsigned int, GLbyte *)
Definition: Drawable.h:414
#define META_Node(library, name)
Definition: Node.h:59
virtual void apply(AttributeType, unsigned int, Vec4 *)
Definition: Drawable.h:425
UpdateCallback(const UpdateCallback &, const CopyOp &)
Definition: Drawable.h:275
virtual void drawImplementation(RenderInfo &) const
Definition: Drawable.h:352
virtual void apply(const FloatArray &array)
Definition: Drawable.h:645
virtual void apply(const Vec4dArray &array)
Definition: Drawable.h:652
virtual void event(osg::NodeVisitor *, osg::Drawable *)
Definition: Drawable.h:299
virtual void apply(ByteArray &array)
Definition: Drawable.h:595
virtual void apply(AttributeType, unsigned int, GLuint *)
Definition: Drawable.h:420
virtual void apply(const DoubleArray &array)
Definition: Drawable.h:649
virtual bool cull(osg::NodeVisitor *, osg::Drawable *, osg::State *) const
Definition: Drawable.h:314
virtual void apply(const IntArray &array)
Definition: Drawable.h:640
virtual void apply(AttributeType, unsigned int, const GLbyte *)
Definition: Drawable.h:450
virtual void apply(UByteArray &array)
Definition: Drawable.h:598
void applyArray(Drawable::AttributeType type, const Array *array)
Definition: Drawable.h:655
T minimum(T lhs, T rhs)
Definition: Math.h:59
void applyArray(Drawable::AttributeType type, Array *array)
Definition: Drawable.h:612
virtual void apply(AttributeType, unsigned int, const Vec4ub *)
Definition: Drawable.h:462
virtual void apply(Vec4dArray &array)
Definition: Drawable.h:609
virtual Drawable * asDrawable()
Definition: Drawable.h:109
CullCallback(const CullCallback &, const CopyOp &)
Definition: Drawable.h:306
ComputeBoundingBoxCallback * getComputeBoundingBoxCallback()
Definition: Drawable.h:181
ref_ptr< UpdateCallback > _drawableUpdateCallback
Definition: Drawable.h:526
EventCallback(const EventCallback &, const CopyOp &)
Definition: Drawable.h:291
virtual void apply(AttributeType, unsigned int, const GLubyte *)
Definition: Drawable.h:454
virtual void apply(UIntArray &array)
Definition: Drawable.h:600
static GLuint generateDisplayList(unsigned int contextID, unsigned int sizeHint=0)
bool _supportsVertexBufferObjects
Definition: Drawable.h:520
BoundingBoxd BoundingBox
Definition: BoundingBox.h:257
#define META_Object(library, name)
Definition: Object.h:42
std::vector< Matrix > MatrixList
Definition: Node.h:53
virtual void accept(PrimitiveFunctor &) const
Definition: Drawable.h:487
static unsigned int s_numberDrawablesReusedLastInLastFrame
Definition: Drawable.h:98
virtual unsigned int getGLObjectSizeHint() const
Definition: Drawable.h:240
virtual bool run(osg::Object *object, osg::Object *data)
Definition: Callback.h:42
virtual void apply(Vec4Array &array)
Definition: Drawable.h:605
bool _supportsDisplayList
Definition: Drawable.h:518
bool isVertexBufferObjectSupported() const
Definition: State.h:1355
virtual void apply(AttributeType, unsigned int, const Vec3 *)
Definition: Drawable.h:460
virtual void apply(Vec2dArray &array)
Definition: Drawable.h:607
void expandBy(const vec_type &v)
Definition: BoundingBox.h:156
virtual void apply(ShortArray &array)
Definition: Drawable.h:596
const BoundingSphere & getBound() const
Definition: Drawable.h:126
Drawable::AttributeFunctor & _af
Definition: Drawable.h:624
ComputeBoundingBoxCallback(const ComputeBoundingBoxCallback &, const CopyOp &)
Definition: Drawable.h:170
bool getUseVertexBufferObjects() const
Definition: Drawable.h:231
DrawCallback * getDrawCallback()
Definition: Drawable.h:342
virtual void apply(AttributeType, unsigned int, GLint *)
Definition: Drawable.h:416
virtual void accept(AttributeFunctor &)
Definition: Drawable.h:441
ref_ptr< CullCallback > _drawableCullCallback
Definition: Drawable.h:529
virtual void apply(AttributeType, unsigned int, const Vec2d *)
Definition: Drawable.h:465
virtual void apply(AttributeType, unsigned int, double *)
Definition: Drawable.h:428
bool getSupportsDisplayList() const
Definition: Drawable.h:212
virtual BoundingBox computeBound(const osg::Drawable &) const
Definition: Drawable.h:174
Drawable::AttributeType _type
Definition: Drawable.h:625
virtual void apply(AttributeType, unsigned int, const Vec3d *)
Definition: Drawable.h:466
AttributeFunctorArrayVisitor(Drawable::AttributeFunctor &af)
Definition: Drawable.h:589
State * getState()
Definition: RenderInfo.h:58
virtual void apply(AttributeType, unsigned int, Vec3 *)
Definition: Drawable.h:424
virtual void apply(const Vec4ubArray &array)
Definition: Drawable.h:644
const_reference front() const
Definition: MixinVector.h:138
const ComputeBoundingBoxCallback * getComputeBoundingBoxCallback() const
Definition: Drawable.h:184
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
Definition: GLU.h:71
virtual void apply(Vec3Array &array)
Definition: Drawable.h:604
BoundingBox _boundingBox
Definition: Drawable.h:513
Shape * getShape()
Definition: Drawable.h:195
virtual void apply(AttributeType, unsigned int, const double *)
Definition: Drawable.h:464
virtual bool supports(const PrimitiveFunctor &) const
Definition: Drawable.h:481
virtual bool supports(const PrimitiveIndexFunctor &) const
Definition: Drawable.h:490
virtual void apply(AttributeType, unsigned int, Vec2 *)
Definition: Drawable.h:423
virtual void accept(ConstAttributeFunctor &) const
Definition: Drawable.h:476
virtual void apply(const UIntArray &array)
Definition: Drawable.h:643
virtual void apply(const Vec3dArray &array)
Definition: Drawable.h:651
virtual void apply(AttributeType, unsigned int, const Vec4d *)
Definition: Drawable.h:467
ConstAttributeFunctorArrayVisitor(Drawable::ConstAttributeFunctor &af)
Definition: Drawable.h:632
virtual bool supports(const ConstAttributeFunctor &) const
Definition: Drawable.h:471
virtual void apply(AttributeType, unsigned int, const Vec4 *)
Definition: Drawable.h:461
virtual void apply(AttributeType, unsigned int, const GLuint *)
Definition: Drawable.h:456
virtual void drawImplementation(osg::RenderInfo &, const osg::Drawable *) const
Definition: Drawable.h:335
ref_ptr< DrawCallback > _drawCallback
Definition: Drawable.h:530
const DrawCallback * getDrawCallback() const
Definition: Drawable.h:345
Definition: Node.h:71
virtual void apply(const Vec4Array &array)
Definition: Drawable.h:648
Definition: AlphaFunc.h:19
void setShape(Shape *shape)
Definition: Drawable.h:192
virtual void apply(const ShortArray &array)
Definition: Drawable.h:639
bool empty() const
Definition: MixinVector.h:91
GLObjectList _globjList
Definition: Drawable.h:524
virtual void accept(ArrayVisitor &)=0
bool _useVertexBufferObjects
Definition: Drawable.h:521
unsigned int getContextID() const
Definition: RenderInfo.h:55
virtual void apply(const Vec2dArray &array)
Definition: Drawable.h:650
virtual void apply(AttributeType, unsigned int, float *)
Definition: Drawable.h:422
virtual bool cull(osg::NodeVisitor *nv, osg::Drawable *drawable, osg::RenderInfo *renderInfo) const
Definition: Drawable.h:317
virtual void apply(IntArray &array)
Definition: Drawable.h:597
virtual void apply(Vec2Array &array)
Definition: Drawable.h:603
const BoundingBox & getBoundingBox() const
Definition: Drawable.h:135
Drawable::ConstAttributeFunctor & _af
Definition: Drawable.h:668
virtual void apply(FloatArray &array)
Definition: Drawable.h:602
virtual void apply(AttributeType, unsigned int, const GLshort *)
Definition: Drawable.h:451
virtual void apply(DoubleArray &array)
Definition: Drawable.h:606
Drawable::AttributeType _type
Definition: Drawable.h:669
virtual void apply(AttributeType, unsigned int, Vec4d *)
Definition: Drawable.h:431
const BoundingBox & getInitialBound() const
Definition: Drawable.h:124
void setInitialBound(const osg::BoundingBox &bbox)
Definition: Drawable.h:121
bool getUseDisplayList() const
Definition: Drawable.h:221
size_type size() const
Definition: MixinVector.h:92
virtual void apply(const Vec2Array &array)
Definition: Drawable.h:646
virtual void apply(AttributeType, unsigned int, Vec3d *)
Definition: Drawable.h:430
virtual void apply(AttributeType, unsigned int, GLshort *)
Definition: Drawable.h:415
virtual void apply(const Vec3Array &array)
Definition: Drawable.h:647
const Shape * getShape() const
Definition: Drawable.h:198
virtual void apply(AttributeType, unsigned int, Vec4ub *)
Definition: Drawable.h:426
virtual void apply(AttributeType, unsigned int, const Vec2 *)
Definition: Drawable.h:459
virtual bool supports(const AttributeFunctor &) const
Definition: Drawable.h:436
virtual const Drawable * asDrawable() const
Definition: Drawable.h:110
virtual void apply(AttributeType, unsigned int, Vec2d *)
Definition: Drawable.h:429
static unsigned int s_numberDeletedDrawablesInLastFrame
Definition: Drawable.h:100