VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtIndirectPerInstanceDataManager.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2021 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
14 
16 
17 #include <vrvMath/DtVector4.h>
19 
20 #include <unordered_map>
21 
22 namespace osg
23 {
24  class State;
25 }
26 
27 namespace makVrv
28 {
29  class DtInstanceContainer;
30  class DtDe;
31  class DtGlBuffer;
32 
33  #define CPU_SIDE_COMPILATION 1
34  #include <../data/shaders/indirect/PerInstanceData.h>
35  #undef CPU_SIDE_COMPILATION
36 
39 
42 
44  template <>
45  inline const char* creatorTypeName<DtIndirectPerInstanceDataManager>(void) { return "DtIndirectPerInstanceDataManagerCreator"; }
46 
49  {
50  public:
51  void operator()(PerInstanceData& info);
52  };
53 
55 
60  {
61  public:
64 
67  protected:
70 
71  private:
77  DtIndirectPerInstanceDataManager &operator=(const DtIndirectPerInstanceDataManager &other) = delete;
78  public:
80  virtual void setColor(int instanceId, const Vector4_32& color);
82  virtual Vector4_32 color(int instanceId) const;
84 
86  virtual void setOtherData0(int instanceId, const Vector4_32& data);
88  virtual Vector4_32 otherData0(int instanceId) const;
90 
92  virtual void setVisibility(int instanceId, bool visible);
94  virtual bool visibility(int instanceId) const;
96 
98  virtual void setLightPointMaxDistance(int instanceId, float distance);
100  virtual float lightPointMaxDistance(int instanceId) const;
102 
104  virtual void setLightPointGroupId(int instanceId, int lightPointGroupId);
106  virtual int lightPointGroupId(int instanceId) const;
108 
110  virtual void addInstance(int perGeomInstanceIndex, int numPerGeomInstances, int instanceId, int lightPointGroupId, bool visible);
111 
113  virtual void removeInstance(int instanceId);
114 
116  virtual void processPerInstanceData(void);
117 
119  virtual void releaseGLObjects(osg::State* state) const;
120 
122  virtual const DtGlBuffer* gpuPerInstanceDataBuffer(void) const;
123 
124  protected:
125 
128 
132 
135 
137  typedef std::unordered_map<int, int> MapInstanceIdToOffsetInInstanceDataBuffer;
139  };
140 
141 }
void operator()(PerInstanceData &info)
std::unordered_map< int, int > MapInstanceIdToOffsetInInstanceDataBuffer
map of instance ids to offset in the instance data buffer
Definition: DtIndirectPerInstanceDataManager.h:137
parent manager class for all Indirect managers. Managers handle information about a specific feature ...
Definition: DtIndirectManager.h:26
MapInstanceIdToOffsetInInstanceDataBuffer myMapInstanceIdToOffsetInInstanceDataBuffer
Definition: DtIndirectPerInstanceDataManager.h:138
friend DtIndirectPerInstanceDataManagerCreator
only creator can create
Definition: DtIndirectPerInstanceDataManager.h:63
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Contains makVrv::DtIndirectManager class.
DtReusableMemoryVector< PerInstanceData, PerInstanceDataInvalidator > DtReusablePerInstanceData
Definition: DtIndirectPerInstanceDataManager.h:54
4 dimensional vector
const char * creatorTypeName< DtIndirectPerInstanceDataManager >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtIndirectPerInstanceDataManager.h:45
DtGlBuffer * myGpuPerInstanceDataBuffer
the gpu buffer for per instance data
Definition: DtIndirectPerInstanceDataManager.h:127
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points. Coordinates are in local database coordinates The coordinat...
A generic OpenGL buffer. This can be: -&gt; a vertex buffer -&gt; an index buffer -&gt; a shader storage buffe...
Definition: DtGlBuffer.h:29
Contains makVrv::DtReusableMemoryVector class.
invalidate the contents of PerInstanceData
Definition: DtIndirectPerInstanceDataManager.h:48
handles data that is specified per instance. Currently only the blend color from the DtOsgArticulated...
Definition: DtIndirectPerInstanceDataManager.h:59
DtVirtualBaseClassCreator< DtIndirectPerInstanceDataManager, DtInstanceContainer & > DtIndirectPerInstanceDataManagerCreator
creator
Definition: DtIndirectPerInstanceDataManager.h:38
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:72
Helper class to manage instances This class allows you to add a DtInstance_64 Internally, however it stores this as a DtInstance (which the GPU can directly read)
Definition: DtInstanceContainer.h:31
DtReusablePerInstanceData myVectorPerInstanceData
the reusable vector representing per instance data that is used to hold &amp; transfer the data to the GP...
Definition: DtIndirectPerInstanceDataManager.h:131
bool myMutablePerInstanceDataDirty
do we need an update
Definition: DtIndirectPerInstanceDataManager.h:134

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)