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) 2023 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  void addLine(const char* name, const DtVector3<double>& point0,
88  const DtVector3<double>& point1, const DtVector4<float>& color, float aliveTime = 5.0f);
89 
95  DtGeom3dLinesComponent* addMultiLine(const char* name, float aliveTime = 5.0f);
96 
104  void addBox(const char* name, const DtVector3<double>& center, const DtMatrix3<float>& rotation,
105  const DtVector3<float>& size, const DtVector4<float>& color, float aliveTime = 5.0f);
106 
113  void addSphere(const char* name, const DtVector3<double>& center, float radius,
114  const DtVector4<float>& color, float aliveTime = 5.0f);
115 
116  protected:
117 
120  DtDebugShapes(DtDe& de);
121 
123  virtual void updateLines(double timeStep);
124 
126  virtual void updateMultiLines(double timeStep);
127 
129  virtual void updateBoxes(double timeStep);
130 
132  virtual void updateSpheres(double timeStep);
133 
135  virtual void slot_preTick();
136 
137  protected:
138 
140 
142 
144 
146  struct DtDebugLine
147  {
148  // How much time left to keep the object active.
149  float myAliveTime = 0.0f;
150 
151  // Handle within the shared DtGeom3dLinesComponent for lines.
152  int myHandle = 0;
153  };
154 
157  {
158  // How much time left to keep the object active.
159  float myAliveTime = 0.0f;
160 
161  // The exclusive lines component used for this multiline object.
162  DtGeom3dLinesComponent* myComponent = nullptr;
163  };
164 
166  struct DtDebugBox
167  {
168  // How much time left to keep the object active.
169  float myAliveTime = 0.0f;
170 
171  // Handles within the shared DtGeom3dLinesComponent for boxes.
172  // Each box has 12 lines.
173  int myHandles[12] = {};
174  };
175 
178  {
179  // How much time left to keep the object active.
180  float myAliveTime = 0.0f;
181 
182  // Handle within the shared DtGeom3dSpheresComponent for spheres.
183  int myHandle = 0;
184  };
185 
189  {
190  struct comp
191  {
192  bool operator() (const std::string& lhs, const std::string rhs) const;
193  };
194 
195  struct hash
196  {
197  size_t operator() (std::string str) const;
198  };
199  };
200 
201  typedef std::unordered_map<std::string, DtDebugLine,
203 
204  typedef std::unordered_map<std::string, DtDebugMultiLine,
206 
207  typedef std::unordered_map<std::string, DtDebugBox,
209 
210  typedef std::unordered_map<std::string, DtDebugSphere,
212 
214  struct LineSet
215  {
217  int myNextHandle = 0;
218  float myComponentUseAliveTime = 0.0f;
219  DtGeom3dLinesComponent* myComponent = nullptr;
220  };
221 
224  {
226  };
227 
229  struct BoxSet
230  {
232  int myNextHandle = 0;
233  float myComponentUseAliveTime = 0.0f;
234  DtGeom3dLinesComponent* myComponent = nullptr;
235  };
236 
238  struct SphereSet
239  {
241  int myNextHandle = 0;
242  float myComponentUseAliveTime = 0.0f;
243  DtGeom3dSpheresComponent* myComponent = nullptr;
244  };
245 
250  };
251 }
BoxMap myMap
Definition: DtDebugShapes.h:231
std::unordered_map< std::string, DtDebugBox, CaseInsensitiveUnorderedMap::hash, CaseInsensitiveUnorderedMap::comp > BoxMap
Definition: DtDebugShapes.h:208
std::unordered_map< std::string, DtDebugLine, CaseInsensitiveUnorderedMap::hash, CaseInsensitiveUnorderedMap::comp > LineMap
Definition: DtDebugShapes.h:202
3 dimensional matrix
A class which represents a component for a set of 3d spheres.
Definition: DtGeom3dSpheresComponent.h:48
MultiLineSet myMultiLineSet
Definition: DtDebugShapes.h:247
SphereSet mySphereSet
Definition: DtDebugShapes.h:249
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:188
4 dimensional vector
double myLastSimulationTime
Definition: DtDebugShapes.h:143
BoxSet myBoxSet
Definition: DtDebugShapes.h:248
3 dimensional vector
A structure used to hold information for a debug line.
Definition: DtDebugShapes.h:146
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
A structure used to hold information for a debug sphere.
Definition: DtDebugShapes.h:177
A structure to organize information about boxes.
Definition: DtDebugShapes.h:229
friend DtDebugShapesCreator
Definition: DtDebugShapes.h:62
std::unordered_map< std::string, DtDebugSphere, CaseInsensitiveUnorderedMap::hash, CaseInsensitiveUnorderedMap::comp > SphereMap
Definition: DtDebugShapes.h:211
A structure to organize information about lines.
Definition: DtDebugShapes.h:214
#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:141
DtDe & myDe
Definition: DtDebugShapes.h:139
std::unordered_map< std::string, DtDebugMultiLine, CaseInsensitiveUnorderedMap::hash, CaseInsensitiveUnorderedMap::comp > MultiLineMap
Definition: DtDebugShapes.h:205
MultiLineMap myMap
Definition: DtDebugShapes.h:225
Base class to provide boost signal/slot management.
A structure used to hold information for a debug line set.
Definition: DtDebugShapes.h:156
A structure to organize information about spheres.
Definition: DtDebugShapes.h:238
3 dimensional matrix
Definition: DtMatrix3.h:20
LineMap myMap
Definition: DtDebugShapes.h:216
LineSet myLineSet
Definition: DtDebugShapes.h:246
A structure to organize information about multilines.
Definition: DtDebugShapes.h:223
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
Contains makVrv::DtGeom3dSpheresComponent class declaration.
Contains makVrv::DtGeom3dLinesComponent class declaration.
SphereMap myMap
Definition: DtDebugShapes.h:240
A structure used to hold information for a debug box.
Definition: DtDebugShapes.h:166
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 Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)