00001
00032 #ifndef LL_LLMATERIALTABLE_H
00033 #define LL_LLMATERIALTABLE_H
00034
00035 #include "lluuid.h"
00036 #include "llstring.h"
00037
00038 #include <list>
00039
00040 const U32 LLMATERIAL_INFO_NAME_LENGTH = 256;
00041
00042
00043
00044
00045 const F32 DEFAULT_OBJECT_DENSITY = 1000.0f;
00046 const F32 LEGACY_DEFAULT_OBJECT_DENSITY = 10.0f;
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 const F32 DEFAULT_AVATAR_DENSITY = 445.3f;
00064
00065
00066 class LLMaterialInfo
00067 {
00068 public:
00069 U8 mMCode;
00070 char mName[LLMATERIAL_INFO_NAME_LENGTH];
00071 LLUUID mDefaultTextureID;
00072 LLUUID mShatterSoundID;
00073 F32 mDensity;
00074 F32 mFriction;
00075 F32 mRestitution;
00076
00077
00078 F32 mHPModifier;
00079 F32 mDamageModifier;
00080 F32 mEPModifier;
00081
00082 LLMaterialInfo(U8 mcode, char* name, const LLUUID &uuid)
00083 {
00084 init(mcode,name,uuid);
00085 };
00086
00087 void init(U8 mcode, char* name, const LLUUID &uuid)
00088 {
00089 mName[0] = 0;
00090 mDensity = 1000.f;
00091 mHPModifier = 1.f;
00092 mDamageModifier = 1.f;
00093 mEPModifier = 1.f;
00094
00095 mMCode = mcode;
00096 if (name)
00097 {
00098 LLString::copy(mName,name,LLMATERIAL_INFO_NAME_LENGTH);
00099 }
00100 mDefaultTextureID = uuid;
00101 };
00102
00103 ~LLMaterialInfo()
00104 {
00105 };
00106
00107 };
00108
00109 class LLMaterialTable
00110 {
00111 public:
00112 static const F32 FRICTION_MIN;
00113 static const F32 FRICTION_GLASS;
00114 static const F32 FRICTION_LIGHT;
00115 static const F32 FRICTION_METAL;
00116 static const F32 FRICTION_PLASTIC;
00117 static const F32 FRICTION_WOOD;
00118 static const F32 FRICTION_LAND;
00119 static const F32 FRICTION_STONE;
00120 static const F32 FRICTION_FLESH;
00121 static const F32 FRICTION_RUBBER;
00122 static const F32 FRICTION_MAX;
00123
00124 static const F32 RESTITUTION_MIN;
00125 static const F32 RESTITUTION_LAND;
00126 static const F32 RESTITUTION_FLESH;
00127 static const F32 RESTITUTION_STONE;
00128 static const F32 RESTITUTION_METAL;
00129 static const F32 RESTITUTION_WOOD;
00130 static const F32 RESTITUTION_GLASS;
00131 static const F32 RESTITUTION_PLASTIC;
00132 static const F32 RESTITUTION_LIGHT;
00133 static const F32 RESTITUTION_RUBBER;
00134 static const F32 RESTITUTION_MAX;
00135
00136 typedef std::list<LLMaterialInfo*> info_list_t;
00137 info_list_t mMaterialInfoList;
00138
00139 LLUUID *mCollisionSoundMatrix;
00140 LLUUID *mSlidingSoundMatrix;
00141 LLUUID *mRollingSoundMatrix;
00142
00143 static const F32 DEFAULT_FRICTION;
00144 static const F32 DEFAULT_RESTITUTION;
00145
00146 public:
00147 LLMaterialTable();
00148 LLMaterialTable(U8);
00149 ~LLMaterialTable();
00150
00151 void initBasicTable();
00152
00153 BOOL add(U8 mcode, char* name, const LLUUID &uuid);
00154 BOOL addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid);
00155 BOOL addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid);
00156 BOOL addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid);
00157 BOOL addShatterSound(U8 mcode, const LLUUID &uuid);
00158 BOOL addDensity(U8 mcode, const F32 &density);
00159 BOOL addFriction(U8 mcode, const F32 &friction);
00160 BOOL addRestitution(U8 mcode, const F32 &restitution);
00161 BOOL addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 &damage_mod, const F32 &ep_mod);
00162
00163 LLUUID getDefaultTextureID(char* name);
00164 LLUUID getDefaultTextureID(U8 mcode);
00165 U8 getMCode(const char* name);
00166 char* getName(U8 mcode);
00167
00168 F32 getDensity(U8 mcode);
00169 F32 getFriction(U8 mcode);
00170 F32 getRestitution(U8 mcode);
00171 F32 getHPMod(U8 mcode);
00172 F32 getDamageMod(U8 mcode);
00173 F32 getEPMod(U8 mcode);
00174
00175 LLUUID getCollisionSoundUUID(U8 mcode, U8 mcode2);
00176 LLUUID getSlidingSoundUUID(U8 mcode, U8 mcode2);
00177 LLUUID getRollingSoundUUID(U8 mcode, U8 mcode2);
00178 LLUUID getShatterSoundUUID(U8 mcode);
00179
00180 LLUUID getGroundCollisionSoundUUID(U8 mcode);
00181 LLUUID getGroundSlidingSoundUUID(U8 mcode);
00182 LLUUID getGroundRollingSoundUUID(U8 mcode);
00183 LLUUID getCollisionParticleUUID(U8 mcode, U8 mcode2);
00184 LLUUID getGroundCollisionParticleUUID(U8 mcode);
00185
00186 static LLMaterialTable basic;
00187 };
00188
00189 #endif
00190