From 6bb4ab0563af81a680192f2ee1c0c4f81aabcdfb Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Fri, 9 May 2008 02:00:55 +0000 Subject: * Applying Dahlia's Triangular hole in a cube peg patch. Fixes the hollow orientation in a cube in the meshmerizer. Thanks Dahlia! * See mantis 0001203 for more details! --- CONTRIBUTORS.txt | 1 + OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index b7d9fe8..6441412 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -55,6 +55,7 @@ Patches * John R Sohn(XenReborn) * Xantor * YZh +* Dahlia LSL Devs diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index db91028..9c6dff4 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -331,11 +331,29 @@ namespace OpenSim.Region.Physics.Meshing if (hshape == HollowShape.Triangle) { float hollowFactorF = (float)fhollowFactor / (float)50000; - Vertex IMM = new Vertex(-0.25f * hollowFactorF, -0.45f * hollowFactorF, 0.0f); - Vertex IPM = new Vertex(+0.5f * hollowFactorF, +0f * hollowFactorF, 0.0f); - Vertex IPP = new Vertex(-0.25f * hollowFactorF, +0.45f * hollowFactorF, 0.0f); + Vertex IMM; + Vertex IPM; + Vertex IPP; + if (pshape == ProfileShape.Square) + { + // corner points are at 345, 105, and 225 degrees for the triangle within a box + + //IMM = new Vertex(((float)Math.Cos(345.0 * DEG_TO_RAD) * 0.5f) * hollowFactorF, ((float)Math.Sin(345.0 * DEG_TO_RAD) * 0.5f) * hollowFactorF, 0.0f); + //IPM = new Vertex(((float)Math.Cos(105.0 * DEG_TO_RAD) * 0.5f) * hollowFactorF, ((float)Math.Sin(105.0 * DEG_TO_RAD) * 0.5f) * hollowFactorF, 0.0f); + //IPP = new Vertex(((float)Math.Cos(225.0 * DEG_TO_RAD) * 0.5f) * hollowFactorF, ((float)Math.Sin(225.0 * DEG_TO_RAD) * 0.5f) * hollowFactorF, 0.0f); + // hard coded here for speed, the equations are in the commented out lines above + IMM = new Vertex(0.48296f * hollowFactorF, -0.12941f * hollowFactorF, 0.0f); + IPM = new Vertex(-0.12941f * hollowFactorF, 0.48296f * hollowFactorF, 0.0f); + IPP = new Vertex(-0.35355f * hollowFactorF, -0.35355f * hollowFactorF, 0.0f); + } + else + { + IMM = new Vertex(-0.25f * hollowFactorF, -0.45f * hollowFactorF, 0.0f); + IPM = new Vertex(+0.5f * hollowFactorF, +0f * hollowFactorF, 0.0f); + IPP = new Vertex(-0.25f * hollowFactorF, +0.45f * hollowFactorF, 0.0f); + } holeHull = new SimpleHull(); -- cgit v1.1