aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMicheil Merlin2011-08-24 20:21:51 -0500
committerBlueWall2011-08-25 06:50:55 -0400
commitcf42fcd978601a315ac1eb9599ab169f14fc9a8d (patch)
tree19073ba0298ad6ce946cc99f6f14df54f44617e1 /OpenSim/Region
parentFix llAttachToAvatar() (diff)
downloadopensim-SC_OLD-cf42fcd978601a315ac1eb9599ab169f14fc9a8d.zip
opensim-SC_OLD-cf42fcd978601a315ac1eb9599ab169f14fc9a8d.tar.gz
opensim-SC_OLD-cf42fcd978601a315ac1eb9599ab169f14fc9a8d.tar.bz2
opensim-SC_OLD-cf42fcd978601a315ac1eb9599ab169f14fc9a8d.tar.xz
llSetPrimitiveParams correct prim hollow for cases where limit should be 70%.
Signed-off-by: BlueWall <jamesh@bluewallgroup.com>
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs87
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs75
2 files changed, 111 insertions, 51 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d340ef2..a690e3b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6608,7 +6608,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6608 return Util.SHA1Hash(src).ToLower(); 6608 return Util.SHA1Hash(src).ToLower();
6609 } 6609 }
6610 6610
6611 protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist) 6611 protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve)
6612 { 6612 {
6613 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); 6613 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
6614 6614
@@ -6619,7 +6619,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6619 { 6619 {
6620 holeshape = (int)ScriptBaseClass.PRIM_HOLE_DEFAULT; 6620 holeshape = (int)ScriptBaseClass.PRIM_HOLE_DEFAULT;
6621 } 6621 }
6622 shapeBlock.ProfileCurve = (byte)holeshape; 6622 shapeBlock.PathCurve = pathcurve;
6623 shapeBlock.ProfileCurve = (byte)holeshape; // Set the hole shape.
6624 shapeBlock.ProfileCurve += profileshape; // Add in the profile shape.
6623 if (cut.x < 0f) 6625 if (cut.x < 0f)
6624 { 6626 {
6625 cut.x = 0f; 6627 cut.x = 0f;
@@ -6651,9 +6653,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6651 { 6653 {
6652 hollow = 0f; 6654 hollow = 0f;
6653 } 6655 }
6654 if (hollow > 0.95) 6656 // If the prim is a Cylinder, Prism, Sphere, Torus or Ring (or not a
6657 // Box or Tube) and the hole shape is a square, hollow is limited to
6658 // a max of 70%. The viewer performs its own check on this value but
6659 // we need to do it here also so llGetPrimitiveParams can have access
6660 // to the correct value.
6661 if (profileshape != (byte)ProfileCurve.Square &&
6662 holeshape == (int)ScriptBaseClass.PRIM_HOLE_SQUARE)
6655 { 6663 {
6656 hollow = 0.95f; 6664 if (hollow > 0.70f)
6665 {
6666 hollow = 0.70f;
6667 }
6668 }
6669 // Otherwise, hollow is limited to 95%.
6670 else
6671 {
6672 if (hollow > 0.95f)
6673 {
6674 hollow = 0.95f;
6675 }
6657 } 6676 }
6658 shapeBlock.ProfileHollow = (ushort)(50000 * hollow); 6677 shapeBlock.ProfileHollow = (ushort)(50000 * hollow);
6659 if (twist.x < -1.0f) 6678 if (twist.x < -1.0f)
@@ -6677,20 +6696,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6677 6696
6678 shapeBlock.ObjectLocalID = part.LocalId; 6697 shapeBlock.ObjectLocalID = part.LocalId;
6679 6698
6680 // retain pathcurve
6681 shapeBlock.PathCurve = part.Shape.PathCurve;
6682
6683 part.Shape.SculptEntry = false; 6699 part.Shape.SculptEntry = false;
6684 return shapeBlock; 6700 return shapeBlock;
6685 } 6701 }
6686 6702
6687 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte fudge) 6703 // Prim type box, cylinder and prism.
6704 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte profileshape, byte pathcurve)
6688 { 6705 {
6689 ObjectShapePacket.ObjectDataBlock shapeBlock; 6706 ObjectShapePacket.ObjectDataBlock shapeBlock;
6690 6707
6691 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); 6708 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
6692
6693 shapeBlock.ProfileCurve += fudge;
6694 6709
6695 if (taper_b.x < 0f) 6710 if (taper_b.x < 0f)
6696 { 6711 {
@@ -6733,18 +6748,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6733 part.UpdateShape(shapeBlock); 6748 part.UpdateShape(shapeBlock);
6734 } 6749 }
6735 6750
6736 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte fudge) 6751 // Prim type sphere.
6752 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte profileshape, byte pathcurve)
6737 { 6753 {
6738 ObjectShapePacket.ObjectDataBlock shapeBlock; 6754 ObjectShapePacket.ObjectDataBlock shapeBlock;
6739 6755
6740 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); 6756 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
6741 6757
6742 // profile/path swapped for a sphere 6758 // profile/path swapped for a sphere
6743 shapeBlock.PathBegin = shapeBlock.ProfileBegin; 6759 shapeBlock.PathBegin = shapeBlock.ProfileBegin;
6744 shapeBlock.PathEnd = shapeBlock.ProfileEnd; 6760 shapeBlock.PathEnd = shapeBlock.ProfileEnd;
6745 6761
6746 shapeBlock.ProfileCurve += fudge;
6747
6748 shapeBlock.PathScaleX = 100; 6762 shapeBlock.PathScaleX = 100;
6749 shapeBlock.PathScaleY = 100; 6763 shapeBlock.PathScaleY = 100;
6750 6764
@@ -6775,13 +6789,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6775 part.UpdateShape(shapeBlock); 6789 part.UpdateShape(shapeBlock);
6776 } 6790 }
6777 6791
6778 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte fudge) 6792 // Prim type torus, tube and ring.
6793 protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte profileshape, byte pathcurve)
6779 { 6794 {
6780 ObjectShapePacket.ObjectDataBlock shapeBlock; 6795 ObjectShapePacket.ObjectDataBlock shapeBlock;
6781 6796
6782 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); 6797 shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
6783
6784 shapeBlock.ProfileCurve += fudge;
6785 6798
6786 // profile/path swapped for a torrus, tube, ring 6799 // profile/path swapped for a torrus, tube, ring
6787 shapeBlock.PathBegin = shapeBlock.ProfileBegin; 6800 shapeBlock.PathBegin = shapeBlock.ProfileBegin;
@@ -6901,7 +6914,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6901 part.UpdateShape(shapeBlock); 6914 part.UpdateShape(shapeBlock);
6902 } 6915 }
6903 6916
6904 protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type) 6917 // Prim type sculpt.
6918 protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type, byte pathcurve)
6905 { 6919 {
6906 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); 6920 ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
6907 UUID sculptId; 6921 UUID sculptId;
@@ -6914,6 +6928,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6914 if (sculptId == UUID.Zero) 6928 if (sculptId == UUID.Zero)
6915 return; 6929 return;
6916 6930
6931 shapeBlock.PathCurve = pathcurve;
6917 shapeBlock.ObjectLocalID = part.LocalId; 6932 shapeBlock.ObjectLocalID = part.LocalId;
6918 shapeBlock.PathScaleX = 100; 6933 shapeBlock.PathScaleX = 100;
6919 shapeBlock.PathScaleY = 150; 6934 shapeBlock.PathScaleY = 150;
@@ -6927,9 +6942,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6927 type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; 6942 type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
6928 } 6943 }
6929 6944
6930 // retain pathcurve
6931 shapeBlock.PathCurve = part.Shape.PathCurve;
6932
6933 part.Shape.SetSculptProperties((byte)type, sculptId); 6945 part.Shape.SetSculptProperties((byte)type, sculptId);
6934 part.Shape.SculptEntry = true; 6946 part.Shape.SculptEntry = true;
6935 part.UpdateShape(shapeBlock); 6947 part.UpdateShape(shapeBlock);
@@ -7053,8 +7065,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7053 taper_b = rules.GetVector3Item(idx++); 7065 taper_b = rules.GetVector3Item(idx++);
7054 topshear = rules.GetVector3Item(idx++); 7066 topshear = rules.GetVector3Item(idx++);
7055 7067
7056 part.Shape.PathCurve = (byte)Extrusion.Straight; 7068 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
7057 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 1); 7069 (byte)ProfileShape.Square, (byte)Extrusion.Straight);
7058 break; 7070 break;
7059 7071
7060 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: 7072 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
@@ -7067,9 +7079,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7067 twist = rules.GetVector3Item(idx++); 7079 twist = rules.GetVector3Item(idx++);
7068 taper_b = rules.GetVector3Item(idx++); 7080 taper_b = rules.GetVector3Item(idx++);
7069 topshear = rules.GetVector3Item(idx++); 7081 topshear = rules.GetVector3Item(idx++);
7070 part.Shape.ProfileShape = ProfileShape.Circle; 7082 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
7071 part.Shape.PathCurve = (byte)Extrusion.Straight; 7083 (byte)ProfileShape.Circle, (byte)Extrusion.Straight);
7072 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 0);
7073 break; 7084 break;
7074 7085
7075 case (int)ScriptBaseClass.PRIM_TYPE_PRISM: 7086 case (int)ScriptBaseClass.PRIM_TYPE_PRISM:
@@ -7082,8 +7093,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7082 twist = rules.GetVector3Item(idx++); 7093 twist = rules.GetVector3Item(idx++);
7083 taper_b = rules.GetVector3Item(idx++); 7094 taper_b = rules.GetVector3Item(idx++);
7084 topshear = rules.GetVector3Item(idx++); 7095 topshear = rules.GetVector3Item(idx++);
7085 part.Shape.PathCurve = (byte)Extrusion.Straight; 7096 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
7086 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 3); 7097 (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight);
7087 break; 7098 break;
7088 7099
7089 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: 7100 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE:
@@ -7095,8 +7106,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7095 hollow = (float)rules.GetLSLFloatItem(idx++); 7106 hollow = (float)rules.GetLSLFloatItem(idx++);
7096 twist = rules.GetVector3Item(idx++); 7107 twist = rules.GetVector3Item(idx++);
7097 taper_b = rules.GetVector3Item(idx++); // dimple 7108 taper_b = rules.GetVector3Item(idx++); // dimple
7098 part.Shape.PathCurve = (byte)Extrusion.Curve1; 7109 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b,
7099 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, 5); 7110 (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1);
7100 break; 7111 break;
7101 7112
7102 case (int)ScriptBaseClass.PRIM_TYPE_TORUS: 7113 case (int)ScriptBaseClass.PRIM_TYPE_TORUS:
@@ -7114,9 +7125,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7114 revolutions = (float)rules.GetLSLFloatItem(idx++); 7125 revolutions = (float)rules.GetLSLFloatItem(idx++);
7115 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7126 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7116 skew = (float)rules.GetLSLFloatItem(idx++); 7127 skew = (float)rules.GetLSLFloatItem(idx++);
7117 part.Shape.PathCurve = (byte)Extrusion.Curve1;
7118 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7128 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7119 revolutions, radiusoffset, skew, 0); 7129 revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1);
7120 break; 7130 break;
7121 7131
7122 case (int)ScriptBaseClass.PRIM_TYPE_TUBE: 7132 case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
@@ -7134,9 +7144,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7134 revolutions = (float)rules.GetLSLFloatItem(idx++); 7144 revolutions = (float)rules.GetLSLFloatItem(idx++);
7135 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7145 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7136 skew = (float)rules.GetLSLFloatItem(idx++); 7146 skew = (float)rules.GetLSLFloatItem(idx++);
7137 part.Shape.PathCurve = (byte)Extrusion.Curve1;
7138 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7147 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7139 revolutions, radiusoffset, skew, 1); 7148 revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1);
7140 break; 7149 break;
7141 7150
7142 case (int)ScriptBaseClass.PRIM_TYPE_RING: 7151 case (int)ScriptBaseClass.PRIM_TYPE_RING:
@@ -7154,9 +7163,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7154 revolutions = (float)rules.GetLSLFloatItem(idx++); 7163 revolutions = (float)rules.GetLSLFloatItem(idx++);
7155 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 7164 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
7156 skew = (float)rules.GetLSLFloatItem(idx++); 7165 skew = (float)rules.GetLSLFloatItem(idx++);
7157 part.Shape.PathCurve = (byte)Extrusion.Curve1;
7158 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 7166 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
7159 revolutions, radiusoffset, skew, 3); 7167 revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1);
7160 break; 7168 break;
7161 7169
7162 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: 7170 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
@@ -7165,8 +7173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7165 7173
7166 string map = rules.Data[idx++].ToString(); 7174 string map = rules.Data[idx++].ToString();
7167 face = (int)rules.GetLSLIntegerItem(idx++); // type 7175 face = (int)rules.GetLSLIntegerItem(idx++); // type
7168 part.Shape.PathCurve = (byte)Extrusion.Curve1; 7176 SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1);
7169 SetPrimitiveShapeParams(part, map, face);
7170 break; 7177 break;
7171 } 7178 }
7172 7179
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
index 623c82d..8cd1e84 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
@@ -182,6 +182,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
182 Vector3.Zero) { Name = obj1Name, UUID = objUuid }; 182 Vector3.Zero) { Name = obj1Name, UUID = objUuid };
183 Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True); 183 Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True);
184 184
185 // Note that prim hollow check is passed with the other prim params in order to allow the
186 // specification of a different check value from the prim param. A cylinder, prism, sphere,
187 // torus or ring, with a hole shape of square, is limited to a hollow of 70%. Test 5 below
188 // specifies a value of 95% and checks to see if 70% was properly returned.
189
185 // Test a sphere. 190 // Test a sphere.
186 CheckllSetPrimitiveParams( 191 CheckllSetPrimitiveParams(
187 "test 1", // Prim test identification string 192 "test 1", // Prim test identification string
@@ -191,7 +196,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
191 new LSL_Types.Vector3(0.0d, 0.075d, 0.0d), // Prim cut 196 new LSL_Types.Vector3(0.0d, 0.075d, 0.0d), // Prim cut
192 0.80d, // Prim hollow 197 0.80d, // Prim hollow
193 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist 198 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist
194 new LSL_Types.Vector3(0.32d, 0.76d, 0.0d)); // Prim dimple 199 new LSL_Types.Vector3(0.32d, 0.76d, 0.0d), // Prim dimple
200 0.80d); // Prim hollow check
195 201
196 // Test a prism. 202 // Test a prism.
197 CheckllSetPrimitiveParams( 203 CheckllSetPrimitiveParams(
@@ -203,7 +209,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
203 0.90d, // Prim hollow 209 0.90d, // Prim hollow
204 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist 210 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist
205 new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper 211 new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper
206 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear 212 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear
213 0.90d); // Prim hollow check
207 214
208 // Test a box. 215 // Test a box.
209 CheckllSetPrimitiveParams( 216 CheckllSetPrimitiveParams(
@@ -212,10 +219,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
212 ScriptBaseClass.PRIM_TYPE_BOX, // Prim type 219 ScriptBaseClass.PRIM_TYPE_BOX, // Prim type
213 ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type 220 ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type
214 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut 221 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut
215 0.90d, // Prim hollow 222 0.95d, // Prim hollow
216 new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), // Prim twist 223 new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), // Prim twist
217 new LSL_Types.Vector3(1.0d, 1.0d, 0.0d), // Prim taper 224 new LSL_Types.Vector3(1.0d, 1.0d, 0.0d), // Prim taper
218 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear 225 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear
226 0.95d); // Prim hollow check
219 227
220 // Test a tube. 228 // Test a tube.
221 CheckllSetPrimitiveParams( 229 CheckllSetPrimitiveParams(
@@ -232,13 +240,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
232 new LSL_Types.Vector3(-1.0d, 1.0d, 0.0d), // Prim taper 240 new LSL_Types.Vector3(-1.0d, 1.0d, 0.0d), // Prim taper
233 1.0d, // Prim revolutions 241 1.0d, // Prim revolutions
234 1.0d, // Prim radius 242 1.0d, // Prim radius
235 0.0d); // Prim skew 243 0.0d, // Prim skew
244 0.00d); // Prim hollow check
245
246 // Test a prism.
247 CheckllSetPrimitiveParams(
248 "test 5", // Prim test identification string
249 new LSL_Types.Vector3(3.5d, 3.5d, 3.5d), // Prim size
250 ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type
251 ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type
252 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut
253 0.95d, // Prim hollow
254 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist
255 new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper
256 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear
257 0.70d); // Prim hollow check
258
259 // Test a sculpted prim.
260 CheckllSetPrimitiveParams(
261 "test 6", // Prim test identification string
262 new LSL_Types.Vector3(2.0d, 2.0d, 2.0d), // Prim size
263 ScriptBaseClass.PRIM_TYPE_SCULPT, // Prim type
264 "be293869-d0d9-0a69-5989-ad27f1946fd4", // Prim map
265 ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE); // Prim sculpt type
236 } 266 }
237 267
238 // Set prim params for a box, cylinder or prism and check results. 268 // Set prim params for a box, cylinder or prism and check results.
239 public void CheckllSetPrimitiveParams(string primTest, 269 public void CheckllSetPrimitiveParams(string primTest,
240 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, 270 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut,
241 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear) 271 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear,
272 double primHollowCheck)
242 { 273 {
243 // Set the prim params. 274 // Set the prim params.
244 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, 275 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
@@ -256,7 +287,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
256 Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), 287 Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2),
257 "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); 288 "TestllSetPrimitiveParams " + primTest + " prim hole default check fail");
258 CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); 289 CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut");
259 Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, 290 Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY,
260 "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); 291 "TestllSetPrimitiveParams " + primTest + " prim hollow check fail");
261 CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); 292 CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist");
262 CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 6), primTest + " prim taper"); 293 CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 6), primTest + " prim taper");
@@ -266,7 +297,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
266 // Set prim params for a sphere and check results. 297 // Set prim params for a sphere and check results.
267 public void CheckllSetPrimitiveParams(string primTest, 298 public void CheckllSetPrimitiveParams(string primTest,
268 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, 299 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut,
269 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple) 300 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple, double primHollowCheck)
270 { 301 {
271 // Set the prim params. 302 // Set the prim params.
272 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, 303 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
@@ -284,7 +315,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
284 Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), 315 Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2),
285 "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); 316 "TestllSetPrimitiveParams " + primTest + " prim hole default check fail");
286 CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); 317 CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut");
287 Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, 318 Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY,
288 "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); 319 "TestllSetPrimitiveParams " + primTest + " prim hollow check fail");
289 CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); 320 CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist");
290 CheckllSetPrimitiveParamsVector(primDimple, m_lslApi.llList2Vector(primParams, 6), primTest + " prim dimple"); 321 CheckllSetPrimitiveParamsVector(primDimple, m_lslApi.llList2Vector(primParams, 6), primTest + " prim dimple");
@@ -295,7 +326,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
295 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, 326 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut,
296 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize, 327 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize,
297 LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper, 328 LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper,
298 double primRev, double primRadius, double primSkew) 329 double primRev, double primRadius, double primSkew, double primHollowCheck)
299 { 330 {
300 // Set the prim params. 331 // Set the prim params.
301 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, 332 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
@@ -314,7 +345,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
314 Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), 345 Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2),
315 "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); 346 "TestllSetPrimitiveParams " + primTest + " prim hole default check fail");
316 CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); 347 CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut");
317 Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, 348 Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY,
318 "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); 349 "TestllSetPrimitiveParams " + primTest + " prim hollow check fail");
319 CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); 350 CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist");
320 CheckllSetPrimitiveParamsVector(primHoleSize, m_lslApi.llList2Vector(primParams, 6), primTest + " prim hole size"); 351 CheckllSetPrimitiveParamsVector(primHoleSize, m_lslApi.llList2Vector(primParams, 6), primTest + " prim hole size");
@@ -329,6 +360,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
329 "TestllSetPrimitiveParams " + primTest + " prim skew fail"); 360 "TestllSetPrimitiveParams " + primTest + " prim skew fail");
330 } 361 }
331 362
363 // Set prim params for a sculpted prim and check results.
364 public void CheckllSetPrimitiveParams(string primTest,
365 LSL_Types.Vector3 primSize, int primType, string primMap, int primSculptType)
366 {
367 // Set the prim params.
368 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
369 ScriptBaseClass.PRIM_TYPE, primType, primMap, primSculptType));
370
371 // Get params for prim to validate settings.
372 LSL_Types.list primParams =
373 m_lslApi.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE));
374
375 // Validate settings.
376 CheckllSetPrimitiveParamsVector(primSize, m_lslApi.llList2Vector(primParams, 0), primTest + " prim size");
377 Assert.AreEqual(primType, m_lslApi.llList2Integer(primParams, 1),
378 "TestllSetPrimitiveParams " + primTest + " prim type check fail");
379 Assert.AreEqual(primMap, (string)m_lslApi.llList2String(primParams, 2),
380 "TestllSetPrimitiveParams " + primTest + " prim map check fail");
381 Assert.AreEqual(primSculptType, m_lslApi.llList2Integer(primParams, 3),
382 "TestllSetPrimitiveParams " + primTest + " prim type scuplt check fail");
383 }
384
332 public void CheckllSetPrimitiveParamsVector(LSL_Types.Vector3 vecCheck, LSL_Types.Vector3 vecReturned, string msg) 385 public void CheckllSetPrimitiveParamsVector(LSL_Types.Vector3 vecCheck, LSL_Types.Vector3 vecReturned, string msg)
333 { 386 {
334 // Check each vector component against expected result. 387 // Check each vector component against expected result.