* Adds poor support for ellipsis in the Meshmerizer. This will get better.. notice the huge nasty facets! Regular spheres still work as they did.

0.6.0-stable
Teravus Ovares 2008-04-08 01:29:45 +00:00
parent e679f3eb36
commit d0f7784101
2 changed files with 113 additions and 2 deletions

View File

@ -204,6 +204,8 @@ namespace OpenSim.Region.Physics.Meshing
}
}
break;
default:
if (hshape == HollowShape.Same)
hshape= HollowShape.Square;
@ -986,6 +988,105 @@ namespace OpenSim.Region.Physics.Meshing
result.DumpRaw(baseDir, primName, "Z extruded");
return result;
}
private static Mesh CreateSphereMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size)
// Builds the z (+ and -) surfaces of a box shaped prim
{
UInt16 hollowFactor = primShape.ProfileHollow;
UInt16 profileBegin = primShape.ProfileBegin;
UInt16 profileEnd = primShape.ProfileEnd;
UInt16 taperX = primShape.PathScaleX;
UInt16 taperY = primShape.PathScaleY;
UInt16 pathShearX = primShape.PathShearX;
UInt16 pathShearY = primShape.PathShearY;
Mesh m = new Mesh();
float radius = 0.6f;
float sq5 = (float) Math.Sqrt(5.0);
float phi = (1 + sq5) * 0.5f;
float rat = (float) Math.Sqrt(10f + (2f * sq5)) / (4f * phi);
float a = (radius / rat) * 0.5f;
float b = (radius / rat) / (2.0f * phi);
Vertex v1 = new Vertex(0f, b, -a);
Vertex v2 = new Vertex(b, a, 0f);
Vertex v3 = new Vertex(-b, a, 0f);
Vertex v4 = new Vertex(0f, b, a);
Vertex v5 = new Vertex(0f, -b, a);
Vertex v6 = new Vertex(-a, 0f, b);
Vertex v7 = new Vertex(0f, -b, -a);
Vertex v8 = new Vertex(a, 0f, -b);
Vertex v9 = new Vertex(a, 0f, b);
Vertex v10 = new Vertex(-a, 0f, -b);
Vertex v11 = new Vertex(b, -a, 0);
Vertex v12 = new Vertex(-b, -a, 0);
m.Add(v1);
m.Add(v2);
m.Add(v3);
m.Add(v4);
m.Add(v5);
m.Add(v6);
m.Add(v7);
m.Add(v8);
m.Add(v9);
m.Add(v10);
m.Add(v11);
m.Add(v12);
Triangle t1 = new Triangle(v1, v2, v3);
Triangle t2 = new Triangle(v4, v3, v2);
Triangle t3 = new Triangle(v4, v5, v6);
Triangle t4 = new Triangle(v4, v9, v5);
Triangle t5 = new Triangle(v1, v7, v8);
Triangle t6 = new Triangle(v1, v10, v7);
Triangle t7 = new Triangle(v5, v11, v12);
Triangle t8 = new Triangle(v7, v12, v11);
Triangle t9 = new Triangle(v3, v6, v10);
Triangle t10 = new Triangle(v12, v10, v6);
Triangle t11 = new Triangle(v2, v8, v9);
Triangle t12 = new Triangle(v11, v9, v8);
Triangle t13 = new Triangle(v4, v6, v3);
Triangle t14 = new Triangle(v4, v2, v9);
Triangle t15 = new Triangle(v1, v3, v10);
Triangle t16 = new Triangle(v1, v8, v2);
Triangle t17 = new Triangle(v7, v10, v12);
Triangle t18 = new Triangle(v7, v11, v8);
Triangle t19 = new Triangle(v5, v12, v6);
Triangle t20 = new Triangle(v5, v9, v11);
m.Add(t1);
m.Add(t2);
m.Add(t3);
m.Add(t4);
m.Add(t5);
m.Add(t6);
m.Add(t7);
m.Add(t8);
m.Add(t9);
m.Add(t10);
m.Add(t11);
m.Add(t12);
m.Add(t13);
m.Add(t14);
m.Add(t15);
m.Add(t16);
m.Add(t17);
m.Add(t18);
m.Add(t19);
m.Add(t20);
// strechy!
foreach (Vertex v in m.vertices)
{
v.X *= size.X;
v.Y *= size.Y;
v.Z *= size.Z;
}
foreach (Triangle t in m.triangles)
{
t.invertNormal();
}
m.DumpRaw(baseDir, primName, "Z extruded");
return m;
}
public static void CalcNormals(Mesh mesh)
{
@ -1065,6 +1166,14 @@ namespace OpenSim.Region.Physics.Meshing
CalcNormals(mesh);
}
break;
case ProfileShape.HalfCircle:
if (primShape.PathCurve == (byte)Extrusion.Curve1)
{
mesh = CreateSphereMesh(primName, primShape, size);
CalcNormals(mesh);
}
break;
case ProfileShape.EquilateralTriangle:
mesh = CreatePrismMesh(primName, primShape, size);
CalcNormals(mesh);

View File

@ -1449,6 +1449,8 @@ namespace OpenSim.Region.Physics.OdePlugin
if (pbs.ProfileShape == ProfileShape.Circle && pbs.PathCurve == (byte)Extrusion.Straight)
return true;
if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1 && (pbs.Scale.X != pbs.Scale.Y || pbs.Scale.Y != pbs.Scale.Z || pbs.Scale.Z != pbs.Scale.X))
return true;
if (pbs.ProfileShape == ProfileShape.EquilateralTriangle)
return true;