llmaterialtable.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLMATERIALTABLE_H
00033 #define LL_LLMATERIALTABLE_H
00034 
00035 #include "lluuid.h"
00036 #include "linked_lists.h"
00037 #include "llstring.h"
00038 
00039 const U32 LLMATERIAL_INFO_NAME_LENGTH = 256;
00040 
00041 class LLMaterialInfo
00042 {
00043 public:
00044         U8                  mMCode;
00045         char            mName[LLMATERIAL_INFO_NAME_LENGTH];     /* Flawfinder: ignore */
00046         LLUUID          mDefaultTextureID;
00047         LLUUID          mShatterSoundID;
00048         F32         mDensity;           // kg/m^3
00049         F32         mFriction;
00050         F32         mRestitution;
00051 
00052         // damage and energy constants
00053         F32                     mHPModifier;            // modifier on mass based HP total
00054         F32                     mDamageModifier;        // modifier on KE based damage
00055         F32                     mEPModifier;            // modifier on mass based EP total
00056 
00057         LLMaterialInfo(U8 mcode, char* name, const LLUUID &uuid)
00058         {
00059                 init(mcode,name,uuid);
00060         };
00061 
00062         void init(U8 mcode, char* name, const LLUUID &uuid)
00063         {
00064                 mName[0] = 0;
00065                 mDensity = 1000.f;             // default to 1000.0 (water)
00066                 mHPModifier = 1.f;
00067                 mDamageModifier = 1.f;
00068                 mEPModifier = 1.f;
00069 
00070                 mMCode = mcode;
00071                 if (name)
00072                 {
00073                         LLString::copy(mName,name,LLMATERIAL_INFO_NAME_LENGTH);
00074                 }
00075                 mDefaultTextureID = uuid;               
00076         };
00077 
00078         ~LLMaterialInfo()
00079         {
00080         };
00081 
00082 };
00083 
00084 class LLMaterialTable
00085 {
00086 public:
00087         LLLinkedList<LLMaterialInfo>    mMaterialInfoList;
00088         LLUUID *mCollisionSoundMatrix;
00089         LLUUID *mSlidingSoundMatrix;
00090         LLUUID *mRollingSoundMatrix;
00091 
00092         static const F32 DEFAULT_FRICTION;
00093         static const F32 DEFAULT_RESTITUTION;
00094 
00095 public:
00096         LLMaterialTable();
00097         LLMaterialTable(U8);  // cheat with an overloaded constructor to build our basic table
00098         ~LLMaterialTable();
00099 
00100         void initBasicTable();
00101 
00102         BOOL add(U8 mcode, char* name, const LLUUID &uuid);                      
00103         BOOL addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid);
00104         BOOL addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid);
00105         BOOL addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid);
00106         BOOL addShatterSound(U8 mcode, const LLUUID &uuid);
00107         BOOL addDensity(U8 mcode, const F32 &density);
00108         BOOL addFriction(U8 mcode, const F32 &friction);
00109         BOOL addRestitution(U8 mcode, const F32 &restitution);
00110         BOOL addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 &damage_mod, const F32 &ep_mod);
00111 
00112         LLUUID getDefaultTextureID(char* name);                                 // LLUUID::null if not found
00113         LLUUID getDefaultTextureID(U8 mcode);                                   // LLUUID::null if not found
00114         U8     getMCode(const char* name);                                              // 0 if not found
00115         char*  getName(U8 mcode);
00116 
00117         F32 getDensity(U8 mcode);                                                       // kg/m^3, 0 if not found
00118         F32 getFriction(U8 mcode);                                                      // havok values
00119         F32 getRestitution(U8 mcode);                                               // havok values
00120         F32 getHPMod(U8 mcode);
00121         F32 getDamageMod(U8 mcode);
00122         F32 getEPMod(U8 mcode);
00123 
00124         LLUUID getCollisionSoundUUID(U8 mcode, U8 mcode2); 
00125         LLUUID getSlidingSoundUUID(U8 mcode, U8 mcode2); 
00126         LLUUID getRollingSoundUUID(U8 mcode, U8 mcode2); 
00127         LLUUID getShatterSoundUUID(U8 mcode);                                   // LLUUID::null if not found
00128 
00129         LLUUID getGroundCollisionSoundUUID(U8 mcode);
00130         LLUUID getGroundSlidingSoundUUID(U8 mcode);
00131         LLUUID getGroundRollingSoundUUID(U8 mcode);
00132         LLUUID getCollisionParticleUUID(U8 mcode, U8 mcode2);
00133         LLUUID getGroundCollisionParticleUUID(U8 mcode);
00134 
00135         static LLMaterialTable basic;
00136 };
00137 
00138 #endif
00139 

Generated on Thu Jul 1 06:08:51 2010 for Second Life Viewer by  doxygen 1.4.7