diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs | 79 |
1 files changed, 39 insertions, 40 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs index bfb5016..cfbe5ae 100644 --- a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs | |||
@@ -32,13 +32,12 @@ using System.Drawing; | |||
32 | using System.Drawing.Drawing2D; | 32 | using System.Drawing.Drawing2D; |
33 | using System.Drawing.Imaging; | 33 | using System.Drawing.Imaging; |
34 | using System.Reflection; | 34 | using System.Reflection; |
35 | using Axiom.Math; | ||
36 | using Nini.Config; | 35 | using Nini.Config; |
36 | using OpenMetaverse.Imaging; | ||
37 | using log4net; | 37 | using log4net; |
38 | using OpenJPEGNet; | ||
39 | using OpenSim.Region.Environment.Interfaces; | 38 | using OpenSim.Region.Environment.Interfaces; |
40 | using OpenSim.Region.Environment.Scenes; | 39 | using OpenSim.Region.Environment.Scenes; |
41 | using libsecondlife; | 40 | using OpenMetaverse; |
42 | 41 | ||
43 | namespace OpenSim.Region.Environment.Modules.World.WorldMap | 42 | namespace OpenSim.Region.Environment.Modules.World.WorldMap |
44 | { | 43 | { |
@@ -252,7 +251,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
252 | if (part.Shape.Textures.DefaultTexture == null) | 251 | if (part.Shape.Textures.DefaultTexture == null) |
253 | continue; | 252 | continue; |
254 | 253 | ||
255 | LLColor texcolor = part.Shape.Textures.DefaultTexture.RGBA; | 254 | Color4 texcolor = part.Shape.Textures.DefaultTexture.RGBA; |
256 | 255 | ||
257 | // Not sure why some of these are null, oh well. | 256 | // Not sure why some of these are null, oh well. |
258 | 257 | ||
@@ -265,7 +264,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
265 | //Try to set the map spot color | 264 | //Try to set the map spot color |
266 | try | 265 | try |
267 | { | 266 | { |
268 | // If the color gets goofy somehow, skip it *shakes fist at LLColor | 267 | // If the color gets goofy somehow, skip it *shakes fist at Color4 |
269 | mapdotspot = Color.FromArgb(colorr, colorg, colorb); | 268 | mapdotspot = Color.FromArgb(colorr, colorg, colorb); |
270 | } | 269 | } |
271 | catch (ArgumentException) | 270 | catch (ArgumentException) |
@@ -282,7 +281,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
282 | // Mono Array | 281 | // Mono Array |
283 | } | 282 | } |
284 | 283 | ||
285 | LLVector3 pos = part.GetWorldPosition(); | 284 | Vector3 pos = part.GetWorldPosition(); |
286 | 285 | ||
287 | // skip prim outside of retion | 286 | // skip prim outside of retion |
288 | if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f) | 287 | if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f) |
@@ -312,20 +311,20 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
312 | Vector3 tScale = new Vector3(); | 311 | Vector3 tScale = new Vector3(); |
313 | Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z); | 312 | Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z); |
314 | 313 | ||
315 | LLQuaternion llrot = part.GetWorldRotation(); | 314 | Quaternion llrot = part.GetWorldRotation(); |
316 | Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z); | 315 | Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z); |
317 | scale = rot * lscale; | 316 | scale = lscale * rot; |
318 | 317 | ||
319 | // negative scales don't work in this situation | 318 | // negative scales don't work in this situation |
320 | scale.x = Math.Abs(scale.x); | 319 | scale.X = Math.Abs(scale.X); |
321 | scale.y = Math.Abs(scale.y); | 320 | scale.Y = Math.Abs(scale.Y); |
322 | scale.z = Math.Abs(scale.z); | 321 | scale.Z = Math.Abs(scale.Z); |
323 | 322 | ||
324 | // This scaling isn't very accurate and doesn't take into account the face rotation :P | 323 | // This scaling isn't very accurate and doesn't take into account the face rotation :P |
325 | int mapdrawstartX = (int)(pos.X - scale.x); | 324 | int mapdrawstartX = (int)(pos.X - scale.X); |
326 | int mapdrawstartY = (int)(pos.Y - scale.y); | 325 | int mapdrawstartY = (int)(pos.Y - scale.Y); |
327 | int mapdrawendX = (int)(pos.X + scale.x); | 326 | int mapdrawendX = (int)(pos.X + scale.X); |
328 | int mapdrawendY = (int)(pos.Y + scale.y); | 327 | int mapdrawendY = (int)(pos.Y + scale.Y); |
329 | 328 | ||
330 | // If object is beyond the edge of the map, don't draw it to avoid errors | 329 | // If object is beyond the edge of the map, don't draw it to avoid errors |
331 | if (mapdrawstartX < 0 || mapdrawstartX > 255 || mapdrawendX < 0 || mapdrawendX > 255 | 330 | if (mapdrawstartX < 0 || mapdrawstartX > 255 || mapdrawendX < 0 || mapdrawendX > 255 |
@@ -342,9 +341,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
342 | Vector3[] FaceC = new Vector3[6]; // vertex C for Facei | 341 | Vector3[] FaceC = new Vector3[6]; // vertex C for Facei |
343 | Vector3[] FaceD = new Vector3[6]; // vertex D for Facei | 342 | Vector3[] FaceD = new Vector3[6]; // vertex D for Facei |
344 | 343 | ||
345 | tScale = new Vector3(lscale.x, -lscale.y, lscale.z); | 344 | tScale = new Vector3(lscale.X, -lscale.Y, lscale.Z); |
346 | scale = ((rot * tScale)); | 345 | scale = ((tScale * rot)); |
347 | vertexes[0] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); | 346 | vertexes[0] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z))); |
348 | // vertexes[0].x = pos.X + vertexes[0].x; | 347 | // vertexes[0].x = pos.X + vertexes[0].x; |
349 | //vertexes[0].y = pos.Y + vertexes[0].y; | 348 | //vertexes[0].y = pos.Y + vertexes[0].y; |
350 | //vertexes[0].z = pos.Z + vertexes[0].z; | 349 | //vertexes[0].z = pos.Z + vertexes[0].z; |
@@ -354,8 +353,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
354 | FaceA[4] = vertexes[0]; | 353 | FaceA[4] = vertexes[0]; |
355 | 354 | ||
356 | tScale = lscale; | 355 | tScale = lscale; |
357 | scale = ((rot * tScale)); | 356 | scale = ((tScale * rot)); |
358 | vertexes[1] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); | 357 | vertexes[1] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z))); |
359 | 358 | ||
360 | // vertexes[1].x = pos.X + vertexes[1].x; | 359 | // vertexes[1].x = pos.X + vertexes[1].x; |
361 | // vertexes[1].y = pos.Y + vertexes[1].y; | 360 | // vertexes[1].y = pos.Y + vertexes[1].y; |
@@ -365,10 +364,10 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
365 | FaceA[1] = vertexes[1]; | 364 | FaceA[1] = vertexes[1]; |
366 | FaceC[4] = vertexes[1]; | 365 | FaceC[4] = vertexes[1]; |
367 | 366 | ||
368 | tScale = new Vector3(lscale.x, -lscale.y, -lscale.z); | 367 | tScale = new Vector3(lscale.X, -lscale.Y, -lscale.Z); |
369 | scale = ((rot * tScale)); | 368 | scale = ((tScale * rot)); |
370 | 369 | ||
371 | vertexes[2] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); | 370 | vertexes[2] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z))); |
372 | 371 | ||
373 | //vertexes[2].x = pos.X + vertexes[2].x; | 372 | //vertexes[2].x = pos.X + vertexes[2].x; |
374 | //vertexes[2].y = pos.Y + vertexes[2].y; | 373 | //vertexes[2].y = pos.Y + vertexes[2].y; |
@@ -378,9 +377,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
378 | FaceD[3] = vertexes[2]; | 377 | FaceD[3] = vertexes[2]; |
379 | FaceC[5] = vertexes[2]; | 378 | FaceC[5] = vertexes[2]; |
380 | 379 | ||
381 | tScale = new Vector3(lscale.x, lscale.y, -lscale.z); | 380 | tScale = new Vector3(lscale.X, lscale.Y, -lscale.Z); |
382 | scale = ((rot * tScale)); | 381 | scale = ((tScale * rot)); |
383 | vertexes[3] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); | 382 | vertexes[3] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z))); |
384 | 383 | ||
385 | //vertexes[3].x = pos.X + vertexes[3].x; | 384 | //vertexes[3].x = pos.X + vertexes[3].x; |
386 | // vertexes[3].y = pos.Y + vertexes[3].y; | 385 | // vertexes[3].y = pos.Y + vertexes[3].y; |
@@ -390,9 +389,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
390 | FaceC[1] = vertexes[3]; | 389 | FaceC[1] = vertexes[3]; |
391 | FaceA[5] = vertexes[3]; | 390 | FaceA[5] = vertexes[3]; |
392 | 391 | ||
393 | tScale = new Vector3(-lscale.x, lscale.y, lscale.z); | 392 | tScale = new Vector3(-lscale.X, lscale.Y, lscale.Z); |
394 | scale = ((rot * tScale)); | 393 | scale = ((tScale * rot)); |
395 | vertexes[4] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); | 394 | vertexes[4] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z))); |
396 | 395 | ||
397 | // vertexes[4].x = pos.X + vertexes[4].x; | 396 | // vertexes[4].x = pos.X + vertexes[4].x; |
398 | // vertexes[4].y = pos.Y + vertexes[4].y; | 397 | // vertexes[4].y = pos.Y + vertexes[4].y; |
@@ -402,9 +401,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
402 | FaceA[2] = vertexes[4]; | 401 | FaceA[2] = vertexes[4]; |
403 | FaceD[4] = vertexes[4]; | 402 | FaceD[4] = vertexes[4]; |
404 | 403 | ||
405 | tScale = new Vector3(-lscale.x, lscale.y, -lscale.z); | 404 | tScale = new Vector3(-lscale.X, lscale.Y, -lscale.Z); |
406 | scale = ((rot * tScale)); | 405 | scale = ((tScale * rot)); |
407 | vertexes[5] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); | 406 | vertexes[5] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z))); |
408 | 407 | ||
409 | // vertexes[5].x = pos.X + vertexes[5].x; | 408 | // vertexes[5].x = pos.X + vertexes[5].x; |
410 | // vertexes[5].y = pos.Y + vertexes[5].y; | 409 | // vertexes[5].y = pos.Y + vertexes[5].y; |
@@ -414,9 +413,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
414 | FaceC[2] = vertexes[5]; | 413 | FaceC[2] = vertexes[5]; |
415 | FaceB[5] = vertexes[5]; | 414 | FaceB[5] = vertexes[5]; |
416 | 415 | ||
417 | tScale = new Vector3(-lscale.x, -lscale.y, lscale.z); | 416 | tScale = new Vector3(-lscale.X, -lscale.Y, lscale.Z); |
418 | scale = ((rot * tScale)); | 417 | scale = ((tScale * rot)); |
419 | vertexes[6] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); | 418 | vertexes[6] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z))); |
420 | 419 | ||
421 | // vertexes[6].x = pos.X + vertexes[6].x; | 420 | // vertexes[6].x = pos.X + vertexes[6].x; |
422 | // vertexes[6].y = pos.Y + vertexes[6].y; | 421 | // vertexes[6].y = pos.Y + vertexes[6].y; |
@@ -426,9 +425,9 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
426 | FaceA[3] = vertexes[6]; | 425 | FaceA[3] = vertexes[6]; |
427 | FaceB[4] = vertexes[6]; | 426 | FaceB[4] = vertexes[6]; |
428 | 427 | ||
429 | tScale = new Vector3(-lscale.x, -lscale.y, -lscale.z); | 428 | tScale = new Vector3(-lscale.X, -lscale.Y, -lscale.Z); |
430 | scale = ((rot * tScale)); | 429 | scale = ((tScale * rot)); |
431 | vertexes[7] = (new Vector3((pos.X + scale.x), (pos.Y + scale.y), (pos.Z + scale.z))); | 430 | vertexes[7] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z))); |
432 | 431 | ||
433 | // vertexes[7].x = pos.X + vertexes[7].x; | 432 | // vertexes[7].x = pos.X + vertexes[7].x; |
434 | // vertexes[7].y = pos.Y + vertexes[7].y; | 433 | // vertexes[7].y = pos.Y + vertexes[7].y; |
@@ -533,8 +532,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
533 | //Vector3 topos = new Vector3(0, 0, 0); | 532 | //Vector3 topos = new Vector3(0, 0, 0); |
534 | // float z = -point3d.z - topos.z; | 533 | // float z = -point3d.z - topos.z; |
535 | 534 | ||
536 | returnpt.X = (int)point3d.x;//(int)((topos.x - point3d.x) / z * d); | 535 | returnpt.X = (int)point3d.X;//(int)((topos.x - point3d.x) / z * d); |
537 | returnpt.Y = (int)(255 - point3d.y);//(int)(255 - (((topos.y - point3d.y) / z * d))); | 536 | returnpt.Y = (int)(255 - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d))); |
538 | 537 | ||
539 | return returnpt; | 538 | return returnpt; |
540 | } | 539 | } |