diff options
Diffstat (limited to 'OpenSim/Framework/RegionInfo.cs')
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 298 |
1 files changed, 298 insertions, 0 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 88b62e0..9e00528 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -36,8 +36,290 @@ using OpenMetaverse; | |||
36 | using OpenMetaverse.StructuredData; | 36 | using OpenMetaverse.StructuredData; |
37 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
38 | 38 | ||
39 | |||
39 | namespace OpenSim.Framework | 40 | namespace OpenSim.Framework |
40 | { | 41 | { |
42 | public class RegionMeta7WindlightData | ||
43 | { | ||
44 | public UUID regionID = UUID.Zero; | ||
45 | public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f); | ||
46 | public float waterFogDensityExponent = 4.0f; | ||
47 | public float underwaterFogModifier = 0.25f; | ||
48 | public Vector3 reflectionWaveletScale = new Vector3(2.0f,2.0f,2.0f); | ||
49 | public float fresnelScale = 0.40f; | ||
50 | public float fresnelOffset = 0.50f; | ||
51 | public float refractScaleAbove = 0.03f; | ||
52 | public float refractScaleBelow = 0.20f; | ||
53 | public float blurMultiplier = 0.040f; | ||
54 | public Vector2 bigWaveDirection = new Vector2(1.05f,-0.42f); | ||
55 | public Vector2 littleWaveDirection = new Vector2(1.11f,-1.16f); | ||
56 | public UUID normalMapTexture = new UUID("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); | ||
57 | public Vector4 horizon = new Vector4(0.26f, 0.24f, 0.34f, 0.33f); | ||
58 | public float hazeHorizon = 0.19f; | ||
59 | public Vector4 blueDensity = new Vector4(0.10f, 0.93f, 0.02f, 0.93f); | ||
60 | public float hazeDensity = 0.70f; | ||
61 | public float densityMultiplier = 0.18f; | ||
62 | public float distanceMultiplier = 0.8f; | ||
63 | public UInt16 maxAltitude = 1605; | ||
64 | public Vector4 sunMoonColor = new Vector4(0.24f, 0.26f, 0.30f, 0.30f); | ||
65 | public float sunMoonPosition = 0.335f; | ||
66 | public Vector4 ambient = new Vector4(0.35f,0.35f,0.35f,0.35f); | ||
67 | public float eastAngle = 0.0f; | ||
68 | public float sunGlowFocus = 0.10f; | ||
69 | public float sunGlowSize = 0.10f; | ||
70 | public float sceneGamma = 1.0f; | ||
71 | public float starBrightness = 0.0f; | ||
72 | public Vector4 cloudColor = new Vector4(0.41f, 0.41f, 0.41f, 0.41f); | ||
73 | public Vector3 cloudXYDensity = new Vector3(1.00f, 0.53f, 1.00f); | ||
74 | public float cloudCoverage = 0.27f; | ||
75 | public float cloudScale = 0.42f; | ||
76 | public Vector3 cloudDetailXYDensity = new Vector3(1.00f, 0.53f, 0.12f); | ||
77 | public float cloudScrollX = 0.20f; | ||
78 | public bool cloudScrollXLock = false; | ||
79 | public float cloudScrollY = 0.01f; | ||
80 | public bool cloudScrollYLock = false; | ||
81 | public bool drawClassicClouds = false; | ||
82 | |||
83 | public delegate void SaveDelegate(RegionMeta7WindlightData wl); | ||
84 | public event SaveDelegate OnSave; | ||
85 | public void Save() | ||
86 | { | ||
87 | if (OnSave != null) | ||
88 | OnSave(this); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | [Serializable] | ||
93 | public class SimpleRegionInfo | ||
94 | { | ||
95 | // private static readonly log4net.ILog m_log | ||
96 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
97 | |||
98 | /// <summary> | ||
99 | /// The port by which http communication occurs with the region (most noticeably, CAPS communication) | ||
100 | /// </summary> | ||
101 | public uint HttpPort | ||
102 | { | ||
103 | get { return m_httpPort; } | ||
104 | set { m_httpPort = value; } | ||
105 | } | ||
106 | protected uint m_httpPort; | ||
107 | |||
108 | /// <summary> | ||
109 | /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) | ||
110 | /// </summary> | ||
111 | public string ServerURI | ||
112 | { | ||
113 | get { return m_serverURI; } | ||
114 | set { m_serverURI = value; } | ||
115 | } | ||
116 | protected string m_serverURI; | ||
117 | |||
118 | public string RegionName | ||
119 | { | ||
120 | get { return m_regionName; } | ||
121 | set { m_regionName = value; } | ||
122 | } | ||
123 | protected string m_regionName = String.Empty; | ||
124 | |||
125 | protected bool Allow_Alternate_Ports; | ||
126 | public bool m_allow_alternate_ports; | ||
127 | protected string m_externalHostName; | ||
128 | |||
129 | protected IPEndPoint m_internalEndPoint; | ||
130 | protected uint? m_regionLocX; | ||
131 | protected uint? m_regionLocY; | ||
132 | protected uint m_remotingPort; | ||
133 | public UUID RegionID = UUID.Zero; | ||
134 | public string RemotingAddress; | ||
135 | public UUID ScopeID = UUID.Zero; | ||
136 | |||
137 | public SimpleRegionInfo() | ||
138 | { | ||
139 | } | ||
140 | |||
141 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) | ||
142 | { | ||
143 | m_regionLocX = regionLocX; | ||
144 | m_regionLocY = regionLocY; | ||
145 | |||
146 | m_internalEndPoint = internalEndPoint; | ||
147 | m_externalHostName = externalUri; | ||
148 | } | ||
149 | |||
150 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) | ||
151 | { | ||
152 | m_regionLocX = regionLocX; | ||
153 | m_regionLocY = regionLocY; | ||
154 | |||
155 | m_externalHostName = externalUri; | ||
156 | |||
157 | m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); | ||
158 | } | ||
159 | |||
160 | public SimpleRegionInfo(RegionInfo ConvertFrom) | ||
161 | { | ||
162 | m_regionName = ConvertFrom.RegionName; | ||
163 | m_regionLocX = ConvertFrom.RegionLocX; | ||
164 | m_regionLocY = ConvertFrom.RegionLocY; | ||
165 | m_internalEndPoint = ConvertFrom.InternalEndPoint; | ||
166 | m_externalHostName = ConvertFrom.ExternalHostName; | ||
167 | m_remotingPort = ConvertFrom.RemotingPort; | ||
168 | m_httpPort = ConvertFrom.HttpPort; | ||
169 | m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; | ||
170 | RemotingAddress = ConvertFrom.RemotingAddress; | ||
171 | RegionID = UUID.Zero; | ||
172 | ServerURI = ConvertFrom.ServerURI; | ||
173 | } | ||
174 | |||
175 | public uint RemotingPort | ||
176 | { | ||
177 | get { return m_remotingPort; } | ||
178 | set { m_remotingPort = value; } | ||
179 | } | ||
180 | |||
181 | /// <value> | ||
182 | /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. | ||
183 | /// | ||
184 | /// XXX Isn't this really doing too much to be a simple getter, rather than an explict method? | ||
185 | /// </value> | ||
186 | public IPEndPoint ExternalEndPoint | ||
187 | { | ||
188 | get | ||
189 | { | ||
190 | // Old one defaults to IPv6 | ||
191 | //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port); | ||
192 | |||
193 | IPAddress ia = null; | ||
194 | // If it is already an IP, don't resolve it - just return directly | ||
195 | if (IPAddress.TryParse(m_externalHostName, out ia)) | ||
196 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
197 | |||
198 | // Reset for next check | ||
199 | ia = null; | ||
200 | try | ||
201 | { | ||
202 | foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) | ||
203 | { | ||
204 | if (ia == null) | ||
205 | ia = Adr; | ||
206 | |||
207 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
208 | { | ||
209 | ia = Adr; | ||
210 | break; | ||
211 | } | ||
212 | } | ||
213 | } | ||
214 | catch (SocketException e) | ||
215 | { | ||
216 | throw new Exception( | ||
217 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + | ||
218 | e + "' attached to this exception", e); | ||
219 | } | ||
220 | |||
221 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
222 | } | ||
223 | |||
224 | set { m_externalHostName = value.ToString(); } | ||
225 | } | ||
226 | |||
227 | public string ExternalHostName | ||
228 | { | ||
229 | get { return m_externalHostName; } | ||
230 | set { m_externalHostName = value; } | ||
231 | } | ||
232 | |||
233 | public IPEndPoint InternalEndPoint | ||
234 | { | ||
235 | get { return m_internalEndPoint; } | ||
236 | set { m_internalEndPoint = value; } | ||
237 | } | ||
238 | |||
239 | public uint RegionLocX | ||
240 | { | ||
241 | get { return m_regionLocX.Value; } | ||
242 | set { m_regionLocX = value; } | ||
243 | } | ||
244 | |||
245 | public uint RegionLocY | ||
246 | { | ||
247 | get { return m_regionLocY.Value; } | ||
248 | set { m_regionLocY = value; } | ||
249 | } | ||
250 | |||
251 | public ulong RegionHandle | ||
252 | { | ||
253 | get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); } | ||
254 | } | ||
255 | |||
256 | public int getInternalEndPointPort() | ||
257 | { | ||
258 | return m_internalEndPoint.Port; | ||
259 | } | ||
260 | |||
261 | public Dictionary<string, object> ToKeyValuePairs() | ||
262 | { | ||
263 | Dictionary<string, object> kvp = new Dictionary<string, object>(); | ||
264 | kvp["uuid"] = RegionID.ToString(); | ||
265 | kvp["locX"] = RegionLocX.ToString(); | ||
266 | kvp["locY"] = RegionLocY.ToString(); | ||
267 | kvp["external_ip_address"] = ExternalEndPoint.Address.ToString(); | ||
268 | kvp["external_port"] = ExternalEndPoint.Port.ToString(); | ||
269 | kvp["external_host_name"] = ExternalHostName; | ||
270 | kvp["http_port"] = HttpPort.ToString(); | ||
271 | kvp["internal_ip_address"] = InternalEndPoint.Address.ToString(); | ||
272 | kvp["internal_port"] = InternalEndPoint.Port.ToString(); | ||
273 | kvp["alternate_ports"] = m_allow_alternate_ports.ToString(); | ||
274 | kvp["server_uri"] = ServerURI; | ||
275 | |||
276 | return kvp; | ||
277 | } | ||
278 | |||
279 | public SimpleRegionInfo(Dictionary<string, object> kvp) | ||
280 | { | ||
281 | if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null)) | ||
282 | { | ||
283 | int port = 0; | ||
284 | Int32.TryParse((string)kvp["external_port"], out port); | ||
285 | IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["external_ip_address"]), port); | ||
286 | ExternalEndPoint = ep; | ||
287 | } | ||
288 | else | ||
289 | ExternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); | ||
290 | |||
291 | if (kvp["external_host_name"] != null) | ||
292 | ExternalHostName = (string)kvp["external_host_name"]; | ||
293 | |||
294 | if (kvp["http_port"] != null) | ||
295 | { | ||
296 | UInt32 port = 0; | ||
297 | UInt32.TryParse((string)kvp["http_port"], out port); | ||
298 | HttpPort = port; | ||
299 | } | ||
300 | |||
301 | if ((kvp["internal_ip_address"] != null) && (kvp["internal_port"] != null)) | ||
302 | { | ||
303 | int port = 0; | ||
304 | Int32.TryParse((string)kvp["internal_port"], out port); | ||
305 | IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["internal_ip_address"]), port); | ||
306 | InternalEndPoint = ep; | ||
307 | } | ||
308 | else | ||
309 | InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); | ||
310 | |||
311 | if (kvp["alternate_ports"] != null) | ||
312 | { | ||
313 | bool alts = false; | ||
314 | Boolean.TryParse((string)kvp["alternate_ports"], out alts); | ||
315 | m_allow_alternate_ports = alts; | ||
316 | } | ||
317 | |||
318 | if (kvp["server_uri"] != null) | ||
319 | ServerURI = (string)kvp["server_uri"]; | ||
320 | } | ||
321 | } | ||
322 | |||
41 | public class RegionInfo | 323 | public class RegionInfo |
42 | { | 324 | { |
43 | // private static readonly log4net.ILog m_log | 325 | // private static readonly log4net.ILog m_log |
@@ -73,6 +355,7 @@ namespace OpenSim.Framework | |||
73 | private bool m_clampPrimSize = false; | 355 | private bool m_clampPrimSize = false; |
74 | private int m_objectCapacity = 0; | 356 | private int m_objectCapacity = 0; |
75 | private string m_regionType = String.Empty; | 357 | private string m_regionType = String.Empty; |
358 | private RegionMeta7WindlightData m_windlight = new RegionMeta7WindlightData(); | ||
76 | protected uint m_httpPort; | 359 | protected uint m_httpPort; |
77 | protected string m_serverURI; | 360 | protected string m_serverURI; |
78 | protected string m_regionName = String.Empty; | 361 | protected string m_regionName = String.Empty; |
@@ -211,6 +494,21 @@ namespace OpenSim.Framework | |||
211 | set { m_regionSettings = value; } | 494 | set { m_regionSettings = value; } |
212 | } | 495 | } |
213 | 496 | ||
497 | public RegionMeta7WindlightData WindlightSettings | ||
498 | { | ||
499 | get | ||
500 | { | ||
501 | if (m_windlight == null) | ||
502 | { | ||
503 | m_windlight = new RegionMeta7WindlightData(); | ||
504 | } | ||
505 | |||
506 | return m_windlight; | ||
507 | } | ||
508 | |||
509 | set { m_windlight = value; } | ||
510 | } | ||
511 | |||
214 | public int NonphysPrimMax | 512 | public int NonphysPrimMax |
215 | { | 513 | { |
216 | get { return m_nonphysPrimMax; } | 514 | get { return m_nonphysPrimMax; } |