VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
staticLocationStateComponent.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2023 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
9 #include <tbb/mutex.h>
10 
11 class Coordinate_System;
12 
13 namespace makVrf
14 {
17 
21  {
22  public:
24 
25 
28  : DtLocationStateComponent(storage)
29  {
30  }
31  };
32 
35  {
36  public:
41  virtual ~DtStaticLocationStateComponentNextFrame() override;
42 
45  virtual const DtUUID& hostGlobalId() const override;
48  virtual void setHostGlobalId(const DtUUID& id) override;
49 
52  virtual const DtVector location() const override;
55  virtual void setLocation(const DtVector&) override;
56 
59  virtual const bool locationChanged() const override;
60 
63  virtual const double heading() const override;
66  virtual const double pitch() const override;
69  virtual const double roll() const override;
70 
73  virtual const int objectAttachMode() const override;
76  virtual const DtVector& worldPosition() const override;
79  virtual const DtVector& relativePosition() const override;
82  virtual const DtVector& parentPosition() const override;
85  virtual const DtVector& localPosition() const override;
88  virtual const DtDcm& worldOrientationMatrix() const override;
91  virtual const bool localPositionIsValid() const override;
94  virtual const bool frozen() const override;
97  virtual void setFrozen(const bool&) override;
98 
101  virtual const DtDcm& parentOrientationMatrix() const override;
104  virtual void setLocalOrientationMatrix(const DtDcm&) override;
105 
108  virtual const DtDcm& localOrientationMatrix() const override;
109 
112  virtual void setLocalPosition(const DtVector&) override;
115  virtual void setWorldPosition(const DtVector&) override;
118  virtual void setParentPosition(const DtVector&) override;
121  virtual void setWorldOrientationMatrix(const DtDcm&) override;
122 
125  virtual const DtTaitBryan orientation() const override;
128  virtual void setOrientation(const DtTaitBryan&) override;
129 
132  virtual const DtTaitBryan& worldOrientation() const override;
135  virtual const DtTaitBryan& topographicOrientation() const override;
138  virtual const DtTaitBryan& parentOrientation() const override;
141  virtual const DtTaitBryan& localOrientation() const override;
142 
145  virtual void setLocalOrientation(const DtTaitBryan&) override;
148  virtual void setLocalOrientationWrtDatabase(const DtTaitBryan&) override;
151  virtual const DtTaitBryan& localOrientationWrtDatabase() const override;
154  virtual void setWorldOrientation(const DtTaitBryan&) override;
157  virtual void setParentOrientation(const DtTaitBryan&) override;
158 
161  void setCoordinateSystem(const Coordinate_System* cs);
164  virtual void setKinematicState(const DtRwVrfKinematicState&) override;
167  virtual const DtRwVrfKinematicState& kinematicState() const override;
168 
171  const bool spatiallyFrozen() const;
172 
174  virtual void makeWritable() override;
175 
177  virtual void makeReadOnly() override;
178 
180  void advanceFrame();
181 
182  protected:
185  };
186 
189  {
190  public:
195  virtual ~DtStaticLocationStateComponentCurrentFrame() override;
196 
199  virtual const DtUUID& hostGlobalId() const override;
200 
203  virtual const bool localPositionIsValid() const override;
206  virtual const DtVector location() const override;
207 
210  virtual const DtVector& worldPosition() const override;
213  virtual const DtVector& relativePosition() const override;
216  virtual const DtVector& parentPosition() const override;
217 
220  virtual const DtDcm& parentOrientationMatrix() const override;
221 
224  virtual const DtVector& localPosition() const override;
225 
228  virtual const int objectAttachMode() const override;
231  virtual const DtDcm& worldOrientationMatrix() const override;
234  virtual const DtDcm& localOrientationMatrix() const override;
237  virtual const DtTaitBryan& localOrientationWrtDatabase() const override;
238 
241  virtual const double heading() const override;
244  virtual const double pitch() const override;
247  virtual const double roll() const override;
248 
251  virtual const DtTaitBryan orientation() const override;
254  virtual const DtTaitBryan& worldOrientation() const override;
257  virtual const DtTaitBryan& topographicOrientation() const override;
260  virtual const DtTaitBryan& parentOrientation() const override;
263  virtual const DtTaitBryan& localOrientation() const override;
266  virtual const bool frozen() const override;
267 
270  virtual const bool locationChanged() const override;
271 
274  void setCoordinateSystem(const Coordinate_System* cs);
276  void refreshKinematicState() const;
279  virtual const DtRwVrfKinematicState& kinematicState() const override;
280 
283  const bool spatiallyFrozen() const;
284 
285  protected:
289  void setLocationChanged(bool b);
292  virtual void setKinematicState(const DtRwVrfKinematicState&) override;
293 
294  protected:
296  mutable tbb::mutex myKinematicStateMutex;
301  };
302 
306  {
307  public:
311 
314  bool isDoubleBuffered() { return true; };
317  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
320  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
323  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
324 
326  virtual void setCoordinateSystem(const Coordinate_System*) override;
327 
329  virtual void updateDataStorage() override;
330 
333  virtual void updateStateData(DtStateData* sd) override
334  {
335  myCurrentFrameState.updateStateData(sd);
336  myNextFrameState.updateStateData(sd);
337  }
338 
341  virtual bool forceAdvance() override;
342 
344  virtual void aboutToBeDeleted() override
345  {
347  myCurrentFrameState.aboutToBeDeleted();
348  myNextFrameState.aboutToBeDeleted();
349  }
350 
351  protected:
356  };
357 
361 }
362 
UUID is a unique ID wrapper class.
Definition: uuid.h:59
DtStaticLocationStateComponentNextFrame myNextFrameState
Next-frame (write) state object.
Definition: staticLocationStateComponent.h:355
DtRwVrfKinematicState * myKinematicState
Kinematic state buffer for next-frame write access.
Definition: staticLocationStateComponent.h:184
virtual void aboutToBeDeleted() override
Notifies both frame states that the owning object is about to be deleted.
Definition: staticLocationStateComponent.h:344
The DtLocationStateComponent interface contains the interface that all DtLocationStateComponents can ...
Definition: locationStateComponent.h:25
The location only state component will simply deal with kinematic state. This is an object whose loca...
Definition: staticLocationStateComponent.h:20
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
3) Define the current frame class. This will be used for read access.
Definition: staticLocationStateComponent.h:188
2) Define the next frame class. This will be used for write access.
Definition: staticLocationStateComponent.h:34
Definition: coordSystem.h:54
virtual const DtFrameStateInterface * currentFrameState() const override
Returns a pointer to the current-frame (read) state interface.
Definition: staticLocationStateComponent.h:317
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
virtual void updateStateData(DtStateData *sd) override
Updates the state data pointer in both current- and next-frame sub-objects.
Definition: staticLocationStateComponent.h:333
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Macro to define all required static and virtual state component type methods. Place in the public sec...
Definition: stateComponent.h:272
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: staticLocationStateComponent.h:305
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
virtual const DtFrameStateInterface * nextFrameState() const override
Returns a const pointer to the next-frame state interface.
Definition: staticLocationStateComponent.h:323
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
bool myLocationChanged
Tracks whether the location changed in the most recently committed frame.
Definition: staticLocationStateComponent.h:300
tbb::mutex myKinematicStateMutex
Mutex protecting concurrent reads of the kinematic state.
Definition: staticLocationStateComponent.h:296
virtual DtFrameStateInterface * nextFrameState() override
Returns a mutable pointer to the next-frame (write) state interface.
Definition: staticLocationStateComponent.h:320
DtStaticLocationStateComponentCurrentFrame myCurrentFrameState
Current-frame (read) state object.
Definition: staticLocationStateComponent.h:353
A subclass extension of DtRwSimKinematicState for VRF-specific movable objects. This class is a DtRwS...
Definition: rwVrfKinematicState.h:28
#define DT_DLL_vrfStateData
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfStateDataDefines.h:29
DtRwVrfKinematicState * myKinematicState
Cached kinematic state for the current frame.
Definition: staticLocationStateComponent.h:298
DtStateComponentCreator< DtStaticLocationStateComponentImplementation > DtStaticLocationStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: staticLocationStateComponent.h:360
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
bool isDoubleBuffered()
Returns true, indicating this component is double-buffered.
Definition: staticLocationStateComponent.h:314

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)