* Added Taper support to the Meshmerizer for Cube and Cylinder.

* Removed the hull verbosity
ThreadPoolClientBranch
Teravus Ovares 2008-02-08 23:28:38 +00:00
parent f05f583613
commit fadf5b479f
3 changed files with 83 additions and 14 deletions

View File

@ -36,6 +36,11 @@ namespace OpenSim.Region.Physics.Meshing
public float stopParameter; public float stopParameter;
public PhysicsVector size; public PhysicsVector size;
public float taperTopFactorX = 1f;
public float taperTopFactorY = 1f;
public float taperBotFactorX = 1f;
public float taperBotFactorY = 1f;
public Mesh Extrude(Mesh m) public Mesh Extrude(Mesh m)
{ {
// Currently only works for iSteps=1; // Currently only works for iSteps=1;
@ -50,8 +55,8 @@ namespace OpenSim.Region.Physics.Meshing
continue; continue;
v.Z = +.5f; v.Z = +.5f;
v.X *= size.X; v.X *= (size.X * taperTopFactorX);
v.Y *= size.Y; v.Y *= (size.Y * taperTopFactorY);
v.Z *= size.Z; v.Z *= size.Z;
} }
@ -61,8 +66,8 @@ namespace OpenSim.Region.Physics.Meshing
continue; continue;
v.Z = -.5f; v.Z = -.5f;
v.X *= size.X; v.X *= (size.X * taperBotFactorX);
v.Y *= size.Y; v.Y *= (size.Y * taperBotFactorY);
v.Z *= size.Z; v.Z *= size.Z;
} }

View File

@ -58,7 +58,7 @@ namespace OpenSim.Region.Physics.Meshing
// Setting baseDir to a path will enable the dumping of raw files // Setting baseDir to a path will enable the dumping of raw files
// raw files can be imported by blender so a visual inspection of the results can be done // raw files can be imported by blender so a visual inspection of the results can be done
// const string baseDir = "rawFiles"; // const string baseDir = "rawFiles";
private const string baseDir = null; private const string baseDir = null; //"rawFiles";
private static void IntersectionParameterPD(PhysicsVector p1, PhysicsVector r1, PhysicsVector p2, private static void IntersectionParameterPD(PhysicsVector p1, PhysicsVector r1, PhysicsVector p2,
PhysicsVector r2, ref float lambda, ref float mu) PhysicsVector r2, ref float lambda, ref float mu)
@ -181,7 +181,13 @@ namespace OpenSim.Region.Physics.Meshing
UInt16 hollowFactor = primShape.ProfileHollow; UInt16 hollowFactor = primShape.ProfileHollow;
UInt16 profileBegin = primShape.ProfileBegin; UInt16 profileBegin = primShape.ProfileBegin;
UInt16 profileEnd = primShape.ProfileEnd; UInt16 profileEnd = primShape.ProfileEnd;
UInt16 taperX = primShape.PathScaleX;
UInt16 taperY = primShape.PathScaleY;
//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 // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface
// of a block are basically the same // of a block are basically the same
// They may be warped differently but the shape is identical // They may be warped differently but the shape is identical
@ -299,6 +305,35 @@ namespace OpenSim.Region.Physics.Meshing
extr.size = size; extr.size = size;
if (taperX != 100)
{
if (taperX > 100)
{
extr.taperTopFactorX = 1.0f - ((float)taperX / 200);
//m_log.Warn("taperTopFactorX: " + extr.taperTopFactorX.ToString());
}
else
{
extr.taperBotFactorX = 1.0f - ((100 - (float)taperX) / 100);
//m_log.Warn("taperBotFactorX: " + extr.taperBotFactorX.ToString());
}
}
if (taperY != 100)
{
if (taperY > 100)
{
extr.taperTopFactorY = 1.0f - ((float)taperY / 200);
//m_log.Warn("taperTopFactorY: " + extr.taperTopFactorY.ToString());
}
else
{
extr.taperBotFactorY = 1.0f - ((100 - (float)taperY) / 100);
//m_log.Warn("taperBotFactorY: " + extr.taperBotFactorY.ToString());
}
}
Mesh result = extr.Extrude(m); Mesh result = extr.Extrude(m);
result.DumpRaw(baseDir, primName, "Z extruded"); result.DumpRaw(baseDir, primName, "Z extruded");
return result; return result;
@ -309,7 +344,8 @@ namespace OpenSim.Region.Physics.Meshing
UInt16 hollowFactor = primShape.ProfileHollow; UInt16 hollowFactor = primShape.ProfileHollow;
UInt16 profileBegin = primShape.ProfileBegin; UInt16 profileBegin = primShape.ProfileBegin;
UInt16 profileEnd = primShape.ProfileEnd; UInt16 profileEnd = primShape.ProfileEnd;
UInt16 taperX = primShape.PathScaleX;
UInt16 taperY = primShape.PathScaleY;
// Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface
// of a block are basically the same // of a block are basically the same
// They may be warped differently but the shape is identical // They may be warped differently but the shape is identical
@ -589,6 +625,34 @@ namespace OpenSim.Region.Physics.Meshing
Extruder extr = new Extruder(); Extruder extr = new Extruder();
extr.size = size; extr.size = size;
if (taperX != 100)
{
if (taperX > 100)
{
extr.taperTopFactorX = 1.0f - ((float)taperX / 200);
//m_log.Warn("taperTopFactorX: " + extr.taperTopFactorX.ToString());
}
else
{
extr.taperBotFactorX = 1.0f - ((100 - (float)taperX) / 100);
//m_log.Warn("taperBotFactorX: " + extr.taperBotFactorX.ToString());
}
}
if (taperY != 100)
{
if (taperY > 100)
{
extr.taperTopFactorY = 1.0f - ((float)taperY / 200);
//m_log.Warn("taperTopFactorY: " + extr.taperTopFactorY.ToString());
}
else
{
extr.taperBotFactorY = 1.0f - ((100 - (float)taperY) / 100);
//m_log.Warn("taperBotFactorY: " + extr.taperBotFactorY.ToString());
}
}
Mesh result = extr.Extrude(m); Mesh result = extr.Extrude(m);
result.DumpRaw(baseDir, primName, "Z extruded"); result.DumpRaw(baseDir, primName, "Z extruded");

