VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtForceManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
8 #include <vrvVrl/vrvVrl.h>
10 
12 #include <vrvUtil/event_signal.h>
13 
17 
18 #include <vlpi/disEnums.h>
19 
20 #include <vlutil/vlMachineTypes.h>
21 #include <vlutil/vlString.h>
22 #include <vector>
23 #include <map>
24 
25 namespace makVrv
26 {
27 
28  class DtSharedSettingsManager;
29 
30 #define FRIENDLY_COLOR .5f,224.f / 255.f, 1.f ,0.8f
31 #define FRIENDLY_PRIMARY_COLOR 0.f, 0.f, 1.f, 0.8f
32 #define OPPOSING_COLOR 1.f,.5f,.5f,0.8f
33 #define OPPOSING_PRIMARY_COLOR 1.f, 0.f, 0.f, 0.8f
34 #define NEUTRAL_COLOR 170.f / 255.f,1.f, 170.f / 255.f,0.8f
35 #define NEUTRAL_PRIMARY_COLOR 0.f, 1.f, 0.f, 0.8f
36 #define UNKNOWN_COLOR 1.f, 1.f, .5f, 0.8f
37 #define UNKNOWN_PRIMARY_COLOR 1.f, 1.f, 0.f, 0.8f
38 
43  {
44  public:
45 
46  struct RGBAColor
47  {
48  RGBAColor(float r, float g, float b, float a)
49  : R(r), G(g), B(b), A(a)
50  {
51  }
52 
54  : R(0.f), G(0.f), B(0.f), A(0.f)
55  {
56  }
57 
58  float R, G, B, A;
59  };
60 
61  public:
62 
65 
67  virtual ~DtForceManager();
68 
69  static const std::string& className();
70 
73  virtual void addForce(DtForceType force, const std::string& forceName,
74  const RGBAColor& forceColor, const RGBAColor& forcePrimaryColor,
75  bool includeInDialogs = true);
76 
78  virtual void removeForce(DtForceType);
79 
81  virtual int numForces() const;
82 
84  virtual DtForceType forceAt(int iIndex) const;
85 
87  virtual RGBAColor colorForForce(DtForceType force,
88  bool usePrimaryColors=false) const;
89 
91  virtual std::string nameForForce(DtForceType force) const;
92 
94  virtual DtForceType forceFromName(const std::string& name) const;
95 
97  virtual bool includeInDialogs(DtForceType force) const;
98 
99  // Used by the entity editor
101  virtual void setHostility(DtU8 force, DtU8 targetForce, bool hostile);
102  virtual bool hostile(DtU8 force, DtU8 targetForce);
104 
106  virtual void clearForces();
107 
108  protected:
109 
110  struct ForceInfo
111  {
112  std::string myForceName;
116  std::vector<int> myHostilityList;
117  };
118 
119  // Information for a specific force
120  virtual const ForceInfo& forceInformation(DtForceType force) const;
121  virtual ForceInfo& forceInformation(DtForceType force);
122 
123 
125  std::map<DtForceType, ForceInfo> myForces;
126  };
127 
130  {
131  public:
132 
138  instance( const DtSharedSettingsManager& mgr );
139 
144  instance( DtEventQueueInterface& eqi );
145 
152  findInstance( DtEventQueueInterface* eqi );
153 
155  virtual ~DtSharedForceManagerSignaler();
156 
159 
162 
165 
167 
168  protected:
169 
172 
173  private:
174 
177 
180  operator = ( const DtSharedForceManagerSignaler& sig);
181 
182  };
183 }
#define DT_DLL_VRVVRL
Definition: vrvVrl.h:19
Virtual base class.
Definition: DtVirtualBaseClass.h:19
event_signal< void(int)> signal_forceAdded
Emitted when a force is removed.
Definition: DtForceManager.h:164
Definition: DtForceManager.h:46
RGBAColor(float r, float g, float b, float a)
Definition: DtForceManager.h:48
RGBAColor myForceColor
Definition: DtForceManager.h:113
std::map< DtForceType, ForceInfo > myForces
Definition: DtForceManager.h:125
The shared settings manager, is the global object responsible for managing any shared settings object...
Definition: DtSharedSettingsManager.h:42
This class will maintain force information used in visualizers that need force dependent data (such a...
Definition: DtForceManager.h:42
Contains makVrv::event_signal class.
The base class for all shared settings.
Definition: DtSharedSettings.h:45
The event queue interface is a cross thread event queue used to emit event_signal across thread bound...
Definition: DtEventQueueInterface.h:26
Contains makVrv::DtVirtualBaseClass class.
Definition: DtForceManager.h:110
event_signal< void(int)> signal_forceRemoved
Emitted when a force is removed.
Definition: DtForceManager.h:161
Contains the DtSharedSettings class declaration.
float R
Definition: DtForceManager.h:58
std::vector< int > myHostilityList
Definition: DtForceManager.h:116
Shared signaler for the force manager to signal when a force is added or removed. ...
Definition: DtForceManager.h:129
RGBAColor myForcePrimaryColor
Definition: DtForceManager.h:114
ForceInfo myNullForce
Definition: DtForceManager.h:124
RGBAColor()
Definition: DtForceManager.h:53
Contains DLL export macros.
std::string myForceName
Definition: DtForceManager.h:112
bool myIncludeInDialogs
Definition: DtForceManager.h:115

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)