internal bool NeedsMeshing(ODEPrim prim, byte physicalType)
{
PrimitiveBaseShape pbs = prim.Shape;
// most of this is redundant now as the mesher will return null if it cant mesh a prim
// but we still need to check for sculptie meshing being enabled so this is the most
// convenient place to do it for now...
// //if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle && pbs.ProfileCurve == (byte)Primitive.ProfileCurve.Circle && pbs.PathScaleY <= 0.75f)
// //MainConsole.Instance.Debug("needsMeshing: " + " pathCurve: " + pbs.PathCurve.ToString() + " profileCurve: " + pbs.ProfileCurve.ToString() + " pathScaleY: " + Primitive.UnpackPathScale(pbs.PathScaleY).ToString());
int iPropertiesNotSupportedDefault = 0;
// return true;
if (forceSimplePrimMeshing)
return true;
// let simple spheres use ode sphere object
PrimitiveBaseShape sphere = PrimitiveBaseShape.CreateSphere();
if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte) Extrusion.Curve1
&& pbs.Scale.X == pbs.Scale.Y && pbs.Scale.X == pbs.Scale.Z && pbs.ProfileHollow == sphere.ProfileHollow &&
pbs.PathBegin == sphere.PathBegin && pbs.PathEnd == sphere.PathEnd &&
pbs.PathCurve == sphere.PathCurve && pbs.HollowShape == sphere.HollowShape &&
pbs.PathRadiusOffset == sphere.PathRadiusOffset && pbs.PathRevolutions == sphere.PathRevolutions &&
pbs.PathScaleY == sphere.PathScaleY && pbs.PathShearX == sphere.PathShearX &&
pbs.PathShearY == sphere.PathShearY && pbs.PathSkew == sphere.PathSkew &&
pbs.PathTaperY == sphere.PathTaperY && pbs.PathTwist == sphere.PathTwist &&
pbs.PathTwistBegin == sphere.PathTwistBegin && pbs.ProfileBegin == sphere.ProfileBegin &&
pbs.ProfileEnd == sphere.ProfileEnd && pbs.ProfileHollow == sphere.ProfileHollow &&
pbs.ProfileShape == sphere.ProfileShape)
return false;
if (pbs.SculptEntry && !meshSculptedPrim)
return false;
if (pbs.SculptType != (byte) SculptType.Mesh &&
pbs.SculptType != (byte) SculptType.None)
return true; //Sculpty, mesh it
if (pbs.SculptType == (byte) SculptType.Mesh)
{
//Mesh, we need to see what the prims says to do with it
if (physicalType == (byte) PhysicsShapeType.Prim)
return false; //Supposed to be a simple box, nothing more
else
return true; //Mesh it!
}
// if it's a standard box or sphere with no cuts, hollows, twist or top shear, return false since ODE can use an internal representation for the prim
if (!forceSimplePrimMeshing)
{
if ((pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte) Extrusion.Straight)
/*|| (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1
&& pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z)*/)
{
if (pbs.ProfileBegin == 0 && pbs.ProfileEnd == 0
&& pbs.ProfileHollow == 0
&& pbs.PathTwist == 0 && pbs.PathTwistBegin == 0
&& pbs.PathBegin == 0 && pbs.PathEnd == 0
&& pbs.PathTaperX == 0 && pbs.PathTaperY == 0
&& pbs.PathScaleX == 100 && pbs.PathScaleY == 100
&& pbs.PathShearX == 0 && pbs.PathShearY == 0)
{
#if SPAM
MainConsole.Instance.Warn("NonMesh");
#endif
return false;
}
}
}
if (pbs.ProfileHollow != 0)
iPropertiesNotSupportedDefault++;
else if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0))
iPropertiesNotSupportedDefault++;
else if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0)
iPropertiesNotSupportedDefault++;
else if (pbs.PathBegin != 0 || pbs.PathEnd != 0)
iPropertiesNotSupportedDefault++;
else if ((pbs.PathScaleX != 100) || (pbs.PathScaleY != 100))
iPropertiesNotSupportedDefault++;
else if ((pbs.PathShearX != 0) || (pbs.PathShearY != 0))
iPropertiesNotSupportedDefault++;
else if (pbs.ProfileShape == ProfileShape.Circle && pbs.PathCurve == (byte) Extrusion.Straight)
iPropertiesNotSupportedDefault++;
else 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))
iPropertiesNotSupportedDefault++;
else if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte) Extrusion.Curve1)
iPropertiesNotSupportedDefault++;
// test for torus
else if ((pbs.ProfileCurve & 0x07) == (byte) ProfileShape.Square &&
pbs.PathCurve == (byte) Extrusion.Curve1)
iPropertiesNotSupportedDefault++;
else if ((pbs.ProfileCurve & 0x07) == (byte) ProfileShape.HalfCircle &&
(pbs.PathCurve == (byte) Extrusion.Curve1 || pbs.PathCurve == (byte) Extrusion.Curve2))
iPropertiesNotSupportedDefault++;
else if ((pbs.ProfileCurve & 0x07) == (byte) ProfileShape.EquilateralTriangle)
{
if (pbs.PathCurve == (byte) Extrusion.Straight)
{
iPropertiesNotSupportedDefault++;
}
else if (pbs.PathCurve == (byte) Extrusion.Curve1)
{
iPropertiesNotSupportedDefault++;
}
}
if ((pbs.ProfileCurve & 0x07) == (byte) ProfileShape.Circle)
{
if (pbs.PathCurve == (byte) Extrusion.Straight)
{
iPropertiesNotSupportedDefault++;
}
// ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits
else if (pbs.PathCurve == (byte) Extrusion.Curve1)
{
iPropertiesNotSupportedDefault++;
}
}
if (iPropertiesNotSupportedDefault == 0)
{
#if SPAM
MainConsole.Instance.Warn("NonMesh");
#endif
return false;
}
#if SPAM
MainConsole.Instance.Debug("Mesh");
#endif
return true;
}