VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtDiGuyInstanceDrawable.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2023 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <osg/MatrixTransform>
13 #include <osg/Drawable>
14 #include <tbb/concurrent_vector.h>
15 
17 
18 namespace makVrv
19 {
20 
21  class DtDiGuyScenario;
22  class DtDiGuyOsgGraphicsInstanceGroup;
23  class DtGlTextureBufferObject;
24 
27  class DtDiGuyInstanceDrawable : public osg::Drawable
28  {
29  public:
30 
33 
35  virtual ~DtDiGuyInstanceDrawable();
36 
38  virtual const char* className() const { return "DtDiGuyInstanceDrawable"; }
39 
41  virtual void releaseGLObjects(osg::State* state) const;
42 
44  virtual void reset();
45 
47  virtual void addDrawable( DtDiGuyOsgGraphicsInstanceGroup* drawable );
48 
50  virtual void drawImplementation( osg::RenderInfo& renderInfo ) const;
51 
53  virtual void copy_tbo_data( const int& num_floats, const float* data );
54 
55  protected:
56 
57  //Setup the texture buffer object for the instanced diguys
58  virtual void setupTextureBufferObject();
59 
60  protected:
61 
62  mutable tbb::concurrent_vector< DtDiGuyOsgGraphicsInstanceGroup*> myDrawables;
63  mutable tbb::concurrent_vector< DtDiGuyOsgGraphicsInstanceGroup*> myTransparentDrawables;
64 
65  mutable osg::Vec3d myMutableCameraPosition;
67 
70 
71  private:
72 
74  DtDiGuyInstanceDrawable( const DtDiGuyInstanceDrawable& ob, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY ) = delete;
75 
77  virtual osg::Object* clone( const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY ) const;
78 
79  };
80 
81 }
Contains the DtOsgTextureBufferObjectApplyAttribute class.
Wrapper for OpenGL Texture Buffer Object.
Definition: DtGlTextureBufferObject.h:28
virtual void reset()
called at the beginning of every frame to clear out drawables list
osg::ref_ptr< TextureBufferObjectApplyAttribute > m_diguy_texture_buffer_attribute
Definition: DtDiGuyInstanceDrawable.h:69
osg::Vec3d myMutableCameraPosition
Definition: DtDiGuyInstanceDrawable.h:65
virtual void addDrawable(DtDiGuyOsgGraphicsInstanceGroup *drawable)
adds an instanced drawable
tbb::concurrent_vector< DtDiGuyOsgGraphicsInstanceGroup * > myTransparentDrawables
Definition: DtDiGuyInstanceDrawable.h:63
virtual osg::Object * clone(const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY) const
Clone this object.
osg::ref_ptr< osg::StateAttribute > myShaderProgram
Definition: DtDiGuyInstanceDrawable.h:66
virtual void releaseGLObjects(osg::State *state) const
releases texture data
virtual ~DtDiGuyInstanceDrawable()
dtor
virtual void setupTextureBufferObject()
virtual void copy_tbo_data(const int &num_floats, const float *data)
function called by main thread job to get data down to the shared GPU
Class that renders all the diguy instance objects in one osg drawable, major performance improvement...
Definition: DtDiGuyInstanceDrawable.h:27
DtGlTextureBufferObject * m_diguy_texture_buffer
Definition: DtDiGuyInstanceDrawable.h:68
tbb::concurrent_vector< DtDiGuyOsgGraphicsInstanceGroup * > myDrawables
Definition: DtDiGuyInstanceDrawable.h:62
virtual const char * className() const
needed by scene graph visualizer
Definition: DtDiGuyInstanceDrawable.h:38
virtual void drawImplementation(osg::RenderInfo &renderInfo) const
draws all the drawables.
This class is part of the DI-Guy Graphics API. It overrides the class diguyGraphicsInstanceGroup. Detailed documentation is in the implementation file documentation here.
Definition: DtDiGuyOsgGraphicsInstanceGroup.h:45

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)