VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
humanStateComponent.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2021 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
6 #pragma once
7 
10 #include <vrfOM/sets/writeDIGuyAppearanceRepository.hpp>
11 #include <vrfOM/sets/readDIGuyAppearanceRepository.hpp>
12 #include <legionStandardOM/sets/writeLifeformRepository.hpp>
13 #include <legionStandardOM/sets/readLifeformRepository.hpp>
14 #include <vlpi/patchIdentifier.h>
15 #include <matrix/vlVector.h>
16 
18 namespace makVrf
19 {
20 
22 
28  {
29  public:
30 
32 
33 
36  : DtFrameStateInterface( sd )
37  {
38  }
39 
41  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR( DtString, diguyAppearance, DiguyAppearance );
43  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR( DtString, diguyType, DiguyType );
45  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR( DtString, diguyHeadAppearance, DiguyHeadAppearance );
47  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR( DtString, diguyItemAppearance, DiguyItemAppearance );
49  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR( DtPatchIdentifier, diguyPrimaryUnitPatch, DiguyPrimaryUnitPatch );
51  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR( DtPatchIdentifier, diguySecondaryUnitPatch, DiguySecondaryUnitPatch );
53  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR( DtPatchIdentifier, diguyRankPatch, DiguyRankPatch );
55  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR( DtString, diguyCharacterName, DiguyCharacterName );
57  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR( DtString, diguyAction, DiguyAction );
59  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR( double, bodyWeight, BodyWeight );
61  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR( bool, diguyUsingAnimationOffset, DiguyUsingAnimationOffset );
63  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR( DtVector, diguyAnimationOffset, DiguyAnimationOffset );
65  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR( float, diguyTransitionSpeed, DiguyTransitionSpeed );
66 
70  virtual void setDiguyType( const DtString& newType, const DtString& newAppearance ) { throw DtUnimplementedMethod("setDiguyType() is not implemented for this class"); };
71  };
72 
76  {
77  public:
78 
83  virtual ~DtHumanStateComponentNextFrame() override;
84 
86  virtual const DtString diguyAppearance() const override;
88  virtual void setDiguyAppearance(const DtString&) override;
89 
91  virtual const DtString diguyType() const override;
93  virtual void setDiguyType(const DtString&) override;
94 
96  virtual const DtString diguyHeadAppearance() const override;
98  virtual void setDiguyHeadAppearance(const DtString&) override;
99 
101  virtual const DtString diguyItemAppearance() const override;
103  virtual void setDiguyItemAppearance(const DtString&) override;
104 
106  virtual const DtPatchIdentifier diguyPrimaryUnitPatch() const override;
108  virtual void setDiguyPrimaryUnitPatch( const DtPatchIdentifier& ) override;
109 
111  virtual const DtPatchIdentifier diguySecondaryUnitPatch() const override;
113  virtual void setDiguySecondaryUnitPatch( const DtPatchIdentifier& ) override;
114 
116  virtual const DtPatchIdentifier diguyRankPatch() const override;
118  virtual void setDiguyRankPatch( const DtPatchIdentifier& ) override;
119 
121  virtual const DtString diguyCharacterName() const override;
123  virtual void setDiguyCharacterName( const DtString& ) override;
124 
126  virtual const DtString diguyAction() const override;
128  virtual void setDiguyAction(const DtString&) override;
129 
131  virtual const double bodyWeight() const override;
133  virtual void setBodyWeight(const double&) override;
134 
136  virtual const bool diguyUsingAnimationOffset() const override;
138  virtual void setDiguyUsingAnimationOffset(const bool&) override;
139 
141  virtual const float diguyTransitionSpeed() const override;
143  virtual void setDiguyTransitionSpeed(const float&) override;
144 
146  virtual const DtVector diguyAnimationOffset() const override;
148  virtual void setDiguyAnimationOffset(const DtVector&) override;
149 
153  virtual void setDiguyType( const DtString& newType, const DtString& newAppearance ) override;
154 
156  virtual void makeWritable() override;
157 
159  virtual void makeReadOnly() override;
160 
161  protected:
163  VRF::WriteDIGuyAppearanceRepository myWriteHumanComponent;
165  LOM::WriteLifeformRepository myWriteLifeformRepository;
166  };
167 
171  {
172  public:
173 
177 
179  virtual ~DtHumanStateComponentCurrentFrame() override;
180 
182  virtual const DtString diguyAppearance() const override;
184  virtual const DtString diguyType() const override;
186  virtual const DtString diguyHeadAppearance() const override;
188  virtual const DtString diguyItemAppearance() const override;
190  virtual const DtPatchIdentifier diguyPrimaryUnitPatch() const override;
192  virtual const DtPatchIdentifier diguySecondaryUnitPatch() const override;
194  virtual const DtPatchIdentifier diguyRankPatch() const override;
196  virtual const DtString diguyCharacterName() const override;
198  virtual const DtString diguyAction() const override;
200  virtual const double bodyWeight() const override;
202  virtual const bool diguyUsingAnimationOffset() const override;
204  virtual const DtVector diguyAnimationOffset() const override;
206  virtual const float diguyTransitionSpeed() const override;
207 
209  bool readComponentValid() const;
210 
213  bool findReadComponent();
214 
215  protected:
217  VRF::ReadDIGuyAppearanceRepository myReadHumanComponent;
219  LOM::ReadLifeformRepository myReadLifeformRepository;
220  };
221 
226  {
227  public:
228 
233  virtual ~DtHumanStateComponentImplementation() override;
234 
236  bool isDoubleBuffered() { return true; };
238  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
240  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
242  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
243 
245  virtual void updateDataStorage() override;
246 
249  virtual void updateStateData(DtStateData* sd) override
250  {
251  myCurrentFrameState.updateStateData(sd);
252  myNextFrameState.updateStateData(sd);
253  }
254 
256  virtual bool forceAdvance() override;
257 
259  virtual void firstFrameAdvance() override;
260 
262  virtual void aboutToBeDeleted() override
263  {
265  myCurrentFrameState.aboutToBeDeleted();
266  myNextFrameState.aboutToBeDeleted();
267  }
268 
269  protected:
270 
277 
278  };
279 
280 
284 
285 }
LOM::ReadLifeformRepository myReadLifeformRepository
Read-only Legion repository for lifeform (body weight) data.
Definition: humanStateComponent.h:219
virtual DtFrameStateInterface * nextFrameState() override
Definition: humanStateComponent.h:240
Exception thrown when a required method has not been implemented.
Definition: stateDataTypes.h:30
virtual void setDiguyType(const DtString &newType, const DtString &newAppearance)
Sets the DI-Guy character type and appearance in a single call.
Definition: humanStateComponent.h:70
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
LOM::WriteLifeformRepository myWriteLifeformRepository
Writable Legion repository for lifeform (body weight) data.
Definition: humanStateComponent.h:165
VRF::ReadDIGuyAppearanceRepository myReadHumanComponent
Read-only Legion repository for DI-Guy appearance data.
Definition: humanStateComponent.h:217
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: humanStateComponent.h:242
DtHumanStateComponentCurrentFrame myCurrentFrameState
Current (read) frame state providing access to the latest committed DI-Guy data.
Definition: humanStateComponent.h:272
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
virtual void updateStateData(DtStateData *sd) override
Propagates an updated state data pointer to both the current and next frame states.
Definition: humanStateComponent.h:249
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
#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
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
DtHumanStateComponentNextFrame myNextFrameState
Next (write) frame state holding pending DI-Guy data changes.
Definition: humanStateComponent.h:274
In order to be a well defined state component, you must:
Definition: humanStateComponent.h:27
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: humanStateComponent.h:238
VRF::WriteDIGuyAppearanceRepository myWriteHumanComponent
Writable Legion repository for DI-Guy appearance data.
Definition: humanStateComponent.h:163
Concrete double-buffered state component implementation for DI-Guy human-figure data. Owns and manages both a current-frame (read) and next-frame (write) instance of DtHumanStateComponent, synchronising them via the Legion network repositories.
Definition: humanStateComponent.h:225
Read-access implementation of DtHumanStateComponent for the current simulation frame. Backed by read-only Legion repositories; provides getters that return live committed state values.
Definition: humanStateComponent.h:170
DtStateComponentCreator< DtHumanStateComponentImplementation > DtHumanStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: humanStateComponent.h:283
virtual void aboutToBeDeleted() override
Notifies both frame states that the component is about to be deleted.
Definition: humanStateComponent.h:262
#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
Definition: stateComponent.h:74
Contains the DtStateComponent class declaration.
bool isDoubleBuffered()
Definition: humanStateComponent.h:236
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
bool myFoundComponent
True once the Legion read repositories have been successfully located.
Definition: humanStateComponent.h:276
Write-access implementation of DtHumanStateComponent for the next simulation frame. Backed by writable Legion repositories; setters mark the component modified when a value changes.
Definition: humanStateComponent.h:75

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)