VR-Forces 4.10 Class Documentation
 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) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
12 #include <matrix/vlVector.h>
13 #include <matrix/vlTaitBryan.h>
14 
15 namespace makVrv
16 {
17  class DtIntersectionCache;
18 
25  {
27 
28  public:
29 
32  {
33  ClampNone = 0,
34  ClampOrientation = 1,
35  ClampPosition = 2,
36  ClampUpright = 4,
37  ClampOrientationAndPosition = ClampOrientation | ClampPosition,
38  ClampOrientationAndUpright = ClampOrientation | ClampUpright,
39  ClampPositionAndUpright = ClampPosition | ClampUpright,
40  ClampAll = ClampOrientation | ClampPosition | ClampUpright
41  };
42 
43  public:
44 
47 
49  virtual ~DtGroundClampingUpdater();
50 
52  virtual void update( DtTime tNow );
53 
56  virtual void setEnabled(bool enabled);
57 
59  virtual void setMode(GroundClampingMode mode);
60 
62  bool isClamping() const;
63 
65  inline bool isClampingUp() const
66  {
67  return myMode & ClampUpright;
68  }
69 
71  inline bool isClampingOrientation() const
72  {
73  return myMode & ClampOrientation;
74  }
75 
77  inline bool isClampingPosition() const
78  {
79  return myMode & ClampPosition;
80  }
81 
89  virtual void setCullCylinderRadiusScale(float scale);
90 
92  virtual void setClampAlways(bool enabled);
93 
95  virtual void setCheckForCulling(bool);
96 
99  virtual void doGroundClamp( DtTime tNow );
100 
103  virtual void setClampTimeThreshold(double);
104 
105  protected:
106 
108  static void computePerpendicularRotation( const DtVector& pos,
109  const DtVector& hitNormal, const DtTaitBryan& orientation,
110  DtTaitBryan& output );
111 
115  bool computeGroundClampingHit(const DtVector& up,const DtVector& unclampedPosition, DtVector& hitLocation, DtVector& hitNormal);
116 
118  void computeIntersectionOrigin(const DtVector& up, const DtVector& unclampedPosition, DtVector& origin) const;
119 
121  bool needClampThisTick() const;
122 
125  bool targetIsMoving( const DtVector& newPos, const DtVector& lastPos ) const;
126 
129  bool targetIsTurning( const DtTaitBryan& newOri, const DtTaitBryan& lastOri ) const;
130 
132  bool checkCulling(const DtVector& up) const;
133 
134  void clampToWater( DtTime tNow );
135 
136  virtual void setNextUpdaterWithoutManagerPlacement(DtSceneObjectUpdater* updater);
137 
138  protected:
139  // handy helper func to determine the delta between circle angles,
141  static double angleDifference( double prev, double curr );
142 
143  protected:
144 
145  static const double theClampTimeThreshold;
146  static const double theMaxCacheInterval;
147  static const double theClampDistThreshold;
148  static const double theClampOrientThreshold;
149  static const double theIsectLength;
150 
155 
158 
161 
164 
168 
171 
174 
177 
180 
183 
186 
189  };
190 }
static const double theMaxCacheInterval
Definition: DtGroundClampingUpdater.h:146
DtVector myUnclampedPosition
Definition: DtGroundClampingUpdater.h:156
bool isClampingOrientation() const
Check to see if the mode supports clamping orientation.
Definition: DtGroundClampingUpdater.h:71
bool myHaveLastClampedPosition
Definition: DtGroundClampingUpdater.h:151
voidpf uLong int origin
Definition: ioapi.h:42
DtIntersectionCache * myIntersectionCache
Ground clamping optimization variables.
Definition: DtGroundClampingUpdater.h:173
Scene Object Updater.
Definition: DtSceneObjectUpdater.h:36
bool myCheckForCull
Whether or not to check to see if object is culled. Default is true.
Definition: DtGroundClampingUpdater.h:185
DtTaitBryan myUnclampedOrientation
Definition: DtGroundClampingUpdater.h:157
DtVector myLastUnclampedPosition
Definition: DtGroundClampingUpdater.h:159
bool myEnabledFlag
Ground clamping state.
Definition: DtGroundClampingUpdater.h:176
bool isClampingUp() const
Check to see if the mode supports clamping up.
Definition: DtGroundClampingUpdater.h:65
DtTaitBryan myLastClampedOrientation
Definition: DtGroundClampingUpdater.h:154
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:170
#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:153
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
double myLastCacheUpdateTime
Definition: DtGroundClampingUpdater.h:162
double myLastClampTime
Definition: DtGroundClampingUpdater.h:163
static const double theClampTimeThreshold
Definition: DtGroundClampingUpdater.h:145
static const double theClampDistThreshold
Definition: DtGroundClampingUpdater.h:147
bool myClampCulledLastFrame
Was the unclamped position outside the cull cylinder last frame.
Definition: DtGroundClampingUpdater.h:182
bool myClampAlwaysFlag
Always clamp regardless of time.
Definition: DtGroundClampingUpdater.h:179
const char int mode
Definition: ioapi.h:38
double myClampTimeThreshold
Definition: DtGroundClampingUpdater.h:187
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:167
static const double theClampOrientThreshold
Definition: DtGroundClampingUpdater.h:148
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
bool myBecameEnabledThisTick
Definition: DtGroundClampingUpdater.h:188
bool myHaveLastClampedOrientation
Definition: DtGroundClampingUpdater.h:152
static const double theIsectLength
Definition: DtGroundClampingUpdater.h:149
DtTaitBryan myLastUnclampedOrientation
Definition: DtGroundClampingUpdater.h:160
bool isClampingPosition() const
Check to see if the mode supports clamping position.
Definition: DtGroundClampingUpdater.h:77
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:24
GroundClampingMode
Ground Clamping Modes.
Definition: DtGroundClampingUpdater.h:31

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)