aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs87
2 files changed, 52 insertions, 37 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 33c3fcf..4f9beb7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3053,7 +3053,7 @@ namespace OpenSim.Region.Framework.Scenes
3053 ret = 1; 3053 ret = 1;
3054 if (hasCut) ret += 2; 3054 if (hasCut) ret += 2;
3055 if (hasDimple) ret += 2; 3055 if (hasDimple) ret += 2;
3056 if (hasHollow) ret += 3; // Emulate lsl on secondlife (according to documentation it should have added only +1) 3056 if (hasHollow) ret += 1;
3057 break; 3057 break;
3058 case PrimType.TORUS: 3058 case PrimType.TORUS:
3059 ret = 1; 3059 ret = 1;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 1437bb7..3dc7613 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -53,8 +53,8 @@ using OpenSim.Region.ScriptEngine.Interfaces;
53using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; 53using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
54using OpenSim.Services.Interfaces; 54using OpenSim.Services.Interfaces;
55 55
56using PrimType = OpenSim.Region.Framework.Scenes.PrimType;
56using GridRegion = OpenSim.Services.Interfaces.GridRegion; 57using GridRegion = OpenSim.Services.Interfaces.GridRegion;
57
58using AssetLandmark = OpenSim.Framework.AssetLandmark; 58using AssetLandmark = OpenSim.Framework.AssetLandmark;
59 59
60using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; 60using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
@@ -1330,6 +1330,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1330 { 1330 {
1331 m_host.AddScriptLPS(1); 1331 m_host.AddScriptLPS(1);
1332 1332
1333 if (face == ScriptBaseClass.ALL_SIDES)
1334 face = SceneObjectPart.ALL_SIDES;
1335
1333 m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); 1336 m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
1334 } 1337 }
1335 1338
@@ -1341,7 +1344,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1341 if (style == (int)ScriptBaseClass.PRIM_TEXGEN_PLANAR) 1344 if (style == (int)ScriptBaseClass.PRIM_TEXGEN_PLANAR)
1342 textype = MappingType.Planar; 1345 textype = MappingType.Planar;
1343 1346
1344 if (face >= 0 && face < part.GetNumberOfSides()) 1347 if (face >= 0 && face < GetNumberOfSides(part))
1345 { 1348 {
1346 tex.CreateFace((uint) face); 1349 tex.CreateFace((uint) face);
1347 tex.FaceTextures[face].TexMapType = textype; 1350 tex.FaceTextures[face].TexMapType = textype;
@@ -1350,7 +1353,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1350 } 1353 }
1351 else if (face == ScriptBaseClass.ALL_SIDES) 1354 else if (face == ScriptBaseClass.ALL_SIDES)
1352 { 1355 {
1353 for (uint i = 0; i < part.GetNumberOfSides(); i++) 1356 for (uint i = 0; i < GetNumberOfSides(part); i++)
1354 { 1357 {
1355 if (tex.FaceTextures[i] != null) 1358 if (tex.FaceTextures[i] != null)
1356 { 1359 {
@@ -1366,7 +1369,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1366 public void SetGlow(SceneObjectPart part, int face, float glow) 1369 public void SetGlow(SceneObjectPart part, int face, float glow)
1367 { 1370 {
1368 Primitive.TextureEntry tex = part.Shape.Textures; 1371 Primitive.TextureEntry tex = part.Shape.Textures;
1369 if (face >= 0 && face < part.GetNumberOfSides()) 1372 if (face >= 0 && face < GetNumberOfSides(part))
1370 { 1373 {
1371 tex.CreateFace((uint) face); 1374 tex.CreateFace((uint) face);
1372 tex.FaceTextures[face].Glow = glow; 1375 tex.FaceTextures[face].Glow = glow;
@@ -1375,7 +1378,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1375 } 1378 }
1376 else if (face == ScriptBaseClass.ALL_SIDES) 1379 else if (face == ScriptBaseClass.ALL_SIDES)
1377 { 1380 {
1378 for (uint i = 0; i < part.GetNumberOfSides(); i++) 1381 for (uint i = 0; i < GetNumberOfSides(part); i++)
1379 { 1382 {
1380 if (tex.FaceTextures[i] != null) 1383 if (tex.FaceTextures[i] != null)
1381 { 1384 {
@@ -1413,7 +1416,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1413 } 1416 }
1414 1417
1415 Primitive.TextureEntry tex = part.Shape.Textures; 1418 Primitive.TextureEntry tex = part.Shape.Textures;
1416 if (face >= 0 && face < part.GetNumberOfSides()) 1419 if (face >= 0 && face < GetNumberOfSides(part))
1417 { 1420 {
1418 tex.CreateFace((uint) face); 1421 tex.CreateFace((uint) face);
1419 tex.FaceTextures[face].Shiny = sval; 1422 tex.FaceTextures[face].Shiny = sval;
@@ -1423,7 +1426,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1423 } 1426 }
1424 else if (face == ScriptBaseClass.ALL_SIDES) 1427 else if (face == ScriptBaseClass.ALL_SIDES)
1425 { 1428 {
1426 for (uint i = 0; i < part.GetNumberOfSides(); i++) 1429 for (uint i = 0; i < GetNumberOfSides(part); i++)
1427 { 1430 {
1428 if (tex.FaceTextures[i] != null) 1431 if (tex.FaceTextures[i] != null)
1429 { 1432 {
@@ -1441,7 +1444,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1441 public void SetFullBright(SceneObjectPart part, int face, bool bright) 1444 public void SetFullBright(SceneObjectPart part, int face, bool bright)
1442 { 1445 {
1443 Primitive.TextureEntry tex = part.Shape.Textures; 1446 Primitive.TextureEntry tex = part.Shape.Textures;
1444 if (face >= 0 && face < part.GetNumberOfSides()) 1447 if (face >= 0 && face < GetNumberOfSides(part))
1445 { 1448 {
1446 tex.CreateFace((uint) face); 1449 tex.CreateFace((uint) face);
1447 tex.FaceTextures[face].Fullbright = bright; 1450 tex.FaceTextures[face].Fullbright = bright;
@@ -1450,7 +1453,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1450 } 1453 }
1451 else if (face == ScriptBaseClass.ALL_SIDES) 1454 else if (face == ScriptBaseClass.ALL_SIDES)
1452 { 1455 {
1453 for (uint i = 0; i < part.GetNumberOfSides(); i++) 1456 for (uint i = 0; i < GetNumberOfSides(part); i++)
1454 { 1457 {
1455 if (tex.FaceTextures[i] != null) 1458 if (tex.FaceTextures[i] != null)
1456 { 1459 {
@@ -1477,11 +1480,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1477 { 1480 {
1478 int i; 1481 int i;
1479 double sum = 0.0; 1482 double sum = 0.0;
1480 for (i = 0 ; i < part.GetNumberOfSides(); i++) 1483 for (i = 0 ; i < GetNumberOfSides(part); i++)
1481 sum += (double)tex.GetFace((uint)i).RGBA.A; 1484 sum += (double)tex.GetFace((uint)i).RGBA.A;
1482 return sum; 1485 return sum;
1483 } 1486 }
1484 if (face >= 0 && face < part.GetNumberOfSides()) 1487 if (face >= 0 && face < GetNumberOfSides(part))
1485 { 1488 {
1486 return (double)tex.GetFace((uint)face).RGBA.A; 1489 return (double)tex.GetFace((uint)face).RGBA.A;
1487 } 1490 }
@@ -1509,7 +1512,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1509 { 1512 {
1510 Primitive.TextureEntry tex = part.Shape.Textures; 1513 Primitive.TextureEntry tex = part.Shape.Textures;
1511 Color4 texcolor; 1514 Color4 texcolor;
1512 if (face >= 0 && face < part.GetNumberOfSides()) 1515 if (face >= 0 && face < GetNumberOfSides(part))
1513 { 1516 {
1514 texcolor = tex.CreateFace((uint)face).RGBA; 1517 texcolor = tex.CreateFace((uint)face).RGBA;
1515 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); 1518 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
@@ -1519,7 +1522,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1519 } 1522 }
1520 else if (face == ScriptBaseClass.ALL_SIDES) 1523 else if (face == ScriptBaseClass.ALL_SIDES)
1521 { 1524 {
1522 for (int i = 0; i < part.GetNumberOfSides(); i++) 1525 for (int i = 0; i < GetNumberOfSides(part); i++)
1523 { 1526 {
1524 if (tex.FaceTextures[i] != null) 1527 if (tex.FaceTextures[i] != null)
1525 { 1528 {
@@ -1624,7 +1627,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1624 { 1627 {
1625 int i; 1628 int i;
1626 1629
1627 for (i = 0 ; i < part.GetNumberOfSides(); i++) 1630 for (i = 0 ; i < GetNumberOfSides(part); i++)
1628 { 1631 {
1629 texcolor = tex.GetFace((uint)i).RGBA; 1632 texcolor = tex.GetFace((uint)i).RGBA;
1630 rgb.x += texcolor.R; 1633 rgb.x += texcolor.R;
@@ -1632,13 +1635,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1632 rgb.z += texcolor.B; 1635 rgb.z += texcolor.B;
1633 } 1636 }
1634 1637
1635 rgb.x /= (float)part.GetNumberOfSides(); 1638 rgb.x /= (float)GetNumberOfSides(part);
1636 rgb.y /= (float)part.GetNumberOfSides(); 1639 rgb.y /= (float)GetNumberOfSides(part);
1637 rgb.z /= (float)part.GetNumberOfSides(); 1640 rgb.z /= (float)GetNumberOfSides(part);
1638 1641
1639 return rgb; 1642 return rgb;
1640 } 1643 }
1641 if (face >= 0 && face < part.GetNumberOfSides()) 1644 if (face >= 0 && face < GetNumberOfSides(part))
1642 { 1645 {
1643 texcolor = tex.GetFace((uint)face).RGBA; 1646 texcolor = tex.GetFace((uint)face).RGBA;
1644 rgb.x = texcolor.R; 1647 rgb.x = texcolor.R;
@@ -1685,7 +1688,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1685 1688
1686 Primitive.TextureEntry tex = part.Shape.Textures; 1689 Primitive.TextureEntry tex = part.Shape.Textures;
1687 1690
1688 if (face >= 0 && face < part.GetNumberOfSides()) 1691 if (face >= 0 && face < GetNumberOfSides(part))
1689 { 1692 {
1690 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); 1693 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
1691 texface.TextureID = textureID; 1694 texface.TextureID = textureID;
@@ -1695,7 +1698,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1695 } 1698 }
1696 else if (face == ScriptBaseClass.ALL_SIDES) 1699 else if (face == ScriptBaseClass.ALL_SIDES)
1697 { 1700 {
1698 for (uint i = 0; i < part.GetNumberOfSides(); i++) 1701 for (uint i = 0; i < GetNumberOfSides(part); i++)
1699 { 1702 {
1700 if (tex.FaceTextures[i] != null) 1703 if (tex.FaceTextures[i] != null)
1701 { 1704 {
@@ -1719,7 +1722,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1719 protected void ScaleTexture(SceneObjectPart part, double u, double v, int face) 1722 protected void ScaleTexture(SceneObjectPart part, double u, double v, int face)
1720 { 1723 {
1721 Primitive.TextureEntry tex = part.Shape.Textures; 1724 Primitive.TextureEntry tex = part.Shape.Textures;
1722 if (face >= 0 && face < part.GetNumberOfSides()) 1725 if (face >= 0 && face < GetNumberOfSides(part))
1723 { 1726 {
1724 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); 1727 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
1725 texface.RepeatU = (float)u; 1728 texface.RepeatU = (float)u;
@@ -1730,7 +1733,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1730 } 1733 }
1731 if (face == ScriptBaseClass.ALL_SIDES) 1734 if (face == ScriptBaseClass.ALL_SIDES)
1732 { 1735 {
1733 for (int i = 0; i < part.GetNumberOfSides(); i++) 1736 for (int i = 0; i < GetNumberOfSides(part); i++)
1734 { 1737 {
1735 if (tex.FaceTextures[i] != null) 1738 if (tex.FaceTextures[i] != null)
1736 { 1739 {
@@ -1755,7 +1758,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1755 protected void OffsetTexture(SceneObjectPart part, double u, double v, int face) 1758 protected void OffsetTexture(SceneObjectPart part, double u, double v, int face)
1756 { 1759 {
1757 Primitive.TextureEntry tex = part.Shape.Textures; 1760 Primitive.TextureEntry tex = part.Shape.Textures;
1758 if (face >= 0 && face < part.GetNumberOfSides()) 1761 if (face >= 0 && face < GetNumberOfSides(part))
1759 { 1762 {
1760 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); 1763 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
1761 texface.OffsetU = (float)u; 1764 texface.OffsetU = (float)u;
@@ -1766,7 +1769,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1766 } 1769 }
1767 if (face == ScriptBaseClass.ALL_SIDES) 1770 if (face == ScriptBaseClass.ALL_SIDES)
1768 { 1771 {
1769 for (int i = 0; i < part.GetNumberOfSides(); i++) 1772 for (int i = 0; i < GetNumberOfSides(part); i++)
1770 { 1773 {
1771 if (tex.FaceTextures[i] != null) 1774 if (tex.FaceTextures[i] != null)
1772 { 1775 {
@@ -1791,7 +1794,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1791 protected void RotateTexture(SceneObjectPart part, double rotation, int face) 1794 protected void RotateTexture(SceneObjectPart part, double rotation, int face)
1792 { 1795 {
1793 Primitive.TextureEntry tex = part.Shape.Textures; 1796 Primitive.TextureEntry tex = part.Shape.Textures;
1794 if (face >= 0 && face < part.GetNumberOfSides()) 1797 if (face >= 0 && face < GetNumberOfSides(part))
1795 { 1798 {
1796 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); 1799 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
1797 texface.Rotation = (float)rotation; 1800 texface.Rotation = (float)rotation;
@@ -1801,7 +1804,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1801 } 1804 }
1802 if (face == ScriptBaseClass.ALL_SIDES) 1805 if (face == ScriptBaseClass.ALL_SIDES)
1803 { 1806 {
1804 for (int i = 0; i < part.GetNumberOfSides(); i++) 1807 for (int i = 0; i < GetNumberOfSides(part); i++)
1805 { 1808 {
1806 if (tex.FaceTextures[i] != null) 1809 if (tex.FaceTextures[i] != null)
1807 { 1810 {
@@ -1827,7 +1830,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1827 { 1830 {
1828 face = 0; 1831 face = 0;
1829 } 1832 }
1830 if (face >= 0 && face < part.GetNumberOfSides()) 1833 if (face >= 0 && face < GetNumberOfSides(part))
1831 { 1834 {
1832 Primitive.TextureEntryFace texface; 1835 Primitive.TextureEntryFace texface;
1833 texface = tex.GetFace((uint)face); 1836 texface = tex.GetFace((uint)face);
@@ -4225,7 +4228,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4225 { 4228 {
4226 if (item.Type == 10 && item.ItemID == m_itemID) 4229 if (item.Type == 10 && item.ItemID == m_itemID)
4227 { 4230 {
4228 result = item.Name!=null?item.Name:String.Empty; 4231 result = item.Name != null ? item.Name : String.Empty;
4229 break; 4232 break;
4230 } 4233 }
4231 } 4234 }
@@ -4238,9 +4241,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4238 { 4241 {
4239 m_host.AddScriptLPS(1); 4242 m_host.AddScriptLPS(1);
4240 4243
4241 return m_host.GetNumberOfSides(); 4244 return GetNumberOfSides(m_host);
4242 } 4245 }
4243 4246
4247 protected int GetNumberOfSides(SceneObjectPart part)
4248 {
4249 int sides = part.GetNumberOfSides();
4250
4251 if (part.GetScriptPrimType() == PrimType.SPHERE && part.Shape.ProfileHollow > 0)
4252 {
4253 // Make up for a bug where LSL shows 4 sides rather than 2
4254 sides += 2;
4255 }
4256
4257 return sides;
4258 }
4259
4260
4244 /* The new / changed functions were tested with the following LSL script: 4261 /* The new / changed functions were tested with the following LSL script:
4245 4262
4246 default 4263 default
@@ -4264,8 +4281,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4264 } 4281 }
4265 */ 4282 */
4266 4283
4267
4268
4269 // Xantor 29/apr/2008 4284 // Xantor 29/apr/2008
4270 // Returns rotation described by rotating angle radians about axis. 4285 // Returns rotation described by rotating angle radians about axis.
4271 // q = cos(a/2) + i (x * sin(a/2)) + j (y * sin(a/2)) + k (z * sin(a/2)) 4286 // q = cos(a/2) + i (x * sin(a/2)) + j (y * sin(a/2)) + k (z * sin(a/2))
@@ -4435,7 +4450,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4435 { 4450 {
4436 face = 0; 4451 face = 0;
4437 } 4452 }
4438 if (face >= 0 && face < part.GetNumberOfSides()) 4453 if (face >= 0 && face < GetNumberOfSides(part))
4439 { 4454 {
4440 offset.x = tex.GetFace((uint)face).OffsetU; 4455 offset.x = tex.GetFace((uint)face).OffsetU;
4441 offset.y = tex.GetFace((uint)face).OffsetV; 4456 offset.y = tex.GetFace((uint)face).OffsetV;
@@ -4476,7 +4491,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4476 { 4491 {
4477 face = 0; 4492 face = 0;
4478 } 4493 }
4479 if (face >= 0 && face < part.GetNumberOfSides()) 4494 if (face >= 0 && face < GetNumberOfSides(part))
4480 { 4495 {
4481 return tex.GetFace((uint)face).Rotation; 4496 return tex.GetFace((uint)face).Rotation;
4482 } 4497 }
@@ -7376,7 +7391,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7376 Primitive.TextureEntry tex = part.Shape.Textures; 7391 Primitive.TextureEntry tex = part.Shape.Textures;
7377 if (face == ScriptBaseClass.ALL_SIDES) 7392 if (face == ScriptBaseClass.ALL_SIDES)
7378 { 7393 {
7379 for (face = 0 ; face < part.GetNumberOfSides() ; face++) 7394 for (face = 0 ; face < GetNumberOfSides(part); face++)
7380 { 7395 {
7381 Primitive.TextureEntryFace texface = tex.GetFace((uint)face); 7396 Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
7382 7397
@@ -7392,7 +7407,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7392 } 7407 }
7393 else 7408 else
7394 { 7409 {
7395 if (face >= 0 && face < part.GetNumberOfSides()) 7410 if (face >= 0 && face < GetNumberOfSides(part))
7396 { 7411 {
7397 Primitive.TextureEntryFace texface = tex.GetFace((uint)face); 7412 Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
7398 7413
@@ -7418,7 +7433,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7418 Color4 texcolor; 7433 Color4 texcolor;
7419 if (face == ScriptBaseClass.ALL_SIDES) 7434 if (face == ScriptBaseClass.ALL_SIDES)
7420 { 7435 {
7421 for (face = 0 ; face < part.GetNumberOfSides() ; face++) 7436 for (face = 0 ; face < GetNumberOfSides(part); face++)
7422 { 7437 {
7423 texcolor = tex.GetFace((uint)face).RGBA; 7438 texcolor = tex.GetFace((uint)face).RGBA;
7424 res.Add(new LSL_Vector(texcolor.R, 7439 res.Add(new LSL_Vector(texcolor.R,