aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs69
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Types/BasicQuadTreeNode.cs269
3 files changed, 9 insertions, 334 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2a498cc..644fbb0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2788,7 +2788,9 @@ namespace OpenSim.Region.Framework.Scenes
2788 IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>(); 2788 IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>();
2789 if (userVerification != null && ep != null) 2789 if (userVerification != null && ep != null)
2790 { 2790 {
2791 if (!userVerification.VerifyClient(aCircuit, ep.Address.ToString())) 2791 System.Net.IPAddress addr = NetworkUtil.GetExternalIPOf(ep.Address);
2792
2793 if (!userVerification.VerifyClient(aCircuit, /*ep.Address.ToString() */ addr.ToString()))
2792 { 2794 {
2793 // uh-oh, this is fishy 2795 // uh-oh, this is fishy
2794 m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); 2796 m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
@@ -2846,17 +2848,11 @@ namespace OpenSim.Region.Framework.Scenes
2846 SubscribeToClientPrimEvents(client); 2848 SubscribeToClientPrimEvents(client);
2847 SubscribeToClientPrimRezEvents(client); 2849 SubscribeToClientPrimRezEvents(client);
2848 SubscribeToClientInventoryEvents(client); 2850 SubscribeToClientInventoryEvents(client);
2849 SubscribeToClientAttachmentEvents(client);
2850 SubscribeToClientTeleportEvents(client); 2851 SubscribeToClientTeleportEvents(client);
2851 SubscribeToClientScriptEvents(client); 2852 SubscribeToClientScriptEvents(client);
2852 SubscribeToClientParcelEvents(client); 2853 SubscribeToClientParcelEvents(client);
2853 SubscribeToClientGridEvents(client); 2854 SubscribeToClientGridEvents(client);
2854 SubscribeToClientGodEvents(client);
2855
2856 SubscribeToClientNetworkEvents(client); 2855 SubscribeToClientNetworkEvents(client);
2857
2858
2859 // EventManager.TriggerOnNewClient(client);
2860 } 2856 }
2861 2857
2862 public virtual void SubscribeToClientTerrainEvents(IClientAPI client) 2858 public virtual void SubscribeToClientTerrainEvents(IClientAPI client)
@@ -2866,8 +2862,7 @@ namespace OpenSim.Region.Framework.Scenes
2866 } 2862 }
2867 2863
2868 public virtual void SubscribeToClientPrimEvents(IClientAPI client) 2864 public virtual void SubscribeToClientPrimEvents(IClientAPI client)
2869 { 2865 {
2870
2871 client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; 2866 client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition;
2872 client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; 2867 client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition;
2873 client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; 2868 client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation;
@@ -2937,18 +2932,6 @@ namespace OpenSim.Region.Framework.Scenes
2937 client.OnMoveTaskItem += ClientMoveTaskInventoryItem; 2932 client.OnMoveTaskItem += ClientMoveTaskInventoryItem;
2938 } 2933 }
2939 2934
2940 public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
2941 {
2942 if (AttachmentsModule != null)
2943 {
2944 client.OnRezSingleAttachmentFromInv += AttachmentsModule.RezSingleAttachmentFromInventory;
2945 client.OnRezMultipleAttachmentsFromInv += AttachmentsModule.RezMultipleAttachmentsFromInventory;
2946 client.OnObjectAttach += AttachmentsModule.AttachObject;
2947 client.OnObjectDetach += AttachmentsModule.DetachObject;
2948 client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory;
2949 }
2950 }
2951
2952 public virtual void SubscribeToClientTeleportEvents(IClientAPI client) 2935 public virtual void SubscribeToClientTeleportEvents(IClientAPI client)
2953 { 2936 {
2954 client.OnTeleportLocationRequest += RequestTeleportLocation; 2937 client.OnTeleportLocationRequest += RequestTeleportLocation;
@@ -2978,44 +2961,29 @@ namespace OpenSim.Region.Framework.Scenes
2978 client.OnSetStartLocationRequest += SetHomeRezPoint; 2961 client.OnSetStartLocationRequest += SetHomeRezPoint;
2979 client.OnRegionHandleRequest += RegionHandleRequest; 2962 client.OnRegionHandleRequest += RegionHandleRequest;
2980 } 2963 }
2981 2964
2982 public virtual void SubscribeToClientGodEvents(IClientAPI client)
2983 {
2984 IGodsModule godsModule = RequestModuleInterface<IGodsModule>();
2985 client.OnGodKickUser += godsModule.KickUser;
2986 client.OnRequestGodlikePowers += godsModule.RequestGodlikePowers;
2987 }
2988
2989 public virtual void SubscribeToClientNetworkEvents(IClientAPI client) 2965 public virtual void SubscribeToClientNetworkEvents(IClientAPI client)
2990 { 2966 {
2991 client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; 2967 client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats;
2992 client.OnViewerEffect += ProcessViewerEffect; 2968 client.OnViewerEffect += ProcessViewerEffect;
2993 } 2969 }
2994 2970
2995 protected virtual void UnsubscribeToClientEvents(IClientAPI client)
2996 {
2997 }
2998
2999 /// <summary> 2971 /// <summary>
3000 /// Register for events from the client 2972 /// Unsubscribe the client from events.
3001 /// </summary> 2973 /// </summary>
3002 /// <param name="client">The IClientAPI of the connected client</param> 2974 /// FIXME: Not called anywhere!
2975 /// <param name="client">The IClientAPI of the client</param>
3003 public virtual void UnSubscribeToClientEvents(IClientAPI client) 2976 public virtual void UnSubscribeToClientEvents(IClientAPI client)
3004 { 2977 {
3005 UnSubscribeToClientTerrainEvents(client); 2978 UnSubscribeToClientTerrainEvents(client);
3006 UnSubscribeToClientPrimEvents(client); 2979 UnSubscribeToClientPrimEvents(client);
3007 UnSubscribeToClientPrimRezEvents(client); 2980 UnSubscribeToClientPrimRezEvents(client);
3008 UnSubscribeToClientInventoryEvents(client); 2981 UnSubscribeToClientInventoryEvents(client);
3009 UnSubscribeToClientAttachmentEvents(client);
3010 UnSubscribeToClientTeleportEvents(client); 2982 UnSubscribeToClientTeleportEvents(client);
3011 UnSubscribeToClientScriptEvents(client); 2983 UnSubscribeToClientScriptEvents(client);
3012 UnSubscribeToClientParcelEvents(client); 2984 UnSubscribeToClientParcelEvents(client);
3013 UnSubscribeToClientGridEvents(client); 2985 UnSubscribeToClientGridEvents(client);
3014 UnSubscribeToClientGodEvents(client);
3015
3016 UnSubscribeToClientNetworkEvents(client); 2986 UnSubscribeToClientNetworkEvents(client);
3017
3018 // EventManager.TriggerOnNewClient(client);
3019 } 2987 }
3020 2988
3021 public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client) 2989 public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client)
@@ -3092,18 +3060,6 @@ namespace OpenSim.Region.Framework.Scenes
3092 client.OnMoveTaskItem -= ClientMoveTaskInventoryItem; 3060 client.OnMoveTaskItem -= ClientMoveTaskInventoryItem;
3093 } 3061 }
3094 3062
3095 public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
3096 {
3097 if (AttachmentsModule != null)
3098 {
3099 client.OnRezSingleAttachmentFromInv -= AttachmentsModule.RezSingleAttachmentFromInventory;
3100 client.OnRezMultipleAttachmentsFromInv -= AttachmentsModule.RezMultipleAttachmentsFromInventory;
3101 client.OnObjectAttach -= AttachmentsModule.AttachObject;
3102 client.OnObjectDetach -= AttachmentsModule.DetachObject;
3103 client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory;
3104 }
3105 }
3106
3107 public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client) 3063 public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client)
3108 { 3064 {
3109 client.OnTeleportLocationRequest -= RequestTeleportLocation; 3065 client.OnTeleportLocationRequest -= RequestTeleportLocation;
@@ -3135,13 +3091,6 @@ namespace OpenSim.Region.Framework.Scenes
3135 client.OnRegionHandleRequest -= RegionHandleRequest; 3091 client.OnRegionHandleRequest -= RegionHandleRequest;
3136 } 3092 }
3137 3093
3138 public virtual void UnSubscribeToClientGodEvents(IClientAPI client)
3139 {
3140 IGodsModule godsModule = RequestModuleInterface<IGodsModule>();
3141 client.OnGodKickUser -= godsModule.KickUser;
3142 client.OnRequestGodlikePowers -= godsModule.RequestGodlikePowers;
3143 }
3144
3145 public virtual void UnSubscribeToClientNetworkEvents(IClientAPI client) 3094 public virtual void UnSubscribeToClientNetworkEvents(IClientAPI client)
3146 { 3095 {
3147 client.OnNetworkStatsUpdate -= StatsReporter.AddPacketsStats; 3096 client.OnNetworkStatsUpdate -= StatsReporter.AddPacketsStats;
@@ -5381,4 +5330,4 @@ namespace OpenSim.Region.Framework.Scenes
5381 return offsets.ToArray(); 5330 return offsets.ToArray();
5382 } 5331 }
5383 } 5332 }
5384} 5333} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 12c1c20..c0ec5df 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -87,8 +87,6 @@ namespace OpenSim.Region.Framework.Scenes
87// protected internal Dictionary<UUID, EntityBase> Entities = new Dictionary<UUID, EntityBase>(); 87// protected internal Dictionary<UUID, EntityBase> Entities = new Dictionary<UUID, EntityBase>();
88 protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>(); 88 protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>();
89 89
90 protected internal BasicQuadTreeNode QuadTree;
91
92 protected RegionInfo m_regInfo; 90 protected RegionInfo m_regInfo;
93 protected Scene m_parentScene; 91 protected Scene m_parentScene;
94 protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>(); 92 protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>();
@@ -116,9 +114,6 @@ namespace OpenSim.Region.Framework.Scenes
116 { 114 {
117 m_parentScene = parent; 115 m_parentScene = parent;
118 m_regInfo = regInfo; 116 m_regInfo = regInfo;
119 QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, (short)Constants.RegionSize, (short)Constants.RegionSize);
120 QuadTree.Subdivide();
121 QuadTree.Subdivide();
122 } 117 }
123 118
124 public PhysicsScene PhysicsScene 119 public PhysicsScene PhysicsScene
diff --git a/OpenSim/Region/Framework/Scenes/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Framework/Scenes/Types/BasicQuadTreeNode.cs
deleted file mode 100644
index 38a9203..0000000
--- a/OpenSim/Region/Framework/Scenes/Types/BasicQuadTreeNode.cs
+++ /dev/null
@@ -1,269 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenSim.Region.Framework.Scenes;
31
32namespace OpenSim.Region.Framework.Scenes.Types
33{
34 public class BasicQuadTreeNode
35 {
36 private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>();
37 private BasicQuadTreeNode[] m_childNodes = null;
38 private BasicQuadTreeNode m_parent = null;
39
40 private short m_leftX;
41 private short m_leftY;
42 private short m_width;
43 private short m_height;
44 //private int m_quadNumber;
45 private string m_quadID;
46
47 public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width,
48 short height)
49 {
50 m_parent = parent;
51 m_quadID = quadID;
52 m_leftX = leftX;
53 m_leftY = leftY;
54 m_width = width;
55 m_height = height;
56 // m_log.Debug("creating quadtree node " + m_quadID);
57 }
58
59 public void AddObject(SceneObjectGroup obj)
60 {
61 if (m_childNodes == null)
62 {
63 if (!m_objects.Contains(obj))
64 {
65 m_objects.Add(obj);
66 }
67 }
68 else
69 {
70 if (obj.AbsolutePosition.X < (m_leftX + (m_width/2)))
71 {
72 if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
73 {
74 m_childNodes[0].AddObject(obj);
75 }
76 else
77 {
78 m_childNodes[2].AddObject(obj);
79 }
80 }
81 else
82 {
83 if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
84 {
85 m_childNodes[1].AddObject(obj);
86 }
87 else
88 {
89 m_childNodes[3].AddObject(obj);
90 }
91 }
92 }
93 }
94
95 public void Subdivide()
96 {
97 if (m_childNodes == null)
98 {
99 m_childNodes = new BasicQuadTreeNode[4];
100 m_childNodes[0] =
101 new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short) (m_width/2),
102 (short) (m_height/2));
103 m_childNodes[1] =
104 new BasicQuadTreeNode(this, m_quadID + "2/", (short) (m_leftX + (m_width/2)), m_leftY,
105 (short) (m_width/2), (short) (m_height/2));
106 m_childNodes[2] =
107 new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short) (m_leftY + (m_height/2)),
108 (short) (m_width/2), (short) (m_height/2));
109 m_childNodes[3] =
110 new BasicQuadTreeNode(this, m_quadID + "4/", (short) (m_leftX + (m_width/2)),
111 (short) (m_height + (m_height/2)), (short) (m_width/2), (short) (m_height/2));
112 }
113 else
114 {
115 for (int i = 0; i < m_childNodes.Length; i++)
116 {
117 m_childNodes[i].Subdivide();
118 }
119 }
120 }
121
122 public List<SceneObjectGroup> GetObjectsFrom(float x, float y)
123 {
124 if (m_childNodes == null)
125 {
126 return new List<SceneObjectGroup>(m_objects);
127 }
128 else
129 {
130 if (x < m_leftX + (m_width/2))
131 {
132 if (y < m_leftY + (m_height/2))
133 {
134 return m_childNodes[0].GetObjectsFrom(x, y);
135 }
136 else
137 {
138 return m_childNodes[2].GetObjectsFrom(x, y);
139 }
140 }
141 else
142 {
143 if (y < m_leftY + (m_height/2))
144 {
145 return m_childNodes[1].GetObjectsFrom(x, y);
146 }
147 else
148 {
149 return m_childNodes[3].GetObjectsFrom(x, y);
150 }
151 }
152 }
153 }
154
155 public List<SceneObjectGroup> GetObjectsFrom(string nodeName)
156 {
157 if (nodeName == m_quadID)
158 {
159 return new List<SceneObjectGroup>(m_objects);
160 }
161 else if (m_childNodes != null)
162 {
163 for (int i = 0; i < 4; i++)
164 {
165 List<SceneObjectGroup> retVal;
166 retVal = m_childNodes[i].GetObjectsFrom(nodeName);
167 if (retVal != null)
168 {
169 return retVal;
170 }
171 }
172 }
173 return null;
174 }
175
176 public string GetNodeID(float x, float y)
177 {
178 if (m_childNodes == null)
179 {
180 return m_quadID;
181 }
182 else
183 {
184 if (x < m_leftX + (m_width/2))
185 {
186 if (y < m_leftY + (m_height/2))
187 {
188 return m_childNodes[0].GetNodeID(x, y);
189 }
190 else
191 {
192 return m_childNodes[2].GetNodeID(x, y);
193 }
194 }
195 else
196 {
197 if (y < m_leftY + (m_height/2))
198 {
199 return m_childNodes[1].GetNodeID(x, y);
200 }
201 else
202 {
203 return m_childNodes[3].GetNodeID(x, y);
204 }
205 }
206 }
207 }
208
209 public void Update()
210 {
211 if (m_childNodes != null)
212 {
213 for (int i = 0; i < 4; i++)
214 {
215 m_childNodes[i].Update();
216 }
217 }
218 else
219 {
220 List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>();
221 foreach (SceneObjectGroup group in m_objects)
222 {
223 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
224 ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
225 {
226 //still in bounds
227 }
228 else
229 {
230 outBounds.Add(group);
231 }
232 }
233
234 foreach (SceneObjectGroup removee in outBounds)
235 {
236 m_objects.Remove(removee);
237 if (m_parent != null)
238 {
239 m_parent.PassUp(removee);
240 }
241 }
242 outBounds.Clear();
243 }
244 }
245
246 public void PassUp(SceneObjectGroup group)
247 {
248 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
249 ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
250 {
251 AddObject(group);
252 }
253 else
254 {
255 if (m_parent != null)
256 {
257 m_parent.PassUp(group);
258 }
259 }
260 }
261
262 public string[] GetNeighbours(string nodeName)
263 {
264 string[] retVal = new string[1];
265 retVal[0] = String.Empty;
266 return retVal;
267 }
268 }
269}