* Moves the Meshmerizer to a separate plugin

* Experimental.   Linux Prebuild needs testing.
* One more update after this to remove the ODEMeshing directory....
This commit is contained in:
Teravus Ovares
2007-11-10 19:13:52 +00:00
parent 43ea37b5a0
commit cb07ba0d68
18 changed files with 1996 additions and 68 deletions

View File

@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.Physics.Meshing
{
class Extruder
{
public float startParameter;
public float stopParameter;
public Manager.PhysicsVector size;
public Mesh Extrude(Mesh m)
{
// Currently only works for iSteps=1;
Mesh result = new Mesh();
Mesh workingPlus = m.Clone();
Mesh workingMinus = m.Clone();
foreach (Vertex v in workingPlus.vertices)
{
if (v == null)
continue;
v.Z = +.5f;
v.X *= size.X;
v.Y *= size.Y;
v.Z *= size.Z;
}
foreach (Vertex v in workingMinus.vertices)
{
if (v == null)
continue;
v.Z = -.5f;
v.X *= size.X;
v.Y *= size.Y;
v.Z *= size.Z;
}
foreach (Triangle t in workingMinus.triangles)
{
t.invertNormal();
}
result.Append(workingMinus);
result.Append(workingPlus);
int iLastNull = 0;
for (int i = 0; i < workingPlus.vertices.Count; i++)
{
int iNext = (i + 1);
if (workingPlus.vertices[i] == null) // Can't make a simplex here
{
iLastNull = i+1;
continue;
}
if (i == workingPlus.vertices.Count-1) // End of list
{
iNext = iLastNull;
}
if (workingPlus.vertices[iNext] == null) // Null means wrap to begin of last segment
{
iNext = iLastNull;
}
Triangle tSide;
tSide = new Triangle(workingPlus.vertices[i], workingMinus.vertices[i], workingPlus.vertices[iNext]);
result.Add(tSide);
tSide = new Triangle(workingPlus.vertices[iNext], workingMinus.vertices[i], workingMinus.vertices[iNext]);
result.Add(tSide);
}
return result;
}
}
}