From b42fec5c74e51ca909ce884a564ee3e9163ae16a Mon Sep 17 00:00:00 2001 From: Dahlia Trimble Date: Thu, 2 Apr 2009 06:54:48 +0000 Subject: partial support for sculpted prim "inside out" setting --- OpenSim/Region/Physics/Meshing/SculptMesh.cs | 49 +++++++++++++++++++++------- 1 file changed, 38 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/Meshing/SculptMesh.cs b/OpenSim/Region/Physics/Meshing/SculptMesh.cs index b458ed4..5b0a881 100644 --- a/OpenSim/Region/Physics/Meshing/SculptMesh.cs +++ b/OpenSim/Region/Physics/Meshing/SculptMesh.cs @@ -231,6 +231,10 @@ namespace PrimMesher normals = new List(); uvs = new List(); + if (mirror) + if (sculptType != SculptType.plane) + invert = !invert; + //float sourceScaleFactor = (float)lod / (float)Math.Max(sculptBitmap.Width, sculptBitmap.Height); float sourceScaleFactor = (float)(lod) / (float)Math.Sqrt(sculptBitmap.Width * sculptBitmap.Height); bool scaleSourceImage = sourceScaleFactor < 1.0f ? true : false; @@ -338,20 +342,43 @@ namespace PrimMesher if (viewerMode) { - f1 = new Face(p1, p3, p4, p1, p3, p4); - f1.uv1 = p1; - f1.uv2 = p3; - f1.uv3 = p4; - - f2 = new Face(p1, p4, p2, p1, p4, p2); - f2.uv1 = p1; - f2.uv2 = p4; - f2.uv3 = p2; + if (invert) + { + f1 = new Face(p1, p4, p3, p1, p4, p3); + f1.uv1 = p1; + f1.uv2 = p4; + f1.uv3 = p3; + + f2 = new Face(p1, p2, p4, p1, p2, p4); + f2.uv1 = p1; + f2.uv2 = p2; + f2.uv3 = p4; + } + else + { + f1 = new Face(p1, p3, p4, p1, p3, p4); + f1.uv1 = p1; + f1.uv2 = p3; + f1.uv3 = p4; + + f2 = new Face(p1, p4, p2, p1, p4, p2); + f2.uv1 = p1; + f2.uv2 = p4; + f2.uv3 = p2; + } } else { - f1 = new Face(p1, p3, p4); - f2 = new Face(p1, p4, p2); + if (invert) + { + f1 = new Face(p1, p4, p3); + f2 = new Face(p1, p2, p4); + } + else + { + f1 = new Face(p1, p3, p4); + f2 = new Face(p1, p4, p2); + } } this.faces.Add(f1); -- cgit v1.1