VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtIntersector.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
10 
11 #pragma once
12 #include <vrvCore/vrvCore.h>
13 #include <vrvCore/DtUniqueID.h>
14 #include <vrvCore/DtTickable.h>
15 
18 #include <boost/unordered_map.hpp>
19 #include <vector>
20 #include <map>
21 
22 
23 namespace makVrv
24 {
25  class DtDe;
26  class DtChannel;
27 
28  class DtSceneObjectAgent;
29  class Dt3DSegmentedLineModelAgent;
30 
34  {
35  public:
36  // For this purpose, a triangle is described as 9 doubles; x0, y0, z0,
37  // x1, x2, etc...
38  typedef std::vector<double> DtIntersectTriangle;
39 
40  public:
43 
46 
48  DtIntersectorResult& operator=( const DtIntersectorResult& orig );
49 
51  bool operator==(const DtIntersectorResult&) const;
52 
54  bool operator!=(const DtIntersectorResult& rhs) const
55  {
56  return !(*this == rhs);
57  }
58 
59  public:
60 
64 
66  double x;
67 
69  double y;
70 
72  double z;
73 
76  double normalX;
77 
80  double normalY;
81 
84  double normalZ;
85 
88 
92 
95 
98 
101  double startX;
102 
105  double startY;
106 
109  double startZ;
110 
113  double endX;
114 
117  double endY;
118 
121  double endZ;
122  };
123 
124  class DtDrawnIntersector;
125 
130  {
131  public:
132 
136  {
137  AllNodes = 0,
138  PickableNodes = 1,
139  SupportNodes = 2,
140  NodesThatReceivesShadows = 4,
141  NodesThatCastsShadows = 8,
142  OsgEarthTerrainSkin = 16,
143  TerrainPatchInsetNotOsgEarth = 32
144  };
145 
147  {
148  DynamicOceanPropertyMsl = 0,
149  DynamicOceanPropertyWaves = 1,
150  DynamicOceanPropertyIgnore = 2
151  };
152 
154  typedef std::vector<DtIntersectorResult> DtIntersections;
155 
157  DtIntersector( DtDe& de );
158 
160  virtual ~DtIntersector();
161 
164  virtual void setDynamicOceanProperties( DynamicOceanProperties properties );
165 
167  DynamicOceanProperties dynamicOceanProperties() const;
168 
183  virtual bool findNearestIntersectionToPoint(double x, double y, double z,
184  double vx, double vy, double vz, DtIntersectorResult& intersection,
185  IntersectProperties properties = AllNodes,
186  std::vector<DtElementID>* ignoreList = 0, bool returnTriangle = false,
187  double maxIsectorLength = -1., bool useHighLod = false ) = 0;
188 
196  virtual bool findAllIntersectionsThroughPoint( double x, double y, double z,
197  double vx, double vy, double vz, DtIntersections& intersections,
198  IntersectProperties properties = AllNodes,
199  std::vector<DtElementID>* ignoreList = 0, bool sort = true,
200  bool useHighLod = false ) = 0;
201 
208  virtual bool findFirstIntersectWithLineSegment(
209  double x, double y, double z, double end_x, double end_y, double end_z,
211  IntersectProperties properties=AllNodes,
212  std::vector<DtElementID>* ignoreList=0,
213  bool useHighLod = false) = 0;
214 
221  virtual bool findAllIntersectWithLineSegment(
222  double x, double y, double z, double end_x, double end_y, double end_z,
223  DtIntersections& intersections,
224  IntersectProperties properties=AllNodes,
225  std::vector<DtElementID>* ignoreList=0, bool sort=true,
226  bool useHighLod = false ) = 0;
227 
233  virtual bool pick( DtChannel& channel, double mx, double my,
235  IntersectProperties properties=AllNodes,
236  std::vector<DtElementID>* ignoreList=0) = 0;
237 
242  virtual bool pickAll( DtChannel* channel, double mx, double my,
243  DtIntersections& intersections,
244  IntersectProperties properties=AllNodes,
245  std::vector<DtElementID>* ignoreList=0) = 0;
246 
248  virtual void setDefaultMaxClamp(double maximumIsectorLength);
256  virtual double defaultMaxClamp() const;
258 
259  protected:
262 
265  struct CachedPick
266  {
268  : simTime(0.0)
269  , channel(0)
270  , mx(0)
271  , my(0)
272  , properties(DtIntersector::AllNodes)
273  , ignoreList(0)
274  {
275  }
276 
277  bool operator==(const CachedPick& b)
278  {
279  return simTime == b.simTime &&
280  channel == b.channel &&
281  mx == b.mx &&
282  my == b.my &&
283  properties == b.properties &&
284  ignoreList == b.ignoreList;
285  }
286 
287  double simTime;
289  double mx;
290  double my;
292  std::vector<DtElementID>* ignoreList;
293  };
294 
299 
300  };
301 
303  {
304  public:
305  DtDrawnIntersector( DtDe& de );
306  virtual ~DtDrawnIntersector();
307 
308  virtual void draw( const DtIntersector::DtIntersections& results );
309 
310  virtual void setColors( const DtColorValue& failedColor,
311  const DtColorValue& oddColor, const DtColorValue& evenColor );
312 
313  protected:
315  typedef std::vector<Dt3DSegmentedLineModelAgent*> LineModelList;
317  typedef std::vector<DtSceneObjectAgent*> SceneObjectList;
322  };
323 
325  {
326  public:
328  virtual ~DtDrawnIntersectorManager();
329 
330  virtual void update( DtTime tNow );
331 
332  virtual void drawIntersection(
333  const DtIntersector::DtIntersections& results, double duration );
334 
335  protected:
337 
338  typedef std::multimap<double, DtDrawnIntersector* > DtDrawnIntersectorMap;
340  };
341 
342 
346  {
347  public:
349  virtual ~DtIntersectorManager();
350 
353  static DtIntersectorManager& instance(DtDe& de);
354 
356  static void registerInstance(DtDe& de, DtIntersectorManager* anInstance);
357 
359  virtual DtIntersector& modelSetIntersector(int modelSet);
360 
362  virtual DtIntersector& characterIntersector();
363 
365  virtual void registerCharacterIntersector(DtIntersector* intersector);
366 
368  virtual void drawIntersection( const DtIntersectorResult& result,
369  double duration );
370 
371  virtual void drawIntersection(
372  const DtIntersector::DtIntersections& results, double duration );
373 
374  protected:
376 
377  protected:
378  typedef boost::unordered_map<int, DtIntersector*> IntersectorMap;
383  };
384 
388  {
389  public:
390 
393  static DtIntersectorCreator& instance(DtDe& de);
394 
396  static void registerInstance(DtDe& de, DtIntersectorCreator* anInstance);
397 
399  virtual DtIntersector* create( DtDe& de, int modelSet ) = 0;
400  };
401 }
DtColorValue class.
IntersectProperties
The IntersectProperties enum is a flag set that indicates the.
Definition: DtIntersector.h:135
IntersectProperties properties
Definition: DtIntersector.h:291
std::vector< Dt3DSegmentedLineModelAgent * > LineModelList
Definition: DtIntersector.h:315
double normalX
The x coordinate of the vector normal to the point of intersection, if requested. ...
Definition: DtIntersector.h:76
Virtual base class.
Definition: DtVirtualBaseClass.h:19
double endY
for debugging, the y coordinate of the line segment that was used to end the intersection ...
Definition: DtIntersector.h:117
DtIntersectorResult myLastResult
Definition: DtIntersector.h:297
CachedPick()
Definition: DtIntersector.h:267
bool hasIntersectTriangle
Indicates whether or not the DtIntersectorResult contains intersected triangle data.
Definition: DtIntersector.h:91
double normalZ
The z coordinate of the vector normal to the point of intersection, if requested. ...
Definition: DtIntersector.h:84
DtDrawnIntersectorManager myDrawnIntersectorManager
Definition: DtIntersector.h:382
DtIntersector is an abstract class that provides the interface for requesting intersections with the ...
Definition: DtIntersector.h:129
DtColorValue myEvenSegmentIntersectorColor
Definition: DtIntersector.h:321
CachedPick myLastPick
Definition: DtIntersector.h:295
Descriptor for a single intersection result.
Definition: DtIntersector.h:33
std::vector< DtIntersectorResult > DtIntersections
A vector of DtIntersectionRecords.
Definition: DtIntersector.h:154
DtDe & myDe
Definition: DtIntersector.h:260
An abstract base class for objects that require updates.
Definition: DtTickable.h:26
Definition: DtIntersector.h:302
DtIntersectTriangle isectTriangle
The triangle intersection, if requested.
Definition: DtIntersector.h:94
DtDrawnIntersectorMap myDrawnIntersectorMap
Definition: DtIntersector.h:339
double y
y coordinate, in database coordinates of the intersection
Definition: DtIntersector.h:69
bool hasIntersect
Indicate whether this DtIntersectorResult object actually contains the result of an intersection...
Definition: DtIntersector.h:63
double startY
for debugging, the y coordinate of the line segment that was used to start the intersection ...
Definition: DtIntersector.h:105
DynamicOceanProperties
Definition: DtIntersector.h:146
bool myLastPickSucceeded
Definition: DtIntersector.h:296
The abstract Channel Class.
Definition: DtChannel.h:30
DtColorValue myFailedIntersectorColor
Definition: DtIntersector.h:319
double startX
for debugging, the x coordinate of the line segment that was used to start the intersection ...
Definition: DtIntersector.h:101
Contains makVrv::DtVirtualBaseClass class.
DtUniqueID id
The elementID of the node intersected.
Definition: DtIntersector.h:87
double z
z coordinate, in database coordinates of the intersection
Definition: DtIntersector.h:72
double normalY
The y coordinate of the vector normal to the point of intersection, if requested. ...
Definition: DtIntersector.h:80
DtDe & myDe
Definition: DtIntersector.h:314
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
bool operator==(const CachedPick &b)
Definition: DtIntersector.h:277
double simTime
Definition: DtIntersector.h:287
double mx
Definition: DtIntersector.h:289
DynamicOceanProperties myDynamicOceanProperties
Definition: DtIntersector.h:261
Definition: DtIntersector.h:324
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
SceneObjectList mySceneObjects
Definition: DtIntersector.h:318
The DtIntersectorManager class manages instances of inter sectors.
Definition: DtIntersector.h:345
std::multimap< double, DtDrawnIntersector * > DtDrawnIntersectorMap
Definition: DtIntersector.h:338
DT_DLL_vrfutil bool intersection(const DtRailSegment *currentSegment, const DtRailSegment *nextSegment)
Given two segments, determine if where they meet is an intersection or just a bend in the road...
std::vector< DtSceneObjectAgent * > SceneObjectList
Definition: DtIntersector.h:317
Contains the declaration for makVrv::DtTickable.
CachedPick is a container class for the information to cache a pick request.
Definition: DtIntersector.h:265
DtDe & myDe
Definition: DtIntersector.h:379
bool operator==(const DtTextureAtlasIndexParser::StringOrFloatAttrib &lhs, const DtTextureAtlasIndexParser::StringOrFloatAttrib &rhs)
needed for search comparison code
Definition: DtTextureAtlasIndexParser.h:153
bool operator!=(const DtIntersectorResult &rhs) const
Inequality Operator.
Definition: DtIntersector.h:54
Contains makVrv::DtUniqueID type.
double endZ
for debugging, the z coordinate of the line segment that was used to end the intersection ...
Definition: DtIntersector.h:121
DtDe & myDe
Definition: DtIntersector.h:336
double x
x coordinate, in database coordinates of the intersection
Definition: DtIntersector.h:66
double myDefaultMaxClamp
Definition: DtIntersector.h:298
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
DtColorValue myOddSegmentIntersectorColor
Definition: DtIntersector.h:320
Abstract creator base class.
Definition: DtIntersector.h:387
double my
Definition: DtIntersector.h:290
boost::unordered_map< int, DtIntersector * > IntersectorMap
Definition: DtIntersector.h:378
IntersectorMap myIntersectors
Definition: DtIntersector.h:380
LineModelList myLineModels
Definition: DtIntersector.h:316
std::vector< double > DtIntersectTriangle
Definition: DtIntersector.h:38
std::vector< DtElementID > * ignoreList
Definition: DtIntersector.h:292
Template for Color values in [0,1] range.
Definition: DtColorValue.h:20
double startZ
for debugging, the z coordinate of the line segment that was used to start the intersection ...
Definition: DtIntersector.h:109
double endX
for debugging, the x coordinate of the line segment that was used to end the intersection ...
Definition: DtIntersector.h:113
DtChannel * channel
Definition: DtIntersector.h:288
bool dynamicOcean
Indicates whether the intersection was with dynamic ocean, if in use.
Definition: DtIntersector.h:97
DtIntersector * myCharacterIntersector
Definition: DtIntersector.h:381
Contains DLL export macros.

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)