aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorCharles Krinke2008-09-05 23:53:44 +0000
committerCharles Krinke2008-09-05 23:53:44 +0000
commit0054bce5ae05d8bfa46159e30585292cd0e1fc27 (patch)
treed6ce91d2238b14836e0c220e84b0b670d9f8772a /OpenSim
parentMantis#2048. Thank you kindly, HomerHorwitz for a patch that: (diff)
downloadopensim-SC-0054bce5ae05d8bfa46159e30585292cd0e1fc27.zip
opensim-SC-0054bce5ae05d8bfa46159e30585292cd0e1fc27.tar.gz
opensim-SC-0054bce5ae05d8bfa46159e30585292cd0e1fc27.tar.bz2
opensim-SC-0054bce5ae05d8bfa46159e30585292cd0e1fc27.tar.xz
Mantis#2093. Thank you kindly, Ewe Loon for a patch that:
Solves SetPrimitiveParams, Revolutions not calculated properly.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs96
1 files changed, 48 insertions, 48 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index a32ffe2..bcdff8f 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -5301,7 +5301,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5301 return Util.Md5Hash(src + ":" + nonce.ToString()); 5301 return Util.Md5Hash(src + ":" + nonce.ToString());
5302 } 5302 }
5303 5303
5304 private ObjectShapePacket.ObjectDataBlock SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist) 5304 private ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist)
5305 { 5305 {
5306 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); 5306 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
5307 5307
@@ -5344,38 +5344,38 @@ namespace OpenSim.Region.ScriptEngine.Common
5344 hollow = 0.95f; 5344 hollow = 0.95f;
5345 } 5345 }
5346 shapeBlock.ProfileHollow = (ushort)(50000 * hollow); 5346 shapeBlock.ProfileHollow = (ushort)(50000 * hollow);
5347 if (twist.x < -0.5f) 5347 if (twist.x < -1.0f)
5348 { 5348 {
5349 twist.x = -0.5f; 5349 twist.x = -1.0f;
5350 } 5350 }
5351 if (twist.x > 0.5f) 5351 if (twist.x > 1.0f)
5352 { 5352 {
5353 twist.x = 0.5f; 5353 twist.x = 1.0f;
5354 } 5354 }
5355 if (twist.y < -0.5f) 5355 if (twist.y < -1.0f)
5356 { 5356 {
5357 twist.y = -0.5f; 5357 twist.y = -1.0f;
5358 } 5358 }
5359 if (twist.y > 0.5f) 5359 if (twist.y > 1.0f)
5360 { 5360 {
5361 twist.y = 0.5f; 5361 twist.y = 1.0f;
5362 } 5362 }
5363 shapeBlock.PathTwistBegin = (sbyte)(200 * twist.x); 5363 shapeBlock.PathTwistBegin = (sbyte)(100 * twist.x);
5364 shapeBlock.PathTwist = (sbyte)(200 * twist.y); 5364 shapeBlock.PathTwist = (sbyte)(100 * twist.y);
5365 5365
5366 shapeBlock.ObjectLocalID = m_host.LocalId; 5366 shapeBlock.ObjectLocalID = part.LocalId;
5367 5367
5368 // retain pathcurve 5368 // retain pathcurve
5369 shapeBlock.PathCurve = m_host.Shape.PathCurve; 5369 shapeBlock.PathCurve = part.Shape.PathCurve;
5370 5370
5371 return shapeBlock; 5371 return shapeBlock;
5372 } 5372 }
5373 5373
5374 private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 taper_b, LSL_Types.Vector3 topshear, byte fudge) 5374 private void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 taper_b, LSL_Types.Vector3 topshear, byte fudge)
5375 { 5375 {
5376 ObjectShapePacket.ObjectDataBlock shapeBlock; 5376 ObjectShapePacket.ObjectDataBlock shapeBlock;
5377 5377
5378 shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); 5378 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
5379 5379
5380 shapeBlock.ProfileCurve += fudge; 5380 shapeBlock.ProfileCurve += fudge;
5381 5381
@@ -5395,8 +5395,8 @@ namespace OpenSim.Region.ScriptEngine.Common
5395 { 5395 {
5396 taper_b.y = 2f; 5396 taper_b.y = 2f;
5397 } 5397 }
5398 shapeBlock.PathScaleX = (byte)(100 * taper_b.x); 5398 shapeBlock.PathScaleX = (byte)(100 * (2.0 - taper_b.x));
5399 shapeBlock.PathScaleY = (byte)(100 * taper_b.y); 5399 shapeBlock.PathScaleY = (byte)(100 * (2.0 - taper_b.y));
5400 if (topshear.x < -0.5f) 5400 if (topshear.x < -0.5f)
5401 { 5401 {
5402 topshear.x = -0.5f; 5402 topshear.x = -0.5f;
@@ -5416,14 +5416,14 @@ namespace OpenSim.Region.ScriptEngine.Common
5416 shapeBlock.PathShearX = (byte)(100 * topshear.x); 5416 shapeBlock.PathShearX = (byte)(100 * topshear.x);
5417 shapeBlock.PathShearY = (byte)(100 * topshear.y); 5417 shapeBlock.PathShearY = (byte)(100 * topshear.y);
5418 5418
5419 m_host.UpdateShape(shapeBlock); 5419 part.UpdateShape(shapeBlock);
5420 } 5420 }
5421 5421
5422 private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 dimple, byte fudge) 5422 private void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 dimple, byte fudge)
5423 { 5423 {
5424 ObjectShapePacket.ObjectDataBlock shapeBlock; 5424 ObjectShapePacket.ObjectDataBlock shapeBlock;
5425 5425
5426 shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); 5426 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
5427 5427
5428 // profile/path swapped for a sphere 5428 // profile/path swapped for a sphere
5429 shapeBlock.PathBegin = shapeBlock.ProfileBegin; 5429 shapeBlock.PathBegin = shapeBlock.ProfileBegin;
@@ -5457,14 +5457,14 @@ namespace OpenSim.Region.ScriptEngine.Common
5457 shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x); 5457 shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x);
5458 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - dimple.y)); 5458 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - dimple.y));
5459 5459
5460 m_host.UpdateShape(shapeBlock); 5460 part.UpdateShape(shapeBlock);
5461 } 5461 }
5462 5462
5463 private void SetPrimitiveShapeParams(int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 holesize, LSL_Types.Vector3 topshear, LSL_Types.Vector3 profilecut, LSL_Types.Vector3 taper_a, float revolutions, float radiusoffset, float skew, byte fudge) 5463 private void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Types.Vector3 cut, float hollow, LSL_Types.Vector3 twist, LSL_Types.Vector3 holesize, LSL_Types.Vector3 topshear, LSL_Types.Vector3 profilecut, LSL_Types.Vector3 taper_a, float revolutions, float radiusoffset, float skew, byte fudge)
5464 { 5464 {
5465 ObjectShapePacket.ObjectDataBlock shapeBlock; 5465 ObjectShapePacket.ObjectDataBlock shapeBlock;
5466 5466
5467 shapeBlock = SetPrimitiveShapeParams(holeshape, cut, hollow, twist); 5467 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
5468 5468
5469 shapeBlock.ProfileCurve += fudge; 5469 shapeBlock.ProfileCurve += fudge;
5470 5470
@@ -5556,7 +5556,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5556 { 5556 {
5557 revolutions = 4f; 5557 revolutions = 4f;
5558 } 5558 }
5559 shapeBlock.PathRevolutions = (byte)(100 * revolutions); 5559 shapeBlock.PathRevolutions = (byte)(66.666667 * (revolutions - 1.0));
5560 // limits on radiusoffset depend on revolutions and hole size (how?) seems like the maximum range is 0 to 1 5560 // limits on radiusoffset depend on revolutions and hole size (how?) seems like the maximum range is 0 to 1
5561 if (radiusoffset < 0f) 5561 if (radiusoffset < 0f)
5562 { 5562 {
@@ -5577,10 +5577,10 @@ namespace OpenSim.Region.ScriptEngine.Common
5577 } 5577 }
5578 shapeBlock.PathSkew = (sbyte)(100 * skew); 5578 shapeBlock.PathSkew = (sbyte)(100 * skew);
5579 5579
5580 m_host.UpdateShape(shapeBlock); 5580 part.UpdateShape(shapeBlock);
5581 } 5581 }
5582 5582
5583 private void SetPrimitiveShapeParams(string map, int type) 5583 private void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type)
5584 { 5584 {
5585 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); 5585 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
5586 LLUUID sculptId; 5586 LLUUID sculptId;
@@ -5591,7 +5591,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5591 return; 5591 return;
5592 } 5592 }
5593 5593
5594 shapeBlock.ObjectLocalID = m_host.LocalId; 5594 shapeBlock.ObjectLocalID = part.LocalId;
5595 shapeBlock.PathScaleX = 100; 5595 shapeBlock.PathScaleX = 100;
5596 shapeBlock.PathScaleY = 150; 5596 shapeBlock.PathScaleY = 150;
5597 5597
@@ -5605,11 +5605,11 @@ namespace OpenSim.Region.ScriptEngine.Common
5605 } 5605 }
5606 5606
5607 // retain pathcurve 5607 // retain pathcurve
5608 shapeBlock.PathCurve = m_host.Shape.PathCurve; 5608 shapeBlock.PathCurve = part.Shape.PathCurve;
5609 5609
5610 m_host.Shape.SetSculptData((byte)type, sculptId); 5610 part.Shape.SetSculptData((byte)type, sculptId);
5611 m_host.Shape.SculptEntry = true; 5611 part.Shape.SculptEntry = true;
5612 m_host.UpdateShape(shapeBlock); 5612 part.UpdateShape(shapeBlock);
5613 } 5613 }
5614 5614
5615 public void llSetPrimitiveParams(LSL_Types.list rules) 5615 public void llSetPrimitiveParams(LSL_Types.list rules)
@@ -5696,8 +5696,8 @@ namespace OpenSim.Region.ScriptEngine.Common
5696 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5696 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5697 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5697 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5698 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5698 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5699 m_host.Shape.PathCurve = (byte) Extrusion.Straight; 5699 part.Shape.PathCurve = (byte)Extrusion.Straight;
5700 SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 1); 5700 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 1);
5701 break; 5701 break;
5702 5702
5703 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_CYLINDER: 5703 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_CYLINDER:
@@ -5710,9 +5710,9 @@ namespace OpenSim.Region.ScriptEngine.Common
5710 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5710 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5711 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5711 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5712 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5712 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5713 m_host.Shape.ProfileShape = ProfileShape.Circle; 5713 part.Shape.ProfileShape = ProfileShape.Circle;
5714 m_host.Shape.PathCurve = (byte) Extrusion.Straight; 5714 part.Shape.PathCurve = (byte)Extrusion.Straight;
5715 SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 0); 5715 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 0);
5716 break; 5716 break;
5717 5717
5718 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_PRISM: 5718 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_PRISM:
@@ -5725,8 +5725,8 @@ namespace OpenSim.Region.ScriptEngine.Common
5725 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5725 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5726 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5726 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5727 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5727 topshear = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5728 m_host.Shape.PathCurve = (byte) Extrusion.Straight; 5728 part.Shape.PathCurve = (byte)Extrusion.Straight;
5729 SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, topshear, 3); 5729 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 3);
5730 break; 5730 break;
5731 5731
5732 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_SPHERE: 5732 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_SPHERE:
@@ -5738,8 +5738,8 @@ namespace OpenSim.Region.ScriptEngine.Common
5738 hollow = (float)Convert.ToDouble(rules.Data[idx++]); 5738 hollow = (float)Convert.ToDouble(rules.Data[idx++]);
5739 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5739 twist = new LSL_Types.Vector3(rules.Data[idx++].ToString());
5740 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // dimple 5740 taper_b = new LSL_Types.Vector3(rules.Data[idx++].ToString()); // dimple
5741 m_host.Shape.PathCurve = (byte) Extrusion.Curve1; 5741 part.Shape.PathCurve = (byte)Extrusion.Curve1;
5742 SetPrimitiveShapeParams(face, v, hollow, twist, taper_b, 5); 5742 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, 5);
5743 break; 5743 break;
5744 5744
5745 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_TORUS: 5745 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_TORUS:
@@ -5757,8 +5757,8 @@ namespace OpenSim.Region.ScriptEngine.Common
5757 revolutions = (float)Convert.ToDouble(rules.Data[idx++]); 5757 revolutions = (float)Convert.ToDouble(rules.Data[idx++]);
5758 radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]); 5758 radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]);
5759 skew = (float)Convert.ToDouble(rules.Data[idx++]); 5759 skew = (float)Convert.ToDouble(rules.Data[idx++]);
5760 m_host.Shape.PathCurve = (byte) Extrusion.Curve1; 5760 part.Shape.PathCurve = (byte)Extrusion.Curve1;
5761 SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 0); 5761 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 0);
5762 break; 5762 break;
5763 5763
5764 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_TUBE: 5764 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_TUBE:
@@ -5776,8 +5776,8 @@ namespace OpenSim.Region.ScriptEngine.Common
5776 revolutions = (float)Convert.ToDouble(rules.Data[idx++]); 5776 revolutions = (float)Convert.ToDouble(rules.Data[idx++]);
5777 radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]); 5777 radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]);
5778 skew = (float)Convert.ToDouble(rules.Data[idx++]); 5778 skew = (float)Convert.ToDouble(rules.Data[idx++]);
5779 m_host.Shape.PathCurve = (byte) Extrusion.Curve1; 5779 part.Shape.PathCurve = (byte)Extrusion.Curve1;
5780 SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 1); 5780 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 1);
5781 break; 5781 break;
5782 5782
5783 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_RING: 5783 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_RING:
@@ -5795,8 +5795,8 @@ namespace OpenSim.Region.ScriptEngine.Common
5795 revolutions = (float)Convert.ToDouble(rules.Data[idx++]); 5795 revolutions = (float)Convert.ToDouble(rules.Data[idx++]);
5796 radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]); 5796 radiusoffset = (float)Convert.ToDouble(rules.Data[idx++]);
5797 skew = (float)Convert.ToDouble(rules.Data[idx++]); 5797 skew = (float)Convert.ToDouble(rules.Data[idx++]);
5798 m_host.Shape.PathCurve = (byte) Extrusion.Curve1; 5798 part.Shape.PathCurve = (byte)Extrusion.Curve1;
5799 SetPrimitiveShapeParams(face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 3); 5799 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 3);
5800 break; 5800 break;
5801 5801
5802 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_SCULPT: 5802 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE_SCULPT:
@@ -5805,8 +5805,8 @@ namespace OpenSim.Region.ScriptEngine.Common
5805 5805
5806 string map = rules.Data[idx++].ToString(); 5806 string map = rules.Data[idx++].ToString();
5807 face = Convert.ToInt32(rules.Data[idx++]); // type 5807 face = Convert.ToInt32(rules.Data[idx++]); // type
5808 m_host.Shape.PathCurve = (byte) Extrusion.Curve1; 5808 part.Shape.PathCurve = (byte)Extrusion.Curve1;
5809 SetPrimitiveShapeParams(map, face); 5809 SetPrimitiveShapeParams(part, map, face);
5810 break; 5810 break;
5811 } 5811 }
5812 5812