VR-Forces 4.8 Class Documentation
 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) 2020 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 void releaseGLObjects(osg::State* state) const;
38 
40  virtual void reset();
41 
43  virtual void addDrawable(DtDiGuyOsgGraphicsInstanceGroup* drawable);
44 
46  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
47 
49  virtual void copy_tbo_data(const int& num_floats, const float* data);
50 
51  protected:
52  //Setup the texture buffer object for the instanced diguys
53  virtual void setupTextureBufferObject();
54 
55  protected:
56  mutable tbb::concurrent_vector< DtDiGuyOsgGraphicsInstanceGroup*> myDrawables;
57  mutable tbb::concurrent_vector< DtDiGuyOsgGraphicsInstanceGroup*> myTransparentDrawables;
58 
59  mutable osg::Vec3d myMutableCameraPosition;
61 
64 
68  mutable bool m_ready_for_clear;
69 
70  private:
72  DtDiGuyInstanceDrawable(const DtDiGuyInstanceDrawable& ob, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
73 
74 
76  virtual osg::Object* clone(const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY) const;
77 
78  };
79 }
80 
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:63
osg::Vec3d myMutableCameraPosition
Definition: DtDiGuyInstanceDrawable.h:59
virtual void addDrawable(DtDiGuyOsgGraphicsInstanceGroup *drawable)
adds an instanced drawable
tbb::concurrent_vector< DtDiGuyOsgGraphicsInstanceGroup * > myTransparentDrawables
Definition: DtDiGuyInstanceDrawable.h:57
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:60
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:68
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:62
tbb::concurrent_vector< DtDiGuyOsgGraphicsInstanceGroup * > myDrawables
Definition: DtDiGuyInstanceDrawable.h:56
virtual void drawImplementation(osg::RenderInfo &renderInfo) const
draws all the drawables.
This class is part of the DI-Guy Graphics API.
Definition: DtDiGuyOsgGraphicsInstanceGroup.h:36

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)