VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
waterSurfaceStateComponent.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 
12 
13 
14 
15 
16 namespace makVrf
17 {
18 
21  {
24  : myWaterCurrentSpeed(0.)
25  , myWaterCurrentDirection(0.)
26  , myTidalOffset(0.)
27  , mySwellState(0)
28  , mySwellStateDirection(0.)
29  , mySeaState(0)
30  , mySeaStateDirection(0.)
31  , mySurfaceTransparency(0.)
32  , myWindDrivenSeaStateEnabled(false)
33  , myChoppiness(0.)
34  , mySurgeDepth(0.)
35  , myDepthOffset(0.)
36  , myWindFetch(0.)
37  , myPriority(0)
38  {};
39 
43  {
44  *this = orig;
45  };
46 
51  {
52  {
53  myWaterCurrentSpeed = orig.myWaterCurrentSpeed;
54  myWaterCurrentDirection = orig.myWaterCurrentDirection;
55  myTidalOffset = orig.myTidalOffset;
56  mySwellState = orig.mySwellState;
57  mySwellStateDirection = orig.mySwellStateDirection;
58  mySeaState = orig.mySeaState;
59  mySeaStateDirection = orig.mySeaStateDirection;
60  mySurfaceTransparency = orig.mySurfaceTransparency;
61  myWindDrivenSeaStateEnabled = orig.myWindDrivenSeaStateEnabled;
62  myChoppiness = orig.myChoppiness;
63  mySurgeDepth = orig.mySurgeDepth;
64  myDepthOffset = orig.myDepthOffset;
65  myWindFetch = orig.myWindFetch;
66  myPriority = orig.myPriority;
67  }
68  return *this;
69  };
71  ACCESSOR_MUTATOR_MEMBER(double, waterCurrentSpeed, WaterCurrentSpeed);
73  ACCESSOR_MUTATOR_MEMBER(double, waterCurrentDirection, WaterCurrentDirection);
75  ACCESSOR_MUTATOR_MEMBER(double, tidalOffset, TidalOffset);
77  ACCESSOR_MUTATOR_MEMBER(int, swellState, SwellState);
79  ACCESSOR_MUTATOR_MEMBER(double, swellStateDirection, SwellStateDirection);
81  ACCESSOR_MUTATOR_MEMBER(int, seaState, SeaState);
83  ACCESSOR_MUTATOR_MEMBER(double, seaStateDirection, SeaStateDirection);
85  ACCESSOR_MUTATOR_MEMBER(double, surfaceTransparency, SurfaceTransparency);
87  ACCESSOR_MUTATOR_MEMBER(bool, windDrivenSeaStateEnabled, WindDrivenSeaStateEnabled);
89  ACCESSOR_MUTATOR_MEMBER(double, choppiness, Choppiness);
91  ACCESSOR_MUTATOR_MEMBER(double, surgeDepth, SurgeDepth);
93  ACCESSOR_MUTATOR_MEMBER(double, depthOffset, DepthOffset);
95  ACCESSOR_MUTATOR_MEMBER(double, windFetch, WindFetch);
97  ACCESSOR_MUTATOR_MEMBER(int, priority, Priority);
98  };
99 
103  {
104  public:
106 
107 
110  : DtFrameStateInterface(storage)
111  {
112  }
113 
114  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, waterCurrentSpeed, WaterCurrentSpeed);
115  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, waterCurrentDirection, WaterCurrentDirection);
116  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, tidalOffset, TidalOffset);
117  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(int, swellState, SwellState);
118  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, swellStateDirection, SwellStateDirection);
119  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(int, seaState, SeaState);
120  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, seaStateDirection, SeaStateDirection);
121  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, surfaceTransparency, SurfaceTransparency);
122  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(bool, windDrivenSeaStateEnabled, WindDrivenSeaStateEnabled);
123  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, choppiness, Choppiness);
124  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, surgeDepth, SurgeDepth);
125  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, depthOffset, DepthOffset);
126  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, windFetch, WindFetch);
127  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(int, priority, Priority);
128 
131  void setIsRemoteComponent(bool b) { myIsRemoteComponent = b; };
132 
133  protected:
135  bool myIsRemoteComponent = false;
136  };
137 
139  class DT_DLL_vrfStateData DtWaterSurfaceStateComponentNextFrame : public DtStateComponentNextFrameTemplate< DtWaterSurfaceStateComponent, DtWaterSurfaceStateComponentData >
140  {
141  public:
146  {
147 
148  };
150 
151  NEXTFRAME_ACCESSOR_MUTATOR_WITHLOCK(double, waterCurrentSpeed, WaterCurrentSpeed);
152  NEXTFRAME_ACCESSOR_MUTATOR_WITHLOCK(double, waterCurrentDirection, WaterCurrentDirection);
153  NEXTFRAME_ACCESSOR_MUTATOR_WITHLOCK(double, tidalOffset, TidalOffset);
154  NEXTFRAME_ACCESSOR_MUTATOR_WITHLOCK(int, swellState, SwellState);
155  NEXTFRAME_ACCESSOR_MUTATOR_WITHLOCK(double, swellStateDirection, SwellStateDirection);
156  NEXTFRAME_ACCESSOR_MUTATOR_WITHLOCK(int, seaState, SeaState);
157  NEXTFRAME_ACCESSOR_MUTATOR_WITHLOCK(double, seaStateDirection, SeaStateDirection);
158  NEXTFRAME_ACCESSOR_MUTATOR_WITHLOCK(double, surfaceTransparency, SurfaceTransparency);
159  NEXTFRAME_ACCESSOR_MUTATOR_WITHLOCK(bool, windDrivenSeaStateEnabled, WindDrivenSeaStateEnabled);
160  NEXTFRAME_ACCESSOR_MUTATOR_WITHLOCK(double, choppiness, Choppiness);
161  NEXTFRAME_ACCESSOR_MUTATOR_WITHLOCK(double, surgeDepth, SurgeDepth);
162  NEXTFRAME_ACCESSOR_MUTATOR_WITHLOCK(double, depthOffset, DepthOffset);
163  NEXTFRAME_ACCESSOR_MUTATOR_WITHLOCK(double, windFetch, WindFetch);
164  NEXTFRAME_ACCESSOR_MUTATOR_WITHLOCK(int, priority, Priority);
165 
166  protected:
168  mutable tbb::spin_rw_mutex myMutex;
169  };
170 
172  class DT_DLL_vrfStateData DtWaterSurfaceStateComponentCurrentFrame : public DtStateComponentCurrentFrameTemplate< DtWaterSurfaceStateComponent, DtWaterSurfaceStateComponentNextFrame, DtWaterSurfaceStateComponentData>
173  {
174  public:
179  {
180  };
181 
182  CURRENTFRAME_ACCESSOR(double, waterCurrentSpeed, WaterCurrentSpeed);
183  CURRENTFRAME_ACCESSOR(double, waterCurrentDirection, WaterCurrentDirection);
184  CURRENTFRAME_ACCESSOR(double, tidalOffset, TidalOffset);
185  CURRENTFRAME_ACCESSOR(int, swellState, SwellState);
186  CURRENTFRAME_ACCESSOR(double, swellStateDirection, SwellStateDirection);
187  CURRENTFRAME_ACCESSOR(int, seaState, SeaState);
188  CURRENTFRAME_ACCESSOR(double, seaStateDirection, SeaStateDirection);
189  CURRENTFRAME_ACCESSOR(double, surfaceTransparency, SurfaceTransparency);
190  CURRENTFRAME_ACCESSOR(bool, windDrivenSeaStateEnabled, WindDrivenSeaStateEnabled);
191  CURRENTFRAME_ACCESSOR(double, choppiness, Choppiness);
192  CURRENTFRAME_ACCESSOR(double, surgeDepth, SurgeDepth);
193  CURRENTFRAME_ACCESSOR(double, depthOffset, DepthOffset);
194  CURRENTFRAME_ACCESSOR(double, windFetch, WindFetch);
195  CURRENTFRAME_ACCESSOR(int, priority, Priority);
196  };
197 
201 
205 
206 }
#define NEXTFRAME_ACCESSOR_MUTATOR_WITHLOCK(MemberType, Accessor, MutatorAndMember)
Declares a public thread-safe next-frame accessor (by value) and next-frame mutator pair...
Definition: stateComponentImplementationTemplate.h:67
DtWaterSurfaceStateComponentData()
Default constructor initializing all water surface fields to zero.
Definition: waterSurfaceStateComponent.h:23
DtWaterSurfaceStateComponentData & operator=(const DtWaterSurfaceStateComponentData &orig)
Assignment operator.
Definition: waterSurfaceStateComponent.h:50
Template for the next-frame (writable) portion of a double-buffered state component. Frame-state access is intended for single-threaded use from a controller thread.
Definition: stateComponentImplementationTemplate.h:87
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
DtWaterSurfaceStateComponentData(const DtWaterSurfaceStateComponentData &orig)
Copy constructor.
Definition: waterSurfaceStateComponent.h:42
3) Define the current frame class. This will be used for read access.
Definition: waterSurfaceStateComponent.h:172
#define CURRENTFRAME_ACCESSOR(MemberType, Accessor, MutatorAndMember)
Declares a read-only current-frame accessor (by value). The MutatorAndMember parameter is unused...
Definition: stateComponentImplementationTemplate.h:77
1) Define the interface class that will be used to represent the next and current frames...
Definition: waterSurfaceStateComponent.h:102
Template that combines a current-frame and next-frame sub-component into a fully double-buffered stat...
Definition: stateComponentImplementationTemplate.h:111
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
#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
DtStateComponentCreator< DtWaterSurfaceStateComponentImplementation > DtWaterSurfaceStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: waterSurfaceStateComponent.h:204
#define UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(Type, Member, Set)
Defines an undefined virtual by-value accessor and an undefined virtual setter, both throwing DtUnimp...
Definition: doubleBufferedDataStorage.h:103
0) Define the State Component Data. This struct replaces the legion stuff
Definition: waterSurfaceStateComponent.h:20
void setIsRemoteComponent(bool b)
Sets whether this component represents a remotely controlled entity.
Definition: waterSurfaceStateComponent.h:131
DtWaterSurfaceStateComponentCurrentFrame(DtStateData *sd)
Constructs the current frame wrapper with the given state data storage.
Definition: waterSurfaceStateComponent.h:177
#define ACCESSOR_MUTATOR_MEMBER(MemberType, Accessor, MutatorAndMember)
Declares a public accessor (by value and reference), a public mutator, and a protected member field...
Definition: stateComponentImplementationTemplate.h:30
#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
2) Define the next frame class. This will be used for write access.
Definition: waterSurfaceStateComponent.h:139
virtual ~DtWaterSurfaceStateComponentNextFrame() override
Definition: waterSurfaceStateComponent.h:149
Contains the DtStateComponent class declaration.
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
Template for the current-frame (read-only) view of a double-buffered state component. Exposes promoted current-frame data through read-only accessors.
Definition: stateComponentImplementationTemplate.h:176
tbb::spin_rw_mutex myMutex
Read-write mutex protecting concurrent access to the next frame data.
Definition: waterSurfaceStateComponent.h:168
DtWaterSurfaceStateComponentNextFrame(DtStateData *sd)
Constructs the next frame wrapper with the given state data storage.
Definition: waterSurfaceStateComponent.h:144

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)