VR-Forces 5.0.1 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) 2021 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  class DtDiGuyScenario;
21  class DtDiGuyOsgGraphicsInstanceGroup;
22  class DtGlTextureBufferObject;
23 
26  class DtDiGuyInstanceDrawable : public osg::Drawable
27  {
28 
29  public:
32 
34  virtual ~DtDiGuyInstanceDrawable();
35 
37  virtual const char* className() const { return "DtDiGuyInstanceDrawable"; }
38 
40  virtual void releaseGLObjects(osg::State* state) const;
41 
43  virtual void reset();
44 
46  virtual void addDrawable(DtDiGuyOsgGraphicsInstanceGroup* drawable);
47 
49  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
50 
52  virtual void copy_tbo_data(const int& num_floats, const float* data);
53 
54  protected:
55  //Setup the texture buffer object for the instanced diguys
56  virtual void setupTextureBufferObject();
57 
58  protected:
59  mutable tbb::concurrent_vector< DtDiGuyOsgGraphicsInstanceGroup*> myDrawables;
60  mutable tbb::concurrent_vector< DtDiGuyOsgGraphicsInstanceGroup*> myTransparentDrawables;
61 
62  mutable osg::Vec3d myMutableCameraPosition;
64 
67 
71  mutable bool m_ready_for_clear;
72 
73  private:
75  DtDiGuyInstanceDrawable(const DtDiGuyInstanceDrawable& ob, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY) = delete;
76 
77 
79  virtual osg::Object* clone(const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY) const ;
80 
81  };
82 }
83 
Contains the DtOsgTextureBufferObjectApplyAttribute class.
Wrapper for OpenGL Texture Buffer Object.
Definition: DtGlTextureBufferObject.h:27
virtual void reset()
called every frame at the beginning to clear out drawables list
osg::ref_ptr< TextureBufferObjectApplyAttribute > m_diguy_texture_buffer_attribute
Definition: DtDiGuyInstanceDrawable.h:66
osg::Vec3d myMutableCameraPosition
Definition: DtDiGuyInstanceDrawable.h:62
virtual void addDrawable(DtDiGuyOsgGraphicsInstanceGroup *drawable)
adds an instanced drawable
tbb::concurrent_vector< DtDiGuyOsgGraphicsInstanceGroup * > myTransparentDrawables
Definition: DtDiGuyInstanceDrawable.h:60
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:63
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
bool m_ready_for_clear
diguy updates add stuff to drawable list, but sometimes that happens 2x, not sure why...
Definition: DtDiGuyInstanceDrawable.h:71
Class that renders all the diguy instance objects in one osg drawable, major performance improvement...
Definition: DtDiGuyInstanceDrawable.h:26
DtGlTextureBufferObject * m_diguy_texture_buffer
Definition: DtDiGuyInstanceDrawable.h:65
tbb::concurrent_vector< DtDiGuyOsgGraphicsInstanceGroup * > myDrawables
Definition: DtDiGuyInstanceDrawable.h:59
virtual const char * className() const
needed by scene graph visualizer
Definition: DtDiGuyInstanceDrawable.h:37
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:44

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)