diff options
author | UbitUmarov | 2018-03-05 16:36:39 +0000 |
---|---|---|
committer | UbitUmarov | 2018-03-05 16:36:39 +0000 |
commit | 18914fae64e9ccd8044924f5db061dbfeed4a33d (patch) | |
tree | a618b8d7ebf9b45ed95e0391a29b9e08c72eb552 | |
parent | Remove the work around for sphere number of faces since as of commit 846f35 i... (diff) | |
download | opensim-SC-18914fae64e9ccd8044924f5db061dbfeed4a33d.zip opensim-SC-18914fae64e9ccd8044924f5db061dbfeed4a33d.tar.gz opensim-SC-18914fae64e9ccd8044924f5db061dbfeed4a33d.tar.bz2 opensim-SC-18914fae64e9ccd8044924f5db061dbfeed4a33d.tar.xz |
make more clear some magic numbers on SOP getnumberofsides(), reduce unnecessary calls to it on LSL api
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 108 |
2 files changed, 73 insertions, 45 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0533099..2c183ad 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -3914,9 +3914,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3914 | { | 3914 | { |
3915 | // removed sides | 3915 | // removed sides |
3916 | int cut = (Shape.ProfileEnd + Shape.ProfileBegin); | 3916 | int cut = (Shape.ProfileEnd + Shape.ProfileBegin); |
3917 | if(cut > 50000) | 3917 | if(cut > 50000) // range is 0 to 50000 |
3918 | cut = 50000; | 3918 | cut = 50000; |
3919 | cut /= 12500; | 3919 | cut /= 12500; // ie 1/4 |
3920 | ret -= cut; | 3920 | ret -= cut; |
3921 | ret += 2; // both cut faces | 3921 | ret += 2; // both cut faces |
3922 | } | 3922 | } |
@@ -3927,9 +3927,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3927 | { | 3927 | { |
3928 | // removed faces | 3928 | // removed faces |
3929 | int cut = (Shape.ProfileEnd + Shape.ProfileBegin); | 3929 | int cut = (Shape.ProfileEnd + Shape.ProfileBegin); |
3930 | if(cut >= 16667 ) | 3930 | if(cut >= 16667 ) // ie 1/3 |
3931 | ret--; | 3931 | ret--; |
3932 | if(cut >= 33333 ) | 3932 | if(cut >= 33333 ) // ie 2/3 |
3933 | ret--; | 3933 | ret--; |
3934 | ret += 2; // both cut faces | 3934 | ret += 2; // both cut faces |
3935 | } | 3935 | } |
@@ -3944,7 +3944,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3944 | // cut faces exist if cut or skew or unequal twist limits | 3944 | // cut faces exist if cut or skew or unequal twist limits |
3945 | if (Shape.PathBegin > 0 || Shape.PathEnd > 0 || Shape.PathSkew != 0 || (Shape.PathTwistBegin != Shape.PathTwist)) | 3945 | if (Shape.PathBegin > 0 || Shape.PathEnd > 0 || Shape.PathSkew != 0 || (Shape.PathTwistBegin != Shape.PathTwist)) |
3946 | ret += 2; | 3946 | ret += 2; |
3947 | if (Shape.ProfileBegin > 0 || Shape.ProfileEnd > 0 || Shape.ProfileHollow > 0) // dimple also if hollow | 3947 | if (Shape.ProfileBegin > 0 || Shape.ProfileEnd > 0 || Shape.ProfileHollow > 0) // dimple faces also if hollow |
3948 | ret += 2; | 3948 | ret += 2; |
3949 | break; | 3949 | break; |
3950 | case PrimType.TORUS: | 3950 | case PrimType.TORUS: |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c7c7831..bac1468 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1933,8 +1933,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1933 | return; | 1933 | return; |
1934 | 1934 | ||
1935 | Primitive.TextureEntry tex = part.Shape.Textures; | 1935 | Primitive.TextureEntry tex = part.Shape.Textures; |
1936 | int nsides = GetNumberOfSides(part); | ||
1936 | Color4 texcolor; | 1937 | Color4 texcolor; |
1937 | if (face >= 0 && face < GetNumberOfSides(part)) | 1938 | |
1939 | if (face >= 0 && face < nsides) | ||
1938 | { | 1940 | { |
1939 | texcolor = tex.CreateFace((uint)face).RGBA; | 1941 | texcolor = tex.CreateFace((uint)face).RGBA; |
1940 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); | 1942 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); |
@@ -1945,8 +1947,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1945 | return; | 1947 | return; |
1946 | } | 1948 | } |
1947 | else if (face == ScriptBaseClass.ALL_SIDES) | 1949 | else if (face == ScriptBaseClass.ALL_SIDES) |
1948 | { | 1950 | { |
1949 | for (uint i = 0; i < GetNumberOfSides(part); i++) | 1951 | for (uint i = 0; i < nsides; i++) |
1950 | { | 1952 | { |
1951 | if (tex.FaceTextures[i] != null) | 1953 | if (tex.FaceTextures[i] != null) |
1952 | { | 1954 | { |
@@ -2063,7 +2065,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2063 | if (style == (int)ScriptBaseClass.PRIM_TEXGEN_PLANAR) | 2065 | if (style == (int)ScriptBaseClass.PRIM_TEXGEN_PLANAR) |
2064 | textype = MappingType.Planar; | 2066 | textype = MappingType.Planar; |
2065 | 2067 | ||
2066 | if (face >= 0 && face < GetNumberOfSides(part)) | 2068 | int nsides = GetNumberOfSides(part); |
2069 | |||
2070 | if (face >= 0 && face < nsides) | ||
2067 | { | 2071 | { |
2068 | tex.CreateFace((uint) face); | 2072 | tex.CreateFace((uint) face); |
2069 | tex.FaceTextures[face].TexMapType = textype; | 2073 | tex.FaceTextures[face].TexMapType = textype; |
@@ -2072,7 +2076,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2072 | } | 2076 | } |
2073 | else if (face == ScriptBaseClass.ALL_SIDES) | 2077 | else if (face == ScriptBaseClass.ALL_SIDES) |
2074 | { | 2078 | { |
2075 | for (uint i = 0; i < GetNumberOfSides(part); i++) | 2079 | for (uint i = 0; i < nsides; i++) |
2076 | { | 2080 | { |
2077 | if (tex.FaceTextures[i] != null) | 2081 | if (tex.FaceTextures[i] != null) |
2078 | { | 2082 | { |
@@ -2091,7 +2095,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2091 | return; | 2095 | return; |
2092 | 2096 | ||
2093 | Primitive.TextureEntry tex = part.Shape.Textures; | 2097 | Primitive.TextureEntry tex = part.Shape.Textures; |
2094 | if (face >= 0 && face < GetNumberOfSides(part)) | 2098 | int nsides = GetNumberOfSides(part); |
2099 | |||
2100 | if (face >= 0 && face < nsides) | ||
2095 | { | 2101 | { |
2096 | tex.CreateFace((uint) face); | 2102 | tex.CreateFace((uint) face); |
2097 | tex.FaceTextures[face].Glow = glow; | 2103 | tex.FaceTextures[face].Glow = glow; |
@@ -2100,7 +2106,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2100 | } | 2106 | } |
2101 | else if (face == ScriptBaseClass.ALL_SIDES) | 2107 | else if (face == ScriptBaseClass.ALL_SIDES) |
2102 | { | 2108 | { |
2103 | for (uint i = 0; i < GetNumberOfSides(part); i++) | 2109 | for (uint i = 0; i < nsides; i++) |
2104 | { | 2110 | { |
2105 | if (tex.FaceTextures[i] != null) | 2111 | if (tex.FaceTextures[i] != null) |
2106 | { | 2112 | { |
@@ -2139,8 +2145,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2139 | break; | 2145 | break; |
2140 | } | 2146 | } |
2141 | 2147 | ||
2148 | int nsides = GetNumberOfSides(part); | ||
2149 | |||
2142 | Primitive.TextureEntry tex = part.Shape.Textures; | 2150 | Primitive.TextureEntry tex = part.Shape.Textures; |
2143 | if (face >= 0 && face < GetNumberOfSides(part)) | 2151 | if (face >= 0 && face < nsides) |
2144 | { | 2152 | { |
2145 | tex.CreateFace((uint) face); | 2153 | tex.CreateFace((uint) face); |
2146 | tex.FaceTextures[face].Shiny = sval; | 2154 | tex.FaceTextures[face].Shiny = sval; |
@@ -2150,7 +2158,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2150 | } | 2158 | } |
2151 | else if (face == ScriptBaseClass.ALL_SIDES) | 2159 | else if (face == ScriptBaseClass.ALL_SIDES) |
2152 | { | 2160 | { |
2153 | for (uint i = 0; i < GetNumberOfSides(part); i++) | 2161 | for (uint i = 0; i < nsides; i++) |
2154 | { | 2162 | { |
2155 | if (tex.FaceTextures[i] != null) | 2163 | if (tex.FaceTextures[i] != null) |
2156 | { | 2164 | { |
@@ -2170,8 +2178,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2170 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | 2178 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) |
2171 | return; | 2179 | return; |
2172 | 2180 | ||
2181 | int nsides = GetNumberOfSides(part); | ||
2173 | Primitive.TextureEntry tex = part.Shape.Textures; | 2182 | Primitive.TextureEntry tex = part.Shape.Textures; |
2174 | if (face >= 0 && face < GetNumberOfSides(part)) | 2183 | if (face >= 0 && face < nsides) |
2175 | { | 2184 | { |
2176 | tex.CreateFace((uint) face); | 2185 | tex.CreateFace((uint) face); |
2177 | tex.FaceTextures[face].Fullbright = bright; | 2186 | tex.FaceTextures[face].Fullbright = bright; |
@@ -2180,7 +2189,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2180 | } | 2189 | } |
2181 | else if (face == ScriptBaseClass.ALL_SIDES) | 2190 | else if (face == ScriptBaseClass.ALL_SIDES) |
2182 | { | 2191 | { |
2183 | for (uint i = 0; i < GetNumberOfSides(part); i++) | 2192 | for (uint i = 0; i < nsides; i++) |
2184 | { | 2193 | { |
2185 | if (tex.FaceTextures[i] != null) | 2194 | if (tex.FaceTextures[i] != null) |
2186 | { | 2195 | { |
@@ -2203,15 +2212,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2203 | protected LSL_Float GetAlpha(SceneObjectPart part, int face) | 2212 | protected LSL_Float GetAlpha(SceneObjectPart part, int face) |
2204 | { | 2213 | { |
2205 | Primitive.TextureEntry tex = part.Shape.Textures; | 2214 | Primitive.TextureEntry tex = part.Shape.Textures; |
2215 | int nsides = GetNumberOfSides(part); | ||
2206 | if (face == ScriptBaseClass.ALL_SIDES) | 2216 | if (face == ScriptBaseClass.ALL_SIDES) |
2207 | { | 2217 | { |
2208 | int i; | 2218 | int i; |
2209 | double sum = 0.0; | 2219 | double sum = 0.0; |
2210 | for (i = 0 ; i < GetNumberOfSides(part); i++) | 2220 | for (i = 0 ; i < nsides; i++) |
2211 | sum += (double)tex.GetFace((uint)i).RGBA.A; | 2221 | sum += (double)tex.GetFace((uint)i).RGBA.A; |
2212 | return sum; | 2222 | return sum; |
2213 | } | 2223 | } |
2214 | if (face >= 0 && face < GetNumberOfSides(part)) | 2224 | if (face >= 0 && face < nsides) |
2215 | { | 2225 | { |
2216 | return (double)tex.GetFace((uint)face).RGBA.A; | 2226 | return (double)tex.GetFace((uint)face).RGBA.A; |
2217 | } | 2227 | } |
@@ -2247,8 +2257,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2247 | return; | 2257 | return; |
2248 | 2258 | ||
2249 | Primitive.TextureEntry tex = part.Shape.Textures; | 2259 | Primitive.TextureEntry tex = part.Shape.Textures; |
2260 | int nsides = GetNumberOfSides(part); | ||
2250 | Color4 texcolor; | 2261 | Color4 texcolor; |
2251 | if (face >= 0 && face < GetNumberOfSides(part)) | 2262 | |
2263 | if (face >= 0 && face < nsides) | ||
2252 | { | 2264 | { |
2253 | texcolor = tex.CreateFace((uint)face).RGBA; | 2265 | texcolor = tex.CreateFace((uint)face).RGBA; |
2254 | texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); | 2266 | texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); |
@@ -2258,7 +2270,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2258 | } | 2270 | } |
2259 | else if (face == ScriptBaseClass.ALL_SIDES) | 2271 | else if (face == ScriptBaseClass.ALL_SIDES) |
2260 | { | 2272 | { |
2261 | for (int i = 0; i < GetNumberOfSides(part); i++) | 2273 | for (int i = 0; i < nsides; i++) |
2262 | { | 2274 | { |
2263 | if (tex.FaceTextures[i] != null) | 2275 | if (tex.FaceTextures[i] != null) |
2264 | { | 2276 | { |
@@ -2446,9 +2458,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2446 | return; | 2458 | return; |
2447 | } | 2459 | } |
2448 | 2460 | ||
2461 | |||
2449 | Primitive.TextureEntry tex = part.Shape.Textures; | 2462 | Primitive.TextureEntry tex = part.Shape.Textures; |
2463 | int nsides = GetNumberOfSides(part); | ||
2450 | 2464 | ||
2451 | if (face >= 0 && face < GetNumberOfSides(part)) | 2465 | if (face >= 0 && face < nsides) |
2452 | { | 2466 | { |
2453 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); | 2467 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); |
2454 | texface.TextureID = textureID; | 2468 | texface.TextureID = textureID; |
@@ -2458,7 +2472,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2458 | } | 2472 | } |
2459 | else if (face == ScriptBaseClass.ALL_SIDES) | 2473 | else if (face == ScriptBaseClass.ALL_SIDES) |
2460 | { | 2474 | { |
2461 | for (uint i = 0; i < GetNumberOfSides(part); i++) | 2475 | for (uint i = 0; i < nsides; i++) |
2462 | { | 2476 | { |
2463 | if (tex.FaceTextures[i] != null) | 2477 | if (tex.FaceTextures[i] != null) |
2464 | { | 2478 | { |
@@ -2485,7 +2499,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2485 | return; | 2499 | return; |
2486 | 2500 | ||
2487 | Primitive.TextureEntry tex = part.Shape.Textures; | 2501 | Primitive.TextureEntry tex = part.Shape.Textures; |
2488 | if (face >= 0 && face < GetNumberOfSides(part)) | 2502 | int nsides = GetNumberOfSides(part); |
2503 | |||
2504 | if (face >= 0 && face < nsides) | ||
2489 | { | 2505 | { |
2490 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); | 2506 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); |
2491 | texface.RepeatU = (float)u; | 2507 | texface.RepeatU = (float)u; |
@@ -2496,7 +2512,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2496 | } | 2512 | } |
2497 | if (face == ScriptBaseClass.ALL_SIDES) | 2513 | if (face == ScriptBaseClass.ALL_SIDES) |
2498 | { | 2514 | { |
2499 | for (int i = 0; i < GetNumberOfSides(part); i++) | 2515 | for (int i = 0; i < nsides; i++) |
2500 | { | 2516 | { |
2501 | if (tex.FaceTextures[i] != null) | 2517 | if (tex.FaceTextures[i] != null) |
2502 | { | 2518 | { |
@@ -2524,7 +2540,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2524 | return; | 2540 | return; |
2525 | 2541 | ||
2526 | Primitive.TextureEntry tex = part.Shape.Textures; | 2542 | Primitive.TextureEntry tex = part.Shape.Textures; |
2527 | if (face >= 0 && face < GetNumberOfSides(part)) | 2543 | int nsides = GetNumberOfSides(part); |
2544 | |||
2545 | if (face >= 0 && face < nsides) | ||
2528 | { | 2546 | { |
2529 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); | 2547 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); |
2530 | texface.OffsetU = (float)u; | 2548 | texface.OffsetU = (float)u; |
@@ -2535,7 +2553,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2535 | } | 2553 | } |
2536 | if (face == ScriptBaseClass.ALL_SIDES) | 2554 | if (face == ScriptBaseClass.ALL_SIDES) |
2537 | { | 2555 | { |
2538 | for (int i = 0; i < GetNumberOfSides(part); i++) | 2556 | for (int i = 0; i < nsides; i++) |
2539 | { | 2557 | { |
2540 | if (tex.FaceTextures[i] != null) | 2558 | if (tex.FaceTextures[i] != null) |
2541 | { | 2559 | { |
@@ -2563,7 +2581,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2563 | return; | 2581 | return; |
2564 | 2582 | ||
2565 | Primitive.TextureEntry tex = part.Shape.Textures; | 2583 | Primitive.TextureEntry tex = part.Shape.Textures; |
2566 | if (face >= 0 && face < GetNumberOfSides(part)) | 2584 | int nsides = GetNumberOfSides(part); |
2585 | |||
2586 | if (face >= 0 && face < nsides) | ||
2567 | { | 2587 | { |
2568 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); | 2588 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); |
2569 | texface.Rotation = (float)rotation; | 2589 | texface.Rotation = (float)rotation; |
@@ -2573,7 +2593,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2573 | } | 2593 | } |
2574 | if (face == ScriptBaseClass.ALL_SIDES) | 2594 | if (face == ScriptBaseClass.ALL_SIDES) |
2575 | { | 2595 | { |
2576 | for (int i = 0; i < GetNumberOfSides(part); i++) | 2596 | for (int i = 0; i < nsides; i++) |
2577 | { | 2597 | { |
2578 | if (tex.FaceTextures[i] != null) | 2598 | if (tex.FaceTextures[i] != null) |
2579 | { | 2599 | { |
@@ -2595,12 +2615,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2595 | protected LSL_String GetTexture(SceneObjectPart part, int face) | 2615 | protected LSL_String GetTexture(SceneObjectPart part, int face) |
2596 | { | 2616 | { |
2597 | Primitive.TextureEntry tex = part.Shape.Textures; | 2617 | Primitive.TextureEntry tex = part.Shape.Textures; |
2618 | int nsides = GetNumberOfSides(part); | ||
2619 | |||
2598 | if (face == ScriptBaseClass.ALL_SIDES) | 2620 | if (face == ScriptBaseClass.ALL_SIDES) |
2599 | { | 2621 | { |
2600 | face = 0; | 2622 | face = 0; |
2601 | } | 2623 | } |
2602 | 2624 | ||
2603 | if (face >= 0 && face < GetNumberOfSides(part)) | 2625 | if (face >= 0 && face < nsides) |
2604 | { | 2626 | { |
2605 | Primitive.TextureEntryFace texface; | 2627 | Primitive.TextureEntryFace texface; |
2606 | texface = tex.GetFace((uint)face); | 2628 | texface = tex.GetFace((uint)face); |
@@ -5459,7 +5481,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5459 | { | 5481 | { |
5460 | m_host.AddScriptLPS(1); | 5482 | m_host.AddScriptLPS(1); |
5461 | 5483 | ||
5462 | return GetNumberOfSides(m_host); | 5484 | return m_host.GetNumberOfSides(); |
5463 | } | 5485 | } |
5464 | 5486 | ||
5465 | protected int GetNumberOfSides(SceneObjectPart part) | 5487 | protected int GetNumberOfSides(SceneObjectPart part) |
@@ -10836,6 +10858,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10836 | public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) | 10858 | public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) |
10837 | { | 10859 | { |
10838 | int idx = 0; | 10860 | int idx = 0; |
10861 | int face; | ||
10862 | Primitive.TextureEntry tex; | ||
10863 | int nsides = GetNumberOfSides(part); | ||
10864 | |||
10839 | while (idx < rules.Length) | 10865 | while (idx < rules.Length) |
10840 | { | 10866 | { |
10841 | int code = (int)rules.GetLSLIntegerItem(idx++); | 10867 | int code = (int)rules.GetLSLIntegerItem(idx++); |
@@ -10976,11 +11002,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10976 | if (remain < 1) | 11002 | if (remain < 1) |
10977 | return new LSL_List(); | 11003 | return new LSL_List(); |
10978 | 11004 | ||
10979 | int face = (int)rules.GetLSLIntegerItem(idx++); | 11005 | face = (int)rules.GetLSLIntegerItem(idx++); |
10980 | Primitive.TextureEntry tex = part.Shape.Textures; | 11006 | tex = part.Shape.Textures; |
11007 | |||
10981 | if (face == ScriptBaseClass.ALL_SIDES) | 11008 | if (face == ScriptBaseClass.ALL_SIDES) |
10982 | { | 11009 | { |
10983 | for (face = 0; face < GetNumberOfSides(part); face++) | 11010 | for (face = 0; face < nsides; face++) |
10984 | { | 11011 | { |
10985 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); | 11012 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); |
10986 | 11013 | ||
@@ -10996,7 +11023,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10996 | } | 11023 | } |
10997 | else | 11024 | else |
10998 | { | 11025 | { |
10999 | if (face >= 0 && face < GetNumberOfSides(part)) | 11026 | if (face >= 0 && face < nsides) |
11000 | { | 11027 | { |
11001 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); | 11028 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); |
11002 | 11029 | ||
@@ -11017,12 +11044,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11017 | return new LSL_List(); | 11044 | return new LSL_List(); |
11018 | 11045 | ||
11019 | face = (int)rules.GetLSLIntegerItem(idx++); | 11046 | face = (int)rules.GetLSLIntegerItem(idx++); |
11020 | |||
11021 | tex = part.Shape.Textures; | 11047 | tex = part.Shape.Textures; |
11022 | Color4 texcolor; | 11048 | Color4 texcolor; |
11049 | |||
11023 | if (face == ScriptBaseClass.ALL_SIDES) | 11050 | if (face == ScriptBaseClass.ALL_SIDES) |
11024 | { | 11051 | { |
11025 | for (face = 0; face < GetNumberOfSides(part); face++) | 11052 | for (face = 0; face < nsides; face++) |
11026 | { | 11053 | { |
11027 | texcolor = tex.GetFace((uint)face).RGBA; | 11054 | texcolor = tex.GetFace((uint)face).RGBA; |
11028 | res.Add(new LSL_Vector(texcolor.R, | 11055 | res.Add(new LSL_Vector(texcolor.R, |
@@ -11042,16 +11069,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11042 | break; | 11069 | break; |
11043 | 11070 | ||
11044 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 11071 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: |
11072 | { | ||
11045 | if (remain < 1) | 11073 | if (remain < 1) |
11046 | return new LSL_List(); | 11074 | return new LSL_List(); |
11047 | 11075 | ||
11048 | face = (int)rules.GetLSLIntegerItem(idx++); | 11076 | face = (int)rules.GetLSLIntegerItem(idx++); |
11049 | |||
11050 | tex = part.Shape.Textures; | 11077 | tex = part.Shape.Textures; |
11051 | int shiny; | 11078 | int shiny; |
11052 | if (face == ScriptBaseClass.ALL_SIDES) | 11079 | if (face == ScriptBaseClass.ALL_SIDES) |
11053 | { | 11080 | { |
11054 | for (face = 0; face < GetNumberOfSides(part); face++) | 11081 | for (face = 0; face < nsides; face++) |
11055 | { | 11082 | { |
11056 | Shininess shinyness = tex.GetFace((uint)face).Shiny; | 11083 | Shininess shinyness = tex.GetFace((uint)face).Shiny; |
11057 | if (shinyness == Shininess.High) | 11084 | if (shinyness == Shininess.High) |
@@ -11097,8 +11124,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11097 | res.Add(new LSL_Integer((int)tex.GetFace((uint)face).Bump)); | 11124 | res.Add(new LSL_Integer((int)tex.GetFace((uint)face).Bump)); |
11098 | } | 11125 | } |
11099 | break; | 11126 | break; |
11100 | 11127 | } | |
11101 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | 11128 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
11129 | { | ||
11102 | if (remain < 1) | 11130 | if (remain < 1) |
11103 | return new LSL_List(); | 11131 | return new LSL_List(); |
11104 | 11132 | ||
@@ -11108,7 +11136,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11108 | int fullbright; | 11136 | int fullbright; |
11109 | if (face == ScriptBaseClass.ALL_SIDES) | 11137 | if (face == ScriptBaseClass.ALL_SIDES) |
11110 | { | 11138 | { |
11111 | for (face = 0; face < GetNumberOfSides(part); face++) | 11139 | for (face = 0; face < nsides; face++) |
11112 | { | 11140 | { |
11113 | if (tex.GetFace((uint)face).Fullbright == true) | 11141 | if (tex.GetFace((uint)face).Fullbright == true) |
11114 | { | 11142 | { |
@@ -11134,7 +11162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11134 | res.Add(new LSL_Integer(fullbright)); | 11162 | res.Add(new LSL_Integer(fullbright)); |
11135 | } | 11163 | } |
11136 | break; | 11164 | break; |
11137 | 11165 | } | |
11138 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: | 11166 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: |
11139 | PrimitiveBaseShape shape = part.Shape; | 11167 | PrimitiveBaseShape shape = part.Shape; |
11140 | 11168 | ||
@@ -11162,7 +11190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11162 | tex = part.Shape.Textures; | 11190 | tex = part.Shape.Textures; |
11163 | if (face == ScriptBaseClass.ALL_SIDES) | 11191 | if (face == ScriptBaseClass.ALL_SIDES) |
11164 | { | 11192 | { |
11165 | for (face = 0; face < GetNumberOfSides(part); face++) | 11193 | for (face = 0; face < nsides; face++) |
11166 | { | 11194 | { |
11167 | if (tex.GetFace((uint)face).TexMapType == MappingType.Planar) | 11195 | if (tex.GetFace((uint)face).TexMapType == MappingType.Planar) |
11168 | { | 11196 | { |
@@ -11212,7 +11240,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11212 | float primglow; | 11240 | float primglow; |
11213 | if (face == ScriptBaseClass.ALL_SIDES) | 11241 | if (face == ScriptBaseClass.ALL_SIDES) |
11214 | { | 11242 | { |
11215 | for (face = 0; face < GetNumberOfSides(part); face++) | 11243 | for (face = 0; face < nsides; face++) |
11216 | { | 11244 | { |
11217 | primglow = tex.GetFace((uint)face).Glow; | 11245 | primglow = tex.GetFace((uint)face).Glow; |
11218 | res.Add(new LSL_Float(primglow)); | 11246 | res.Add(new LSL_Float(primglow)); |
@@ -11306,7 +11334,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11306 | tex = part.Shape.Textures; | 11334 | tex = part.Shape.Textures; |
11307 | if (face == ScriptBaseClass.ALL_SIDES) | 11335 | if (face == ScriptBaseClass.ALL_SIDES) |
11308 | { | 11336 | { |
11309 | for (face = 0; face < GetNumberOfSides(part); face++) | 11337 | for (face = 0; face < nsides; face++) |
11310 | { | 11338 | { |
11311 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); | 11339 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); |
11312 | getLSLFaceMaterial(ref res, code, part, texface); | 11340 | getLSLFaceMaterial(ref res, code, part, texface); |
@@ -11314,7 +11342,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11314 | } | 11342 | } |
11315 | else | 11343 | else |
11316 | { | 11344 | { |
11317 | if (face >= 0 && face < GetNumberOfSides(part)) | 11345 | if (face >= 0 && face < nsides) |
11318 | { | 11346 | { |
11319 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); | 11347 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); |
11320 | getLSLFaceMaterial(ref res, code, part, texface); | 11348 | getLSLFaceMaterial(ref res, code, part, texface); |