VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtGroundClampingUpdater.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2022 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
12 
14 
15 #include <matrix/vlVector.h>
16 #include <matrix/vlTaitBryan.h>
17 
18 namespace makVrv
19 {
20  class DtIntersectionCache;
21  class DtIntersectorsContainer;
22  class DtCoordinateConverter;
23 
30  {
32 
33  public:
34 
37  {
38  ClampNone = 0,
39  ClampOrientation = 1,
40  ClampPosition = 2,
41  ClampUpright = 4,
42  ClampOrientationAndPosition = ClampOrientation | ClampPosition,
43  ClampOrientationAndUpright = ClampOrientation | ClampUpright,
44  ClampPositionAndUpright = ClampPosition | ClampUpright,
45  ClampAll = ClampOrientation | ClampPosition | ClampUpright
46  };
47 
48  public:
49 
52 
54  virtual ~DtGroundClampingUpdater();
55 
57  virtual void update( DtTime tNow );
58 
61  virtual void setGroundClampingEnabled(bool enabled);
62 
64  virtual void setMode(GroundClampingMode mode);
65 
67  bool isClamping() const;
68 
70  inline bool isClampingUp() const
71  {
72  return myMode & ClampUpright;
73  }
74 
76  inline bool isClampingOrientation() const
77  {
78  return myMode & ClampOrientation;
79  }
80 
82  inline bool isClampingPosition() const
83  {
84  return myMode & ClampPosition;
85  }
86 
94  virtual void setCullCylinderRadiusScale(float scale);
95 
97  virtual void setClampAlways(bool enabled);
98 
100  virtual void setCheckForCulling(bool);
101 
104  virtual void doGroundClamp( DtTime tNow );
105 
108  virtual void setClampTimeThreshold(double);
109 
110  protected:
111 
113  static void computePerpendicularRotation( const DtVector& pos,
114  const DtVector& hitNormal, const DtTaitBryan& orientation,
115  DtTaitBryan& output );
116 
120  bool computeGroundClampingHit(const DtVector& up,const DtVector& unclampedPosition, DtVector& hitLocation, DtVector& hitNormal);
121 
123  void computeIntersectionOrigin(const DtVector& up, const DtVector& unclampedPosition, DtVector& origin) const;
124 
126  bool needClampThisTick() const;
127 
130  bool targetIsMoving( const DtVector& newPos, const DtVector& lastPos ) const;
131 
134  bool targetIsTurning( const DtTaitBryan& newOri, const DtTaitBryan& lastOri ) const;
135 
137  bool checkCulling(const DtVector& up) const;
138 
139  void clampToWater( DtTime tNow );
140 
141  virtual void setNextUpdaterWithoutManagerPlacement(DtSceneObjectUpdater* updater);
142 
144  virtual void slot_coordinateSystemChanged();
145 
146  protected:
147  // handy helper func to determine the delta between circle angles,
149  static double angleDifference( double prev, double curr );
150 
151  protected:
152 
153  static const double theClampTimeThreshold;
154  static const double theMaxCacheInterval;
155  static const double theClampDistThreshold;
156  static const double theClampOrientThreshold;
157  static const double theIsectLength;
158 
163 
166 
169 
172 
176 
179 
182 
185 
188 
191 
194 
197 
198  DtIntersectorsContainer* myIntersectors = nullptr;
199 
200  // local clone of the current system wide coordinate system converter.
201  // for thread safety.
202  DtCoordinateConverter* myCoordinateConverter = nullptr;
203  };
204 }
static const double theMaxCacheInterval
Definition: DtGroundClampingUpdater.h:154
DtVector myUnclampedPosition
Definition: DtGroundClampingUpdater.h:164
bool isClampingOrientation() const
Check to see if the mode supports clamping orientation.
Definition: DtGroundClampingUpdater.h:76
DtCoordinateConverter is the base class for &#39;local (cig) to geocentric&#39; converters.
Definition: DtCoordinateConverter.h:25
bool myHaveLastClampedPosition
Definition: DtGroundClampingUpdater.h:159
voidpf uLong int origin
Definition: ioapi.h:42
DtIntersectionCache * myIntersectionCache
Ground clamping optimization variables.
Definition: DtGroundClampingUpdater.h:181
Scene Object Updater.
Definition: DtSceneObjectUpdater.h:40
Utility class that contains intersectors for all model sets in the system (3d, xr, 2d) Use an object of this class when all models sets can be possibly needed. When you know which model set you need, you can just use the DtIntersectorCreator to create an intersector for a model set Models sets corresponding to 3d, xr and 2d are created by default (these correspond to values of 0, 1 and 5) Additional model sets can be registered with DtIntersectorsContainer::registerModelSet.
Definition: DtIntersectorsContainer.h:37
bool myCheckForCull
Whether or not to check to see if object is culled. Default is true.
Definition: DtGroundClampingUpdater.h:193
DtTaitBryan myUnclampedOrientation
Definition: DtGroundClampingUpdater.h:165
DtVector myLastUnclampedPosition
Definition: DtGroundClampingUpdater.h:167
bool isClampingUp() const
Check to see if the mode supports clamping up.
Definition: DtGroundClampingUpdater.h:70
DtTaitBryan myLastClampedOrientation
Definition: DtGroundClampingUpdater.h:162
Contains the declaration for makVrv::DtSceneObjectUpdater.
DtSurfaceClampingUpdater is an updater that is given a position and orientation, and will clamp those...
Definition: DtSurfaceClampingUpdater.h:29
GroundClampingMode myMode
The type of clamping this updater is doing.
Definition: DtGroundClampingUpdater.h:178
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
An abstract interface for managing cached intersection information and determining if the cache needs...
Definition: DtIntersectionCache.h:22
DtVector myLastClampedPosition
Definition: DtGroundClampingUpdater.h:161
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
double myLastCacheUpdateTime
Definition: DtGroundClampingUpdater.h:170
double myLastClampTime
Definition: DtGroundClampingUpdater.h:171
static const double theClampTimeThreshold
Definition: DtGroundClampingUpdater.h:153
static const double theClampDistThreshold
Definition: DtGroundClampingUpdater.h:155
Base class to provide boost signal/slot management.
bool myClampCulledLastFrame
Was the unclamped position outside the cull cylinder last frame.
Definition: DtGroundClampingUpdater.h:190
bool myClampAlwaysFlag
Always clamp regardless of time.
Definition: DtGroundClampingUpdater.h:187
const char int mode
Definition: ioapi.h:38
double myClampTimeThreshold
Definition: DtGroundClampingUpdater.h:195
float myCullCylinderScale
Object is not ground clamped if the camera is farther away than this times the object&#39;s bounding radi...
Definition: DtGroundClampingUpdater.h:175
static const double theClampOrientThreshold
Definition: DtGroundClampingUpdater.h:156
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
bool myBecameEnabledThisTick
Definition: DtGroundClampingUpdater.h:196
bool myHaveLastClampedOrientation
Definition: DtGroundClampingUpdater.h:160
bool myGroundClampingEnabled
Ground clamping state.
Definition: DtGroundClampingUpdater.h:184
static const double theIsectLength
Definition: DtGroundClampingUpdater.h:157
DtTaitBryan myLastUnclampedOrientation
Definition: DtGroundClampingUpdater.h:168
bool isClampingPosition() const
Check to see if the mode supports clamping position.
Definition: DtGroundClampingUpdater.h:82
DtGroundClampingUpdater is a scene object updater that is given a position and orientation, and depending on how it is configured, updates a scene object with a position and orientation that are clamped to the underlying terrain.
Definition: DtGroundClampingUpdater.h:29
GroundClampingMode
Ground Clamping Modes.
Definition: DtGroundClampingUpdater.h:36

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)