VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtDebugShapes.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2024 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
15 
16 #include <vrvMath/DtMatrix3.h>
17 #include <vrvMath/DtVector3.h>
18 #include <vrvMath/DtVector4.h>
19 
22 
23 #include <matrix/vlVector.h>
24 
25 #include <unordered_map>
26 #include <vector>
27 
28 
29 namespace makVrv
30 {
31  // forward Declarations
32  class DtDe;
34 
37 
39  template <>
40  inline const char* creatorTypeName<DtDebugShapes>() { return "DtDebugShapesCreator"; }
41 
61  {
63 
64  public:
65 
66  virtual ~DtDebugShapes();
67 
69  DtDebugShapes() = delete;
70 
73  const DtDebugShapes& other) = delete;
74 
76  DtDebugShapes& operator=(
77  const DtDebugShapes& other) = delete;
78 
79  public:
80 
87  virtual void addLine(const std::string name, const Vector3_64& point0,
88  const Vector3_64& point1, const Vector4_32& color, float aliveTime = 5.0f);
89 
92  virtual void removeLine(const std::string name);
93 
99  virtual DtGeom3dLinesComponent* addMultiLine(const std::string name, float aliveTime = 5.0f);
100 
103  virtual void removeMultiLine(const std::string name);
104 
112  virtual void addBox(const std::string name, const Vector3_64& center, const Matrix3_32& rotation,
113  const Vector3_32& size, const Vector4_32& color, float aliveTime = 5.0f);
114 
117  virtual void removeBox(const std::string name);
118 
125  virtual void addSphere(const std::string name, const Vector3_64& center, float radius,
126  const Vector4_32& color, float aliveTime = 5.0f);
127 
130  virtual void removeSphere(const std::string name);
131 
132  protected:
133 
136  DtDebugShapes(DtDe& de);
137 
139  virtual void updateLines(double timeStep);
140 
142  virtual void updateMultiLines(double timeStep);
143 
145  virtual void updateBoxes(double timeStep);
146 
148  virtual void updateSpheres(double timeStep);
149 
151  virtual void slot_preTick();
152 
153  protected:
154 
156 
158 
160 
162  struct DtDebugLine
163  {
164  // How much time left to keep the object active.
165  float myAliveTime = 0.0f;
166 
167  // Handle within the shared DtGeom3dLinesComponent for lines.
168  int myHandle = 0;
169  };
170 
173  {
174  // How much time left to keep the object active.
175  float myAliveTime = 0.0f;
176 
177  // The exclusive lines component used for this multiline object.
178  DtGeom3dLinesComponent* myComponent = nullptr;
179  };
180 
182  struct DtDebugBox
183  {
184  // How much time left to keep the object active.
185  float myAliveTime = 0.0f;
186 
187  // Handles within the shared DtGeom3dLinesComponent for boxes.
188  // Each box has 12 lines.
189  int myHandles[12] = {};
190  };
191 
194  {
195  // How much time left to keep the object active.
196  float myAliveTime = 0.0f;
197 
198  // Handle within the shared DtGeom3dSpheresComponent for spheres.
199  int myHandle = 0;
200  };
201 
205  {
206  struct comp
207  {
208  bool operator() (const std::string& lhs, const std::string rhs) const;
209  };
210 
211  struct hash
212  {
213  size_t operator() (std::string str) const;
214  };
215  };
216 
217  typedef std::unordered_map<std::string, DtDebugLine,
219 
220  typedef std::unordered_map<std::string, DtDebugMultiLine,
222 
223  typedef std::unordered_map<std::string, DtDebugBox,
225 
226  typedef std::unordered_map<std::string, DtDebugSphere,
228 
230  struct LineSet
231  {
233  int myNextHandle = 0;
234  float myComponentUseAliveTime = 0.0f;
235  DtGeom3dLinesComponent* myComponent = nullptr;
236  };
237 
240  {
242  };
243 
245  struct BoxSet
246  {
248  int myNextHandle = 0;
249  float myComponentUseAliveTime = 0.0f;
250  DtGeom3dLinesComponent* myComponent = nullptr;
251  };
252 
254  struct SphereSet
255  {
257  int myNextHandle = 0;
258  float myComponentUseAliveTime = 0.0f;
259  DtGeom3dSpheresComponent* myComponent = nullptr;
260  };
261 
266  };
267 }
BoxMap myMap
Definition: DtDebugShapes.h:247
std::unordered_map< std::string, DtDebugBox, CaseInsensitiveUnorderedMap::hash, CaseInsensitiveUnorderedMap::comp > BoxMap
Definition: DtDebugShapes.h:224
std::unordered_map< std::string, DtDebugLine, CaseInsensitiveUnorderedMap::hash, CaseInsensitiveUnorderedMap::comp > LineMap
Definition: DtDebugShapes.h:218
3 dimensional matrix
A class which represents a component for a set of 3d spheres.
Definition: DtGeom3dSpheresComponent.h:48
MultiLineSet myMultiLineSet
Definition: DtDebugShapes.h:263
SphereSet mySphereSet
Definition: DtDebugShapes.h:265
voidpf void uLong size
Definition: ioapi.h:39
A structure used to contain a compare operator and a hash operator for use with a case insensitive st...
Definition: DtDebugShapes.h:204
4 dimensional vector
double myLastSimulationTime
Definition: DtDebugShapes.h:159
BoxSet myBoxSet
Definition: DtDebugShapes.h:264
3 dimensional vector
A structure used to hold information for a debug line.
Definition: DtDebugShapes.h:162
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:23
A structure used to hold information for a debug sphere.
Definition: DtDebugShapes.h:193
A structure to organize information about boxes.
Definition: DtDebugShapes.h:245
friend DtDebugShapesCreator
Definition: DtDebugShapes.h:62
std::unordered_map< std::string, DtDebugSphere, CaseInsensitiveUnorderedMap::hash, CaseInsensitiveUnorderedMap::comp > SphereMap
Definition: DtDebugShapes.h:227
A structure to organize information about lines.
Definition: DtDebugShapes.h:230
#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
DtSignalConnectionManager myConnections
Definition: DtDebugShapes.h:157
DtDe & myDe
Definition: DtDebugShapes.h:155
std::unordered_map< std::string, DtDebugMultiLine, CaseInsensitiveUnorderedMap::hash, CaseInsensitiveUnorderedMap::comp > MultiLineMap
Definition: DtDebugShapes.h:221
MultiLineMap myMap
Definition: DtDebugShapes.h:241
Base class to provide boost signal/slot management.
A structure used to hold information for a debug line set.
Definition: DtDebugShapes.h:172
A structure to organize information about spheres.
Definition: DtDebugShapes.h:254
3 dimensional matrix
Definition: DtMatrix3.h:20
LineMap myMap
Definition: DtDebugShapes.h:232
LineSet myLineSet
Definition: DtDebugShapes.h:262
A structure to organize information about multilines.
Definition: DtDebugShapes.h:239
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
Contains makVrv::DtGeom3dSpheresComponent class declaration.
Contains makVrv::DtGeom3dLinesComponent class declaration.
SphereMap myMap
Definition: DtDebugShapes.h:256
A structure used to hold information for a debug box.
Definition: DtDebugShapes.h:182
This class can be used to help you visually debug lines and boxes.
Definition: DtDebugShapes.h:60
DtVirtualBaseClassCreator< DtDebugShapes > DtDebugShapesCreator
creator
Definition: DtDebugShapes.h:33
const char * creatorTypeName< DtDebugShapes >()
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtDebugShapes.h:40
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)