XEngine API refactor. Fully implement ALL_SIDES with sanity checks.
Correct color handling functions to no longer return the inverse color. Remove pointless * 256 / 256 legacy constructs.0.6.0-stable
parent
deaf0e3814
commit
1160731100
|
@ -252,7 +252,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
//These are the implementations of the various ll-functions used by the LSL scripts.
|
//These are the implementations of the various ll-functions used by the LSL scripts.
|
||||||
//starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07
|
|
||||||
public LSL_Types.LSLFloat llSin(double f)
|
public LSL_Types.LSLFloat llSin(double f)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
@ -1040,7 +1039,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
Primitive.TextureEntry tex = part.Shape.Textures;
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
Color4 texcolor;
|
Color4 texcolor;
|
||||||
if (face > -1)
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
{
|
{
|
||||||
texcolor = tex.CreateFace((uint)face).RGBA;
|
texcolor = tex.CreateFace((uint)face).RGBA;
|
||||||
texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
|
texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
|
||||||
|
@ -1050,7 +1049,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
part.UpdateTexture(tex);
|
part.UpdateTexture(tex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (face == -1)
|
else if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
for (uint i = 0; i < GetNumberOfSides(part); i++)
|
for (uint i = 0; i < GetNumberOfSides(part); i++)
|
||||||
{
|
{
|
||||||
|
@ -1076,14 +1075,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public void SetGlow(SceneObjectPart part, int face, float glow)
|
public void SetGlow(SceneObjectPart part, int face, float glow)
|
||||||
{
|
{
|
||||||
Primitive.TextureEntry tex = part.Shape.Textures;
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
if (face > -1)
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
{
|
{
|
||||||
tex.CreateFace((uint) face);
|
tex.CreateFace((uint) face);
|
||||||
tex.FaceTextures[face].Glow = glow;
|
tex.FaceTextures[face].Glow = glow;
|
||||||
part.UpdateTexture(tex);
|
part.UpdateTexture(tex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (face == -1)
|
else if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
for (uint i = 0; i < GetNumberOfSides(part); i++)
|
for (uint i = 0; i < GetNumberOfSides(part); i++)
|
||||||
{
|
{
|
||||||
|
@ -1123,7 +1122,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive.TextureEntry tex = part.Shape.Textures;
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
if (face > -1)
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
{
|
{
|
||||||
tex.CreateFace((uint) face);
|
tex.CreateFace((uint) face);
|
||||||
tex.FaceTextures[face].Shiny = sval;
|
tex.FaceTextures[face].Shiny = sval;
|
||||||
|
@ -1131,9 +1130,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
part.UpdateTexture(tex);
|
part.UpdateTexture(tex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (face == -1)
|
else if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
for (uint i = 0; i < 32; i++)
|
for (uint i = 0; i < GetNumberOfSides(part); i++)
|
||||||
{
|
{
|
||||||
if (tex.FaceTextures[i] != null)
|
if (tex.FaceTextures[i] != null)
|
||||||
{
|
{
|
||||||
|
@ -1151,16 +1150,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public void SetFullBright(SceneObjectPart part, int face, bool bright)
|
public void SetFullBright(SceneObjectPart part, int face, bool bright)
|
||||||
{
|
{
|
||||||
Primitive.TextureEntry tex = part.Shape.Textures;
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
if (face > -1)
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
{
|
{
|
||||||
tex.CreateFace((uint) face);
|
tex.CreateFace((uint) face);
|
||||||
tex.FaceTextures[face].Fullbright = bright;
|
tex.FaceTextures[face].Fullbright = bright;
|
||||||
part.UpdateTexture(tex);
|
part.UpdateTexture(tex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (face == -1)
|
else if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
for (uint i = 0; i < 32; i++)
|
for (uint i = 0; i < GetNumberOfSides(part); i++)
|
||||||
{
|
{
|
||||||
if (tex.FaceTextures[i] != null)
|
if (tex.FaceTextures[i] != null)
|
||||||
{
|
{
|
||||||
|
@ -1176,16 +1175,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Types.LSLFloat llGetAlpha(int face)
|
public LSL_Types.LSLFloat llGetAlpha(int face)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
Primitive.TextureEntry tex = m_host.Shape.Textures;
|
|
||||||
if (face == -1) // TMP: Until we can determine number of sides, ALL_SIDES (-1) will return default color
|
return GetAlpha(m_host, face);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LSL_Types.LSLFloat GetAlpha(SceneObjectPart part, int face)
|
||||||
|
{
|
||||||
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
|
if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
return (double)((tex.DefaultTexture.RGBA.A * 255) / 255);
|
int i;
|
||||||
|
double sum = 0.0;
|
||||||
|
for (i = 0 ; i < GetNumberOfSides(part) ; i++)
|
||||||
|
sum += (double)((tex.GetFace((uint)i).RGBA.A * 255) / 255);
|
||||||
|
return sum;
|
||||||
}
|
}
|
||||||
if (face > -1)
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
{
|
{
|
||||||
return (double)((tex.GetFace((uint)face).RGBA.A * 255) / 255);
|
return (double)((tex.GetFace((uint)face).RGBA.A * 255) / 255);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSetAlpha(double alpha, int face)
|
public void llSetAlpha(double alpha, int face)
|
||||||
|
@ -1199,7 +1208,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
Primitive.TextureEntry tex = part.Shape.Textures;
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
Color4 texcolor;
|
Color4 texcolor;
|
||||||
if (face > -1)
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
{
|
{
|
||||||
texcolor = tex.CreateFace((uint)face).RGBA;
|
texcolor = tex.CreateFace((uint)face).RGBA;
|
||||||
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
|
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
|
||||||
|
@ -1207,7 +1216,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
part.UpdateTexture(tex);
|
part.UpdateTexture(tex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (face == -1)
|
else if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < GetNumberOfSides(part); i++)
|
for (int i = 0; i < GetNumberOfSides(part); i++)
|
||||||
{
|
{
|
||||||
|
@ -1325,23 +1334,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Types.Vector3 llGetColor(int face)
|
public LSL_Types.Vector3 llGetColor(int face)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
Primitive.TextureEntry tex = m_host.Shape.Textures;
|
return GetColor(m_host, face);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LSL_Types.Vector3 GetColor(SceneObjectPart part, int face)
|
||||||
|
{
|
||||||
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
Color4 texcolor;
|
Color4 texcolor;
|
||||||
LSL_Types.Vector3 rgb;
|
LSL_Types.Vector3 rgb = new LSL_Types.Vector3();
|
||||||
if (face == -1) // TMP: Until we can determine number of sides, ALL_SIDES (-1) will return default color
|
if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
texcolor = tex.DefaultTexture.RGBA;
|
int i;
|
||||||
rgb.x = (255 - (texcolor.R * 255)) / 255;
|
|
||||||
rgb.y = (255 - (texcolor.G * 255)) / 255;
|
for (i = 0 ; i < GetNumberOfSides(part) ; i++)
|
||||||
rgb.z = (255 - (texcolor.B * 255)) / 255;
|
{
|
||||||
|
texcolor = tex.GetFace((uint)i).RGBA;
|
||||||
|
rgb.x += texcolor.R;
|
||||||
|
rgb.y += texcolor.G;
|
||||||
|
rgb.z += texcolor.B;
|
||||||
|
}
|
||||||
|
|
||||||
|
rgb.x /= (float)GetNumberOfSides(part);
|
||||||
|
rgb.y /= (float)GetNumberOfSides(part);
|
||||||
|
rgb.z /= (float)GetNumberOfSides(part);
|
||||||
|
|
||||||
return rgb;
|
return rgb;
|
||||||
}
|
}
|
||||||
if (face > -1)
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
{
|
{
|
||||||
texcolor = tex.GetFace((uint)face).RGBA;
|
texcolor = tex.GetFace((uint)face).RGBA;
|
||||||
rgb.x = (255 - (texcolor.R * 255)) / 255;
|
rgb.x = texcolor.R;
|
||||||
rgb.y = (255 - (texcolor.G * 255)) / 255;
|
rgb.y = texcolor.G;
|
||||||
rgb.z = (255 - (texcolor.B * 255)) / 255;
|
rgb.z = texcolor.B;
|
||||||
return rgb;
|
return rgb;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1371,7 +1395,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
Primitive.TextureEntry tex = part.Shape.Textures;
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
|
|
||||||
if (face > -1)
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
{
|
{
|
||||||
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
|
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
|
||||||
texface.TextureID = textureID;
|
texface.TextureID = textureID;
|
||||||
|
@ -1379,9 +1403,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
part.UpdateTexture(tex);
|
part.UpdateTexture(tex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (face == -1)
|
else if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
for (uint i = 0; i < 32; i++)
|
for (uint i = 0; i < GetNumberOfSides(part); i++)
|
||||||
{
|
{
|
||||||
if (tex.FaceTextures[i] != null)
|
if (tex.FaceTextures[i] != null)
|
||||||
{
|
{
|
||||||
|
@ -1405,7 +1429,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
private void ScaleTexture(SceneObjectPart part, double u, double v, int face)
|
private void ScaleTexture(SceneObjectPart part, double u, double v, int face)
|
||||||
{
|
{
|
||||||
Primitive.TextureEntry tex = part.Shape.Textures;
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
if (face > -1)
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
{
|
{
|
||||||
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
|
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
|
||||||
texface.RepeatU = (float)u;
|
texface.RepeatU = (float)u;
|
||||||
|
@ -1414,9 +1438,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
part.UpdateTexture(tex);
|
part.UpdateTexture(tex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (face == -1)
|
if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 32; i++)
|
for (int i = 0; i < GetNumberOfSides(part); i++)
|
||||||
{
|
{
|
||||||
if (tex.FaceTextures[i] != null)
|
if (tex.FaceTextures[i] != null)
|
||||||
{
|
{
|
||||||
|
@ -1441,7 +1465,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
private void OffsetTexture(SceneObjectPart part, double u, double v, int face)
|
private void OffsetTexture(SceneObjectPart part, double u, double v, int face)
|
||||||
{
|
{
|
||||||
Primitive.TextureEntry tex = part.Shape.Textures;
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
if (face > -1)
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
{
|
{
|
||||||
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
|
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
|
||||||
texface.OffsetU = (float)u;
|
texface.OffsetU = (float)u;
|
||||||
|
@ -1450,9 +1474,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
part.UpdateTexture(tex);
|
part.UpdateTexture(tex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (face == -1)
|
if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 32; i++)
|
for (int i = 0; i < GetNumberOfSides(part); i++)
|
||||||
{
|
{
|
||||||
if (tex.FaceTextures[i] != null)
|
if (tex.FaceTextures[i] != null)
|
||||||
{
|
{
|
||||||
|
@ -1477,7 +1501,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
private void RotateTexture(SceneObjectPart part, double rotation, int face)
|
private void RotateTexture(SceneObjectPart part, double rotation, int face)
|
||||||
{
|
{
|
||||||
Primitive.TextureEntry tex = part.Shape.Textures;
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
if (face > -1)
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
{
|
{
|
||||||
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
|
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
|
||||||
texface.Rotation = (float)rotation;
|
texface.Rotation = (float)rotation;
|
||||||
|
@ -1485,9 +1509,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
part.UpdateTexture(tex);
|
part.UpdateTexture(tex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (face == -1)
|
if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 32; i++)
|
for (int i = 0; i < GetNumberOfSides(part); i++)
|
||||||
{
|
{
|
||||||
if (tex.FaceTextures[i] != null)
|
if (tex.FaceTextures[i] != null)
|
||||||
{
|
{
|
||||||
|
@ -1503,12 +1527,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Types.LSLString llGetTexture(int face)
|
public LSL_Types.LSLString llGetTexture(int face)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
Primitive.TextureEntry tex = m_host.Shape.Textures;
|
return GetTexture(m_host, face);
|
||||||
if (face == -1)
|
}
|
||||||
|
|
||||||
|
private LSL_Types.LSLString GetTexture(SceneObjectPart part, int face)
|
||||||
|
{
|
||||||
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
|
if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
face = 0;
|
face = 0;
|
||||||
}
|
}
|
||||||
if (face > -1)
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
{
|
{
|
||||||
Primitive.TextureEntryFace texface;
|
Primitive.TextureEntryFace texface;
|
||||||
texface = tex.GetFace((uint)face);
|
texface = tex.GetFace((uint)face);
|
||||||
|
@ -3469,7 +3498,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return GetNumberOfSides(m_host);
|
return GetNumberOfSides(m_host);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Types.LSLInteger GetNumberOfSides(SceneObjectPart part)
|
private int GetNumberOfSides(SceneObjectPart part)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
bool hasCut;
|
bool hasCut;
|
||||||
|
@ -3701,16 +3730,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Types.Vector3 llGetTextureOffset(int face)
|
public LSL_Types.Vector3 llGetTextureOffset(int face)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
Primitive.TextureEntry tex = m_host.Shape.Textures;
|
return GetTextureOffset(m_host, face);
|
||||||
LSL_Types.Vector3 offset;
|
}
|
||||||
if (face == -1)
|
|
||||||
|
private LSL_Types.Vector3 GetTextureOffset(SceneObjectPart part, int face)
|
||||||
|
{
|
||||||
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
|
LSL_Types.Vector3 offset = new LSL_Types.Vector3();
|
||||||
|
if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
face = 0;
|
face = 0;
|
||||||
}
|
}
|
||||||
offset.x = tex.GetFace((uint)face).OffsetU;
|
if(face >= 0 && face < GetNumberOfSides(part))
|
||||||
offset.y = tex.GetFace((uint)face).OffsetV;
|
{
|
||||||
offset.z = 0.0;
|
offset.x = tex.GetFace((uint)face).OffsetU;
|
||||||
return offset;
|
offset.y = tex.GetFace((uint)face).OffsetV;
|
||||||
|
offset.z = 0.0;
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Types.Vector3 llGetTextureScale(int side)
|
public LSL_Types.Vector3 llGetTextureScale(int side)
|
||||||
|
@ -3731,12 +3772,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Types.LSLFloat llGetTextureRot(int face)
|
public LSL_Types.LSLFloat llGetTextureRot(int face)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
Primitive.TextureEntry tex = m_host.Shape.Textures;
|
return GetTextureRot(m_host, face);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LSL_Types.LSLFloat GetTextureRot(SceneObjectPart part, int face)
|
||||||
|
{
|
||||||
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
if (face == -1)
|
if (face == -1)
|
||||||
{
|
{
|
||||||
face = 0;
|
face = 0;
|
||||||
}
|
}
|
||||||
return tex.GetFace((uint)face).Rotation;
|
if (face >= 0 && face < GetNumberOfSides(part))
|
||||||
|
{
|
||||||
|
return tex.GetFace((uint)face).Rotation;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Types.LSLInteger llSubStringIndex(string source, string pattern)
|
public LSL_Types.LSLInteger llSubStringIndex(string source, string pattern)
|
||||||
|
@ -4385,7 +4438,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
pTexAnim.Flags = (Primitive.TextureAnimMode)mode;
|
pTexAnim.Flags = (Primitive.TextureAnimMode)mode;
|
||||||
|
|
||||||
//ALL_SIDES
|
//ALL_SIDES
|
||||||
if (face == -1)
|
if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
face = 255;
|
face = 255;
|
||||||
|
|
||||||
pTexAnim.Face = (uint)face;
|
pTexAnim.Face = (uint)face;
|
||||||
|
@ -5807,11 +5860,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
case (int)ScriptBaseClass.PRIM_GLOW:
|
case (int)ScriptBaseClass.PRIM_GLOW:
|
||||||
if (remain < 2)
|
if (remain < 2)
|
||||||
return;
|
return;
|
||||||
// TODO: LSL constant ALL_SIDES (value -1) is inserted into LSL_Types.list
|
face = rules.GetLSLIntegerItem(idx++);
|
||||||
// as a raw CLI Int32. When / if this is inserted as an
|
|
||||||
// LSL_Types.LSLInteger extract value using LSL_Types.list.GetLSLIntegerItem
|
|
||||||
// face = rules.GetLSLIntegerItem(idx++);
|
|
||||||
face = (int)rules.GetLSLIntegerItem(idx++);
|
|
||||||
float glow = (float)rules.GetLSLFloatItem(idx++);
|
float glow = (float)rules.GetLSLFloatItem(idx++);
|
||||||
|
|
||||||
SetGlow(part, face, glow);
|
SetGlow(part, face, glow);
|
||||||
|
@ -5830,11 +5879,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
|
case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
|
||||||
if (remain < 2)
|
if (remain < 2)
|
||||||
return;
|
return;
|
||||||
// TODO: LSL constant ALL_SIDES (value -1) is inserted into LSL_Types.list
|
face = rules.GetLSLIntegerItem(idx++);
|
||||||
// as a raw CLI Int32. When / if this is inserted as an
|
|
||||||
// LSL_Types.LSLInteger extract value using LSL_Types.list.GetLSLIntegerItem
|
|
||||||
// face = rules.GetLSLIntegerItem(idx++);
|
|
||||||
face = (int)rules.GetLSLIntegerItem(idx++);
|
|
||||||
bool st = rules.GetLSLIntegerItem(idx++);
|
bool st = rules.GetLSLIntegerItem(idx++);
|
||||||
SetFullBright(part, face , st);
|
SetFullBright(part, face , st);
|
||||||
break;
|
break;
|
||||||
|
@ -6019,7 +6064,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
Primitive.TextureEntry tex = part.Shape.Textures;
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
Color4 texcolor;
|
Color4 texcolor;
|
||||||
if (face > -1)
|
if (face >= 0 && face < GetNumberOfSides(m_host))
|
||||||
{
|
{
|
||||||
texcolor = tex.CreateFace((uint)face).RGBA;
|
texcolor = tex.CreateFace((uint)face).RGBA;
|
||||||
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
|
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
|
||||||
|
@ -6027,12 +6072,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
part.UpdateTexture(tex);
|
part.UpdateTexture(tex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (face == -1)
|
else if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
texcolor = tex.DefaultTexture.RGBA;
|
texcolor = tex.DefaultTexture.RGBA;
|
||||||
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
|
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
|
||||||
tex.DefaultTexture.RGBA = texcolor;
|
tex.DefaultTexture.RGBA = texcolor;
|
||||||
for (uint i = 0; i < 32; i++)
|
for (uint i = 0; i < GetNumberOfSides(m_host); i++)
|
||||||
{
|
{
|
||||||
if (tex.FaceTextures[i] != null)
|
if (tex.FaceTextures[i] != null)
|
||||||
{
|
{
|
||||||
|
@ -6242,7 +6287,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
int face = (int)rules.GetLSLIntegerItem(idx++);
|
int face = (int)rules.GetLSLIntegerItem(idx++);
|
||||||
Primitive.TextureEntry tex = m_host.Shape.Textures;
|
Primitive.TextureEntry tex = m_host.Shape.Textures;
|
||||||
if (face == -1) // ALL_SIDES
|
if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
for (face = 0 ; face < GetNumberOfSides(m_host) ; face++)
|
for (face = 0 ; face < GetNumberOfSides(m_host) ; face++)
|
||||||
{
|
{
|
||||||
|
@ -6260,16 +6305,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
|
if (face >= 0 && face < GetNumberOfSides(m_host))
|
||||||
|
{
|
||||||
|
Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
|
||||||
|
|
||||||
res.Add(new LSL_Types.LSLString(texface.TextureID.ToString()));
|
res.Add(new LSL_Types.LSLString(texface.TextureID.ToString()));
|
||||||
res.Add(new LSL_Types.Vector3(texface.RepeatU,
|
res.Add(new LSL_Types.Vector3(texface.RepeatU,
|
||||||
texface.RepeatV,
|
texface.RepeatV,
|
||||||
0));
|
0));
|
||||||
res.Add(new LSL_Types.Vector3(texface.OffsetU,
|
res.Add(new LSL_Types.Vector3(texface.OffsetU,
|
||||||
texface.OffsetV,
|
texface.OffsetV,
|
||||||
0));
|
0));
|
||||||
res.Add(new LSL_Types.LSLFloat(texface.Rotation));
|
res.Add(new LSL_Types.LSLFloat(texface.Rotation));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -6281,24 +6329,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
tex = m_host.Shape.Textures;
|
tex = m_host.Shape.Textures;
|
||||||
Color4 texcolor;
|
Color4 texcolor;
|
||||||
if (face == -1) // ALL_SIDES
|
if (face == ScriptBaseClass.ALL_SIDES)
|
||||||
{
|
{
|
||||||
for (face = 0 ; face < GetNumberOfSides(m_host) ; face++)
|
for (face = 0 ; face < GetNumberOfSides(m_host) ; face++)
|
||||||
{
|
{
|
||||||
texcolor = tex.GetFace((uint)face).RGBA;
|
texcolor = tex.GetFace((uint)face).RGBA;
|
||||||
res.Add(new LSL_Types.Vector3((255 - (texcolor.R * 255)) / 255,
|
res.Add(new LSL_Types.Vector3(texcolor.R,
|
||||||
(255 - (texcolor.G * 255)) / 255,
|
texcolor.G,
|
||||||
(255 - (texcolor.B * 255)) / 255));
|
texcolor.B));
|
||||||
res.Add(new LSL_Types.LSLFloat((texcolor.A * 255) / 255));
|
res.Add(new LSL_Types.LSLFloat(texcolor.A));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
texcolor = tex.GetFace((uint)face).RGBA;
|
texcolor = tex.GetFace((uint)face).RGBA;
|
||||||
res.Add(new LSL_Types.Vector3((255 - (texcolor.R * 255)) / 255,
|
res.Add(new LSL_Types.Vector3(texcolor.R,
|
||||||
(255 - (texcolor.G * 255)) / 255,
|
texcolor.G,
|
||||||
(255 - (texcolor.B * 255)) / 255));
|
texcolor.B));
|
||||||
res.Add(new LSL_Types.LSLFloat((texcolor.A * 255) / 255));
|
res.Add(new LSL_Types.LSLFloat(texcolor.A));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue