MAK Legion 1.1 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
vehicleSim.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2014 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
15 #include "legionDataStore/view.h"
16 
17 #include "legionNet/connection.h"
18 
19 #include "legionStandardOM/sets/writeEntityRepository.hpp"
20 #include "legionStandardOM/sets/writeAircraftRepository.hpp"
21 #include "legionStandardOM/sets/writeArtPartRepository.hpp"
22 #include "legionStandardOM/sets/writeArtPartParamRepository.hpp"
23 #include "legionStandardOM/sets/writeEmitterRepository.hpp"
24 #include "legionStandardOM/sets/readEmitterRepository.hpp"
25 #include "legionStandardOM/sets/writeBeamRepository.hpp"
26 #include "legionStandardOM/views/entityView.h"
27 #include "legionStandardOM/events/detonateEvent.hpp"
28 #include "legionStandardOM/events/fireEvent.hpp"
29 
30 #include "matrix/coordTransform.h"
31 
32 
33 const int MAX_ARTPARTS = 4;
34 
38 {
39 public:
40 
43  DtVehicleSim(Legion::SimulationDatabase* database, LOM::EntityView* rel,
44  Legion::UInt64 id, const Legion::ObjectType& type,
45  const std::string& name, const std::string markings,
46  bool haveArtParts );
47 
49  virtual ~DtVehicleSim();
50 
52  virtual void init( double initLat, double initLon, double initAlt, double initSpeed,
53  double initHeading, double initTRadius,
54  double initPitch, double initRoll, bool autoRoll );
55 
57  virtual void simTick( DtTime dt );
58 
60  virtual void fireMunition( const Legion::UInt64& targetGid );
61  virtual void fireMunition();
62  virtual void detonateMunition();
63  virtual void munitionTick();
64 
66  virtual void processDetonation(const LOM::DetonateEvent& inter );
67  virtual int checkDetonation(const LOM::DetonateEvent& inter );
68  virtual void reactToDamage();
69  virtual bool isDestroyed();
70  virtual DtTime timeDestroyed();
71 
73  virtual void toggleEmissions();
74  virtual void enableEmissions();
75  virtual void disableEmissions();
76 
77  virtual void setFrozen(bool frozen);
78 
79 public:
80 
81  static void setLethalDetonationRange( double range );
82  static void setMunitionFlightTime( DtTime time );
83 
84 protected:
85 
86  virtual void moveArtParts( DtTime dt );
87  virtual LOM::ReadEntityRepository nearestEntity();
88  virtual void emitterSystemAdditionCallback(const std::vector<LOM::ReadEmitterRepository>& obj);
89  virtual void emitterSystemRemovalCallback(const std::vector<LOM::ReadEmitterRepository>& obj);
90 
91 protected:
92 
94 
95 protected:
96 
98  LOM::WriteEntityRepository myEntityPub;
99  LOM::WriteAircraftRepository myAircraftDetailsPub;
100  LOM::WriteArtPartRepository myArtParts[MAX_ARTPARTS];
101  LOM::WriteEmitterRepository myEmitterSysPub;
102 
103  LOM::EntityView* myRel;
105 
106  float mySpeed;
108  float myTurnRate;
110 
111  DtCoordTransform myLocalToGeoc;
112  DtCoordTransform myGeocToLocal;
113 
114  DtTaitBryan myEuler;
115  DtVector myPos;
116  DtVector myVel;
117  DtVector myAccel;
118  DtVector myRotRate;
119 
120  float myTurretAz;
122  float myGunElev;
124 
128 
131 
135 
136 protected:
137 
139  static DtTime theMunitionFlightTime;
140 
141 };
virtual void emitterSystemAdditionCallback(const std::vector< LOM::ReadEmitterRepository > &obj)
Definition: vehicleSim.cxx:496
virtual bool isDestroyed()
Definition: vehicleSim.cxx:474
UInt32 myDetonateCbHandle
Definition: vehicleSim.h:132
float myTurretAzRate
Definition: vehicleSim.h:121
DtTime myDetonateTime
Definition: vehicleSim.h:125
virtual int checkDetonation(const LOM::DetonateEvent &inter)
Definition: vehicleSim.cxx:228
Part of the F18 example.
Definition: vehicleSim.h:37
DtVector myPos
topographic Euler angles
Definition: vehicleSim.h:115
virtual void init(double initLat, double initLon, double initAlt, double initSpeed, double initHeading, double initTRadius, double initPitch, double initRoll, bool autoRoll)
Set initial values for simulation parameters.
Definition: vehicleSim.cxx:83
unsigned int UInt32
Definition: c_api.h:54
LOM::EntityView * myRel
Definition: vehicleSim.h:103
float mySpeed
Definition: vehicleSim.h:106
virtual void toggleEmissions()
Emissions (radar)
Definition: vehicleSim.cxx:346
DtCoordTransform myLocalToGeoc
Definition: vehicleSim.h:111
static DtTime theMunitionFlightTime
Definition: vehicleSim.h:139
bool myHaveArtParts
Definition: vehicleSim.h:129
void detonationCb(Legion::Span< LOM::DetonateEvent > &events)
Definition: vehicleSim.cxx:512
virtual void processDetonation(const LOM::DetonateEvent &inter)
Reaction to detonations.
Definition: vehicleSim.cxx:219
virtual ~DtVehicleSim()
Destructor.
Definition: vehicleSim.cxx:74
A span represents a contiguous array of objects in memory.
Definition: span.h:22
DtTaitBryan myEuler
Definition: vehicleSim.h:114
bool myEmissionsEnabled
Definition: vehicleSim.h:130
float myTurnRate
Definition: vehicleSim.h:108
LOM::WriteArtPartRepository myArtParts[MAX_ARTPARTS]
Definition: vehicleSim.h:100
LOM::WriteEmitterRepository myEmitterSysPub
Definition: vehicleSim.h:101
float myTurretAz
in body coordinates
Definition: vehicleSim.h:120
virtual void reactToDamage()
Definition: vehicleSim.cxx:265
The SimulationDatabase stores all data for the simulation. It also owns the event, control, and view managers.
Definition: simulationDatabase.h:42
bool myIsDestroyed
Definition: vehicleSim.h:127
DtVector myVel
in topographic (N, E, down) coordinates
Definition: vehicleSim.h:116
virtual void emitterSystemRemovalCallback(const std::vector< LOM::ReadEmitterRepository > &obj)
Definition: vehicleSim.cxx:504
LOM::WriteEntityRepository myEntityPub
Definition: vehicleSim.h:98
UInt64 myTargetId
Definition: vehicleSim.h:133
DtVector myAccel
in topographic (N, E, down) coordinates
Definition: vehicleSim.h:117
static void setLethalDetonationRange(double range)
Definition: vehicleSim.cxx:485
float myTurnRadius
Definition: vehicleSim.h:107
Legion::SetView< LOM::ReadEmitterRepository > * myRefEmitList
Definition: vehicleSim.h:104
virtual void disableEmissions()
Definition: vehicleSim.cxx:329
DtVehicleSim(Legion::SimulationDatabase *database, LOM::EntityView *rel, Legion::UInt64 id, const Legion::ObjectType &type, const std::string &name, const std::string markings, bool haveArtParts)
Constructor.
Definition: vehicleSim.cxx:34
virtual DtTime timeDestroyed()
Definition: vehicleSim.cxx:480
static void setMunitionFlightTime(DtTime time)
Definition: vehicleSim.cxx:491
virtual void fireMunition()
Definition: vehicleSim.cxx:380
float myGunElev
Definition: vehicleSim.h:122
virtual void munitionTick()
Definition: vehicleSim.cxx:465
unsigned long long UInt64
Definition: dataTypes.h:46
virtual void enableEmissions()
Definition: vehicleSim.cxx:281
The Object type contains a 7-digit tuple representing the type of a simulation entity Recommend follo...
Definition: objectType.h:21
LOM::WriteAircraftRepository myAircraftDetailsPub
Definition: vehicleSim.h:99
static double theLethalDetonationRange
Definition: vehicleSim.h:138
DtCoordTransform myGeocToLocal
Definition: vehicleSim.h:112
virtual void simTick(DtTime dt)
Call once per frame to simulate, and make necessary VR-Link calls.
Definition: vehicleSim.cxx:154
const int MAX_ARTPARTS
Definition: vehicleSim.h:33
UInt32 myFireEvent
Definition: vehicleSim.h:134
float myGunElevRate
Definition: vehicleSim.h:123
float myScalarAccel
Definition: vehicleSim.h:109
DtVector myRotRate
in topographic (N, E, down) coordinates
Definition: vehicleSim.h:118
DtTime myTimeDestroyed
Definition: vehicleSim.h:126
virtual void setFrozen(bool frozen)
Definition: vehicleSim.cxx:341
virtual void moveArtParts(DtTime dt)
Definition: vehicleSim.cxx:193
virtual void detonateMunition()
Definition: vehicleSim.cxx:418
virtual LOM::ReadEntityRepository nearestEntity()
Definition: vehicleSim.cxx:358
unsigned long long UInt64
Definition: c_api.h:56
Legion::SimulationDatabase * myDatabase
Definition: vehicleSim.h:97

Document ID: Generated on Wed May 26 15:17:05 EDT 2021 from SVN revision 229676
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)