aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs39
1 files changed, 36 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
index 975184a..f1883b5 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
@@ -262,12 +262,12 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
262 262
263 m_colors.Clear(); 263 m_colors.Clear();
264 m_warpTextures.Clear(); 264 m_warpTextures.Clear();
265
265 GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; 266 GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
266 GC.Collect(); 267 GC.Collect();
267 GC.WaitForPendingFinalizers(); 268 GC.WaitForPendingFinalizers();
268 GC.Collect(); 269 GC.Collect();
269 GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.Default; 270 GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.Default;
270
271 return bitmap; 271 return bitmap;
272 } 272 }
273 273
@@ -441,6 +441,34 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
441 ); 441 );
442 } 442 }
443 443
444 private void UVPlanarMap(Vertex v, Vector3 scale, out float tu, out float tv)
445 {
446 Vector3 scaledPos = v.Position * scale;
447 float d = v.Normal.X;
448 if (d >= 0.5f)
449 {
450 tu = 2f * scaledPos.Y;
451 tv = scaledPos.X * v.Normal.Z - scaledPos.Z * v.Normal.X;
452 }
453 else if( d <= -0.5f)
454 {
455 tu = -2f * scaledPos.Y;
456 tv = -scaledPos.X * v.Normal.Z + scaledPos.Z * v.Normal.X;
457 }
458 else if (v.Normal.Y > 0f)
459 {
460 tu = -2f * scaledPos.X;
461 tv = scaledPos.Y * v.Normal.Z - scaledPos.Z * v.Normal.Y;
462 }
463 else
464 {
465 tu = 2f * scaledPos.X;
466 tv = -scaledPos.Y * v.Normal.Z + scaledPos.Z * v.Normal.Y;
467 }
468
469 tv *= 2f;
470 }
471
444 private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim) 472 private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim)
445 { 473 {
446 if ((PCode)prim.Shape.PCode != PCode.Prim) 474 if ((PCode)prim.Shape.PCode != PCode.Prim)
@@ -576,8 +604,13 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
576 warp_Vertex vert; 604 warp_Vertex vert;
577 Vertex v = face.Vertices[j]; 605 Vertex v = face.Vertices[j];
578 warp_Vector pos = ConvertVector(v.Position); 606 warp_Vector pos = ConvertVector(v.Position);
579 tu = v.TexCoord.X - 0.5f; 607 if(teFace.TexMapType == MappingType.Planar)
580 tv = 0.5f - v.TexCoord.Y; 608 UVPlanarMap(v, prim.Scale,out tu, out tv);
609 else
610 {
611 tu = v.TexCoord.X - 0.5f;
612 tv = 0.5f - v.TexCoord.Y;
613 }
581 if (rotation != 0) 614 if (rotation != 0)
582 { 615 {
583 float tur = tu * rc - tv * rs; 616 float tur = tu * rc - tv * rs;