MAK Legion API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
clutterSim.h
Go to the documentation of this file.
1 /*********************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************************/
5 
7 #include "legionDataStore/span.h"
8 
9 #include "legionStandardOM/controls/playControl.hpp"
10 #include "legionStandardOM/controls/pauseControl.hpp"
11 
12 #include "legionStandardOM/sets/writeEntityRepository.hpp"
13 
14 #include "makUtil/simTime.h"
15 
16 #include <vector>
17 
18 namespace Legion
19 {
20  class EventManager;
21  class ControlManager;
22  class ViewManager;
23 }
24 
25 namespace LOM
26 {
27  class WriteEntityRepository;
28  class EntityView;
29 }
30 
31 namespace Clutter
32 {
33  class SimEngine
34  {
35  public:
37  Legion::Vector2d referenceCoordinate, int maxEntites, int forceId);
38  ~SimEngine();
39 
40  void finish();
41  void tick();
42 
43  // Toggle play/pause
44  void togglePause() { myTogglePause = true; }
45  bool isPaused() const { return mySimTime.isPaused(); }
46 
47  // Change the Force ID
48  // If isContinuous is false, only change once this frame; otherwise, make change every frame
49  // fractionToChange determines how many entities are changed (i.e., 1/1, 1/2, 1/3 ... where every 2nd, 3rd etc. entity is changed).
50  void toggleForceId(int fractionToToggle);
51 
52  double simTime() { return mySimTime.time(); }
53 
54  protected:
55  bool init();
56 
57  void updateForce();
58 
61 
62  void addEmbarkation();
63  void removeEmbarkation();
65 
67  void updateEntities(int firstEntityIndex, int numberOfEntites);
68  bool entityAtDestination(LOM::WriteEntityRepository* ent);
69  void selectNewDestination(LOM::WriteEntityRepository* ent);
70  double nextRand(int maxRange);
71 
76  LOM::EntityView* myEntityView;
77 
78  std::vector<LOM::WriteEntityRepository> myEntites;
79 
85 
86  int myForceId;
88 
90  MAK::SimTime mySimTime;
92 
93  //extended attributes of the entity
96 
99  };
100 }
bool myIsInitalized
Definition: clutterSim.h:89
void updateForce()
Definition: clutterSim.cxx:425
Legion::ControlManager * myControlManager
Definition: clutterSim.h:75
int myNumberEntities
Definition: clutterSim.h:83
void updateEmbarkedEntities()
Definition: clutterSim.cxx:310
Legion::Vector2d myMax
Definition: clutterSim.h:81
int myNumberRemoteEntities
Definition: clutterSim.h:84
void processPauseControls(Legion::Span< LOM::PauseControl > &controlList)
Definition: clutterSim.cxx:395
The ViewManager creates and manages the views of a database.
Definition: viewManager.h:48
void finish()
Definition: clutterSim.cxx:213
Legion::Vector2d myMin
Definition: clutterSim.h:80
~SimEngine()
Definition: clutterSim.cxx:117
Legion::EventManager * myEventManager
Definition: clutterSim.h:74
bool isPaused() const
Definition: clutterSim.h:45
Legion::UInt32 myMoveDelayAttrIndex
Definition: clutterSim.h:94
The EventManager manages the creation and distribution of simulation events such as Fire and Detonate...
Definition: eventManager.h:33
A span represents a contiguous array of objects in memory.
Definition: span.h:21
void selectNewDestination(LOM::WriteEntityRepository *ent)
Definition: clutterSim.cxx:509
Definition: vector.h:116
Legion::UInt32 myPauseCallbackHandle
Definition: clutterSim.h:98
void extendEntityAttributes()
Definition: clutterSim.cxx:123
SimEngine(Legion::SimulationDatabase *db, Legion::Vector2d minBounds, Legion::Vector2d maxBounds, Legion::Vector2d referenceCoordinate, int maxEntites, int forceId)
Definition: clutterSim.cxx:86
void addEmbarkation()
Definition: clutterSim.cxx:284
unsigned int UInt32
Definition: dataTypes.h:44
The SimulationDatabase stores all data for the simulation. It also owns the event, control, and view managers.
Definition: simulationDatabase.h:39
int myForceId
Definition: clutterSim.h:86
void togglePause()
Definition: clutterSim.h:44
bool entityAtDestination(LOM::WriteEntityRepository *ent)
Definition: clutterSim.cxx:495
Definition: clutterSim.h:33
Legion::Vector2d myReferenceCoordinate
Definition: clutterSim.h:82
bool myTogglePause
Definition: clutterSim.h:91
void toggleForceId(int fractionToToggle)
Definition: clutterSim.cxx:419
double simTime()
Definition: clutterSim.h:52
Legion::UInt32 myMoveGoalAttrIndex
Definition: clutterSim.h:95
int myFractionToToggle
Definition: clutterSim.h:87
LOM::EntityView * myEntityView
Definition: clutterSim.h:76
Legion::UInt32 myPlayCallbackHandle
Definition: clutterSim.h:97
void processPlayControls(Legion::Span< LOM::PlayControl > &controlList)
Definition: clutterSim.cxx:375
bool init()
Definition: clutterSim.cxx:150
MAK::SimTime mySimTime
Definition: clutterSim.h:90
The control manager is responsible for creating and adding controls to the simulation database...
Definition: controlManager.h:33
void updateEntities(int firstEntityIndex, int numberOfEntites)
Definition: clutterSim.cxx:441
void removeEmbarkation()
Definition: clutterSim.cxx:347
Legion::ViewManager * myViewManager
Definition: clutterSim.h:73
std::vector< LOM::WriteEntityRepository > myEntites
Definition: clutterSim.h:78
void tick()
Definition: clutterSim.cxx:224
Legion::SimulationDatabase * mySimDatabase
Definition: clutterSim.h:72
double nextRand(int maxRange)
Definition: clutterSim.cxx:527

Document ID: Generated on Mon Mar 8 15:11:30 EST 2021 from SVN revision 225633
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)