Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork

avinationmerge
ubit 2012-07-17 01:33:31 +02:00
commit 05cca8c694
2 changed files with 45 additions and 60 deletions

View File

@ -203,9 +203,9 @@ namespace OpenSim.Region.Physics.OdePlugin
private float waterlevel = 0f; private float waterlevel = 0f;
private int framecount = 0; private int framecount = 0;
private IntPtr WaterGeom = IntPtr.Zero; // private IntPtr WaterGeom = IntPtr.Zero;
private IntPtr WaterHeightmapData = IntPtr.Zero; // private IntPtr WaterHeightmapData = IntPtr.Zero;
private GCHandle WaterMapHandler = new GCHandle(); // private GCHandle WaterMapHandler = new GCHandle();
public float avPIDD = 2200f; // make it visible public float avPIDD = 2200f; // make it visible
public float avPIDP = 900f; // make it visible public float avPIDP = 900f; // make it visible
@ -2491,9 +2491,9 @@ namespace OpenSim.Region.Physics.OdePlugin
public override void SetWaterLevel(float baseheight) public override void SetWaterLevel(float baseheight)
{ {
waterlevel = baseheight; waterlevel = baseheight;
randomizeWater(waterlevel); // randomizeWater(waterlevel);
} }
/*
public void randomizeWater(float baseheight) public void randomizeWater(float baseheight)
{ {
const uint heightmapWidth = Constants.RegionSize + 2; const uint heightmapWidth = Constants.RegionSize + 2;
@ -2574,7 +2574,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
} }
*/
public override void Dispose() public override void Dispose()
{ {
lock (OdeLock) lock (OdeLock)
@ -2624,7 +2624,7 @@ namespace OpenSim.Region.Physics.OdePlugin
TerrainHeightFieldHeightsHandlers.Clear(); TerrainHeightFieldHeightsHandlers.Clear();
TerrainHeightFieldHeights.Clear(); TerrainHeightFieldHeights.Clear();
/*
if (WaterGeom != IntPtr.Zero) if (WaterGeom != IntPtr.Zero)
{ {
d.GeomDestroy(WaterGeom); d.GeomDestroy(WaterGeom);
@ -2636,7 +2636,7 @@ namespace OpenSim.Region.Physics.OdePlugin
if (WaterMapHandler.IsAllocated) if (WaterMapHandler.IsAllocated)
WaterMapHandler.Free(); WaterMapHandler.Free();
} }
*/
if (ContactgeomsArray != IntPtr.Zero) if (ContactgeomsArray != IntPtr.Zero)
Marshal.FreeHGlobal(ContactgeomsArray); Marshal.FreeHGlobal(ContactgeomsArray);
if (GlobalContactsArray != IntPtr.Zero) if (GlobalContactsArray != IntPtr.Zero)

View File

@ -2469,9 +2469,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
public LSL_Rotation llGetLocalRot() public LSL_Rotation llGetLocalRot()
{
return GetPartLocalRot(m_host);
}
private LSL_Rotation GetPartLocalRot(SceneObjectPart part)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
Quaternion rot = m_host.RotationOffset; Quaternion rot = part.RotationOffset;
return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
} }
@ -8000,7 +8005,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset.
int idx = 0; int idx = 0;
SceneObjectPart sitpart = World.GetSceneObjectPart(av.ParentID); // betting this will be used
bool positionChanged = false; bool positionChanged = false;
Vector3 finalPos = Vector3.Zero; Vector3 finalPos = Vector3.Zero;
@ -8015,81 +8019,62 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
switch (code) switch (code)
{ {
// a avatar is a child
case (int)ScriptBaseClass.PRIM_POSITION: case (int)ScriptBaseClass.PRIM_POSITION:
case (int)ScriptBaseClass.PRIM_POS_LOCAL: case (int)ScriptBaseClass.PRIM_POS_LOCAL:
{ {
if (remain < 1) if (remain < 1)
return; return;
LSL_Vector v; LSL_Vector v;
v = rules.GetVector3Item(idx++); v = rules.GetVector3Item(idx++);
if (sitpart == null) SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
if (part == null)
break; break;
Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
if (sitpart != sitpart.ParentGroup.RootPart) if (part.LinkNum > 1)
{ {
pos -= sitpart.OffsetPosition; // remove sit part offset localRot = GetPartLocalRot(part);
Quaternion rot = sitpart.RotationOffset; localPos = GetPartLocalPos(part);
pos *= Quaternion.Conjugate(rot); // removed sit part rotation
} }
Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f * 2.0f);
pos += sitOffset;
finalPos = pos; v -= localPos;
positionChanged = true; v /= localRot;
LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f);
v = v + 2 * sitOffset;
av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
av.SendAvatarDataToAllAgents();
} }
break; break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
case (int)ScriptBaseClass.PRIM_ROTATION: case (int)ScriptBaseClass.PRIM_ROTATION:
{ {
if (remain < 1) if (remain < 1)
return; return;
if (sitpart == null) LSL_Rotation r;
r = rules.GetQuaternionItem(idx++);
SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
if (part == null)
break; break;
LSL_Rotation r = rules.GetQuaternionItem(idx++); LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested world rotation LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
SceneObjectGroup sitgrp = sitpart.ParentGroup; if (part.LinkNum > 1)
if (sitgrp != null) localRot = GetPartLocalRot(part);
{
// need to replicate SL bug
rot = sitgrp.RootPart.RotationOffset * rot;
if (sitgrp.RootPart != sitpart)
{
Quaternion srot = sitpart.RotationOffset;
rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation
}
av.Rotation = rot; r = r * llGetRootRotation() / localRot;
// av.SendAvatarDataToAllAgents(); av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
av.SendTerseUpdateToAllClients(); av.SendAvatarDataToAllAgents();
}
}
break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
{
if (remain < 1)
return;
if (sitpart == null)
break;
LSL_Rotation r = rules.GetQuaternionItem(idx++);
Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation
if (sitpart != sitpart.ParentGroup.RootPart)
{
Quaternion srot = sitpart.RotationOffset;
rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation
}
av.Rotation = rot;
// av.SendAvatarDataToAllAgents();
av.SendTerseUpdateToAllClients();
} }
break; break;