diff options
author | UbitUmarov | 2018-05-26 23:03:27 +0100 |
---|---|---|
committer | UbitUmarov | 2018-05-26 23:03:27 +0100 |
commit | e0b2ee80f9a0325405124a189d2d36a5e9478efc (patch) | |
tree | 2ab19cce9f4e46027c288c7725660d685de0f172 /OpenSim/Region | |
parent | update warp3d.dll (diff) | |
download | opensim-SC-e0b2ee80f9a0325405124a189d2d36a5e9478efc.zip opensim-SC-e0b2ee80f9a0325405124a189d2d36a5e9478efc.tar.gz opensim-SC-e0b2ee80f9a0325405124a189d2d36a5e9478efc.tar.bz2 opensim-SC-e0b2ee80f9a0325405124a189d2d36a5e9478efc.tar.xz |
fix a bug on warp3d.dll
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index d76bdf7..69c7b57 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs | |||
@@ -107,7 +107,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
107 | Util.GetConfigVarFromSections<bool>(m_config, "TextureOnMapTile", configSections, m_textureTerrain); | 107 | Util.GetConfigVarFromSections<bool>(m_config, "TextureOnMapTile", configSections, m_textureTerrain); |
108 | m_textureAverageTerrain = | 108 | m_textureAverageTerrain = |
109 | Util.GetConfigVarFromSections<bool>(m_config, "AverageTextureColorOnMapTile", configSections, m_textureAverageTerrain); | 109 | Util.GetConfigVarFromSections<bool>(m_config, "AverageTextureColorOnMapTile", configSections, m_textureAverageTerrain); |
110 | if(m_textureAverageTerrain) | 110 | if (m_textureAverageTerrain) |
111 | m_textureTerrain = true; | 111 | m_textureTerrain = true; |
112 | m_texturePrims = | 112 | m_texturePrims = |
113 | Util.GetConfigVarFromSections<bool>(m_config, "TexturePrims", configSections, m_texturePrims); | 113 | Util.GetConfigVarFromSections<bool>(m_config, "TexturePrims", configSections, m_texturePrims); |
@@ -116,7 +116,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
116 | m_renderMeshes = | 116 | m_renderMeshes = |
117 | Util.GetConfigVarFromSections<bool>(m_config, "RenderMeshes", configSections, m_renderMeshes); | 117 | Util.GetConfigVarFromSections<bool>(m_config, "RenderMeshes", configSections, m_renderMeshes); |
118 | 118 | ||
119 | } | 119 | } |
120 | 120 | ||
121 | public void AddRegion(Scene scene) | 121 | public void AddRegion(Scene scene) |
122 | { | 122 | { |
@@ -227,7 +227,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
227 | 227 | ||
228 | WarpRenderer renderer = new WarpRenderer(); | 228 | WarpRenderer renderer = new WarpRenderer(); |
229 | 229 | ||
230 | if(!renderer.CreateScene(viewWitdh, viewHeigth)) | 230 | if (!renderer.CreateScene(viewWitdh, viewHeigth)) |
231 | return new Bitmap(viewWitdh, viewHeigth); | 231 | return new Bitmap(viewWitdh, viewHeigth); |
232 | 232 | ||
233 | #region Camera | 233 | #region Camera |
@@ -235,16 +235,16 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
235 | warp_Vector pos = ConvertVector(cameraPos); | 235 | warp_Vector pos = ConvertVector(cameraPos); |
236 | warp_Vector lookat = warp_Vector.add(pos, ConvertVector(cameraDir)); | 236 | warp_Vector lookat = warp_Vector.add(pos, ConvertVector(cameraDir)); |
237 | 237 | ||
238 | if(orto) | 238 | if (orto) |
239 | renderer.Scene.defaultCamera.setOrthographic(true, viewWitdh, viewHeigth); | 239 | renderer.Scene.defaultCamera.setOrthographic(true, viewWitdh, viewHeigth); |
240 | else | 240 | else |
241 | renderer.Scene.defaultCamera.setFov(fov); | 241 | renderer.Scene.defaultCamera.setFov(fov); |
242 | 242 | ||
243 | renderer.Scene.defaultCamera.setPos(pos); | 243 | renderer.Scene.defaultCamera.setPos(pos); |
244 | renderer.Scene.defaultCamera.lookAt(lookat); | 244 | renderer.Scene.defaultCamera.lookAt(lookat); |
245 | #endregion Camera | 245 | #endregion Camera |
246 | 246 | ||
247 | renderer.Scene.setAmbient(warp_Color.getColor(192,191,173)); | 247 | renderer.Scene.setAmbient(warp_Color.getColor(192, 191, 173)); |
248 | renderer.Scene.addLight("Light1", new warp_Light(new warp_Vector(0f, 1f, 8f), warp_Color.White, 0, 320, 40)); | 248 | renderer.Scene.addLight("Light1", new warp_Light(new warp_Vector(0f, 1f, 8f), warp_Color.White, 0, 320, 40)); |
249 | 249 | ||
250 | CreateWater(renderer); | 250 | CreateWater(renderer); |
@@ -297,9 +297,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
297 | waterHeight, | 297 | waterHeight, |
298 | m_scene.RegionInfo.RegionSizeY * 0.5f); | 298 | m_scene.RegionInfo.RegionSizeY * 0.5f); |
299 | 299 | ||
300 | warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR)); | 300 | warp_Material waterMaterial = new warp_Material(ConvertColor(WATER_COLOR)); |
301 | renderer.Scene.addMaterial("WaterColor", waterColorMaterial); | 301 | renderer.Scene.addMaterial("WaterMat", waterMaterial); |
302 | renderer.SetObjectMaterial("Water", "WaterColor"); | 302 | renderer.SetObjectMaterial("Water", "WaterMat"); |
303 | } | 303 | } |
304 | 304 | ||
305 | // Add a terrain to the renderer. | 305 | // Add a terrain to the renderer. |
@@ -321,9 +321,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
321 | bitWidth = (int)Math.Ceiling((Math.Log(terrain.Width) * log2inv)); | 321 | bitWidth = (int)Math.Ceiling((Math.Log(terrain.Width) * log2inv)); |
322 | bitHeight = (int)Math.Ceiling((Math.Log(terrain.Height) * log2inv)); | 322 | bitHeight = (int)Math.Ceiling((Math.Log(terrain.Height) * log2inv)); |
323 | 323 | ||
324 | if(bitWidth > 8) // more than 256 is very heavy :( | 324 | if (bitWidth > 8) // more than 256 is very heavy :( |
325 | bitWidth = 8; | 325 | bitWidth = 8; |
326 | if(bitHeight > 8) | 326 | if (bitHeight > 8) |
327 | bitHeight = 8; | 327 | bitHeight = 8; |
328 | 328 | ||
329 | int twidth = (int)Math.Pow(2, bitWidth); | 329 | int twidth = (int)Math.Pow(2, bitWidth); |
@@ -350,20 +350,20 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
350 | tv = y * invsy; | 350 | tv = y * invsy; |
351 | for (x = 0; x < regionsx; x += diff) | 351 | for (x = 0; x < regionsx; x += diff) |
352 | { | 352 | { |
353 | pos = ConvertVector(x , y , (float)terrain[(int)x, (int)y]); | 353 | pos = ConvertVector(x, y, (float)terrain[(int)x, (int)y]); |
354 | obj.addVertex(new warp_Vertex(pos, x * invsx, tv )); | 354 | obj.addVertex(new warp_Vertex(pos, x * invsx, tv)); |
355 | } | 355 | } |
356 | pos = ConvertVector(x , y , (float)terrain[(int)(x - diff), (int)y]); | 356 | pos = ConvertVector(x, y, (float)terrain[(int)(x - diff), (int)y]); |
357 | obj.addVertex(new warp_Vertex(pos, 1.0f, tv)); | 357 | obj.addVertex(new warp_Vertex(pos, 1.0f, tv)); |
358 | } | 358 | } |
359 | 359 | ||
360 | int lastY = (int)(y - diff); | 360 | int lastY = (int)(y - diff); |
361 | for (x = 0; x < regionsx; x += diff) | 361 | for (x = 0; x < regionsx; x += diff) |
362 | { | 362 | { |
363 | pos = ConvertVector(x , y , (float)terrain[(int)x, lastY]); | 363 | pos = ConvertVector(x, y, (float)terrain[(int)x, lastY]); |
364 | obj.addVertex(new warp_Vertex(pos, x * invsx, 1.0f)); | 364 | obj.addVertex(new warp_Vertex(pos, x * invsx, 1.0f)); |
365 | } | 365 | } |
366 | pos = ConvertVector(x , y , (float)terrain[(int)(x - diff), lastY]); | 366 | pos = ConvertVector(x, y, (float)terrain[(int)(x - diff), lastY]); |
367 | obj.addVertex(new warp_Vertex(pos, 1.0f, 1.0f)); | 367 | obj.addVertex(new warp_Vertex(pos, 1.0f, 1.0f)); |
368 | 368 | ||
369 | // create triangles. | 369 | // create triangles. |
@@ -410,7 +410,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
410 | heightRanges[1] = (float)regionInfo.Elevation2NW; | 410 | heightRanges[1] = (float)regionInfo.Elevation2NW; |
411 | heightRanges[2] = (float)regionInfo.Elevation2SE; | 411 | heightRanges[2] = (float)regionInfo.Elevation2SE; |
412 | heightRanges[3] = (float)regionInfo.Elevation2NE; | 412 | heightRanges[3] = (float)regionInfo.Elevation2NE; |
413 | 413 | ||
414 | warp_Texture texture; | 414 | warp_Texture texture; |
415 | using (Bitmap image = TerrainSplat.Splat(terrain, textureIDs, startHeights, heightRanges, | 415 | using (Bitmap image = TerrainSplat.Splat(terrain, textureIDs, startHeights, heightRanges, |
416 | m_scene.RegionInfo.WorldLocX, m_scene.RegionInfo.WorldLocY, | 416 | m_scene.RegionInfo.WorldLocX, m_scene.RegionInfo.WorldLocY, |
@@ -419,8 +419,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
419 | texture = new warp_Texture(image); | 419 | texture = new warp_Texture(image); |
420 | 420 | ||
421 | warp_Material material = new warp_Material(texture); | 421 | warp_Material material = new warp_Material(texture); |
422 | renderer.Scene.addMaterial("TerrainColor", material); | 422 | renderer.Scene.addMaterial("TerrainMat", material); |
423 | renderer.SetObjectMaterial("Terrain", "TerrainColor"); | 423 | renderer.SetObjectMaterial("Terrain", "TerrainMat"); |
424 | } | 424 | } |
425 | 425 | ||
426 | private void CreateAllPrims(WarpRenderer renderer) | 426 | private void CreateAllPrims(WarpRenderer renderer) |
@@ -429,14 +429,14 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
429 | return; | 429 | return; |
430 | 430 | ||
431 | m_scene.ForEachSOG( | 431 | m_scene.ForEachSOG( |
432 | delegate(SceneObjectGroup group) | 432 | delegate (SceneObjectGroup group) |
433 | { | 433 | { |
434 | foreach (SceneObjectPart child in group.Parts) | 434 | foreach (SceneObjectPart child in group.Parts) |
435 | CreatePrim(renderer, child); | 435 | CreatePrim(renderer, child); |
436 | } | 436 | } |
437 | ); | 437 | ); |
438 | } | 438 | } |
439 | 439 | ||
440 | private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim) | 440 | private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim) |
441 | { | 441 | { |
442 | if ((PCode)prim.Shape.PCode != PCode.Prim) | 442 | if ((PCode)prim.Shape.PCode != PCode.Prim) |
@@ -447,14 +447,14 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
447 | warp_Matrix m = warp_Matrix.quaternionMatrix(primRot); | 447 | warp_Matrix m = warp_Matrix.quaternionMatrix(primRot); |
448 | 448 | ||
449 | float screenFactor = renderer.Scene.EstimateBoxProjectedArea(primPos, ConvertVector(prim.Scale), m); | 449 | float screenFactor = renderer.Scene.EstimateBoxProjectedArea(primPos, ConvertVector(prim.Scale), m); |
450 | if(screenFactor < 0) | 450 | if (screenFactor < 0) |
451 | return; | 451 | return; |
452 | 452 | ||
453 | int p2 = (int)(-(float)Math.Log(screenFactor) * 1.442695f * 0.5 - 1); | 453 | int p2 = (int)(-(float)Math.Log(screenFactor) * 1.442695f * 0.5 - 1); |
454 | 454 | ||
455 | if(p2 < 0) | 455 | if (p2 < 0) |
456 | p2 = 0; | 456 | p2 = 0; |
457 | else if(p2 > 3) | 457 | else if (p2 > 3) |
458 | p2 = 3; | 458 | p2 = 3; |
459 | 459 | ||
460 | DetailLevel lod = (DetailLevel)(3 - p2); | 460 | DetailLevel lod = (DetailLevel)(3 - p2); |
@@ -479,12 +479,12 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
479 | } | 479 | } |
480 | else // It's sculptie | 480 | else // It's sculptie |
481 | { | 481 | { |
482 | if(m_imgDecoder != null) | 482 | if (m_imgDecoder != null) |
483 | { | 483 | { |
484 | Image sculpt = m_imgDecoder.DecodeToImage(sculptAsset); | 484 | Image sculpt = m_imgDecoder.DecodeToImage(sculptAsset); |
485 | if(sculpt != null) | 485 | if (sculpt != null) |
486 | { | 486 | { |
487 | renderMesh = m_primMesher.GenerateFacetedSculptMesh(omvPrim,(Bitmap)sculpt, lod); | 487 | renderMesh = m_primMesher.GenerateFacetedSculptMesh(omvPrim, (Bitmap)sculpt, lod); |
488 | sculpt.Dispose(); | 488 | sculpt.Dispose(); |
489 | } | 489 | } |
490 | } | 490 | } |
@@ -519,27 +519,27 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
519 | 519 | ||
520 | Primitive.TextureEntryFace teFace = prim.Shape.Textures.GetFace((uint)i); | 520 | Primitive.TextureEntryFace teFace = prim.Shape.Textures.GetFace((uint)i); |
521 | Color4 faceColor = teFace.RGBA; | 521 | Color4 faceColor = teFace.RGBA; |
522 | if(faceColor.A == 0) | 522 | if (faceColor.A == 0) |
523 | continue; | 523 | continue; |
524 | 524 | ||
525 | string materialName = String.Empty; | 525 | string materialName = String.Empty; |
526 | if (m_texturePrims) | 526 | if (m_texturePrims) |
527 | { | 527 | { |
528 | // if(lod > DetailLevel.Low) | 528 | // if(lod > DetailLevel.Low) |
529 | { | 529 | { |
530 | // materialName = GetOrCreateMaterial(renderer, faceColor, teFace.TextureID, lod == DetailLevel.Low); | 530 | // materialName = GetOrCreateMaterial(renderer, faceColor, teFace.TextureID, lod == DetailLevel.Low); |
531 | materialName = GetOrCreateMaterial(renderer, faceColor, teFace.TextureID, false); | 531 | materialName = GetOrCreateMaterial(renderer, faceColor, teFace.TextureID, false); |
532 | if(String.IsNullOrEmpty(materialName)) | 532 | if (String.IsNullOrEmpty(materialName)) |
533 | continue; | 533 | continue; |
534 | int c = renderer.Scene.material(materialName).getColor(); | 534 | int c = renderer.Scene.material(materialName).getColor(); |
535 | if((c & warp_Color.MASKALPHA) == 0) | 535 | if ((c & warp_Color.MASKALPHA) == 0) |
536 | continue; | 536 | continue; |
537 | } | 537 | } |
538 | } | 538 | } |
539 | else | 539 | else |
540 | materialName = GetOrCreateMaterial(renderer, faceColor); | 540 | materialName = GetOrCreateMaterial(renderer, faceColor); |
541 | 541 | ||
542 | if(renderer.Scene.material(materialName).getTexture() == null) | 542 | if (renderer.Scene.material(materialName).getTexture() == null) |
543 | { | 543 | { |
544 | // uv map details dont not matter for color; | 544 | // uv map details dont not matter for color; |
545 | for (int j = 0; j < face.Vertices.Count; j++) | 545 | for (int j = 0; j < face.Vertices.Count; j++) |
@@ -549,7 +549,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
549 | warp_Vertex vert = new warp_Vertex(pos, v.TexCoord.X, v.TexCoord.Y); | 549 | warp_Vertex vert = new warp_Vertex(pos, v.TexCoord.X, v.TexCoord.Y); |
550 | faceObj.addVertex(vert); | 550 | faceObj.addVertex(vert); |
551 | } | 551 | } |
552 | } | 552 | } |
553 | else | 553 | else |
554 | { | 554 | { |
555 | float tu; | 555 | float tu; |
@@ -561,7 +561,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
561 | float rotation = teFace.Rotation; | 561 | float rotation = teFace.Rotation; |
562 | float rc = 0; | 562 | float rc = 0; |
563 | float rs = 0; | 563 | float rs = 0; |
564 | if(rotation != 0) | 564 | if (rotation != 0) |
565 | { | 565 | { |
566 | rc = (float)Math.Cos(rotation); | 566 | rc = (float)Math.Cos(rotation); |
567 | rs = (float)Math.Sin(rotation); | 567 | rs = (float)Math.Sin(rotation); |
@@ -574,7 +574,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
574 | warp_Vector pos = ConvertVector(v.Position); | 574 | warp_Vector pos = ConvertVector(v.Position); |
575 | tu = v.TexCoord.X - 0.5f; | 575 | tu = v.TexCoord.X - 0.5f; |
576 | tv = 0.5f - v.TexCoord.Y; | 576 | tv = 0.5f - v.TexCoord.Y; |
577 | if(rotation != 0) | 577 | if (rotation != 0) |
578 | { | 578 | { |
579 | float tur = tu * rc - tv * rs; | 579 | float tur = tu * rc - tv * rs; |
580 | float tvr = tu * rs + tv * rc; | 580 | float tvr = tu * rs + tv * rc; |
@@ -593,10 +593,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
593 | tv += offsetv; | 593 | tv += offsetv; |
594 | vert = new warp_Vertex(pos, tu, tv); | 594 | vert = new warp_Vertex(pos, tu, tv); |
595 | } | 595 | } |
596 | 596 | ||
597 | faceObj.addVertex(vert); | 597 | faceObj.addVertex(vert); |
598 | } | 598 | } |
599 | } | 599 | } |
600 | 600 | ||
601 | for (int j = 0; j < face.Indices.Count; j += 3) | 601 | for (int j = 0; j < face.Indices.Count; j += 3) |
602 | { | 602 | { |
@@ -628,7 +628,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
628 | bool fetched = false; | 628 | bool fetched = false; |
629 | 629 | ||
630 | // Attempt to fetch the texture metadata | 630 | // Attempt to fetch the texture metadata |
631 | string cacheName = "MAPCLR"+face.TextureID.ToString(); | 631 | string cacheName = "MAPCLR" + face.TextureID.ToString(); |
632 | AssetBase metadata = m_scene.AssetService.GetCached(cacheName); | 632 | AssetBase metadata = m_scene.AssetService.GetCached(cacheName); |
633 | if (metadata != null) | 633 | if (metadata != null) |
634 | { | 634 | { |
@@ -637,7 +637,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
637 | 637 | ||
638 | if (map != null) | 638 | if (map != null) |
639 | { | 639 | { |
640 | ctmp = map["X-RGBA"].AsColor4(); | 640 | ctmp = map["X-RGBA"].AsColor4(); |
641 | fetched = true; | 641 | fetched = true; |
642 | } | 642 | } |
643 | } | 643 | } |
@@ -704,14 +704,14 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
704 | warp_Texture texture = GetTexture(textureID); | 704 | warp_Texture texture = GetTexture(textureID); |
705 | if (texture != null) | 705 | if (texture != null) |
706 | { | 706 | { |
707 | if(useAverageTextureColor) | 707 | if (useAverageTextureColor) |
708 | color = warp_Color.multiply(color, texture.averageColor); | 708 | color = warp_Color.multiply(color, texture.averageColor); |
709 | else | 709 | else |
710 | mat.setTexture(texture); | 710 | mat.setTexture(texture); |
711 | } | 711 | } |
712 | else | 712 | else |
713 | color = warp_Color.multiply(color, warp_Color.Grey); | 713 | color = warp_Color.multiply(color, warp_Color.Grey); |
714 | 714 | ||
715 | mat.setColor(color); | 715 | mat.setColor(color); |
716 | renderer.Scene.addMaterial(materialName, mat); | 716 | renderer.Scene.addMaterial(materialName, mat); |
717 | 717 | ||
@@ -721,16 +721,16 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
721 | private warp_Texture GetTexture(UUID id) | 721 | private warp_Texture GetTexture(UUID id) |
722 | { | 722 | { |
723 | warp_Texture ret = null; | 723 | warp_Texture ret = null; |
724 | if(id == UUID.Zero) | 724 | if (id == UUID.Zero) |
725 | return ret; | 725 | return ret; |
726 | 726 | ||
727 | if(m_warpTextures.TryGetValue(id.ToString(), out ret)) | 727 | if (m_warpTextures.TryGetValue(id.ToString(), out ret)) |
728 | return ret; | 728 | return ret; |
729 | 729 | ||
730 | byte[] asset = m_scene.AssetService.GetData(id.ToString()); | 730 | byte[] asset = m_scene.AssetService.GetData(id.ToString()); |
731 | 731 | ||
732 | if (asset != null) | 732 | if (asset != null) |
733 | { | 733 | { |
734 | try | 734 | try |
735 | { | 735 | { |
736 | using (Bitmap img = (Bitmap)m_imgDecoder.DecodeToImage(asset)) | 736 | using (Bitmap img = (Bitmap)m_imgDecoder.DecodeToImage(asset)) |
@@ -761,7 +761,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
761 | 761 | ||
762 | private static warp_Quaternion ConvertQuaternion(Quaternion quat) | 762 | private static warp_Quaternion ConvertQuaternion(Quaternion quat) |
763 | { | 763 | { |
764 | return new warp_Quaternion(quat.X, quat.Z, quat.Y, -quat.W); | 764 | return new warp_Quaternion(quat.X, quat.Z, quat.Y, -quat.W); |
765 | } | 765 | } |
766 | 766 | ||
767 | private static int ConvertColor(Color4 color) | 767 | private static int ConvertColor(Color4 color) |
@@ -791,8 +791,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
791 | 791 | ||
792 | try | 792 | try |
793 | { | 793 | { |
794 | using(MemoryStream stream = new MemoryStream(j2kData)) | 794 | using (MemoryStream stream = new MemoryStream(j2kData)) |
795 | using(Bitmap bitmap = (Bitmap)J2kImage.FromStream(stream)) | 795 | using (Bitmap bitmap = (Bitmap)J2kImage.FromStream(stream)) |
796 | { | 796 | { |
797 | width = bitmap.Width; | 797 | width = bitmap.Width; |
798 | height = bitmap.Height; | 798 | height = bitmap.Height; |
@@ -803,13 +803,13 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
803 | // Sum up the individual channels | 803 | // Sum up the individual channels |
804 | unsafe | 804 | unsafe |
805 | { | 805 | { |
806 | if(pixelBytes == 4) | 806 | if (pixelBytes == 4) |
807 | { | 807 | { |
808 | for(int y = 0; y < height; y++) | 808 | for (int y = 0; y < height; y++) |
809 | { | 809 | { |
810 | byte* row = (byte*)bitmapData.Scan0 + (y * bitmapData.Stride); | 810 | byte* row = (byte*)bitmapData.Scan0 + (y * bitmapData.Stride); |
811 | 811 | ||
812 | for(int x = 0; x < width; x++) | 812 | for (int x = 0; x < width; x++) |
813 | { | 813 | { |
814 | b += row[x * pixelBytes + 0]; | 814 | b += row[x * pixelBytes + 0]; |
815 | g += row[x * pixelBytes + 1]; | 815 | g += row[x * pixelBytes + 1]; |
@@ -820,11 +820,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
820 | } | 820 | } |
821 | else | 821 | else |
822 | { | 822 | { |
823 | for(int y = 0; y < height; y++) | 823 | for (int y = 0; y < height; y++) |
824 | { | 824 | { |
825 | byte* row = (byte*)bitmapData.Scan0 + (y * bitmapData.Stride); | 825 | byte* row = (byte*)bitmapData.Scan0 + (y * bitmapData.Stride); |
826 | 826 | ||
827 | for(int x = 0; x < width; x++) | 827 | for (int x = 0; x < width; x++) |
828 | { | 828 | { |
829 | b += row[x * pixelBytes + 0]; | 829 | b += row[x * pixelBytes + 0]; |
830 | g += row[x * pixelBytes + 1]; | 830 | g += row[x * pixelBytes + 1]; |
@@ -843,13 +843,13 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
843 | decimal bm = ((decimal)b / totalPixels) * OO_255; | 843 | decimal bm = ((decimal)b / totalPixels) * OO_255; |
844 | decimal am = ((decimal)a / totalPixels) * OO_255; | 844 | decimal am = ((decimal)a / totalPixels) * OO_255; |
845 | 845 | ||
846 | if(pixelBytes == 3) | 846 | if (pixelBytes == 3) |
847 | am = 1m; | 847 | am = 1m; |
848 | 848 | ||
849 | return new Color4((float)rm, (float)gm, (float)bm, (float)am); | 849 | return new Color4((float)rm, (float)gm, (float)bm, (float)am); |
850 | 850 | ||
851 | } | 851 | } |
852 | catch(Exception ex) | 852 | catch (Exception ex) |
853 | { | 853 | { |
854 | m_log.WarnFormat( | 854 | m_log.WarnFormat( |
855 | "[WARP 3D IMAGE MODULE]: Error decoding JPEG2000 texture {0} ({1} bytes): {2}", | 855 | "[WARP 3D IMAGE MODULE]: Error decoding JPEG2000 texture {0} ({1} bytes): {2}", |