diff options
author | Melanie Thielker | 2008-09-18 03:38:20 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-18 03:38:20 +0000 |
commit | deaf0e3814a512799e39123c00d9b765c1ca3002 (patch) | |
tree | 80ce1663c87ee4000f04c28c2ef964545d73dbf2 | |
parent | Kan-Ed fix series. (diff) | |
download | opensim-SC-deaf0e3814a512799e39123c00d9b765c1ca3002.zip opensim-SC-deaf0e3814a512799e39123c00d9b765c1ca3002.tar.gz opensim-SC-deaf0e3814a512799e39123c00d9b765c1ca3002.tar.bz2 opensim-SC-deaf0e3814a512799e39123c00d9b765c1ca3002.tar.xz |
Kan-Ed fix series.
XEngine: Change a number of methods to use the new link part method.
Fix ALL_SIDES for llSetColor, llSetTexture, llSetAlpha, llSetPrimitiveParams,
llGetPrimitiveParams(PRIM_TEXTURE, PRIM_COLOR).
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 95 |
1 files changed, 64 insertions, 31 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4d8482b..054c326 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1052,7 +1052,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1052 | } | 1052 | } |
1053 | else if (face == -1) | 1053 | else if (face == -1) |
1054 | { | 1054 | { |
1055 | for (uint i = 0; i < llGetNumberOfSides(); i++) | 1055 | for (uint i = 0; i < GetNumberOfSides(part); i++) |
1056 | { | 1056 | { |
1057 | if (tex.FaceTextures[i] != null) | 1057 | if (tex.FaceTextures[i] != null) |
1058 | { | 1058 | { |
@@ -1085,7 +1085,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1085 | } | 1085 | } |
1086 | else if (face == -1) | 1086 | else if (face == -1) |
1087 | { | 1087 | { |
1088 | for (uint i = 0; i < 32; i++) | 1088 | for (uint i = 0; i < GetNumberOfSides(part); i++) |
1089 | { | 1089 | { |
1090 | if (tex.FaceTextures[i] != null) | 1090 | if (tex.FaceTextures[i] != null) |
1091 | { | 1091 | { |
@@ -1209,7 +1209,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1209 | } | 1209 | } |
1210 | else if (face == -1) | 1210 | else if (face == -1) |
1211 | { | 1211 | { |
1212 | for (int i = 0; i < 32; i++) | 1212 | for (int i = 0; i < GetNumberOfSides(part); i++) |
1213 | { | 1213 | { |
1214 | if (tex.FaceTextures[i] != null) | 1214 | if (tex.FaceTextures[i] != null) |
1215 | { | 1215 | { |
@@ -3465,14 +3465,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3465 | public LSL_Types.LSLInteger llGetNumberOfSides() | 3465 | public LSL_Types.LSLInteger llGetNumberOfSides() |
3466 | { | 3466 | { |
3467 | m_host.AddScriptLPS(1); | 3467 | m_host.AddScriptLPS(1); |
3468 | |||
3469 | return GetNumberOfSides(m_host); | ||
3470 | } | ||
3471 | |||
3472 | public LSL_Types.LSLInteger GetNumberOfSides(SceneObjectPart part) | ||
3473 | { | ||
3468 | int ret = 0; | 3474 | int ret = 0; |
3469 | bool hasCut; | 3475 | bool hasCut; |
3470 | bool hasHollow; | 3476 | bool hasHollow; |
3471 | bool hasDimple; | 3477 | bool hasDimple; |
3472 | bool hasProfileCut; | 3478 | bool hasProfileCut; |
3473 | 3479 | ||
3474 | int primType = getScriptPrimType(m_host.Shape); | 3480 | int primType = getScriptPrimType(part.Shape); |
3475 | hasCutHollowDimpleProfileCut(primType, m_host.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); | 3481 | hasCutHollowDimpleProfileCut(primType, part.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); |
3476 | 3482 | ||
3477 | switch (primType) | 3483 | switch (primType) |
3478 | { | 3484 | { |
@@ -5543,21 +5549,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5543 | 5549 | ||
5544 | public void llSetPrimitiveParams(LSL_Types.list rules) | 5550 | public void llSetPrimitiveParams(LSL_Types.list rules) |
5545 | { | 5551 | { |
5546 | llSetLinkPrimitiveParams(m_host.LinkNum, rules); | 5552 | SetPrimParams(m_host, rules); |
5547 | } | 5553 | } |
5548 | 5554 | ||
5549 | public void llSetLinkPrimitiveParams(int linknumber, LSL_Types.list rules) | 5555 | public void llSetLinkPrimitiveParams(int linknumber, LSL_Types.list rules) |
5550 | { | 5556 | { |
5551 | m_host.AddScriptLPS(1); | 5557 | m_host.AddScriptLPS(1); |
5552 | 5558 | ||
5553 | if (m_host.ParentGroup == null) | 5559 | List<SceneObjectPart> parts = GetLinkParts(linknumber); |
5554 | return; | ||
5555 | |||
5556 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknumber); | ||
5557 | 5560 | ||
5558 | if (part == null) | 5561 | foreach (SceneObjectPart part in parts) |
5559 | return; | 5562 | SetPrimParams(part, rules); |
5563 | } | ||
5560 | 5564 | ||
5565 | private void SetPrimParams(SceneObjectPart part, LSL_Types.list rules) | ||
5566 | { | ||
5561 | int idx = 0; | 5567 | int idx = 0; |
5562 | 5568 | ||
5563 | while (idx < rules.Length) | 5569 | while (idx < rules.Length) |
@@ -6235,20 +6241,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6235 | return res; | 6241 | return res; |
6236 | 6242 | ||
6237 | int face = (int)rules.GetLSLIntegerItem(idx++); | 6243 | int face = (int)rules.GetLSLIntegerItem(idx++); |
6238 | if (face == -1) | ||
6239 | face = 0; | ||
6240 | |||
6241 | Primitive.TextureEntry tex = m_host.Shape.Textures; | 6244 | Primitive.TextureEntry tex = m_host.Shape.Textures; |
6242 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); | 6245 | if (face == -1) // ALL_SIDES |
6243 | 6246 | { | |
6244 | res.Add(new LSL_Types.LSLString(texface.TextureID.ToString())); | 6247 | for (face = 0 ; face < GetNumberOfSides(m_host) ; face++) |
6245 | res.Add(new LSL_Types.Vector3(texface.RepeatU, | 6248 | { |
6246 | texface.RepeatV, | 6249 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); |
6247 | 0)); | 6250 | |
6248 | res.Add(new LSL_Types.Vector3(texface.OffsetU, | 6251 | res.Add(new LSL_Types.LSLString(texface.TextureID.ToString())); |
6249 | texface.OffsetV, | 6252 | res.Add(new LSL_Types.Vector3(texface.RepeatU, |
6250 | 0)); | 6253 | texface.RepeatV, |
6251 | res.Add(new LSL_Types.LSLFloat(texface.Rotation)); | 6254 | 0)); |
6255 | res.Add(new LSL_Types.Vector3(texface.OffsetU, | ||
6256 | texface.OffsetV, | ||
6257 | 0)); | ||
6258 | res.Add(new LSL_Types.LSLFloat(texface.Rotation)); | ||
6259 | } | ||
6260 | } | ||
6261 | else | ||
6262 | { | ||
6263 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); | ||
6264 | |||
6265 | res.Add(new LSL_Types.LSLString(texface.TextureID.ToString())); | ||
6266 | res.Add(new LSL_Types.Vector3(texface.RepeatU, | ||
6267 | texface.RepeatV, | ||
6268 | 0)); | ||
6269 | res.Add(new LSL_Types.Vector3(texface.OffsetU, | ||
6270 | texface.OffsetV, | ||
6271 | 0)); | ||
6272 | res.Add(new LSL_Types.LSLFloat(texface.Rotation)); | ||
6273 | } | ||
6252 | break; | 6274 | break; |
6253 | 6275 | ||
6254 | case (int)ScriptBaseClass.PRIM_COLOR: | 6276 | case (int)ScriptBaseClass.PRIM_COLOR: |
@@ -6259,14 +6281,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6259 | 6281 | ||
6260 | tex = m_host.Shape.Textures; | 6282 | tex = m_host.Shape.Textures; |
6261 | Color4 texcolor; | 6283 | Color4 texcolor; |
6262 | if (face == -1) // TMP: Until we can determine number of sides, ALL_SIDES (-1) will return default color | 6284 | if (face == -1) // ALL_SIDES |
6263 | texcolor = tex.DefaultTexture.RGBA; | 6285 | { |
6286 | for (face = 0 ; face < GetNumberOfSides(m_host) ; face++) | ||
6287 | { | ||
6288 | texcolor = tex.GetFace((uint)face).RGBA; | ||
6289 | res.Add(new LSL_Types.Vector3((255 - (texcolor.R * 255)) / 255, | ||
6290 | (255 - (texcolor.G * 255)) / 255, | ||
6291 | (255 - (texcolor.B * 255)) / 255)); | ||
6292 | res.Add(new LSL_Types.LSLFloat((texcolor.A * 255) / 255)); | ||
6293 | } | ||
6294 | } | ||
6264 | else | 6295 | else |
6296 | { | ||
6265 | texcolor = tex.GetFace((uint)face).RGBA; | 6297 | texcolor = tex.GetFace((uint)face).RGBA; |
6266 | res.Add(new LSL_Types.Vector3((255 - (texcolor.R * 255)) / 255, | 6298 | res.Add(new LSL_Types.Vector3((255 - (texcolor.R * 255)) / 255, |
6267 | (255 - (texcolor.G * 255)) / 255, | 6299 | (255 - (texcolor.G * 255)) / 255, |
6268 | (255 - (texcolor.B * 255)) / 255)); | 6300 | (255 - (texcolor.B * 255)) / 255)); |
6269 | res.Add(new LSL_Types.LSLFloat((texcolor.A * 255) / 255)); | 6301 | res.Add(new LSL_Types.LSLFloat((texcolor.A * 255) / 255)); |
6302 | } | ||
6270 | break; | 6303 | break; |
6271 | 6304 | ||
6272 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 6305 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: |