![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2011 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: DtForceManager.h,v $ $Revision: 1.7 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00009 #ifndef DtForceManager_H_ 00010 #define DtForceManager_H_ 00011 00012 #include <vrvVrl/vrvVrl.h> 00013 #include <vrvCore/DtSharedSettings.h> 00014 00018 00019 #include <vlpi/disEnums.h> 00020 00021 #include <vlutil/vlMachineTypes.h> 00022 #include <vlutil/vlString.h> 00023 #include <vector> 00024 #include <map> 00025 00026 namespace makVrv 00027 { 00028 00029 class DtSharedSettingsManager; 00030 00031 00035 class DT_DLL_VRVVRL DtForceManager : public DtSharedSettings 00036 { 00037 public: 00038 00039 struct RGBAColor 00040 { 00041 RGBAColor(float r, float g, float b, float a) 00042 : R(r), G(g), B(b), A(a) 00043 { 00044 } 00045 00046 RGBAColor() 00047 : R(0.f), G(0.f), B(0.f), A(0.f) 00048 { 00049 } 00050 00051 float R, G, B, A; 00052 }; 00053 00054 public: 00055 00057 DtForceManager(DtSharedSettingsManager& manager); 00058 00060 virtual ~DtForceManager(); 00061 00062 static std::string className(); 00063 00066 virtual void addForce(DtForceType force, const std::string& forceName, 00067 const RGBAColor& forceColor, const RGBAColor& forcePrimaryColor, 00068 bool includeInDialogs = true); 00069 00071 virtual DtForceType nextAvailableId(); 00072 00074 virtual void removeForce(DtForceType); 00075 00077 virtual int numForces() const; 00078 00080 virtual DtForceType forceAt(int iIndex) const; 00081 00083 virtual RGBAColor colorForForce(DtForceType force, 00084 bool usePrimaryColors=false) const; 00085 00087 virtual std::string nameForForce(DtForceType force) const; 00088 00090 virtual DtForceType forceFromName(const std::string& name) const; 00091 00093 virtual bool includeInDialogs(DtForceType force) const; 00094 00095 // Used by the entity editor 00097 virtual void setHostility(DtU8 force, DtU8 targetForce, bool hostile); 00098 virtual bool hostile(DtU8 force, DtU8 targetForce); 00100 00102 virtual void clearForces(); 00103 00104 protected: 00105 00106 struct ForceInfo 00107 { 00108 std::string myForceName; 00109 RGBAColor myForceColor; 00110 RGBAColor myForcePrimaryColor; 00111 bool myIncludeInDialogs; 00112 std::vector<int> myHostilityList; 00113 }; 00114 00115 // Information for a specific force 00116 virtual const ForceInfo& forceInformation(DtForceType force) const; 00117 virtual ForceInfo& forceInformation(DtForceType force); 00118 00119 00120 ForceInfo myNullForce; 00121 std::map<DtForceType, ForceInfo> myForces; 00122 }; 00123 } 00124 00125 #endif