From 049cfe80e4d8e0a030346f7ad9ad280b7afa4718 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Thu, 12 Jun 2008 11:06:31 +0000 Subject: [PATCH] * Insulate maptile volume draw routine against TextureEntry oddities. --- OpenSim/Region/Environment/Scenes/Scene.cs | 42 ++++++++++++++-------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 798c9adb76..526c1258a1 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1168,24 +1168,38 @@ namespace OpenSim.Region.Environment.Scenes // Draw if the object is at least 1 meter wide in any direction if (part.Scale.X > 1f || part.Scale.Y > 1f || part.Scale.Z > 1f) { - LLColor texcolor = part.Shape.Textures.DefaultTexture.RGBA; - int colorr = 255 - (int)(texcolor.R * 255f); - int colorg = 255 - (int)(texcolor.G * 255f); - int colorb = 255 - (int)(texcolor.B * 255f); - - if (colorr == 255 && colorg == 255 && colorb == 255) - { } - else + // Try to get the RGBA of the default texture entry.. + // + try { - try - { - // If the color gets goofy somehow, skip it *shakes fist at LLColor - mapdotspot = Color.FromArgb(colorr, colorg, colorb); - } - catch (ArgumentException) + LLColor texcolor = part.Shape.Textures.DefaultTexture.RGBA; + int colorr = 255 - (int)(texcolor.R * 255f); + int colorg = 255 - (int)(texcolor.G * 255f); + int colorb = 255 - (int)(texcolor.B * 255f); + + if (colorr == 255 && colorg == 255 && colorb == 255) + { } + else { + //Try to set the map spot color + try + { + // If the color gets goofy somehow, skip it *shakes fist at LLColor + mapdotspot = Color.FromArgb(colorr, colorg, colorb); + } + catch (ArgumentException) + { + } } } + catch (IndexOutOfRangeException) + { + // Windows Array + } + catch (ArgumentOutOfRangeException) + { + // Mono Array + } LLVector3 pos = part.GetWorldPosition();