diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
3 files changed, 103 insertions, 50 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6f34168..18c0dd2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -7040,6 +7040,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7040 | 7040 | ||
7041 | protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve) | 7041 | protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve) |
7042 | { | 7042 | { |
7043 | float tempFloat; // Use in float expressions below to avoid byte cast precision issues. | ||
7043 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); | 7044 | ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); |
7044 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | 7045 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) |
7045 | return shapeBlock; | 7046 | return shapeBlock; |
@@ -7123,8 +7124,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7123 | { | 7124 | { |
7124 | twist.y = 1.0f; | 7125 | twist.y = 1.0f; |
7125 | } | 7126 | } |
7126 | shapeBlock.PathTwistBegin = (sbyte)(100 * twist.x); | 7127 | // A fairly large precision error occurs for some calculations, |
7127 | shapeBlock.PathTwist = (sbyte)(100 * twist.y); | 7128 | // if a float or double is directly cast to a byte or sbyte |
7129 | // variable, in both .Net and Mono. In .Net, coding | ||
7130 | // "(sbyte)(float)(some expression)" corrects the precision | ||
7131 | // errors. But this does not work for Mono. This longer coding | ||
7132 | // form of creating a tempoary float variable from the | ||
7133 | // expression first, then casting that variable to a byte or | ||
7134 | // sbyte, works for both .Net and Mono. These types of | ||
7135 | // assignments occur in SetPrimtiveBlockShapeParams and | ||
7136 | // SetPrimitiveShapeParams in support of llSetPrimitiveParams. | ||
7137 | tempFloat = (float)(100.0d * twist.x); | ||
7138 | shapeBlock.PathTwistBegin = (sbyte)tempFloat; | ||
7139 | tempFloat = (float)(100.0d * twist.y); | ||
7140 | shapeBlock.PathTwist = (sbyte)tempFloat; | ||
7128 | 7141 | ||
7129 | shapeBlock.ObjectLocalID = part.LocalId; | 7142 | shapeBlock.ObjectLocalID = part.LocalId; |
7130 | 7143 | ||
@@ -7138,6 +7151,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7138 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | 7151 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) |
7139 | return; | 7152 | return; |
7140 | 7153 | ||
7154 | float tempFloat; // Use in float expressions below to avoid byte cast precision issues. | ||
7141 | ObjectShapePacket.ObjectDataBlock shapeBlock; | 7155 | ObjectShapePacket.ObjectDataBlock shapeBlock; |
7142 | 7156 | ||
7143 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve); | 7157 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve); |
@@ -7158,8 +7172,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7158 | { | 7172 | { |
7159 | taper_b.y = 2f; | 7173 | taper_b.y = 2f; |
7160 | } | 7174 | } |
7161 | shapeBlock.PathScaleX = (byte)(100 * (2.0 - taper_b.x)); | 7175 | tempFloat = (float)(100.0d * (2.0d - taper_b.x)); |
7162 | shapeBlock.PathScaleY = (byte)(100 * (2.0 - taper_b.y)); | 7176 | shapeBlock.PathScaleX = (byte)tempFloat; |
7177 | tempFloat = (float)(100.0d * (2.0d - taper_b.y)); | ||
7178 | shapeBlock.PathScaleY = (byte)tempFloat; | ||
7163 | if (topshear.x < -0.5f) | 7179 | if (topshear.x < -0.5f) |
7164 | { | 7180 | { |
7165 | topshear.x = -0.5f; | 7181 | topshear.x = -0.5f; |
@@ -7176,8 +7192,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7176 | { | 7192 | { |
7177 | topshear.y = 0.5f; | 7193 | topshear.y = 0.5f; |
7178 | } | 7194 | } |
7179 | shapeBlock.PathShearX = (byte)(100 * topshear.x); | 7195 | tempFloat = (float)(100.0d * topshear.x); |
7180 | shapeBlock.PathShearY = (byte)(100 * topshear.y); | 7196 | shapeBlock.PathShearX = (byte)tempFloat; |
7197 | tempFloat = (float)(100.0d * topshear.y); | ||
7198 | shapeBlock.PathShearY = (byte)tempFloat; | ||
7181 | 7199 | ||
7182 | part.Shape.SculptEntry = false; | 7200 | part.Shape.SculptEntry = false; |
7183 | part.UpdateShape(shapeBlock); | 7201 | part.UpdateShape(shapeBlock); |
@@ -7233,6 +7251,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7233 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | 7251 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) |
7234 | return; | 7252 | return; |
7235 | 7253 | ||
7254 | float tempFloat; // Use in float expressions below to avoid byte cast precision issues. | ||
7236 | ObjectShapePacket.ObjectDataBlock shapeBlock; | 7255 | ObjectShapePacket.ObjectDataBlock shapeBlock; |
7237 | 7256 | ||
7238 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve); | 7257 | shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve); |
@@ -7257,8 +7276,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7257 | { | 7276 | { |
7258 | holesize.y = 0.5f; | 7277 | holesize.y = 0.5f; |
7259 | } | 7278 | } |
7260 | shapeBlock.PathScaleX = (byte)(100 * (2 - holesize.x)); | 7279 | tempFloat = (float)(100.0d * (2.0d - holesize.x)); |
7261 | shapeBlock.PathScaleY = (byte)(100 * (2 - holesize.y)); | 7280 | shapeBlock.PathScaleX = (byte)tempFloat; |
7281 | tempFloat = (float)(100.0d * (2.0d - holesize.y)); | ||
7282 | shapeBlock.PathScaleY = (byte)tempFloat; | ||
7262 | if (topshear.x < -0.5f) | 7283 | if (topshear.x < -0.5f) |
7263 | { | 7284 | { |
7264 | topshear.x = -0.5f; | 7285 | topshear.x = -0.5f; |
@@ -7275,8 +7296,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7275 | { | 7296 | { |
7276 | topshear.y = 0.5f; | 7297 | topshear.y = 0.5f; |
7277 | } | 7298 | } |
7278 | shapeBlock.PathShearX = (byte)(100 * topshear.x); | 7299 | tempFloat = (float)(100.0d * topshear.x); |
7279 | shapeBlock.PathShearY = (byte)(100 * topshear.y); | 7300 | shapeBlock.PathShearX = (byte)tempFloat; |
7301 | tempFloat = (float)(100.0d * topshear.y); | ||
7302 | shapeBlock.PathShearY = (byte)tempFloat; | ||
7280 | if (profilecut.x < 0f) | 7303 | if (profilecut.x < 0f) |
7281 | { | 7304 | { |
7282 | profilecut.x = 0f; | 7305 | profilecut.x = 0f; |
@@ -7320,8 +7343,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7320 | { | 7343 | { |
7321 | taper_a.y = 1f; | 7344 | taper_a.y = 1f; |
7322 | } | 7345 | } |
7323 | shapeBlock.PathTaperX = (sbyte)(100 * taper_a.x); | 7346 | tempFloat = (float)(100.0d * taper_a.x); |
7324 | shapeBlock.PathTaperY = (sbyte)(100 * taper_a.y); | 7347 | shapeBlock.PathTaperX = (sbyte)tempFloat; |
7348 | tempFloat = (float)(100.0d * taper_a.y); | ||
7349 | shapeBlock.PathTaperY = (sbyte)tempFloat; | ||
7325 | if (revolutions < 1f) | 7350 | if (revolutions < 1f) |
7326 | { | 7351 | { |
7327 | revolutions = 1f; | 7352 | revolutions = 1f; |
@@ -7330,7 +7355,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7330 | { | 7355 | { |
7331 | revolutions = 4f; | 7356 | revolutions = 4f; |
7332 | } | 7357 | } |
7333 | shapeBlock.PathRevolutions = (byte)(66.666667 * (revolutions - 1.0)); | 7358 | tempFloat = 66.66667f * (revolutions - 1.0f); |
7359 | shapeBlock.PathRevolutions = (byte)tempFloat; | ||
7334 | // limits on radiusoffset depend on revolutions and hole size (how?) seems like the maximum range is 0 to 1 | 7360 | // limits on radiusoffset depend on revolutions and hole size (how?) seems like the maximum range is 0 to 1 |
7335 | if (radiusoffset < 0f) | 7361 | if (radiusoffset < 0f) |
7336 | { | 7362 | { |
@@ -7340,7 +7366,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7340 | { | 7366 | { |
7341 | radiusoffset = 1f; | 7367 | radiusoffset = 1f; |
7342 | } | 7368 | } |
7343 | shapeBlock.PathRadiusOffset = (sbyte)(100 * radiusoffset); | 7369 | tempFloat = 100.0f * radiusoffset; |
7370 | shapeBlock.PathRadiusOffset = (sbyte)tempFloat; | ||
7344 | if (skew < -0.95f) | 7371 | if (skew < -0.95f) |
7345 | { | 7372 | { |
7346 | skew = -0.95f; | 7373 | skew = -0.95f; |
@@ -7349,7 +7376,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7349 | { | 7376 | { |
7350 | skew = 0.95f; | 7377 | skew = 0.95f; |
7351 | } | 7378 | } |
7352 | shapeBlock.PathSkew = (sbyte)(100 * skew); | 7379 | tempFloat = 100.0f * skew; |
7380 | shapeBlock.PathSkew = (sbyte)tempFloat; | ||
7353 | 7381 | ||
7354 | part.Shape.SculptEntry = false; | 7382 | part.Shape.SculptEntry = false; |
7355 | part.UpdateShape(shapeBlock); | 7383 | part.UpdateShape(shapeBlock); |
@@ -8268,10 +8296,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8268 | res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); | 8296 | res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); |
8269 | 8297 | ||
8270 | // float revolutions | 8298 | // float revolutions |
8271 | res.Add(new LSL_Float((Shape.PathRevolutions * 0.015) + 1.0)); // Slightly inaccurate, because an unsigned | 8299 | res.Add(new LSL_Float(Math.Round(Shape.PathRevolutions * 0.015d, 2, MidpointRounding.AwayFromZero)) + 1.0d); |
8272 | // byte is being used to represent the entire | 8300 | // Slightly inaccurate, because an unsigned byte is being used to represent |
8273 | // range of floating-point values from 1.0 | 8301 | // the entire range of floating-point values from 1.0 through 4.0 (which is how |
8274 | // through 4.0 (which is how SL does it). | 8302 | // SL does it). |
8303 | // | ||
8304 | // Using these formulas to store and retrieve PathRevolutions, it is not | ||
8305 | // possible to use all values between 1.00 and 4.00. For instance, you can't | ||
8306 | // represent 1.10. You can represent 1.09 and 1.11, but not 1.10. So, if you | ||
8307 | // use llSetPrimitiveParams to set revolutions to 1.10 and then retreive them | ||
8308 | // with llGetPrimitiveParams, you'll retrieve 1.09. You can also see a similar | ||
8309 | // behavior in the viewer as you cannot set 1.10. The viewer jumps to 1.11. | ||
8310 | // In SL, llSetPrimitveParams and llGetPrimitiveParams can set and get a value | ||
8311 | // such as 1.10. So, SL must store and retreive the actual user input rather | ||
8312 | // than only storing the encoded value. | ||
8275 | 8313 | ||
8276 | // float radiusoffset | 8314 | // float radiusoffset |
8277 | res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0)); | 8315 | res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0)); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 0c1da47..8f450f8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -712,9 +712,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
712 | == World.LandChannel.GetLandObject( | 712 | == World.LandChannel.GetLandObject( |
713 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 713 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) |
714 | { | 714 | { |
715 | World.RequestTeleportLocation(presence.ControllingClient, regionName, | 715 | // We will launch the teleport on a new thread so that when the script threads are terminated |
716 | new Vector3((float)position.x, (float)position.y, (float)position.z), | 716 | // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. |
717 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); | 717 | Util.FireAndForget( |
718 | o => World.RequestTeleportLocation(presence.ControllingClient, regionName, | ||
719 | new Vector3((float)position.x, (float)position.y, (float)position.z), | ||
720 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation)); | ||
718 | 721 | ||
719 | ScriptSleep(5000); | 722 | ScriptSleep(5000); |
720 | } | 723 | } |
@@ -750,9 +753,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
750 | == World.LandChannel.GetLandObject( | 753 | == World.LandChannel.GetLandObject( |
751 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 754 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) |
752 | { | 755 | { |
753 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, | 756 | // We will launch the teleport on a new thread so that when the script threads are terminated |
754 | new Vector3((float)position.x, (float)position.y, (float)position.z), | 757 | // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. |
755 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); | 758 | Util.FireAndForget( |
759 | o => World.RequestTeleportLocation(presence.ControllingClient, regionHandle, | ||
760 | new Vector3((float)position.x, (float)position.y, (float)position.z), | ||
761 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation)); | ||
762 | |||
756 | ScriptSleep(5000); | 763 | ScriptSleep(5000); |
757 | } | 764 | } |
758 | } | 765 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 8cd1e84..0cbad41 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | |||
@@ -49,7 +49,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
49 | 49 | ||
50 | private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; | 50 | private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; |
51 | private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d; | 51 | private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d; |
52 | private const double FLOAT_ACCURACY = 0.00005d; | 52 | private const float FLOAT_ACCURACY = 0.00005f; |
53 | private LSL_Api m_lslApi; | 53 | private LSL_Api m_lslApi; |
54 | 54 | ||
55 | [SetUp] | 55 | [SetUp] |
@@ -194,10 +194,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
194 | ScriptBaseClass.PRIM_TYPE_SPHERE, // Prim type | 194 | ScriptBaseClass.PRIM_TYPE_SPHERE, // Prim type |
195 | ScriptBaseClass.PRIM_HOLE_DEFAULT, // Prim hole type | 195 | ScriptBaseClass.PRIM_HOLE_DEFAULT, // Prim hole type |
196 | 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 |
197 | 0.80d, // Prim hollow | 197 | 0.80f, // Prim hollow |
198 | 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 |
199 | 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 | 200 | 0.80f); // Prim hollow check |
201 | 201 | ||
202 | // Test a prism. | 202 | // Test a prism. |
203 | CheckllSetPrimitiveParams( | 203 | CheckllSetPrimitiveParams( |
@@ -206,11 +206,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
206 | ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type | 206 | ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type |
207 | ScriptBaseClass.PRIM_HOLE_CIRCLE, // Prim hole type | 207 | ScriptBaseClass.PRIM_HOLE_CIRCLE, // Prim hole type |
208 | new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut | 208 | new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut |
209 | 0.90d, // Prim hollow | 209 | 0.90f, // Prim hollow |
210 | 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 |
211 | 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 |
212 | 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 | 213 | 0.90f); // Prim hollow check |
214 | 214 | ||
215 | // Test a box. | 215 | // Test a box. |
216 | CheckllSetPrimitiveParams( | 216 | CheckllSetPrimitiveParams( |
@@ -219,11 +219,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
219 | ScriptBaseClass.PRIM_TYPE_BOX, // Prim type | 219 | ScriptBaseClass.PRIM_TYPE_BOX, // Prim type |
220 | ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type | 220 | ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type |
221 | 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 |
222 | 0.95d, // Prim hollow | 222 | 0.95f, // Prim hollow |
223 | 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 |
224 | 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 |
225 | 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 | 226 | 0.95f); // Prim hollow check |
227 | 227 | ||
228 | // Test a tube. | 228 | // Test a tube. |
229 | CheckllSetPrimitiveParams( | 229 | CheckllSetPrimitiveParams( |
@@ -232,16 +232,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
232 | ScriptBaseClass.PRIM_TYPE_TUBE, // Prim type | 232 | ScriptBaseClass.PRIM_TYPE_TUBE, // Prim type |
233 | ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type | 233 | ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type |
234 | new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut | 234 | new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut |
235 | 0.00d, // Prim hollow | 235 | 0.00f, // Prim hollow |
236 | new LSL_Types.Vector3(1.0d, -1.0d, 0.0d), // Prim twist | 236 | new LSL_Types.Vector3(1.0d, -1.0d, 0.0d), // Prim twist |
237 | new LSL_Types.Vector3(1.0d, 0.5d, 0.0d), // Prim hole size | 237 | new LSL_Types.Vector3(1.0d, 0.05d, 0.0d), // Prim hole size |
238 | new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear | 238 | // Expression for y selected to test precision problems during byte |
239 | // cast in SetPrimitiveShapeParams. | ||
240 | new LSL_Types.Vector3(0.0d, 0.35d + 0.1d, 0.0d), // Prim shear | ||
239 | new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim profile cut | 241 | new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim profile cut |
240 | new LSL_Types.Vector3(-1.0d, 1.0d, 0.0d), // Prim taper | 242 | // Expression for y selected to test precision problems during sbyte |
241 | 1.0d, // Prim revolutions | 243 | // cast in SetPrimitiveShapeParams. |
242 | 1.0d, // Prim radius | 244 | new LSL_Types.Vector3(-1.0d, 0.70d + 0.1d + 0.1d, 0.0d), // Prim taper |
243 | 0.0d, // Prim skew | 245 | 1.11f, // Prim revolutions |
244 | 0.00d); // Prim hollow check | 246 | 0.88f, // Prim radius |
247 | 0.95f, // Prim skew | ||
248 | 0.00f); // Prim hollow check | ||
245 | 249 | ||
246 | // Test a prism. | 250 | // Test a prism. |
247 | CheckllSetPrimitiveParams( | 251 | CheckllSetPrimitiveParams( |
@@ -250,11 +254,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
250 | ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type | 254 | ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type |
251 | ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type | 255 | ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type |
252 | new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut | 256 | new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut |
253 | 0.95d, // Prim hollow | 257 | 0.95f, // Prim hollow |
254 | new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist | 258 | // Expression for x selected to test precision problems during sbyte |
255 | new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper | 259 | // cast in SetPrimitiveShapeBlockParams. |
260 | new LSL_Types.Vector3(0.7d + 0.2d, 0.0d, 0.0d), // Prim twist | ||
261 | // Expression for y selected to test precision problems during sbyte | ||
262 | // cast in SetPrimitiveShapeParams. | ||
263 | new LSL_Types.Vector3(2.0d, (1.3d + 0.1d), 0.0d), // Prim taper | ||
256 | new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear | 264 | new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear |
257 | 0.70d); // Prim hollow check | 265 | 0.70f); // Prim hollow check |
258 | 266 | ||
259 | // Test a sculpted prim. | 267 | // Test a sculpted prim. |
260 | CheckllSetPrimitiveParams( | 268 | CheckllSetPrimitiveParams( |
@@ -268,8 +276,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
268 | // Set prim params for a box, cylinder or prism and check results. | 276 | // Set prim params for a box, cylinder or prism and check results. |
269 | public void CheckllSetPrimitiveParams(string primTest, | 277 | public void CheckllSetPrimitiveParams(string primTest, |
270 | LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, | 278 | LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, |
271 | double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear, | 279 | float primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear, |
272 | double primHollowCheck) | 280 | float primHollowCheck) |
273 | { | 281 | { |
274 | // Set the prim params. | 282 | // Set the prim params. |
275 | m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, | 283 | m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, |
@@ -297,7 +305,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
297 | // Set prim params for a sphere and check results. | 305 | // Set prim params for a sphere and check results. |
298 | public void CheckllSetPrimitiveParams(string primTest, | 306 | public void CheckllSetPrimitiveParams(string primTest, |
299 | LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, | 307 | LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, |
300 | double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple, double primHollowCheck) | 308 | float primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple, float primHollowCheck) |
301 | { | 309 | { |
302 | // Set the prim params. | 310 | // Set the prim params. |
303 | m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, | 311 | m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, |
@@ -324,9 +332,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
324 | // Set prim params for a torus, tube or ring and check results. | 332 | // Set prim params for a torus, tube or ring and check results. |
325 | public void CheckllSetPrimitiveParams(string primTest, | 333 | public void CheckllSetPrimitiveParams(string primTest, |
326 | LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, | 334 | LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, |
327 | double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize, | 335 | float primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize, |
328 | LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper, | 336 | LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper, |
329 | double primRev, double primRadius, double primSkew, double primHollowCheck) | 337 | float primRev, float primRadius, float primSkew, float primHollowCheck) |
330 | { | 338 | { |
331 | // Set the prim params. | 339 | // Set the prim params. |
332 | m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, | 340 | m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, |
@@ -353,7 +361,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
353 | CheckllSetPrimitiveParamsVector(primProfCut, m_lslApi.llList2Vector(primParams, 8), primTest + " prim profile cut"); | 361 | CheckllSetPrimitiveParamsVector(primProfCut, m_lslApi.llList2Vector(primParams, 8), primTest + " prim profile cut"); |
354 | CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 9), primTest + " prim taper"); | 362 | CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 9), primTest + " prim taper"); |
355 | Assert.AreEqual(primRev, m_lslApi.llList2Float(primParams, 10), FLOAT_ACCURACY, | 363 | Assert.AreEqual(primRev, m_lslApi.llList2Float(primParams, 10), FLOAT_ACCURACY, |
356 | "TestllSetPrimitiveParams " + primTest + " prim revolution fail"); | 364 | "TestllSetPrimitiveParams " + primTest + " prim revolutions fail"); |
357 | Assert.AreEqual(primRadius, m_lslApi.llList2Float(primParams, 11), FLOAT_ACCURACY, | 365 | Assert.AreEqual(primRadius, m_lslApi.llList2Float(primParams, 11), FLOAT_ACCURACY, |
358 | "TestllSetPrimitiveParams " + primTest + " prim radius fail"); | 366 | "TestllSetPrimitiveParams " + primTest + " prim radius fail"); |
359 | Assert.AreEqual(primSkew, m_lslApi.llList2Float(primParams, 12), FLOAT_ACCURACY, | 367 | Assert.AreEqual(primSkew, m_lslApi.llList2Float(primParams, 12), FLOAT_ACCURACY, |