implemented

integration
SignpostMarv 2012-08-01 15:18:02 +01:00 committed by Justin Clark-Casey (justincc)
parent 74f5253a36
commit 466d684fbe
3 changed files with 64 additions and 0 deletions

View File

@ -4236,6 +4236,56 @@ namespace OpenSim.Region.Framework.Scenes
ScheduleFullUpdate();
}
public void UpdateSlice(float begin, float end)
{
if (end < begin)
{
float temp = begin;
begin = end;
end = temp;
}
end = Math.Min(1f, Math.Max(0f, end));
begin = Math.Min(Math.Min(1f, Math.Max(0f, begin)), end - 0.02f);
if (begin < 0.02f && end < 0.02f)
{
begin = 0f;
end = 0.02f;
}
ushort uBegin = (ushort)(50000.0 * begin);
ushort uEnd = (ushort)(50000.0 * (1f - end));
bool updatePossiblyNeeded = false;
if (GetPrimType() == PrimType.SPHERE)
{
if (m_shape.ProfileBegin != uBegin || m_shape.ProfileEnd != uEnd)
{
m_shape.ProfileBegin = uBegin;
m_shape.ProfileEnd = uEnd;
updatePossiblyNeeded = true;
}
}
else if (m_shape.PathBegin != uBegin || m_shape.PathEnd != uEnd)
{
m_shape.PathBegin = uBegin;
m_shape.PathEnd = uEnd;
updatePossiblyNeeded = true;
}
if (updatePossiblyNeeded && ParentGroup != null)
{
ParentGroup.HasGroupChanged = true;
}
if (updatePossiblyNeeded && PhysActor != null)
{
PhysActor.Shape = m_shape;
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
}
if (updatePossiblyNeeded)
{
ScheduleFullUpdate();
}
}
/// <summary>
/// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics
/// engine can use it.

View File

@ -7666,6 +7666,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Float gain = rules.GetLSLFloatItem(idx++);
TargetOmega(part, axis, (double)spinrate, (double)gain);
break;
case (int)ScriptBaseClass.PRIM_SLICE:
if (remain < 1)
return;
LSL_Vector slice = rules.GetVector3Item(idx++);
part.UpdateSlice((float)slice.x, (float)slice.y);
break;
case (int)ScriptBaseClass.PRIM_LINK_TARGET:
if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
return null;
@ -8340,6 +8346,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.PRIM_POS_LOCAL:
res.Add(new LSL_Vector(GetPartLocalPos(part)));
break;
case (int)ScriptBaseClass.PRIM_SLICE:
res.Add(new LSL_Vector(
(part.GetPrimType() == PrimType.SPHERE ? part.Shape.ProfileBegin : part.Shape.PathBegin) / 50000.0,
1 - (part.GetPrimType() == PrimType.SPHERE ? part.Shape.ProfileEnd : part.Shape.PathEnd) / 50000.0,
0
));
break;
}
}
return res;

View File

@ -328,6 +328,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int PRIM_OMEGA = 32;
public const int PRIM_POS_LOCAL = 33;
public const int PRIM_LINK_TARGET = 34;
public const int PRIM_SLICE = 35;
public const int PRIM_TEXGEN_DEFAULT = 0;
public const int PRIM_TEXGEN_PLANAR = 1;