VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
diGuyController.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2021 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
13 
15 #include "vrfobjcore/boolIOPort.h"
16 
18 #include "vrfutil/simClock.h"
19 
20 #include <vl/hostStructs.h>
21 
22 #include <map>
23 
24 class DtSimManager;
25 class DtSimMessage;
27 class DtDiGuyAnimation;
32 class DtInputPortGroup;
33 class DtAnalogInputPort;
34 class DtBooleanInputPort;
35 class DtStringInputPort;
38 class DtAnalogOutputPort;
39 
41 {
49 };
50 
51 typedef std::map<DtString,unsigned int> DtDemeanorToRankMap;
52 
70  public DtBindableLuaComponent < DtDiGuyController >
71 {
72 public:
73 
74  //typedef std::map<DtLifeformStaticPosture,double> DtPostureTransitionTimeMap;
75  //typedef std::map<DtLifeformStaticPosture,DtPostureTransitionTimeMap> DtPostureTransitionsMap;
76 
77 public:
78 
81  DtDiGuyController( const DtString& name, DtVrfObject* owner, DtSimManager* simManager,
82  DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0 );
83 
85  virtual ~DtDiGuyController();
86 
89  virtual const char* type() const;
90 
93  virtual bool init();
94 
100  virtual bool createPSR();
101 
105  virtual void preFirstTickInit();
106 
108  virtual void tick();
109 
113  virtual void taskedTick(DtTime & dT);
114 
117  virtual bool intrinsicOverride();
118 
122  virtual bool intrinsicTick(DtLifeformStaticPosture post,
123  double speed,DtWeaponState weapon, DtString & demeanor);
124 
126  virtual bool tickWhileDestroyed() const;
127 
130  virtual void setCurrentAnimation(const DtDiGuyAnimation * animation,bool overridePosture = false);
131 
134  virtual void sendSetPosture(DtLifeformState post);
135 
137  static void setCharacteristicsCallback(DtSimMessage * msg, void * usr);
138  virtual void processSetCharacterCharacteristics(DtSimMessage* msg);
139 
141  static void setAppearanceCallback(DtSimMessage * msg, void * usr);
142  virtual void processSetCharacterAppearance(DtSimMessage* msg);
143 
145  static void setHandItemCallback(DtSimMessage * msg, void * usr);
146  virtual void processSetCharacterHandItem(DtSimMessage* msg);
147 
149  static void setHeadCallback(DtSimMessage * msg, void * usr);
150  virtual void processSetCharacterHead(DtSimMessage* msg);
151 
152  static void setRestoreCallback(DtSimMessage * msg, void * usrData);
153  virtual void processSetRestore(DtSimMessage * msg);
154 
156  static void setAdjustDemeanorCallback(DtSimMessage * msg, void * usrData);
157  virtual void processSetAdjustDemeanor(DtSimMessage* msg);
158 
159  static void animationTaskCallback(DtSimMessage * msg, void * usrData);
160  virtual void processAnimationTask(DtSimMessage * msg);
161 
164  virtual void clearTask();
165  virtual void taskComplete(bool success = true);
166  virtual void reset();
167 
169  virtual void updateAnimationState(DtLifeformStaticPosture post,
170  double speed,DtWeaponState weapon, const DtString & demeanor);
171 
173  virtual DtDiGuyDirectionType directionStringToEnum(const DtString & direction);
174 
178 
179 
181  bool isAnimationAvailable(const std::string& animation) const;
182 
184  bool isAppearanceAvailable(const std::string& appearance) const;
185 
187  bool isHandItemAvailable(const std::string& item) const;
188 
191  bool isHeadAvailable(const std::string& head) const;
192 
194  bool isGestureAvailable(const std::string& gesture) const;
195 
197 
200  virtual void bindLuaFunctions(lua_State* L);
201  virtual void bindLuaGlobals(lua_State* L);
202 
206  static DtSimComponent * creator(const DtString& name,
207  DtVrfObject* owner,
208  DtSimManager* simManager,
209  DtComponentDescriptor* desc = 0,
210  DtReaderWriterRegistry* parentRegistry = 0);
211 
212 protected:
213 
215  virtual void registerRadioMessageCallbacks();
216 
218  virtual void registerDiGuyTasks();
219 
222  virtual void determineInitialHandItem();
223 
224  virtual DtVector groundClamp(double heading, const DtVector& location) const;
225 
226 protected:
229 
231  DtDiGuyController(const DtDiGuyController & orig);
232 
235  orig);
236 
238  virtual bool createPortGroups();
239 
241  virtual bool createPorts();
242 
245  virtual bool createCollisionPort();
246  virtual bool createAimDirectionPort();
247  virtual bool createOrderedAnimationPort();
248  virtual bool createOrderedHandItemPort();
249 
250  virtual DtString determineDemeanor( DtWeaponState weaponState,
251  DtLifeformStaticPosture posture );
252 
254  virtual void determineDirection();
255 
256  virtual DtString chooseRandomAppearance();
257 
259  virtual void updatePosition(const DtTime & dT,DtTaitBryan & localOrientation);
260 
261  virtual DtString selectDamageAnimation(const DtRwNLengthStringVector& animations);
262 
263  virtual void initializeAdjustedDemeanorMap();
264 
265  //virtual void initializePostureTransitionsMap();
266 
267  //virtual double getPostureTransitionTime(DtLifeformStaticPosture from, DtLifeformStaticPosture to);
268 
270  virtual double diGuyHeading() const;
271 
272 protected:
273 
275 
282  DtTaitBryan myTaskedOrientation;
283 
288 
300 
304 
312 
320 
326 
331 
337 
340 
343 
346 
347 
352 
356 
358 
360 
361  //DtPostureTransitionsMap myPostureTransitionsMap;
362 };
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
Stores data representing all the possible appearances, animations, hand items, heads, etc.
Definition: diGuyCharacterData.h:63
DtStringInputPort * myOrderedAnimationPort
Input Port Name: ordered-animation Input Port Description: Specifies an animation to be used as long ...
Definition: diGuyController.h:325
Definition: diGuyController.h:48
double myCurrentAnimationSpeed
Definition: diGuyController.h:287
Definition: diGuyControllerDescriptor.h:19
DtDiGuyControllerPSR * myProcessState
Container for state data associated with this component.
Definition: diGuyController.h:303
DtVrfObject is used to represent any type of simulated object (entities, aggregate, control objects) in a VR-Forces application.
Definition: vrfObject.h:215
bool myNeedUpdate
Definition: diGuyController.h:354
const DtDiGuyAnimation * myDefaultAnimation
Definition: diGuyController.h:278
DtUpdateRepositoryOutputPortGroup * myUpdateRepositoryOutputPortGroup
Used to update repository with any movement data.
Definition: diGuyController.h:351
const DtDiGuyAnimation * myCurrentAnimation
Definition: diGuyController.h:284
Description: This repository holds all information that is common to all the forms of all objects wit...
Definition: vrfMovingObjectStateRepository.h:29
DtRwNLengthStringVector is a named, readable/writable vector of strings of arbitrary length...
Definition: rwNLengthStringVector.h:28
Instances of DtBooleanOutputPort are output ports through which data producers can send boolean data...
Definition: boolIOPort.h:45
Definition: diGuyController.h:46
DtLifeformStaticPosture myDefaultAnimationPosture
Definition: diGuyController.h:279
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
This class provides a base class for all controllers that are capable of executing a DtSimTask...
Definition: singleTaskControllerComponent.h:20
virtual void bindLuaFunctions(lua_State *)=0
Override to bind lua functions.
bool myAmRotating
Definition: diGuyController.h:295
Contains class declarations for DtStringInputPort, DtStringOutputPort, and DtStringPortData.
Definition: stringIOPort.h:27
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:42
const DtDiGuyControllerDescriptor * myDiGuyDescriptor
Definition: diGuyController.h:274
bool myTickWhileDead
Definition: diGuyController.h:353
Definition: readerWriterRegistry.h:39
virtual const char * type() const =0
Returns a string identifies the class type of component.
Definition: bindableLuaComponent.h:53
DtTime myTimeElapsed
Definition: diGuyController.h:294
DtTaitBryan myTaskedOrientation
Definition: diGuyController.h:282
double myTransitionTime
The remaining time for the current posture transition. Gets decremented in tick() ...
Definition: diGuyController.h:342
Definition: diGuyController.h:42
virtual void taskComplete(bool success=true)
If we are currently tasked, this will cause us to notify the entity that we&#39;re done and delete the ta...
virtual void clearTask()
If component is currently tasked, calls clearPendingSubtasks(), sets the tasked flag to false...
DtVrfMovingObjectStateRepository * myLocalState
Definition: diGuyController.h:277
virtual void reset()
For those reader/writer items that support it, resets the reader/writer value to original state Defau...
const DtDiGuyAnimation * myTaskedAnimation
Definition: diGuyController.h:281
DtAnalogInputPort * myAimDirectionPort
Input Port Name: aim-direction Input Port Description: Specifies the heading in which the entity shou...
Definition: diGuyController.h:319
Definition: diGuyController.h:45
DtStringInputPort * myOrderedHandItemPort
Input Port Name: ordered-hand-item Input Port Description: Specifies a hand item to be used...
Definition: diGuyController.h:330
Instances of DtAnalogOutputPort are input ports through which data producers can send real numbers...
Definition: analogIOPort.h:45
The DtDiGuyAnimation class is a class that stores the DI-Guy animation information that is used to en...
Definition: diGuyAnimation.h:29
const DtDiGuyCharacterData * myCharacterData
Definition: diGuyController.h:276
bool myTaskInterrupted
Definition: diGuyController.h:280
DtLifeformStaticPosture
These are the available static postures for lifeform (human) entities.
Definition: lifeformStaticPostures.h:22
std::map< DtString, unsigned int > DtDemeanorToRankMap
Definition: diGuyController.h:51
DtDiGuyDirectionType
Definition: diGuyController.h:40
File: simMsg.h.
Definition: simMessage.h:35
File: vlClock.h.
Contains the DtLifeformStaticPosture enumeration declaration.
virtual void tick()
This gives the thread of control to the component.
Contains class declarations for DtBooleanInputPort, DtBooleanOutputPort, and DtBooleanPortData.
Definition: boolIOPort.h:25
virtual bool tickWhileDestroyed() const
If the component returns true here, it will be ticked regardless of the destroyed state of the host e...
double myAnimationDuration
These values are stored in the PSR Do we want this animation to be performed only once...
Definition: diGuyController.h:293
virtual bool createPorts()
Called by init.
Definition: diGuyController.h:44
virtual bool createPortGroups()
Called by init.
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:67
DtWeaponState myCurrentAnimationWeaponState
Definition: diGuyController.h:285
int myLastPosition
Definition: diGuyController.h:357
Definition: diGuyController.h:47
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
DtDemeanorToRankMap myDemeanorRankMap
Definition: diGuyController.h:359
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
DtInputPortGroup is a data port group of a data consumer.
Definition: inputPortGroup.h:32
Instances of DtCollisionInputPort are input ports through which data consumers can receive informatio...
Definition: collisionIOPort.h:29
Contains class declarations for DtAnalogInputPort, DtAnalogOutputPort, and DtAnalogPortData.
Definition: analogIOPort.h:25
Definition: diGuyControllerPSR.h:33
DtLifeformStaticPosture myCurrentAnimationPosture
Definition: diGuyController.h:286
The simulation engine is controlled by a single,top-level class called the Simulation Manager...
Definition: simManager.h:103
DtBooleanOutputPort * myIsChangingPosturePort
Output Port Name: is-changing-posture Output Port Description: Indicated that the DI Guy character is...
Definition: diGuyController.h:336
virtual void bindLuaGlobals(lua_State *)=0
Override to bind lua globals.
double myCurrentHeading
The last heading for the entity. Will be used when setting animation for rotating on the spot...
Definition: diGuyController.h:345
DtUpdateRepositoryOutputPortGroup is a data port group of a data consumer that contains methods and p...
Definition: updateRepositoryOutputPortGroup.h:28
Controls appearances and animations for an entity that is represented by a DI-Guy 3D visual represent...
Definition: diGuyController.h:69
bool myAmTransitioningPosture
Local flag for we know we&#39;re changing posture.
Definition: diGuyController.h:339
bool myAmOrdered
Definition: diGuyController.h:355
double myDirectionOfMovement
This is an angle, in radians, relative to the current heading (a value of PI represents &quot;backwards&quot;)...
Definition: diGuyController.h:299
Definition: diGuyController.h:43
DtBooleanInputPort * myCollisionPort
Input Port Name: collision Input Port Description: Checks to see if we&#39;re avoiding a collision...
Definition: diGuyController.h:311

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)