VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtGeom3dLinesSystem.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2023 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
13 #include <vrvCore/DtJobSplitter.h>
15 
16 #include <vrvMath/DtCamera.h>
18 #include <vrvMath/DtVector4.h>
19 
22 
23 #include <matrix/vlVector.h>
24 
25 #include <array>
26 #include <unordered_map>
27 #include <vector>
28 #include <tbb/concurrent_vector.h>
29 
30 namespace makVrv
31 {
32  // forward Declarations
33  class DtCoordinateSystem;
34  class DtDe;
35  class Dt3dLinesStagingBuffer;
36  class DtGeom3dLinesComponent;
38 
41 
43  template <>
44  inline const char* creatorTypeName<DtGeom3dLinesSystem>() { return "DtGeom3dLinesSystemCreator"; }
45 
63  {
65 
66  public:
67 
68  virtual ~DtGeom3dLinesSystem();
69 
71  DtGeom3dLinesSystem() = delete;
72 
75  const DtGeom3dLinesSystem& other) = delete;
76 
78  DtGeom3dLinesSystem& operator=(
79  const DtGeom3dLinesSystem& other) = delete;
80 
81  public:
82 
89  virtual DtGeom3dLinesComponent* createComponent(DtModelSetId modelSet);
90 
95  virtual void registerComponent(DtGeom3dLinesComponent* component);
96 
99  virtual void unregisterComponent(DtGeom3dLinesComponent* component);
100 
103  virtual size_t registeredComponentCount(const DtModelSetId modelSetId) const;
104 
111  virtual double computeAltitude(const DtVector& point, bool& geoCentric) const;
112 
122  virtual bool cull(void* cameraContext, const DtModelSetId modelSetId,
123  const DtVector& cameraPos, const Frustum_64& frustum);
124 
130  virtual void submit3dLinesForDraw(void* cameraContext,
131  std::vector<Dt3dLinesStagingBuffer*>& buffers);
132 
133  protected:
134 
138 
141  virtual void slot_coordinateSystemChanged();
142 
144  virtual void slot_preTick();
145 
153  static bool isSphereVisible(
154  const std::array<DtVector4<double>, 6>& cullingPlanes,
155  const DtVector3<double>& center, double radiusSquared);
156 
159  static void theCullJob(void* data);
160 
161  protected:
162 
165  struct CullJobData
166  {
167  std::vector<DtGeom3dLinesComponent*>* myComponents = nullptr;
168  size_t myBeginIndex = 0;
169  size_t myEndIndex = 0;
170  Dt3dLinesStagingBuffer* myBuffer = nullptr;
171  const std::array<DtVector4<double>, 6>* myCullingPlanes = nullptr;
172  unsigned int myCategoryFlags = 0;
173  };
174 
178  struct Buffer
179  {
180  Dt3dLinesStagingBuffer* myBuffer = nullptr;
183  };
184 
189  {
190  std::vector<Buffer*> myBuffers;
191  bool myCameraWasUsedDuringCull = true;
192  DtJobSplitter* myJobSplitter = nullptr;
193  };
194 
197  {
198  std::vector<DtGeom3dLinesComponent*> myComponents;
199  };
200 
202 
204 
205  // Local clone of the system wide coordinate system.
207 
208  // Flags that determine what categories of components are active.
210 
211  // Components are registered with an associated DtModelSetId and this
212  // map is used to map the DtModelSetId to the components associated with it.
213  std::unordered_map<DtModelSetId, PerModelSetComponents*> myPerModelSetComponents;
214 
215  // This map is read only during cull and render.
216  // It maps a cameraContext to associated staging data.
217  std::unordered_map<void*, PerCameraStaging*> myPerCameraStagingMap;
218 
219  // This vector handles new camera's when they are encountered
220  // during cull. The contents of the vector are handed to
221  // myPerCameraStagingMap to be processed in a thread safe way
222  // during update.
223  tbb::concurrent_vector<void*> myPendingCameras;
224  };
225 }
std::vector< DtGeom3dLinesComponent * > myComponents
Definition: DtGeom3dLinesSystem.h:198
A class responsible for processing DtGeom3dLinesComponent objects.
Definition: DtGeom3dLinesSystem.h:62
A structure to hold per camera data for staging. There will be one of these for every active camera T...
Definition: DtGeom3dLinesSystem.h:188
unsigned int myComponentCategoryFlags
Definition: DtGeom3dLinesSystem.h:209
tbb::concurrent_vector< void * > myPendingCameras
Definition: DtGeom3dLinesSystem.h:223
const char * creatorTypeName< DtGeom3dLinesSystem >()
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtGeom3dLinesSystem.h:44
DtJobSplitterJob myCullJob
Definition: DtGeom3dLinesSystem.h:182
this class is used to split work up between threads.
Definition: DtJobSplitter.h:64
4 dimensional vector
std::unordered_map< void *, PerCameraStaging * > myPerCameraStagingMap
Definition: DtGeom3dLinesSystem.h:217
A structure used to hold culling data per cull job. This is used in multithread culling tasks...
Definition: DtGeom3dLinesSystem.h:165
DtSignalConnectionManager myConnections
Definition: DtGeom3dLinesSystem.h:203
Camera forward declarations.
std::unordered_map< DtModelSetId, PerModelSetComponents * > myPerModelSetComponents
Definition: DtGeom3dLinesSystem.h:213
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:23
DtCoordinateSystem * myCoordinateSystem
Definition: DtGeom3dLinesSystem.h:206
Contains makVrv::DtJobSplitter class.
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
A class which represents a component for a set of 3d lines.
Definition: DtGeom3dLinesComponent.h:51
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
DtVirtualBaseClassCreator< DtGeom3dLinesSystem > DtGeom3dLinesSystemCreator
creator
Definition: DtGeom3dLinesSystem.h:37
A class which represents a buffer used for staging 3d line points. &quot;staging&quot; means collecting...
Definition: Dt3dLinesStagingBuffer.h:34
A structure to hold buffer data to use for culling and rendering. This is used in internal job splitt...
Definition: DtGeom3dLinesSystem.h:178
The DtCoordinateSystem is used to manage the current coordinate system of the scene.
Definition: DtCoordinateSystem.h:40
CullJobData myCullJobData
Definition: DtGeom3dLinesSystem.h:181
Base class to provide boost signal/slot management.
A structure to hold per model set components.
Definition: DtGeom3dLinesSystem.h:196
A generic structure to hold data for a job for use with DtJobSplitter.
Definition: DtJobSplitter.h:26
Camera class.
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
DtModelSetId
Definition: DtModelSetEnums.h:19
DtDe & myDe
Definition: DtGeom3dLinesSystem.h:201
Contains various enum classes relating to model sets.
std::vector< Buffer * > myBuffers
Definition: DtGeom3dLinesSystem.h:190
friend DtGeom3dLinesSystemCreator
Definition: DtGeom3dLinesSystem.h:64
Contains DLL export macros.

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)