More code cleaning following last commit (removed code that was commented out).
							parent
							
								
									a7d7ca9b0f
								
							
						
					
					
						commit
						ff5c86c90a
					
				|  | @ -46,13 +46,6 @@ using Nini.Config; | |||
| 
 | ||||
| namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule | ||||
| { | ||||
|     //The data structure that maintains the list of quarks a script engine subscribes to. | ||||
|     //It might be better to organize the quarks in a k-d tree structure, for easier | ||||
|     //partitioning of the quarks based on spatial information. | ||||
|     //But for now, we just assume the quarks each script engine operates on form a rectangle shape. | ||||
|     //So we just use xmin,ymin and xmax,ymax to identify the rectange; and use a List structure to | ||||
|     //store the quarks. | ||||
|     //Quark size is defined in QuarkInfo.SizeX and QuarkInfo.SizeY. | ||||
| 
 | ||||
|     // The RegionSyncPhysEngine has a receive thread to process messages from the RegionSyncServer. | ||||
|     // It is the client side of the synchronization channel, and send to and receive updates from the  | ||||
|  |  | |||
|  | @ -65,10 +65,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule | |||
|         private PhysEngineToSceneConnector m_idlePEToSceneConnector = null; | ||||
|         private PhysEngineToSceneConnector m_physEngineToSceneConnector = null; | ||||
| 
 | ||||
|         //quark information | ||||
|         //private int QuarkInfo.SizeX; | ||||
|         //private int QuarkInfo.SizeY; | ||||
|         //private string m_quarkListString; | ||||
|         private string m_subscriptionSpaceString; | ||||
| 
 | ||||
|         #endregion PhysEngineToSceneConnectorModule members and functions | ||||
|  | @ -303,8 +299,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule | |||
|             Command cmdSyncStatus = new Command("status", CommandIntentions.COMMAND_HAZARDOUS, SyncStatus, "Displays synchronization status."); | ||||
| 
 | ||||
|             //The following two commands are more for easier debugging purpose | ||||
|             Command cmdSyncSetQuarks = new Command("quarkSpace", CommandIntentions.COMMAND_HAZARDOUS, SetQuarkList, "Set the set of quarks to subscribe to. For debugging purpose. Should be issued before \"sync start\""); | ||||
|             cmdSyncSetQuarks.AddArgument("quarkSpace", "The (rectangle) space of quarks to subscribe, represented by x0_y0,x1_y1, the left-bottom and top-right corners of the rectangel space", "String"); | ||||
|             //Command cmdSyncSetQuarks = new Command("quarkSpace", CommandIntentions.COMMAND_HAZARDOUS, SetQuarkList, "Set the set of quarks to subscribe to. For debugging purpose. Should be issued before \"sync start\""); | ||||
|             //cmdSyncSetQuarks.AddArgument("quarkSpace", "The (rectangle) space of quarks to subscribe, represented by x0_y0,x1_y1, the left-bottom and top-right corners of the rectangel space", "String"); | ||||
| 
 | ||||
|             //Command cmdSyncSetQuarkSize = new Command("quarksize", CommandIntentions.COMMAND_HAZARDOUS, SetQuarkSize, "Set the size of each quark. For debugging purpose. Should be issued before \"sync quarks\""); | ||||
|             //cmdSyncSetQuarkSize.AddArgument("quarksizeX", "The size on x axis of each quark", "Integer"); | ||||
|  | @ -361,9 +357,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule | |||
|                 //m_log.Warn(LogHeader + " Starting synchronization"); | ||||
|                 m_log.Warn(LogHeader + ": Starting RegionSyncPhysEngine"); | ||||
| 
 | ||||
|                 //Only one remote scene to connect to. Subscribe to whatever specified in the config file. | ||||
|                 //List<string> quarkStringList = RegionSyncUtil.QuarkStringToStringList(m_quarkListString); | ||||
|                 //InitPhysEngineToSceneConnector(quarkStringList); | ||||
|                 InitPhysEngineToSceneConnector(m_subscriptionSpaceString); | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -507,17 +507,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule | |||
|         //a boolean variable to indicate in symmetric sync is configured | ||||
|         //private bool m_symsync = false; | ||||
| 
 | ||||
|         /* | ||||
|         public bool IsSymSync | ||||
|         { | ||||
|             get { return IsSymSync; } | ||||
|         } | ||||
|          * */ | ||||
| 
 | ||||
|         //quark related information | ||||
|         //private int QuarkInfo.SizeX; | ||||
|         //private int QuarkInfo.SizeY; | ||||
| 
 | ||||
|         #endregion | ||||
| 
 | ||||
|         #region Event Handlers | ||||
|  |  | |||
|  | @ -144,17 +144,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule | |||
|         public bool Connected | ||||
|         { get { return m_tcpclient.Connected; } } | ||||
| 
 | ||||
|         //private int QuarkInfo.SizeX; | ||||
|         //private int QuarkInfo.SizeY; | ||||
|         //private List<QuarkInfo> m_quarkSubscriptions; | ||||
|         /* | ||||
|         Dictionary<string, QuarkInfo> m_quarkSubscriptions; | ||||
|         public Dictionary<string, QuarkInfo> QuarkSubscriptionList | ||||
|         { | ||||
|             get { return m_quarkSubscriptions; } | ||||
|         } | ||||
|         */  | ||||
| 
 | ||||
| 
 | ||||
|         #endregion | ||||
| 
 | ||||
|  | @ -168,9 +157,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule | |||
|             m_port = ((IPEndPoint)client.Client.RemoteEndPoint).Port; | ||||
|             m_syncServer = syncServer; | ||||
| 
 | ||||
|             //QuarkInfo.SizeX = quarkSizeX; | ||||
|             //QuarkInfo.SizeY = quarkSizeY; | ||||
| 
 | ||||
|             m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||||
|             //m_log.WarnFormat("{0} Constructed", LogHeader); | ||||
| 
 | ||||
|  | @ -454,26 +440,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule | |||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         /* | ||||
|         //For simplicity, we assume the subscription sent by PhysEngine is legistimate (no overlapping with other script engines, etc) | ||||
|         private void HandleQuarkSubscription(RegionSyncMessage msg) | ||||
|         { | ||||
|             string quarkString = Encoding.ASCII.GetString(msg.Data, 0, msg.Length); | ||||
|             m_log.Debug(LogHeader + ": received quark-string: " + quarkString); | ||||
| 
 | ||||
|             List<string> quarkStringList = RegionSyncUtil.QuarkStringToStringList(quarkString); | ||||
|             //m_quarkSubscriptions = RegionSyncUtil.GetQuarkInfoList(quarkStringList, QuarkInfo.SizeX, QuarkInfo.SizeY); | ||||
|             List<QuarkInfo> quarkList = RegionSyncUtil.GetQuarkInfoList(quarkStringList); | ||||
|             m_syncServer.RegisterQuarkSubscription(quarkList, this); | ||||
| 
 | ||||
|             m_quarkSubscriptions = new Dictionary<string, QuarkInfo>(); | ||||
|             foreach (QuarkInfo quark in quarkList) | ||||
|             { | ||||
|                 m_quarkSubscriptions.Add(quark.QuarkStringRepresentation, quark); | ||||
|             } | ||||
|         } | ||||
|          * */  | ||||
| 
 | ||||
|         private RegionSyncMessage PrepareObjectUpdateMessage(RegionSyncMessage.MsgType msgType, SceneObjectGroup sog) | ||||
|         { | ||||
|             OSDMap data = new OSDMap(3); | ||||
|  | @ -550,36 +516,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule | |||
| 
 | ||||
|         #endregion Send/Receive messages to/from the remote Physics Engine | ||||
| 
 | ||||
|         #region Spacial query functions (should be eventually implemented within Scene) | ||||
|         /* | ||||
|         //This should be a function of Scene, but since we don't have the quark concept in Scene yet,  | ||||
|         //for now we implement it here. | ||||
|         //Ideally, for quark based space representation, the Scene has a list of quarks, and each quark points | ||||
|         //to a list of objects within that quark. Then it's much easier to return the right set of objects within | ||||
|         //a certain space. (Or use DB that supports spatial queries.) | ||||
|         List<SceneObjectGroup> GetObjectsInGivenSpace(Scene scene, Dictionary<string, QuarkInfo> quarkSubscriptions) | ||||
|         { | ||||
|             List<EntityBase> entities = m_scene.GetEntities(); | ||||
|             List<SceneObjectGroup> sogList = new List<SceneObjectGroup>(); | ||||
|             foreach (EntityBase e in entities) | ||||
|             { | ||||
|                 if (e is SceneObjectGroup) | ||||
|                 { | ||||
|                     SceneObjectGroup sog = (SceneObjectGroup)e; | ||||
|                     string quarkID = RegionSyncUtil.GetQuarkIDByPosition(sog.AbsolutePosition); | ||||
|                     if (m_quarkSubscriptions.ContainsKey(quarkID)) | ||||
|                     { | ||||
|                         sogList.Add(sog); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             return sogList; | ||||
|         } | ||||
|         */ | ||||
| 
 | ||||
|         #endregion  | ||||
| 
 | ||||
|         #region Load balancing functions | ||||
|         /* | ||||
|         public void SendLoadBalanceRejection(string response) | ||||
|  |  | |||
|  | @ -106,16 +106,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule | |||
|         //list of idle physics engines that have registered. | ||||
|         private List<IdlePhysEngineInfo> m_idlePhysEngineList = new List<IdlePhysEngineInfo>(); | ||||
| 
 | ||||
|         //List of all quarks, each using the concatenation of x,y values of its left-bottom corners,  | ||||
|         // where the x,y values are the offset position in the scene. | ||||
|         //private Dictionary<string, QuarkInfo> m_quarksInScene = new Dictionary<string, QuarkInfo>(); | ||||
| 
 | ||||
|         private string LogHeader = "[SCENE TO PHYS ENGINE SYNC SERVER]"; | ||||
| 
 | ||||
|         //Quark related info | ||||
|         //private int QuarkInfo.SizeX; | ||||
|         //private int QuarkInfo.SizeY; | ||||
| 
 | ||||
|         #region ICommandableModule Members | ||||
|         private readonly Commander m_commander = new Commander("phys"); | ||||
|         public ICommander CommandInterface | ||||
|  | @ -134,13 +127,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule | |||
| 
 | ||||
|             Command cmdSyncStatus = new Command("status", CommandIntentions.COMMAND_HAZARDOUS, SyncStatus, "Displays synchronization status."); | ||||
| 
 | ||||
|             //The following two commands are more for easier debugging purpose | ||||
|             // Command cmdSyncSetQuarks = new Command("quarkSpace", CommandIntentions.COMMAND_HAZARDOUS, SetQuarkList, "Set the set of quarks to subscribe to. For debugging purpose. Should be issued before \"sync start\""); | ||||
|             // cmdSyncSetQuarks.AddArgument("quarkSpace", "The (rectangle) space of quarks to subscribe, represented by x0_y0,x1_y1, the left-bottom and top-right corners of the rectangel space", "String"); | ||||
| 
 | ||||
|             // Command cmdSyncSetQuarkSize = new Command("quarksize", CommandIntentions.COMMAND_HAZARDOUS, SetQuarkSize, "Set the size of each quark. For debugging purpose. Should be issued before \"sync quarks\""); | ||||
|             // cmdSyncSetQuarkSize.AddArgument("quarksizeX", "The size on x axis of each quark", "Integer"); | ||||
|             // cmdSyncSetQuarkSize.AddArgument("quarksizeY", "The size on y axis of each quark", "Integer"); | ||||
| 
 | ||||
|             // m_commander.RegisterCommand("start", cmdSyncStart); | ||||
|             // m_commander.RegisterCommand("stop", cmdSyncStop); | ||||
|  | @ -322,7 +308,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule | |||
|                 m_allScenes.Add(m_scene); | ||||
|             } | ||||
| 
 | ||||
|             //InitQuarksInScene(); | ||||
|             SubscribeToEvents(); | ||||
|             m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; | ||||
|             InstallInterfaces(); | ||||
|  | @ -371,18 +356,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule | |||
|             UnSubscribeToEvents(); | ||||
|         } | ||||
| 
 | ||||
|         /* | ||||
|         public void RegisterQuarkSubscription(List<QuarkInfo> quarkSubscriptions, SceneToPhysEngineConnector peConnector) | ||||
|         { | ||||
|             foreach (QuarkInfo quark in quarkSubscriptions) | ||||
|             { | ||||
|                 string quarkID = quark.QuarkStringRepresentation; | ||||
|                 // TODO: does the physics engine connect to quarks. Next line commented out. | ||||
|                 // m_quarksInScene[quarkID].PEConnector = peConnector; | ||||
|                 m_log.Debug(LogHeader + ": " + quarkID + " subscribed by "+peConnector.Description); | ||||
|             } | ||||
|         } | ||||
|          * */  | ||||
| 
 | ||||
|         // Add a connector to a physics engine | ||||
|         public void AddSyncedPhysEngine(SceneToPhysEngineConnector peConnector) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Huaiyu (Kitty) Liu
						Huaiyu (Kitty) Liu