VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtBallisticGeometry.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2026 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
15 
16 #include <vrvMath/DtVector3.h>
17 
18 #include <osg/Node>
19 #include <osg/Drawable>
20 #include <osg/Uniform>
21 #include <atomic>
22 #include <osg/StateSet>
23 
24 #include <unordered_map>
25 
26 namespace osg
27 {
28  class NodeVisitor;
29  class State;
30 }
31 
32 namespace makVrv
33 {
34  class DtDe;
35 
36  class DtBallisticRenderer;
37  class DtBallisticDrawComponent;
38  class DtBallisticComputeComponent;
39  class DtBallisticRunTimeSettings;
40  class DtBallisticProjectile;
41  class DtBallisticRendererUserData;
42  class DtGlBuffer;
43 
46 
49 
51  template <>
52  inline const char* creatorTypeName<DtBallisticGeometry>(void) { return "DtBallisticGeometryCreator"; }
53 
58  class DT_DLL_VRVOSG DtBallisticGeometry : public osg::Drawable
59  {
60  public:
62 
63  protected:
69 
71  virtual ~DtBallisticGeometry();
72 
73  private:
75  DtBallisticGeometry() = delete;
76 
78  DtBallisticGeometry(const DtBallisticGeometry& other) = delete;
79 
81  DtBallisticGeometry& operator=(const DtBallisticGeometry& other) = delete;
82 
83  public:
87  virtual void setName(const std::string& name) override;
88 
92  virtual void setCellId(const Vector3_int& cellId);
93 
95  virtual const unsigned int id(void) const;
96 
100  virtual void setRenderer(DtBallisticRenderer* drawerNode);
101 
103  virtual const char* className() const;
104 
106  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
107 
114  virtual void debugDrawImplementation(osg::RenderInfo& renderInfo,
115  const osg::Matrixd& modelViewMatrix, DtGlBuffer* visibleSSBO, DtGlBuffer* indirectSSBO);
116 
118  virtual void accept(osg::NodeVisitor& nv);
119 
128  void shutdown();
129 
131  virtual void releaseGLObjects(osg::State* state) const override;
132 
134  virtual void accept(osg::PrimitiveFunctor& functor) const override;
135 
139  virtual void setLocalOriginTransform(const osg::Matrixd& localOriginTransform);
140 
147  virtual void perCameraUpdateAndCull(const osg::Camera* camera, const osg::Matrix& modelViewMatrix, const osg::FrameStamp* frameStamp, DtBallisticRendererUserData* userData);
148 
149 
157  virtual void addProjectile(int slot, DtBallisticProjectile* projectile);
158 
165  virtual void removeProjectile(int slot);
166 
168  int projectileCount() const;
169 
176  bool hasSlot(int slot) const;
177 
179  DtBallisticDrawComponent* drawComponent() const;
180 
181  protected:
183  virtual void drawImplementation(osg::RenderInfo& renderInfo, const osg::Matrixd& modelViewMatrix
184  , bool isLightBin, bool isDepthBin, bool isShadowPass
185  , DtGlBuffer* visibleSSBO, DtGlBuffer* indirectSSBO) const;
186 
192 
196  std::unordered_map<int, DtBallisticProjectile*> myActiveSlots;
197 
200  std::atomic<int> myProjectileCount;
201 
204 
206  unsigned int myId;
207 
210 
215 
219 
222  };
223 }
std::unordered_map< int, DtBallisticProjectile * > myActiveSlots
Map of active pool slot indices to their projectile pointers for this cell. Non-owning pointers; life...
Definition: DtBallisticGeometry.h:196
Vector3_int myCellId
Spatial cell ID assigned by DtBallisticSpatialGrid.
Definition: DtBallisticGeometry.h:209
std::atomic< int > myProjectileCount
Cached count of myActiveSlots.size(); written from the main thread, read from render threads...
Definition: DtBallisticGeometry.h:200
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
osg::Matrixd myLocalOriginTransformMatrix
Local-origin transform matrix anchoring this geometry in world space.
Definition: DtBallisticGeometry.h:203
DtVirtualBaseClassCreator< DtBallisticGeometry, DtBallisticComputeComponent & > DtBallisticGeometryCreator
creator
Definition: DtBallisticGeometry.h:45
OSG Drawable that drives per-camera GPU cull and draw for a ballistic spatial cell.
Definition: DtBallisticGeometry.h:58
const char * creatorTypeName< DtBallisticGeometry >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtBallisticGeometry.h:52
3 dimensional vector
OSG Drawable that batches and issues GPU draw calls for all ballistic geometries. ...
Definition: DtBallisticRenderer.h:46
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:23
const DtBallisticRunTimeSettings & myBallisticRunTimeSettings
Reference to the shared ballistic runtime settings.
Definition: DtBallisticGeometry.h:221
CPU-side pool slot descriptor for a single GPU-simulated bullet.
Definition: DtBallisticProjectile.h:23
DtBallisticDrawComponent * myDrawComponent
Shared draw component; non-owning pointer.
Definition: DtBallisticGeometry.h:214
DtBallisticRenderer * myBallisticRenderer
Non-owning pointer to the renderer that owns this geometry.
Definition: DtBallisticGeometry.h:218
Interface for the ballistic rendering draw pass.
Definition: DtBallisticDrawComponent.h:52
Interface for GPU compute operations driving the ballistic simulation pipeline.
Definition: DtBallisticComputeComponent.h:71
A generic OpenGL buffer. This can be: -&gt; a vertex buffer -&gt; an index buffer -&gt; a shader storage buffe...
Definition: DtGlBuffer.h:29
DtBallisticComputeComponent * myComputeComponent
Shared compute component used for GPU dispatches; non-owning and set to null by shutdown() after the ...
Definition: DtBallisticGeometry.h:191
DtDe & myDe
Reference to the simulation environment.
Definition: DtBallisticGeometry.h:188
Singleton holding runtime-tweakable settings for the ballistic system.
Definition: DtBallisticRunTimeSettings.h:43
Contains DLL export macros.
Per-camera data used by DtBallisticRenderer to drive GPU cull and draw for one camera.
Definition: DtBallisticRendererUserData.h:71
osg::ref_ptr< osg::StateSet > myDrawStateSet
OSG state set applied during the draw pass.
Definition: DtBallisticGeometry.h:212
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
friend DtBallisticGeometryCreator
Definition: DtBallisticGeometry.h:61
unsigned int myId
Unique integer ID for this geometry instance.
Definition: DtBallisticGeometry.h:206

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)