aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/SOPMaterial.cs130
-rw-r--r--OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs1
2 files changed, 65 insertions, 66 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs
index e4b9380..27b7679 100644
--- a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs
+++ b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs
@@ -121,8 +121,8 @@ namespace OpenSim.Region.Framework.Scenes
121 public byte SpecularLightColorB = 255; 121 public byte SpecularLightColorB = 255;
122 public byte SpecularLightColorA = 255; 122 public byte SpecularLightColorA = 255;
123 // data size 12 ints so far 123 // data size 12 ints so far
124 public UUID NormalMapID = UUID.Zero; 124 public UUID NormalMapID = UUID.Zero;
125 public UUID SpecularMapID = UUID.Zero; 125 public UUID SpecularMapID = UUID.Zero;
126 126
127 // other data 127 // other data
128 public UUID ID; 128 public UUID ID;
@@ -134,7 +134,7 @@ namespace OpenSim.Region.Framework.Scenes
134 134
135 public FaceMaterial(FaceMaterial other) 135 public FaceMaterial(FaceMaterial other)
136 { 136 {
137 if(other == null) 137 if (other == null)
138 return; 138 return;
139 139
140 DiffuseAlphaMode = other.DiffuseAlphaMode; 140 DiffuseAlphaMode = other.DiffuseAlphaMode;
@@ -160,32 +160,32 @@ namespace OpenSim.Region.Framework.Scenes
160 160
161 public FaceMaterial(OSDMap mat) 161 public FaceMaterial(OSDMap mat)
162 { 162 {
163 if(mat == null) 163 if (mat == null)
164 return; 164 return;
165 const float scale = 0.0001f; 165 const float scale = 0.0001f;
166 NormalMapID = mat["NormMap"].AsUUID(); 166 NormalMapID = mat["NormMap"].AsUUID();
167 NormalOffsetX = scale * (float)mat["NormOffsetX"].AsReal(); 167 NormalOffsetX = scale * (float)mat["NormOffsetX"].AsReal();
168 NormalOffsetY = scale * (float)mat["NormOffsetY"].AsReal(); 168 NormalOffsetY = scale * (float)mat["NormOffsetY"].AsReal();
169 NormalRepeatX = scale * (float)mat["NormRepeatX"].AsReal(); 169 NormalRepeatX = scale * (float)mat["NormRepeatX"].AsReal();
170 NormalRepeatY = scale * (float)mat["NormRepeatY"].AsReal(); 170 NormalRepeatY = scale * (float)mat["NormRepeatY"].AsReal();
171 NormalRotation = scale * (float)mat["NormRotation"].AsReal(); 171 NormalRotation = scale * (float)mat["NormRotation"].AsReal();
172 172
173 SpecularMapID = mat["SpecMap"].AsUUID(); 173 SpecularMapID = mat["SpecMap"].AsUUID();
174 SpecularOffsetX = scale * (float)mat["SpecOffsetX"].AsReal(); 174 SpecularOffsetX = scale * (float)mat["SpecOffsetX"].AsReal();
175 SpecularOffsetY = scale * (float)mat["SpecOffsetY"].AsReal(); 175 SpecularOffsetY = scale * (float)mat["SpecOffsetY"].AsReal();
176 SpecularRepeatX = scale * (float)mat["SpecRepeatX"].AsReal(); 176 SpecularRepeatX = scale * (float)mat["SpecRepeatX"].AsReal();
177 SpecularRepeatY = scale * (float)mat["SpecRepeatY"].AsReal(); 177 SpecularRepeatY = scale * (float)mat["SpecRepeatY"].AsReal();
178 SpecularRotation = scale * (float)mat["SpecRotation"].AsReal(); 178 SpecularRotation = scale * (float)mat["SpecRotation"].AsReal();
179 179
180 Color4 SpecularLightColortmp = mat["SpecColor"].AsColor4(); // we can read as color4 180 Color4 SpecularLightColortmp = mat["SpecColor"].AsColor4(); // we can read as color4
181 SpecularLightColorR = (byte)(SpecularLightColortmp.R); 181 SpecularLightColorR = (byte)(SpecularLightColortmp.R);
182 SpecularLightColorG = (byte)(SpecularLightColortmp.G); 182 SpecularLightColorG = (byte)(SpecularLightColortmp.G);
183 SpecularLightColorB = (byte)(SpecularLightColortmp.B); 183 SpecularLightColorB = (byte)(SpecularLightColortmp.B);
184 184
185 SpecularLightExponent = (Byte)mat["SpecExp"].AsUInteger(); 185 SpecularLightExponent = (Byte)mat["SpecExp"].AsUInteger();
186 EnvironmentIntensity = (Byte)mat["EnvIntensity"].AsUInteger(); 186 EnvironmentIntensity = (Byte)mat["EnvIntensity"].AsUInteger();
187 DiffuseAlphaMode = (Byte)mat["DiffuseAlphaMode"].AsUInteger(); 187 DiffuseAlphaMode = (Byte)mat["DiffuseAlphaMode"].AsUInteger();
188 AlphaMaskCutoff = (Byte)mat["AlphaMaskCutoff"].AsUInteger(); 188 AlphaMaskCutoff = (Byte)mat["AlphaMaskCutoff"].AsUInteger();
189 } 189 }
190 190
191 public void genID() 191 public void genID()
@@ -198,29 +198,29 @@ namespace OpenSim.Region.Framework.Scenes
198 198
199 public unsafe override int GetHashCode() 199 public unsafe override int GetHashCode()
200 { 200 {
201 if(!validinthash) 201 if (!validinthash)
202 { 202 {
203 unchecked 203 unchecked
204 { 204 {
205 // if you don't like this, don't read... 205 // if you don't like this, don't read...
206 int* ptr; 206 int* ptr;
207 fixed(byte* ptrbase = &DiffuseAlphaMode) 207 fixed (byte* ptrbase = &DiffuseAlphaMode)
208 { 208 {
209 ptr = (int*)ptrbase; 209 ptr = (int*)ptrbase;
210 inthash = *ptr; 210 inthash = *ptr;
211 for(int i = 0; i < 11; i++) 211 for (int i = 0; i < 11; i++)
212 inthash ^= *ptr++; 212 inthash ^= *ptr++;
213 } 213 }
214 fixed(Guid* ptrbase = &NormalMapID.Guid) 214 fixed (Guid* ptrbase = &NormalMapID.Guid)
215 { 215 {
216 ptr = (int*)ptrbase; 216 ptr = (int*)ptrbase;
217 for(int i = 0; i < 16; i++) 217 for (int i = 0; i < 16; i++)
218 inthash ^= ptr[i]; 218 inthash ^= ptr[i];
219 } 219 }
220 fixed(Guid* ptrbase = &SpecularMapID.Guid) 220 fixed (Guid* ptrbase = &SpecularMapID.Guid)
221 { 221 {
222 ptr = (int*)ptrbase; 222 ptr = (int*)ptrbase;
223 for(int i = 0; i < 16; i++) 223 for (int i = 0; i < 16; i++)
224 inthash ^= ptr[i]; 224 inthash ^= ptr[i];
225 } 225 }
226 } 226 }
@@ -231,7 +231,7 @@ namespace OpenSim.Region.Framework.Scenes
231 231
232 public override bool Equals(Object o) 232 public override bool Equals(Object o)
233 { 233 {
234 if(o == null || !(o is FaceMaterial)) 234 if (o == null || !(o is FaceMaterial))
235 return false; 235 return false;
236 236
237 FaceMaterial other = (FaceMaterial)o; 237 FaceMaterial other = (FaceMaterial)o;
@@ -264,18 +264,18 @@ namespace OpenSim.Region.Framework.Scenes
264 float scale = 10000f; 264 float scale = 10000f;
265 265
266 mat["NormMap"] = NormalMapID; 266 mat["NormMap"] = NormalMapID;
267 mat["NormOffsetX"] = (int) (scale * NormalOffsetX); 267 mat["NormOffsetX"] = (int)(scale * NormalOffsetX);
268 mat["NormOffsetY"] = (int) (scale * NormalOffsetY); 268 mat["NormOffsetY"] = (int)(scale * NormalOffsetY);
269 mat["NormRepeatX"] = (int) (scale * NormalRepeatX); 269 mat["NormRepeatX"] = (int)(scale * NormalRepeatX);
270 mat["NormRepeatY"] = (int) (scale * NormalRepeatY); 270 mat["NormRepeatY"] = (int)(scale * NormalRepeatY);
271 mat["NormRotation"] = (int) (scale * NormalRotation); 271 mat["NormRotation"] = (int)(scale * NormalRotation);
272 272
273 mat["SpecMap"] = SpecularMapID; 273 mat["SpecMap"] = SpecularMapID;
274 mat["SpecOffsetX"] = (int) (scale * SpecularOffsetX); 274 mat["SpecOffsetX"] = (int)(scale * SpecularOffsetX);
275 mat["SpecOffsetY"] = (int) (scale * SpecularOffsetY); 275 mat["SpecOffsetY"] = (int)(scale * SpecularOffsetY);
276 mat["SpecRepeatX"] = (int) (scale * SpecularRepeatX); 276 mat["SpecRepeatX"] = (int)(scale * SpecularRepeatX);
277 mat["SpecRepeatY"] = (int) (scale * SpecularRepeatY); 277 mat["SpecRepeatY"] = (int)(scale * SpecularRepeatY);
278 mat["SpecRotation"] = (int) (scale * SpecularRotation); 278 mat["SpecRotation"] = (int)(scale * SpecularRotation);
279 279
280 OSDArray carray = new OSDArray(4); 280 OSDArray carray = new OSDArray(4);
281 carray.Add(SpecularLightColorR); 281 carray.Add(SpecularLightColorR);
@@ -283,10 +283,10 @@ namespace OpenSim.Region.Framework.Scenes
283 carray.Add(SpecularLightColorB); 283 carray.Add(SpecularLightColorB);
284 carray.Add(255); // solid color 284 carray.Add(255); // solid color
285 mat["SpecColor"] = carray; 285 mat["SpecColor"] = carray;
286 mat["SpecExp"] = SpecularLightExponent; 286 mat["SpecExp"] = SpecularLightExponent;
287 mat["EnvIntensity"] = EnvironmentIntensity; 287 mat["EnvIntensity"] = EnvironmentIntensity;
288 mat["DiffuseAlphaMode"] = DiffuseAlphaMode; 288 mat["DiffuseAlphaMode"] = DiffuseAlphaMode;
289 mat["AlphaMaskCutoff"] = AlphaMaskCutoff; 289 mat["AlphaMaskCutoff"] = AlphaMaskCutoff;
290 290
291 return mat; 291 return mat;
292 } 292 }
@@ -295,27 +295,27 @@ namespace OpenSim.Region.Framework.Scenes
295 { 295 {
296 const float scale = 10000f; 296 const float scale = 10000f;
297 bool fullLLSD = false; 297 bool fullLLSD = false;
298 if(sb == null) 298 if (sb == null)
299 { 299 {
300 300
301 sb = LLSDxmlEncode.Start(1024,false); 301 sb = LLSDxmlEncode.Start(1024, false);
302 fullLLSD = true; 302 fullLLSD = true;
303 } 303 }
304 304
305 LLSDxmlEncode.AddMap(sb); 305 LLSDxmlEncode.AddMap(sb);
306 LLSDxmlEncode.AddElem("NormMap", NormalMapID, sb); 306 LLSDxmlEncode.AddElem("NormMap", NormalMapID, sb);
307 LLSDxmlEncode.AddElem("NormOffsetX", (int) (scale * NormalOffsetX + 0.5f), sb); 307 LLSDxmlEncode.AddElem("NormOffsetX", (int)(scale * NormalOffsetX + 0.5f), sb);
308 LLSDxmlEncode.AddElem("NormOffsetY", (int) (scale * NormalOffsetY + 0.5f), sb); 308 LLSDxmlEncode.AddElem("NormOffsetY", (int)(scale * NormalOffsetY + 0.5f), sb);
309 LLSDxmlEncode.AddElem("NormRepeatX", (int) (scale * NormalRepeatX + 0.5f), sb); 309 LLSDxmlEncode.AddElem("NormRepeatX", (int)(scale * NormalRepeatX + 0.5f), sb);
310 LLSDxmlEncode.AddElem("NormRepeatY", (int) (scale * NormalRepeatY + 0.5f), sb); 310 LLSDxmlEncode.AddElem("NormRepeatY", (int)(scale * NormalRepeatY + 0.5f), sb);
311 LLSDxmlEncode.AddElem("NormRotation", (int) (scale * NormalRotation + 0.5f), sb); 311 LLSDxmlEncode.AddElem("NormRotation", (int)(scale * NormalRotation + 0.5f), sb);
312 312
313 LLSDxmlEncode.AddElem("SpecMap", SpecularMapID, sb); 313 LLSDxmlEncode.AddElem("SpecMap", SpecularMapID, sb);
314 LLSDxmlEncode.AddElem("SpecOffsetX", (int) (scale * SpecularOffsetX + 0.5f), sb); 314 LLSDxmlEncode.AddElem("SpecOffsetX", (int)(scale * SpecularOffsetX + 0.5f), sb);
315 LLSDxmlEncode.AddElem("SpecOffsetY", (int) (scale * SpecularOffsetY + 0.5f), sb); 315 LLSDxmlEncode.AddElem("SpecOffsetY", (int)(scale * SpecularOffsetY + 0.5f), sb);
316 LLSDxmlEncode.AddElem("SpecRepeatX", (int) (scale * SpecularRepeatX + 0.5f), sb); 316 LLSDxmlEncode.AddElem("SpecRepeatX", (int)(scale * SpecularRepeatX + 0.5f), sb);
317 LLSDxmlEncode.AddElem("SpecRepeatY", (int) (scale * SpecularRepeatY + 0.5f), sb); 317 LLSDxmlEncode.AddElem("SpecRepeatY", (int)(scale * SpecularRepeatY + 0.5f), sb);
318 LLSDxmlEncode.AddElem("SpecRotation", (int) (scale * SpecularRotation + 0.5f), sb); 318 LLSDxmlEncode.AddElem("SpecRotation", (int)(scale * SpecularRotation + 0.5f), sb);
319 319
320 LLSDxmlEncode.AddArray("SpecColor", sb); 320 LLSDxmlEncode.AddArray("SpecColor", sb);
321 LLSDxmlEncode.AddElem(SpecularLightColorR, sb); 321 LLSDxmlEncode.AddElem(SpecularLightColorR, sb);
@@ -324,14 +324,14 @@ namespace OpenSim.Region.Framework.Scenes
324 LLSDxmlEncode.AddElem(255, sb); 324 LLSDxmlEncode.AddElem(255, sb);
325 LLSDxmlEncode.AddEndArray(sb); 325 LLSDxmlEncode.AddEndArray(sb);
326 326
327 LLSDxmlEncode.AddElem("SpecExp", SpecularLightExponent, sb); 327 LLSDxmlEncode.AddElem("SpecExp", SpecularLightExponent, sb);
328 LLSDxmlEncode.AddElem("EnvIntensity", EnvironmentIntensity, sb); 328 LLSDxmlEncode.AddElem("EnvIntensity", EnvironmentIntensity, sb);
329 LLSDxmlEncode.AddElem("DiffuseAlphaMode", DiffuseAlphaMode, sb); 329 LLSDxmlEncode.AddElem("DiffuseAlphaMode", DiffuseAlphaMode, sb);
330 LLSDxmlEncode.AddElem("AlphaMaskCutoff", AlphaMaskCutoff, sb); 330 LLSDxmlEncode.AddElem("AlphaMaskCutoff", AlphaMaskCutoff, sb);
331 331
332 LLSDxmlEncode.AddEndMap(sb); 332 LLSDxmlEncode.AddEndMap(sb);
333 333
334 if(fullLLSD) 334 if (fullLLSD)
335 { 335 {
336 return LLSDxmlEncode.End(sb); 336 return LLSDxmlEncode.End(sb);
337 } 337 }
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs
index 6a4ef1e..7397218 100644
--- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs
+++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs
@@ -442,7 +442,6 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
442 while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0) 442 while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0)
443 outMs.Write(readBuffer, 0, readLen); 443 outMs.Write(readBuffer, 0, readLen);
444 444
445 outMs.Flush();
446 outMs.Seek(0, SeekOrigin.Begin); 445 outMs.Seek(0, SeekOrigin.Begin);
447 446
448 byte[] decompressedBuf = outMs.GetBuffer(); 447 byte[] decompressedBuf = outMs.GetBuffer();