View File

@ -245,9 +245,9 @@ namespace OpenSim.Region.Physics.Meshing
SimpleHull otherHullClone = otherHull.Clone(); SimpleHull otherHullClone = otherHull.Clone();
bool intersects = false; bool intersects = false;
m_log.Debug("State before intersection detection"); //m_log.Debug("State before intersection detection");
m_log.Debug(String.Format("The baseHull is:\n{1}", 0, baseHullClone.ToString())); //m_log.Debug(String.Format("The baseHull is:\n{1}", 0, baseHullClone.ToString()));
m_log.Debug(String.Format("The otherHull is:\n{1}", 0, otherHullClone.ToString())); //m_log.Debug(String.Format("The otherHull is:\n{1}", 0, otherHullClone.ToString()));
{ {
int iBase, iOther; int iBase, iOther;
@ -276,8 +276,8 @@ namespace OpenSim.Region.Physics.Meshing
} }
} }
m_log.Debug("State after intersection detection for the base hull"); //m_log.Debug("State after intersection detection for the base hull");
m_log.Debug(String.Format("The baseHull is:\n{1}", 0, baseHullClone.ToString())); //m_log.Debug(String.Format("The baseHull is:\n{1}", 0, baseHullClone.ToString()));
{ {
int iOther, iBase; int iOther, iBase;
@ -305,8 +305,8 @@ namespace OpenSim.Region.Physics.Meshing
} }
} }
m_log.Debug("State after intersection detection for the base hull"); //m_log.Debug("State after intersection detection for the base hull");
m_log.Debug(String.Format("The otherHull is:\n{1}", 0, otherHullClone.ToString())); //m_log.Debug(String.Format("The otherHull is:\n{1}", 0, otherHullClone.ToString()));
bool otherIsInBase = baseHullClone.containsPointsFrom(otherHullClone); bool otherIsInBase = baseHullClone.containsPointsFrom(otherHullClone);
@ -389,7 +389,7 @@ namespace OpenSim.Region.Physics.Meshing
done = true; done = true;
} }
m_log.Debug(String.Format("The resulting Hull is:\n{1}", 0, result.ToString())); //m_log.Debug(String.Format("The resulting Hull is:\n{1}", 0, result.ToString()));
return result; return result;
} }