* Adds Top Shear support to the Meshmerizer for the Cube prim and the Cylinder prim.

ThreadPoolClientBranch
Teravus Ovares 2008-02-09 05:18:52 +00:00
parent fec65b3c69
commit c9b5516ca8
4 changed files with 87 additions and 2 deletions

View File

@ -40,6 +40,8 @@ namespace OpenSim.Region.Physics.Meshing
public float taperTopFactorY = 1f;
public float taperBotFactorX = 1f;
public float taperBotFactorY = 1f;
public float pushX = 0f;
public float pushY = 0f;
public Mesh Extrude(Mesh m)
{
@ -54,10 +56,17 @@ namespace OpenSim.Region.Physics.Meshing
if (v == null)
continue;
// This is the top
// Set the Z + .5 to match the rest of the scale of the mesh
// Scale it by Size, and Taper the scaling
v.Z = +.5f;
v.X *= (size.X * taperTopFactorX);
v.Y *= (size.Y * taperTopFactorY);
v.Z *= size.Z;
//Push the top of the object over by the Top Shear amount
v.X += pushX * size.X;
v.Y += pushY * size.X;
}
foreach (Vertex v in workingMinus.vertices)
@ -65,6 +74,7 @@ namespace OpenSim.Region.Physics.Meshing
if (v == null)
continue;
// This is the bottom
v.Z = -.5f;
v.X *= (size.X * taperBotFactorX);
v.Y *= (size.Y * taperBotFactorY);

View File

@ -183,11 +183,14 @@ namespace OpenSim.Region.Physics.Meshing
UInt16 profileEnd = primShape.ProfileEnd;
UInt16 taperX = primShape.PathScaleX;
UInt16 taperY = primShape.PathScaleY;
UInt16 pathShearX = primShape.PathShearX;
UInt16 pathShearY = primShape.PathShearY;
//m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString());
//m_log.Error("pathTaper:" + primShape.PathTaperX.ToString() + "," + primShape.PathTaperY.ToString());
//m_log.Error("ProfileBegin:" + primShape.ProfileBegin.ToString() + "," + primShape.ProfileBegin.ToString());
//m_log.Error("PathScale:" + primShape.PathScaleX.ToString() + "," + primShape.PathScaleY.ToString());
// Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface
// of a block are basically the same
// They may be warped differently but the shape is identical
@ -242,7 +245,7 @@ namespace OpenSim.Region.Physics.Meshing
// Calculated separately to avoid errors
cutHull.AddVertex(legEnd);
m_log.Debug(String.Format("Starting cutting of the hollow shape from the prim {1}", 0, primName));
//m_log.Debug(String.Format("Starting cutting of the hollow shape from the prim {1}", 0, primName));
SimpleHull cuttedHull = SimpleHull.SubtractHull(outerHull, cutHull);
outerHull = cuttedHull;
@ -334,6 +337,37 @@ namespace OpenSim.Region.Physics.Meshing
}
}
if (pathShearX != 0)
{
if (pathShearX > 50) {
// Complimentary byte. Negative values wrap around the byte. Positive values go up to 50
extr.pushX = (((float)(256 - pathShearX) / 100) * -1f);
// m_log.Warn("pushX: " + extr.pushX);
}
else
{
extr.pushX = (float)pathShearX / 100;
// m_log.Warn("pushX: " + extr.pushX);
}
}
if (pathShearY != 0)
{
if (pathShearY > 50) {
// Complimentary byte. Negative values wrap around the byte. Positive values go up to 50
extr.pushY = (((float)(256 - pathShearY) / 100) * -1f);
//m_log.Warn("pushY: " + extr.pushY);
}
else
{
extr.pushY = (float)pathShearY / 100;
//m_log.Warn("pushY: " + extr.pushY);
}
}
Mesh result = extr.Extrude(m);
result.DumpRaw(baseDir, primName, "Z extruded");
return result;
@ -346,6 +380,9 @@ namespace OpenSim.Region.Physics.Meshing
UInt16 profileEnd = primShape.ProfileEnd;
UInt16 taperX = primShape.PathScaleX;
UInt16 taperY = primShape.PathScaleY;
UInt16 pathShearX = primShape.PathShearX;
UInt16 pathShearY = primShape.PathShearY;
// Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface
// of a block are basically the same
// They may be warped differently but the shape is identical
@ -653,7 +690,37 @@ namespace OpenSim.Region.Physics.Meshing
//m_log.Warn("taperBotFactorY: " + extr.taperBotFactorY.ToString());
}
}
if (pathShearX != 0)
{
if (pathShearX > 50)
{
// Complimentary byte. Negative values wrap around the byte. Positive values go up to 50
extr.pushX = (((float)(256 - pathShearX) / 100) * -1f);
//m_log.Warn("pushX: " + extr.pushX);
}
else
{
extr.pushX = (float)pathShearX / 100;
//m_log.Warn("pushX: " + extr.pushX);
}
}
if (pathShearY != 0)
{
if (pathShearY > 50)
{
// Complimentary byte. Negative values wrap around the byte. Positive values go up to 50
extr.pushY = (((float)(256 - pathShearY) / 100) * -1f);
//m_log.Warn("pushY: " + extr.pushY);
}
else
{
extr.pushY = (float)pathShearY / 100;
//m_log.Warn("pushY: " + extr.pushY);
}
}
Mesh result = extr.Extrude(m);
result.DumpRaw(baseDir, primName, "Z extruded");
return result;

View File

@ -389,7 +389,12 @@ namespace OpenSim.Region.Physics.OdePlugin
{
disableBody();
}
// This sleeper is there to moderate how long it takes between
// setting up the mesh and pre-processing it when we get rapid fire mesh requests on a single object
System.Threading.Thread.Sleep(10);
float[] vertexList = mesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory
int[] indexList = mesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage
int VertexCount = vertexList.GetLength(0)/3;

View File

@ -1014,6 +1014,9 @@ namespace OpenSim.Region.Physics.OdePlugin
if ((pbs.PathScaleX != 100) || (pbs.PathScaleY != 100))
return true;
if ((pbs.PathShearX != 0) || (pbs.PathShearY != 0))
return true;
if (pbs.ProfileShape == ProfileShape.Circle && pbs.PathCurve == (byte)Extrusion.Straight)
return true;