Remove old physics sync code. Attempt to fake ScenePresence in physics bucket sync
parent
c9c94a5f23
commit
a25eac0a40
|
@ -364,12 +364,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
|
||||
public void QueueScenePresenceForTerseUpdate(ScenePresence presence)
|
||||
{
|
||||
/*
|
||||
lock (m_updateScenePresenceLock)
|
||||
{
|
||||
m_presenceUpdates[presence.UUID] = presence;
|
||||
}
|
||||
* */
|
||||
}
|
||||
|
||||
|
||||
|
@ -410,17 +408,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
List<ScenePresence> presenceUpdates = null;
|
||||
List<ScenePresence> presenceUpdates = new List<ScenePresence>();
|
||||
if (m_presenceUpdates.Count > 0)
|
||||
{
|
||||
lock (m_updateScenePresenceLock)
|
||||
{
|
||||
updated = true;
|
||||
presenceUpdates = new List<ScenePresence>(m_presenceUpdates.Values);
|
||||
m_presenceUpdates.Clear();
|
||||
}
|
||||
}
|
||||
* */
|
||||
|
||||
if (updated)
|
||||
{
|
||||
|
@ -455,15 +452,26 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
m_primUpdatesPerBucketSender[bucketName](bucketName, primUpdates[bucketName]);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if(presenceUpdates!=null){
|
||||
foreach (ScenePresence presence in presenceUpdates)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!presence.IsDeleted)
|
||||
{
|
||||
|
||||
// Robert admits to doing this terrible kludge
|
||||
// Someday, ScenePresences will be properly handled but, for the moment,
|
||||
// we convert a ScenePresence update to a physics bucket transmission.
|
||||
SceneObjectPart sop = new SceneObjectPart(presence.UUID, new PrimitiveBaseShape(),
|
||||
Vector3.Zero, Quaternion.Identity, Vector3.Zero);
|
||||
sop.PhysActor = presence.PhysicsActor;
|
||||
sop.UUID = presence.UUID;
|
||||
sop.BucketSyncInfoList = new Dictionary<string, BucketSyncInfo>();
|
||||
sop.BucketSyncInfoList.Add("Physics", new BucketSyncInfo(DateTime.Now.Ticks, ActorID, "Physics"));
|
||||
List<SceneObjectPart> lsop = new List<SceneObjectPart>();
|
||||
lsop.Add(sop);
|
||||
PrimUpdatesPhysicsBucketSender("Physics", lsop);
|
||||
|
||||
/*
|
||||
OSDMap data = new OSDMap(10);
|
||||
data["id"] = OSD.FromUUID(presence.UUID);
|
||||
// Do not include offset for appearance height. That will be handled by RegionSyncClient before sending to viewers
|
||||
|
@ -490,16 +498,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
|
||||
RegionSyncMessage rsm = new RegionSyncMessage(RegionSyncMessage.MsgType.UpdatedAvatar, OSDParser.SerializeJsonString(data));
|
||||
m_server.EnqueuePresenceUpdate(presence.UUID, rsm.ToBytes());
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[REGION SYNC MODULE] Caught exception sending presence updates for {0}: {1}", presence.Name, e.Message);
|
||||
m_log.ErrorFormat("[REGION SYNC MODULE] Caught exception sending presence updates for {0}: {1}", presence.Name, e);
|
||||
}
|
||||
}}
|
||||
* */
|
||||
}
|
||||
|
||||
// Indicate that the current batch of updates has been completed
|
||||
Interlocked.Exchange(ref m_sendingUpdates, 0);
|
||||
|
|
|
@ -496,40 +496,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//RA: Physics Engine
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
protected IPhysEngineToSceneConnectorModule m_physEngineToSceneConnectorModule = null;
|
||||
public IPhysEngineToSceneConnectorModule PhysEngineToSceneConnectorModule
|
||||
{
|
||||
get { return m_physEngineToSceneConnectorModule; }
|
||||
set { m_physEngineToSceneConnectorModule = value; }
|
||||
}
|
||||
|
||||
protected ISceneToPhysEngineServer m_sceneToPhysEngineSyncServer = null;
|
||||
public ISceneToPhysEngineServer SceneToPhysEngineSyncServer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_sceneToPhysEngineSyncServer == null)
|
||||
{
|
||||
// kludge since this module is loaded in postInitialize
|
||||
m_sceneToPhysEngineSyncServer = RequestModuleInterface<ISceneToPhysEngineServer>();
|
||||
}
|
||||
return m_sceneToPhysEngineSyncServer;
|
||||
}
|
||||
set { m_sceneToPhysEngineSyncServer = value; }
|
||||
}
|
||||
|
||||
// depending on what mode we're in, the different modules are available
|
||||
protected bool IsPhysEngineActor()
|
||||
{
|
||||
if (PhysEngineToSceneConnectorModule != null)
|
||||
{
|
||||
return this.PhysEngineToSceneConnectorModule.IsPhysEngineActor();
|
||||
}
|
||||
if (SceneToPhysEngineSyncServer != null)
|
||||
{
|
||||
return this.SceneToPhysEngineSyncServer.IsPhysEngineActor();
|
||||
}
|
||||
return false;
|
||||
// turns out every actor needs the physics engine.
|
||||
return true;
|
||||
// return ActorSyncModule != null && ActorSyncModule.ActorType == DSGActorTypes.PhysicsEngine;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1513,8 +1484,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
RegionSyncServerModule = RequestModuleInterface<IRegionSyncServerModule>();
|
||||
RegionSyncClientModule = RequestModuleInterface<IRegionSyncClientModule>();
|
||||
ScriptEngineToSceneConnectorModule = RequestModuleInterface<IScriptEngineToSceneConnectorModule>();
|
||||
PhysEngineToSceneConnectorModule = RequestModuleInterface<IPhysEngineToSceneConnectorModule>();
|
||||
SceneToPhysEngineSyncServer = RequestModuleInterface<ISceneToPhysEngineServer>();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//SYMMETRIC SYNC (KittyL: started 12/23/2010)
|
||||
|
@ -1723,7 +1692,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
int tmpPhysicsMS2 = Util.EnvironmentTickCount();
|
||||
// Do not simulate physics locally if this is a synced client
|
||||
//if (!IsSyncedClient())
|
||||
if (IsSyncedServer() || this.IsPhysEngineActor())
|
||||
if (IsSyncedServer() || IsPhysEngineActor())
|
||||
{
|
||||
if ((m_frame % m_update_physics == 0) && m_physics_enabled)
|
||||
m_sceneGraph.UpdatePreparePhysics();
|
||||
|
@ -1732,7 +1701,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
// Do not simulate physics locally if this is a synced client
|
||||
//if (!IsSyncedClient())
|
||||
if (IsSyncedServer() || this.IsPhysEngineActor())
|
||||
if (IsSyncedServer() || IsPhysEngineActor())
|
||||
{
|
||||
if (m_frame % m_update_entitymovement == 0)
|
||||
m_sceneGraph.UpdateScenePresenceMovement();
|
||||
|
@ -1743,7 +1712,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
int tmpPhysicsMS = Util.EnvironmentTickCount();
|
||||
// Do not simulate physics locally if this is a synced client
|
||||
//if (!IsSyncedClient())
|
||||
if (IsSyncedServer() || this.IsPhysEngineActor())
|
||||
if (IsSyncedServer() || IsPhysEngineActor())
|
||||
{
|
||||
if (m_frame % m_update_physics == 0)
|
||||
{
|
||||
|
|
|
@ -5763,6 +5763,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
if (updatedProperties != null && updatedProperties.Count > 0)
|
||||
{
|
||||
m_log.DebugFormat("{0}: Tainting bucket for properties {1}",
|
||||
"[SCENE OBJECT PART]", updatedProperties.ToString());
|
||||
foreach (SceneObjectPartProperties property in updatedProperties)
|
||||
{
|
||||
TaintBucketSyncInfo(property);
|
||||
|
|
|
@ -548,6 +548,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
lock (m_scene.SyncRoot)
|
||||
actor.Velocity = value;
|
||||
m_scene.PhysicsScene.AddPhysicsActorTaint(actor);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -2444,6 +2446,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// REGION SYNC
|
||||
if (m_scene.IsSyncedServer())
|
||||
{
|
||||
// the old and new systems live in parallel
|
||||
m_scene.RegionSyncModule.QueueScenePresenceForTerseUpdate(this);
|
||||
m_scene.RegionSyncServerModule.QueuePresenceForTerseUpdate(this);
|
||||
return;
|
||||
}
|
||||
|
@ -3368,7 +3372,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
new Vector3(0f, 0f, m_appearance.AvatarHeight), isFlying);
|
||||
|
||||
scene.AddPhysicsActorTaint(m_physicsActor);
|
||||
//m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
|
||||
m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
|
||||
m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
|
||||
m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
|
||||
m_physicsActor.SubscribeEvents(500);
|
||||
|
|
|
@ -121,6 +121,7 @@ public class PECharacter : PhysicsActor
|
|||
public override Vector3 Position {
|
||||
get { return _position; }
|
||||
set { _position = value;
|
||||
SyncUpdated = true;
|
||||
}
|
||||
}
|
||||
public override float Mass {
|
||||
|
@ -133,6 +134,7 @@ public class PECharacter : PhysicsActor
|
|||
public override Vector3 Force {
|
||||
get { return _force; }
|
||||
set { _force = value;
|
||||
SyncUpdated = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,16 +155,19 @@ public class PECharacter : PhysicsActor
|
|||
public override Vector3 Velocity {
|
||||
get { return _velocity; }
|
||||
set { _velocity = value;
|
||||
// SyncUpdated = true;
|
||||
}
|
||||
}
|
||||
public override Vector3 Torque {
|
||||
get { return _torque; }
|
||||
set { _torque = value;
|
||||
// SyncUpdated = true;
|
||||
}
|
||||
}
|
||||
public override float CollisionScore {
|
||||
get { return _collisionScore; }
|
||||
set { _collisionScore = value;
|
||||
// SyncUpdated = true;
|
||||
}
|
||||
}
|
||||
public override Vector3 Acceleration {
|
||||
|
|
|
@ -96,7 +96,10 @@ public class PEScene : PhysicsScene
|
|||
return prim;
|
||||
}
|
||||
|
||||
public override void AddPhysicsActorTaint(PhysicsActor prim) { }
|
||||
public override void AddPhysicsActorTaint(PhysicsActor prim)
|
||||
{
|
||||
prim.SyncUpdated = true;
|
||||
}
|
||||
|
||||
public override float Simulate(float timeStep)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue