initial steps to support physical phantoms

avinationmerge
UbitUmarov 2012-03-11 06:32:06 +00:00
parent b0f01cec98
commit 21a76a619f
6 changed files with 73 additions and 13 deletions

View File

@ -131,6 +131,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public bool m_disabled;
public bool m_taintadd;
public bool m_taintselected;
public bool m_taintphantom;
public bool m_taintCollidesWater;
public uint m_localID;
@ -161,6 +162,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private bool iscolliding;
private bool m_isphysical;
private bool m_isphantom;
private bool m_isSelected;
private bool m_NoColide; // for now only for internal use for bad meshs
@ -311,8 +313,9 @@ namespace OpenSim.Region.Physics.OdePlugin
m_taintvehicledata = vdata;
_parent_scene.AddPhysicsActorTaint(this);
}
public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode, uint localid)
Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom, CollisionLocker dode, uint localid)
{
m_localID = localid;
ode = dode;
@ -373,6 +376,9 @@ namespace OpenSim.Region.Physics.OdePlugin
m_targetSpace = _parent_scene.space;
}
m_isphantom = pisPhantom;
m_taintphantom = pisPhantom;
_triMeshData = IntPtr.Zero;
m_NoColide = false;

View File

@ -1730,7 +1730,7 @@ namespace OpenSim.Region.Physics.OdePlugin
OdePrim newPrim;
lock (OdeLock)
{
newPrim = new OdePrim(name, this, pos, siz, rot, mesh, pbs, isphysical, ode, localid);
newPrim = new OdePrim(name, this, pos, siz, rot, mesh, pbs, isphysical,false, ode, localid);
lock (_prims)
_prims.Add(newPrim);
@ -1738,23 +1738,27 @@ namespace OpenSim.Region.Physics.OdePlugin
return newPrim;
}
/*
private PhysicsActor AddPrim(String name, Vector3 position, PhysicsActor parent,
PrimitiveBaseShape pbs, uint localid, byte[] sdata)
private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
IMesh mesh, PrimitiveBaseShape pbs, bool isphysical, bool isphantom, uint localid)
{
Vector3 pos = position;
Vector3 siz = size;
Quaternion rot = rotation;
OdePrim newPrim;
lock (OdeLock)
{
newPrim = new OdePrim(name, this, pos, parent, pbs, ode, localid, sdata);
newPrim = new OdePrim(name, this, pos, siz, rot, mesh, pbs, isphysical, isphantom, ode, localid);
lock (_prims)
_prims.Add(newPrim);
}
return newPrim;
}
*/
public void addActivePrim(OdePrim activatePrim)
{
@ -1781,6 +1785,23 @@ namespace OpenSim.Region.Physics.OdePlugin
return result;
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, uint localid)
{
PhysicsActor result;
IMesh mesh = null;
if (needsMeshing(pbs))
mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true);
result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, isPhantom, localid);
return result;
}
/*
public override PhysicsActor AddPrimShape(string primName, PhysicsActor parent, PrimitiveBaseShape pbs, Vector3 position,
uint localid, byte[] sdata)

View File

@ -170,6 +170,8 @@ namespace OpenSim.Region.Physics.Manager
public abstract Vector3 Size { get; set; }
public bool Phantom { get; set; }
public abstract PrimitiveBaseShape Shape { set; }
uint m_baseLocalID;

View File

@ -122,9 +122,6 @@ namespace OpenSim.Region.Physics.Manager
/// <param name="prim"></param>
public abstract void RemovePrim(PhysicsActor prim);
//public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
// Vector3 size, Quaternion rotation); //To be removed - Actually removed!
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical, uint localid);
@ -134,6 +131,12 @@ namespace OpenSim.Region.Physics.Manager
return null;
}
public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid);
}
public virtual float TimeDilation
{
get { return 1.0f; }

View File

@ -65,6 +65,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_isphysical;
private bool m_isPhantom;
private bool m_fakeisphysical;
protected bool m_building;
@ -831,9 +832,10 @@ namespace OpenSim.Region.Physics.OdePlugin
public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,uint plocalID)
{
Name = primName;
LocalID = plocalID;
m_vehicle = null;
@ -908,6 +910,8 @@ namespace OpenSim.Region.Physics.OdePlugin
m_isSelected = false;
m_delaySelect = false;
m_isPhantom = pisPhantom;
mu = parent_scene.m_materialContactsData[(int)Material.Wood].mu;
bounce = parent_scene.m_materialContactsData[(int)Material.Wood].bounce;

View File

@ -1140,12 +1140,29 @@ namespace OpenSim.Region.Physics.OdePlugin
OdePrim newPrim;
lock (OdeLock)
{
newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical);
newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical,false,localID);
lock (_prims)
_prims.Add(newPrim);
}
return newPrim;
}
private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
PrimitiveBaseShape pbs, bool isphysical, bool isPhantom, uint localID)
{
Vector3 pos = position;
Vector3 siz = size;
Quaternion rot = rotation;
OdePrim newPrim;
lock (OdeLock)
{
newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical,isPhantom,localID);
lock (_prims)
_prims.Add(newPrim);
}
newPrim.LocalID = localID;
return newPrim;
}
@ -1168,6 +1185,13 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, uint localid)
{
return AddPrim(primName, position, size, rotation, pbs, isPhysical, isPhantom, localid);
}
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
{