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) 2025 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
13 
14 #include <vrvOsg/vrvOsg.h>
16 
18 
19 #include <vrvMath/DtVector4.h>
21 
22 #include <unordered_map>
23 
24 namespace osg
25 {
26  class State;
27 }
28 
29 namespace makVrv
30 {
31  class DtDe;
32  class DtGlBuffer;
33 
34  #define CPU_SIDE_COMPILATION 1
35  #include <../data/shaders/indirect/PerInstanceData.h>
36  #undef CPU_SIDE_COMPILATION
37 
40 
43 
45  template <>
46  inline const char* creatorTypeName<DtIndirectPerInstanceDataManager>(void) { return "DtIndirectPerInstanceDataManagerCreator"; }
47 
50  {
51  public:
52  void operator()(PerInstanceData& info);
53  };
54 
56 
66  {
67  public:
70 
73  protected:
76 
77  private:
83  DtIndirectPerInstanceDataManager &operator=(const DtIndirectPerInstanceDataManager &other) = delete;
84  public:
86  virtual void setColor(int instanceId, const Vector4_32& color);
88  virtual Vector4_32 color(int instanceId) const;
90 
92  virtual void setOtherData0(int instanceId, const Vector4_32& data);
94  virtual Vector4_32 otherData0(int instanceId) const;
96 
98  virtual void setVisibility(int instanceId, bool visible);
100  virtual bool visibility(int instanceId) const;
102 
104  virtual void setLightPointMaxDistance(int instanceId, float distance);
106  virtual float lightPointMaxDistance(int instanceId) const;
108 
110  virtual void setLightPointGroupId(int instanceId, int lightPointGroupId);
112  virtual int lightPointGroupId(int instanceId) const;
114 
116  virtual void addInstance(std::vector<PerGeomInstance*>& perGeomInstances, int instanceId, int lightPointGroupId, bool visible);
117 
119  virtual void removeInstance(int instanceId);
120 
122  virtual void processPerInstanceData();
123 
125  virtual void releaseGLObjects(osg::State* state) const;
126 
128  virtual const DtGlBuffer* gpuPerInstanceDataBuffer() const;
129 
130  protected:
131 
134 
138 
141 
143  typedef std::unordered_map<int, int> MapInstanceIdToOffsetInInstanceDataBuffer;
145  };
146 
147 }
void operator()(PerInstanceData &info)
std::unordered_map< int, int > MapInstanceIdToOffsetInInstanceDataBuffer
map of instance ids to offset in the instance data buffer
Definition: DtIndirectPerInstanceDataManager.h:143
DtVirtualBaseClassCreator< DtIndirectPerInstanceDataManager > DtIndirectPerInstanceDataManagerCreator
creator
Definition: DtIndirectPerInstanceDataManager.h:39
parent manager class for all Indirect managers. Managers handle information about a specific feature ...
Definition: DtIndirectManager.h:25
MapInstanceIdToOffsetInInstanceDataBuffer myMapInstanceIdToOffsetInInstanceDataBuffer
Definition: DtIndirectPerInstanceDataManager.h:144
friend DtIndirectPerInstanceDataManagerCreator
only creator can create
Definition: DtIndirectPerInstanceDataManager.h:69
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Contains makVrv::DtIndirectManager class.
DtReusableMemoryVector< PerInstanceData, PerInstanceDataInvalidator > DtReusablePerInstanceData
Definition: DtIndirectPerInstanceDataManager.h:55
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:46
DtGlBuffer * myGpuPerInstanceDataBuffer
the gpu buffer for per instance data
Definition: DtIndirectPerInstanceDataManager.h:133
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:23
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:49
handles data that is specified per instance. Currently only the blend color from the DtOsgArticulated...
Definition: DtIndirectPerInstanceDataManager.h:65
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:76
DtReusablePerInstanceData myVectorPerInstanceData
the reusable vector representing per instance data that is used to hold &amp; transfer the data to the GP...
Definition: DtIndirectPerInstanceDataManager.h:137
bool myMutablePerInstanceDataDirty
do we need an update
Definition: DtIndirectPerInstanceDataManager.h:140
DtPerGeomInstance class declaration.

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)