VR-Forces 4.8 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) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
11 
12 #pragma once
13 
15 #include "vrfutil/simClock.h"
16 #include <vl/hostStructs.h>
17 #include "vrfobjcore/boolIOPort.h"
19 
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 
73 public:
74 
75  //typedef std::map<DtLifeformStaticPosture, double>
76  // DtPostureTransitionTimeMap;
77 
78  //typedef std::map< DtLifeformStaticPosture, DtPostureTransitionTimeMap>
79  // DtPostureTransitionsMap;
80 
81 
84  DtDiGuyController(const DtString& name,
85  DtVrfObject* owner,
86  DtSimManager* simManager,
87  DtComponentDescriptor* desc = 0,
88  DtReaderWriterRegistry* parentRegistry = 0);
89 
91  virtual ~DtDiGuyController();
92 
95  virtual const char* type() const;
96 
99  virtual bool init();
100 
106  virtual bool createPSR();
107 
111  virtual void preFirstTickInit();
112 
114  virtual void tick();
115 
119  virtual void taskedTick(DtTime & dT);
120 
123  virtual bool intrinsicOverride();
124 
128  virtual bool intrinsicTick(DtLifeformStaticPosture post,
129  double speed,DtWeaponState weapon, DtString & demeanor);
130 
132  virtual bool tickWhileDestroyed() const;
133 
136  virtual void setCurrentAnimation(const DtDiGuyAnimation * animation,bool overridePosture = false);
137 
140  virtual void sendSetPosture(DtLifeformState post);
141 
143  static void setCharacteristicsCallback(DtSimMessage * msg, void * usr);
144  virtual void processSetCharacterCharacteristics(DtSimMessage* msg);
145 
147  static void setAppearanceCallback(DtSimMessage * msg, void * usr);
148  virtual void processSetCharacterAppearance(DtSimMessage* msg);
149 
151  static void setHandItemCallback(DtSimMessage * msg, void * usr);
152  virtual void processSetCharacterHandItem(DtSimMessage* msg);
153 
155  static void setHeadCallback(DtSimMessage * msg, void * usr);
156  virtual void processSetCharacterHead(DtSimMessage* msg);
157 
158  static void setRestoreCallback(DtSimMessage * msg, void * usrData);
159  virtual void processSetRestore(DtSimMessage * msg);
160 
162  static void setAdjustDemeanorCallback(DtSimMessage * msg, void * usrData);
163  virtual void processSetAdjustDemeanor(DtSimMessage* msg);
164 
165  static void animationTaskCallback(DtSimMessage * msg, void * usrData);
166  virtual void processAnimationTask(DtSimMessage * msg);
167 
170  virtual void clearTask();
171  virtual void taskComplete(bool success = true);
172  virtual void reset();
173 
175  virtual void updateAnimationState(DtLifeformStaticPosture post,
176  double speed,DtWeaponState weapon, const DtString & demeanor);
177 
179  virtual DtDiGuyDirectionType directionStringToEnum(const DtString & direction);
180 
184 
185 
187  bool isAnimationAvailable(const std::string& animation) const;
188 
190  bool isAppearanceAvailable(const std::string& appearance) const;
191 
193  bool isHandItemAvailable(const std::string& item) const;
194 
197  bool isHeadAvailable(const std::string& head) const;
198 
200  bool isGestureAvailable(const std::string& gesture) const;
201 
203 
206  virtual void bindLuaFunctions(lua_State* L);
207  virtual void bindLuaGlobals(lua_State* L);
208 
212  static DtSimComponent * creator(const DtString& name,
213  DtVrfObject* owner,
214  DtSimManager* simManager,
215  DtComponentDescriptor* desc = 0,
216  DtReaderWriterRegistry* parentRegistry = 0);
217 
218 protected:
219 
221  virtual void registerRadioMessageCallbacks();
222 
224  virtual void registerDiGuyTasks();
225 
228  virtual void determineInitialHandItem();
229 
230  virtual DtVector groundClamp(double heading, const DtVector& location) const;
231 
232 protected:
235 
237  DtDiGuyController(const DtDiGuyController & orig);
238 
241  orig);
242 
244  virtual bool createPortGroups();
245 
247  virtual bool createPorts();
248 
251  virtual bool createCollisionPort();
252  virtual bool createAimDirectionPort();
253  virtual bool createOrderedAnimationPort();
254  virtual bool createOrderedHandItemPort();
255 
256  virtual DtString determineDemeanor(DtWeaponState weapon, DtLifeformStaticPosture post);
257 
259  virtual void determineDirection();
260 
261  virtual DtString chooseRandomAppearance();
262 
264  virtual void updatePosition(const DtTime & dT,DtTaitBryan & localOrientation);
265 
266  virtual DtString selectDamageAnimation(const DtRwNLengthStringVector& animations);
267 
268  virtual void initializeAdjustedDemeanorMap();
269 
270  //virtual void initializePostureTransitionsMap();
271 
272  //virtual double getPostureTransitionTime(DtLifeformStaticPosture from, DtLifeformStaticPosture to);
273 
275  virtual double diGuyHeading() const;
276 
277 protected:
278 
280 
287  DtTaitBryan myTaskedOrientation;
288 
293 
305 
309 
317 
325 
331 
336 
342 
345 
348 
351 
352 
357 
361 
363 
365 
366  //DtPostureTransitionsMap myPostureTransitionsMap;
367 };
#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:57
DtStringInputPort * myOrderedAnimationPort
Input Port Name: ordered-animation Input Port Description: Specifies an animation to be used as long ...
Definition: diGuyController.h:330
Definition: diGuyController.h:48
double myCurrentAnimationSpeed
Definition: diGuyController.h:292
Definition: diGuyControllerDescriptor.h:19
DtDiGuyControllerPSR * myProcessState
Container for state data associated with this component.
Definition: diGuyController.h:308
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:359
const DtDiGuyAnimation * myDefaultAnimation
Definition: diGuyController.h:283
DtUpdateRepositoryOutputPortGroup * myUpdateRepositoryOutputPortGroup
Used to update repository with any movement data.
Definition: diGuyController.h:356
const DtDiGuyAnimation * myCurrentAnimation
Definition: diGuyController.h:289
Description: This repository holds all information that is common to all the forms of all objects wit...
Definition: vrfMovingObjectStateRepository.h:26
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:284
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:300
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:279
bool myTickWhileDead
Definition: diGuyController.h:358
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:299
DtTaitBryan myTaskedOrientation
Definition: diGuyController.h:287
double myTransitionTime
The remaining time for the current posture transition. Gets decremented in tick() ...
Definition: diGuyController.h:347
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:282
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:286
DtAnalogInputPort * myAimDirectionPort
Input Port Name: aim-direction Input Port Description: Specifies the heading in which the entity shou...
Definition: diGuyController.h:324
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:335
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:281
bool myTaskInterrupted
Definition: diGuyController.h:285
DtLifeformStaticPosture
DtLifeformStaticPosture enumeration.
Definition: lifeformStaticPostures.h:27
DtDiGuyDirectionType
Definition: diGuyController.h:40
File: simMsg.h.
Definition: simMessage.h:35
File: vlClock.h.
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:298
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:290
int myLastPosition
Definition: diGuyController.h:362
Definition: diGuyController.h:47
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
DtDemeanorToRankMap myDemeanorRankMap
Definition: diGuyController.h:364
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:291
The simulation engine is controlled by a single,top-level class called the Simulation Manager...
Definition: simManager.h:102
DtBooleanOutputPort * myIsChangingPosturePort
Output Port Name: is-changing-posture Output Port Description: Indicated that the DI Guy character is...
Definition: diGuyController.h:341
std::map< DtString, unsigned int > DtDemeanorToRankMap
Definition: diGuyController.h:51
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:350
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:344
bool myAmOrdered
Definition: diGuyController.h:360
double myDirectionOfMovement
This is an angle, in radians, relative to the current heading (a value of PI represents &quot;backwards&quot;)...
Definition: diGuyController.h:304
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:316

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)