mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
Bring us up to date.
This commit is contained in:
@@ -7040,6 +7040,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve)
|
||||
{
|
||||
float tempFloat; // Use in float expressions below to avoid byte cast precision issues.
|
||||
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
|
||||
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
|
||||
return shapeBlock;
|
||||
@@ -7123,8 +7124,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
twist.y = 1.0f;
|
||||
}
|
||||
shapeBlock.PathTwistBegin = (sbyte)(100 * twist.x);
|
||||
shapeBlock.PathTwist = (sbyte)(100 * twist.y);
|
||||
// A fairly large precision error occurs for some calculations,
|
||||
// if a float or double is directly cast to a byte or sbyte
|
||||
// variable, in both .Net and Mono. In .Net, coding
|
||||
// "(sbyte)(float)(some expression)" corrects the precision
|
||||
// errors. But this does not work for Mono. This longer coding
|
||||
// form of creating a tempoary float variable from the
|
||||
// expression first, then casting that variable to a byte or
|
||||
// sbyte, works for both .Net and Mono. These types of
|
||||
// assignments occur in SetPrimtiveBlockShapeParams and
|
||||
// SetPrimitiveShapeParams in support of llSetPrimitiveParams.
|
||||
tempFloat = (float)(100.0d * twist.x);
|
||||
shapeBlock.PathTwistBegin = (sbyte)tempFloat;
|
||||
tempFloat = (float)(100.0d * twist.y);
|
||||
shapeBlock.PathTwist = (sbyte)tempFloat;
|
||||
|
||||
shapeBlock.ObjectLocalID = part.LocalId;
|
||||
|
||||
@@ -7138,6 +7151,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
|
||||
return;
|
||||
|
||||
float tempFloat; // Use in float expressions below to avoid byte cast precision issues.
|
||||
ObjectShapePacket.ObjectDataBlock shapeBlock;
|
||||
|
||||
shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
|
||||
@@ -7158,8 +7172,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
taper_b.y = 2f;
|
||||
}
|
||||
shapeBlock.PathScaleX = (byte)(100 * (2.0 - taper_b.x));
|
||||
shapeBlock.PathScaleY = (byte)(100 * (2.0 - taper_b.y));
|
||||
tempFloat = (float)(100.0d * (2.0d - taper_b.x));
|
||||
shapeBlock.PathScaleX = (byte)tempFloat;
|
||||
tempFloat = (float)(100.0d * (2.0d - taper_b.y));
|
||||
shapeBlock.PathScaleY = (byte)tempFloat;
|
||||
if (topshear.x < -0.5f)
|
||||
{
|
||||
topshear.x = -0.5f;
|
||||
@@ -7176,8 +7192,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
topshear.y = 0.5f;
|
||||
}
|
||||
shapeBlock.PathShearX = (byte)(100 * topshear.x);
|
||||
shapeBlock.PathShearY = (byte)(100 * topshear.y);
|
||||
tempFloat = (float)(100.0d * topshear.x);
|
||||
shapeBlock.PathShearX = (byte)tempFloat;
|
||||
tempFloat = (float)(100.0d * topshear.y);
|
||||
shapeBlock.PathShearY = (byte)tempFloat;
|
||||
|
||||
part.Shape.SculptEntry = false;
|
||||
part.UpdateShape(shapeBlock);
|
||||
@@ -7233,6 +7251,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
|
||||
return;
|
||||
|
||||
float tempFloat; // Use in float expressions below to avoid byte cast precision issues.
|
||||
ObjectShapePacket.ObjectDataBlock shapeBlock;
|
||||
|
||||
shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
|
||||
@@ -7257,8 +7276,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
holesize.y = 0.5f;
|
||||
}
|
||||
shapeBlock.PathScaleX = (byte)(100 * (2 - holesize.x));
|
||||
shapeBlock.PathScaleY = (byte)(100 * (2 - holesize.y));
|
||||
tempFloat = (float)(100.0d * (2.0d - holesize.x));
|
||||
shapeBlock.PathScaleX = (byte)tempFloat;
|
||||
tempFloat = (float)(100.0d * (2.0d - holesize.y));
|
||||
shapeBlock.PathScaleY = (byte)tempFloat;
|
||||
if (topshear.x < -0.5f)
|
||||
{
|
||||
topshear.x = -0.5f;
|
||||
@@ -7275,8 +7296,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
topshear.y = 0.5f;
|
||||
}
|
||||
shapeBlock.PathShearX = (byte)(100 * topshear.x);
|
||||
shapeBlock.PathShearY = (byte)(100 * topshear.y);
|
||||
tempFloat = (float)(100.0d * topshear.x);
|
||||
shapeBlock.PathShearX = (byte)tempFloat;
|
||||
tempFloat = (float)(100.0d * topshear.y);
|
||||
shapeBlock.PathShearY = (byte)tempFloat;
|
||||
if (profilecut.x < 0f)
|
||||
{
|
||||
profilecut.x = 0f;
|
||||
@@ -7320,8 +7343,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
taper_a.y = 1f;
|
||||
}
|
||||
shapeBlock.PathTaperX = (sbyte)(100 * taper_a.x);
|
||||
shapeBlock.PathTaperY = (sbyte)(100 * taper_a.y);
|
||||
tempFloat = (float)(100.0d * taper_a.x);
|
||||
shapeBlock.PathTaperX = (sbyte)tempFloat;
|
||||
tempFloat = (float)(100.0d * taper_a.y);
|
||||
shapeBlock.PathTaperY = (sbyte)tempFloat;
|
||||
if (revolutions < 1f)
|
||||
{
|
||||
revolutions = 1f;
|
||||
@@ -7330,7 +7355,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
revolutions = 4f;
|
||||
}
|
||||
shapeBlock.PathRevolutions = (byte)(66.666667 * (revolutions - 1.0));
|
||||
tempFloat = 66.66667f * (revolutions - 1.0f);
|
||||
shapeBlock.PathRevolutions = (byte)tempFloat;
|
||||
// limits on radiusoffset depend on revolutions and hole size (how?) seems like the maximum range is 0 to 1
|
||||
if (radiusoffset < 0f)
|
||||
{
|
||||
@@ -7340,7 +7366,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
radiusoffset = 1f;
|
||||
}
|
||||
shapeBlock.PathRadiusOffset = (sbyte)(100 * radiusoffset);
|
||||
tempFloat = 100.0f * radiusoffset;
|
||||
shapeBlock.PathRadiusOffset = (sbyte)tempFloat;
|
||||
if (skew < -0.95f)
|
||||
{
|
||||
skew = -0.95f;
|
||||
@@ -7349,7 +7376,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
skew = 0.95f;
|
||||
}
|
||||
shapeBlock.PathSkew = (sbyte)(100 * skew);
|
||||
tempFloat = 100.0f * skew;
|
||||
shapeBlock.PathSkew = (sbyte)tempFloat;
|
||||
|
||||
part.Shape.SculptEntry = false;
|
||||
part.UpdateShape(shapeBlock);
|
||||
@@ -8268,10 +8296,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0));
|
||||
|
||||
// float revolutions
|
||||
res.Add(new LSL_Float((Shape.PathRevolutions * 0.015) + 1.0)); // Slightly inaccurate, because an unsigned
|
||||
// byte is being used to represent the entire
|
||||
// range of floating-point values from 1.0
|
||||
// through 4.0 (which is how SL does it).
|
||||
res.Add(new LSL_Float(Math.Round(Shape.PathRevolutions * 0.015d, 2, MidpointRounding.AwayFromZero)) + 1.0d);
|
||||
// Slightly inaccurate, because an unsigned byte is being used to represent
|
||||
// the entire range of floating-point values from 1.0 through 4.0 (which is how
|
||||
// SL does it).
|
||||
//
|
||||
// Using these formulas to store and retrieve PathRevolutions, it is not
|
||||
// possible to use all values between 1.00 and 4.00. For instance, you can't
|
||||
// represent 1.10. You can represent 1.09 and 1.11, but not 1.10. So, if you
|
||||
// use llSetPrimitiveParams to set revolutions to 1.10 and then retreive them
|
||||
// with llGetPrimitiveParams, you'll retrieve 1.09. You can also see a similar
|
||||
// behavior in the viewer as you cannot set 1.10. The viewer jumps to 1.11.
|
||||
// In SL, llSetPrimitveParams and llGetPrimitiveParams can set and get a value
|
||||
// such as 1.10. So, SL must store and retreive the actual user input rather
|
||||
// than only storing the encoded value.
|
||||
|
||||
// float radiusoffset
|
||||
res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0));
|
||||
|
||||
@@ -712,9 +712,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
== World.LandChannel.GetLandObject(
|
||||
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
|
||||
{
|
||||
World.RequestTeleportLocation(presence.ControllingClient, regionName,
|
||||
new Vector3((float)position.x, (float)position.y, (float)position.z),
|
||||
new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation);
|
||||
// We will launch the teleport on a new thread so that when the script threads are terminated
|
||||
// before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
|
||||
Util.FireAndForget(
|
||||
o => World.RequestTeleportLocation(presence.ControllingClient, regionName,
|
||||
new Vector3((float)position.x, (float)position.y, (float)position.z),
|
||||
new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation));
|
||||
|
||||
ScriptSleep(5000);
|
||||
}
|
||||
@@ -750,9 +753,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
== World.LandChannel.GetLandObject(
|
||||
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
|
||||
{
|
||||
World.RequestTeleportLocation(presence.ControllingClient, regionHandle,
|
||||
new Vector3((float)position.x, (float)position.y, (float)position.z),
|
||||
new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation);
|
||||
// We will launch the teleport on a new thread so that when the script threads are terminated
|
||||
// before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
|
||||
Util.FireAndForget(
|
||||
o => World.RequestTeleportLocation(presence.ControllingClient, regionHandle,
|
||||
new Vector3((float)position.x, (float)position.y, (float)position.z),
|
||||
new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation));
|
||||
|
||||
ScriptSleep(5000);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user