diff options
Diffstat (limited to 'linden/indra/llprimitive/llmaterialtable.h')
-rw-r--r-- | linden/indra/llprimitive/llmaterialtable.h | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/linden/indra/llprimitive/llmaterialtable.h b/linden/indra/llprimitive/llmaterialtable.h new file mode 100644 index 0000000..12be1e9 --- /dev/null +++ b/linden/indra/llprimitive/llmaterialtable.h | |||
@@ -0,0 +1,135 @@ | |||
1 | /** | ||
2 | * @file llmaterialtable.h | ||
3 | * @brief Table of material information for the viewer UI | ||
4 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #ifndef LL_LLMATERIALTABLE_H | ||
29 | #define LL_LLMATERIALTABLE_H | ||
30 | |||
31 | #include "lluuid.h" | ||
32 | #include "linked_lists.h" | ||
33 | #include "llstring.h" | ||
34 | |||
35 | const U32 LLMATERIAL_INFO_NAME_LENGTH = 256; | ||
36 | |||
37 | class LLMaterialInfo | ||
38 | { | ||
39 | public: | ||
40 | U8 mMCode; | ||
41 | char mName[LLMATERIAL_INFO_NAME_LENGTH]; | ||
42 | LLUUID mDefaultTextureID; | ||
43 | LLUUID mShatterSoundID; | ||
44 | F32 mDensity; // kg/m^3 | ||
45 | F32 mFriction; | ||
46 | F32 mRestitution; | ||
47 | |||
48 | // damage and energy constants | ||
49 | F32 mHPModifier; // modifier on mass based HP total | ||
50 | F32 mDamageModifier; // modifier on KE based damage | ||
51 | F32 mEPModifier; // modifier on mass based EP total | ||
52 | |||
53 | LLMaterialInfo(U8 mcode, char* name, const LLUUID &uuid) | ||
54 | { | ||
55 | init(mcode,name,uuid); | ||
56 | }; | ||
57 | |||
58 | void init(U8 mcode, char* name, const LLUUID &uuid) | ||
59 | { | ||
60 | mName[0] = 0; | ||
61 | mDensity = 1000.f; // default to 1000.0 (water) | ||
62 | mHPModifier = 1.f; | ||
63 | mDamageModifier = 1.f; | ||
64 | mEPModifier = 1.f; | ||
65 | |||
66 | mMCode = mcode; | ||
67 | if (name) | ||
68 | { | ||
69 | LLString::copy(mName,name,LLMATERIAL_INFO_NAME_LENGTH); | ||
70 | } | ||
71 | mDefaultTextureID = uuid; | ||
72 | }; | ||
73 | |||
74 | ~LLMaterialInfo() | ||
75 | { | ||
76 | }; | ||
77 | |||
78 | }; | ||
79 | |||
80 | class LLMaterialTable | ||
81 | { | ||
82 | public: | ||
83 | LLLinkedList<LLMaterialInfo> mMaterialInfoList; | ||
84 | LLUUID *mCollisionSoundMatrix; | ||
85 | LLUUID *mSlidingSoundMatrix; | ||
86 | LLUUID *mRollingSoundMatrix; | ||
87 | |||
88 | static const F32 DEFAULT_FRICTION; | ||
89 | static const F32 DEFAULT_RESTITUTION; | ||
90 | |||
91 | public: | ||
92 | LLMaterialTable(); | ||
93 | LLMaterialTable(U8); // cheat with an overloaded constructor to build our basic table | ||
94 | ~LLMaterialTable(); | ||
95 | |||
96 | void initBasicTable(); | ||
97 | |||
98 | BOOL add(U8 mcode, char* name, const LLUUID &uuid); | ||
99 | BOOL addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid); | ||
100 | BOOL addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); | ||
101 | BOOL addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); | ||
102 | BOOL addShatterSound(U8 mcode, const LLUUID &uuid); | ||
103 | BOOL addDensity(U8 mcode, const F32 &density); | ||
104 | BOOL addFriction(U8 mcode, const F32 &friction); | ||
105 | BOOL addRestitution(U8 mcode, const F32 &restitution); | ||
106 | BOOL addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 &damage_mod, const F32 &ep_mod); | ||
107 | |||
108 | LLUUID getDefaultTextureID(char* name); // LLUUID::null if not found | ||
109 | LLUUID getDefaultTextureID(U8 mcode); // LLUUID::null if not found | ||
110 | U8 getMCode(const char* name); // 0 if not found | ||
111 | char* getName(U8 mcode); | ||
112 | |||
113 | F32 getDensity(U8 mcode); // kg/m^3, 0 if not found | ||
114 | F32 getFriction(U8 mcode); // havok values | ||
115 | F32 getRestitution(U8 mcode); // havok values | ||
116 | F32 getHPMod(U8 mcode); | ||
117 | F32 getDamageMod(U8 mcode); | ||
118 | F32 getEPMod(U8 mcode); | ||
119 | |||
120 | LLUUID getCollisionSoundUUID(U8 mcode, U8 mcode2); | ||
121 | LLUUID getSlidingSoundUUID(U8 mcode, U8 mcode2); | ||
122 | LLUUID getRollingSoundUUID(U8 mcode, U8 mcode2); | ||
123 | LLUUID getShatterSoundUUID(U8 mcode); // LLUUID::null if not found | ||
124 | |||
125 | LLUUID getGroundCollisionSoundUUID(U8 mcode); | ||
126 | LLUUID getGroundSlidingSoundUUID(U8 mcode); | ||
127 | LLUUID getGroundRollingSoundUUID(U8 mcode); | ||
128 | LLUUID getCollisionParticleUUID(U8 mcode, U8 mcode2); | ||
129 | LLUUID getGroundCollisionParticleUUID(U8 mcode); | ||
130 | |||
131 | static LLMaterialTable basic; | ||
132 | }; | ||
133 | |||
134 | #endif | ||
135 | |||