* Cleaned up tons of code duplication in ODEPrim

* Re-enabled the native ODE prim types when possible
* Fixed several invalid assumptions in the prim recycle process.
* Added better message for 'reused a disposed physicsactor'
* Added a way to recover from errors during collision_optimized
* Added a way to recover from an error condition where prim_geom wasn't reset properly
0.6.0-stable
Teravus Ovares 2008-10-14 02:48:30 +00:00
parent 55fa9c7378
commit 180e3de50f
2 changed files with 253 additions and 331 deletions

View File

@ -161,22 +161,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_density = parent_scene.geomDefaultDensity; m_density = parent_scene.geomDefaultDensity;
m_tensor = parent_scene.bodyMotorJointMaxforceTensor; m_tensor = parent_scene.bodyMotorJointMaxforceTensor;
body_autodisable_frames = parent_scene.bodyFramesAutoDisable; body_autodisable_frames = parent_scene.bodyFramesAutoDisable;
//if (_position.X > 257)
//{
//_position.X = 257;
//}
//if (_position.X < 0)
//{
//_position.X = 0;
//}
//if (_position.Y > 257)
//{
//_position.Y = 257;
//}
//if (_position.Y < 0)
//{
// _position.Y = 0;
//}
prim_geom = (IntPtr)0; prim_geom = (IntPtr)0;
prev_geom = (IntPtr)0; prev_geom = (IntPtr)0;
@ -715,14 +700,14 @@ namespace OpenSim.Region.Physics.OdePlugin
oldMesh = null; oldMesh = null;
} }
if (IsPhysical && Body == (IntPtr) 0) // if (IsPhysical && Body == (IntPtr) 0)
{ // {
// Recreate the body // Recreate the body
m_interpenetrationcount = 0; // m_interpenetrationcount = 0;
m_collisionscore = 0; // m_collisionscore = 0;
enableBody(); // enableBody();
} // }
} }
public void ProcessTaints(float timestep) public void ProcessTaints(float timestep)
@ -775,7 +760,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
else else
{ {
m_log.Error("[PHYSICS]: The scene reused a disposed PhysActor! *waves finger*, Don't be evil."); m_log.Error("[PHYSICS]: The scene reused a disposed PhysActor! *waves finger*, Don't be evil. A couple of things can cause this. An improper prim breakdown(be sure to set prim_geom to zero after d.GeomDestroy! An improper buildup (creating the geom failed). Or, the Scene Reused a physics actor after disposing it.)");
} }
} }
@ -910,6 +895,80 @@ namespace OpenSim.Region.Physics.OdePlugin
m_taintVelocity = PhysicsVector.Zero; m_taintVelocity = PhysicsVector.Zero;
} }
public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh)
{
if (_mesh != null)
{
setMesh(_parent_scene, _mesh);
}
else
{
if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1)
{
if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z)
{
if (((_size.X / 2f) > 0f))
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
try
{
SetGeom(d.CreateSphere(m_targetSpace, _size.X / 2));
}
catch (AccessViolationException)
{
m_log.Warn("[PHYSICS]: Unable to create physics proxy for object");
ode.dunlock(_parent_scene.world);
return;
}
}
else
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
try
{
SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
}
catch (AccessViolationException)
{
m_log.Warn("[PHYSICS]: Unable to create physics proxy for object");
ode.dunlock(_parent_scene.world);
return;
}
}
}
else
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
try
{
SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
}
catch (AccessViolationException)
{
m_log.Warn("[PHYSICS]: Unable to create physics proxy for object");
ode.dunlock(_parent_scene.world);
return;
}
}
}
else
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
try
{
SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
}
catch (AccessViolationException)
{
m_log.Warn("[PHYSICS]: Unable to create physics proxy for object");
ode.dunlock(_parent_scene.world);
return;
}
}
}
}
public void changeadd(float timestep) public void changeadd(float timestep)
{ {
int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
@ -930,93 +989,11 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
//if (_mesh == null )
// _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical);
lock (OdeScene.OdeLock) lock (OdeScene.OdeLock)
{ {
if (_mesh != null) CreateGeom(m_targetSpace, _mesh);
{
setMesh(_parent_scene, _mesh);
}
else
{
if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1)
{
if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z)
{
if (((_size.X / 2f) > 0f))
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
try
{
SetGeom(d.CreateSphere(m_targetSpace, _size.X / 2));
}
catch (AccessViolationException)
{
m_log.Warn("[PHYSICS]: Unable to create physics proxy for object");
ode.dunlock(_parent_scene.world);
return;
}
}
else
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
try
{
SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
}
catch (AccessViolationException)
{
m_log.Warn("[PHYSICS]: Unable to create physics proxy for object");
ode.dunlock(_parent_scene.world);
return;
}
}
}
else
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
try
{
SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
}
catch (AccessViolationException)
{
m_log.Warn("[PHYSICS]: Unable to create physics proxy for object");
ode.dunlock(_parent_scene.world);
return;
}
}
}
//else if (pbs.ProfileShape == ProfileShape.Circle && pbs.PathCurve == (byte)Extrusion.Straight)
//{
//Cyllinder
//if (_size.X == _size.Y)
//{
//prim_geom = d.CreateCylinder(m_targetSpace, _size.X / 2, _size.Z);
//}
//else
//{
//prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
//}
//}
else
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
try
{
SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
}
catch (AccessViolationException)
{
m_log.Warn("[PHYSICS]: Unable to create physics proxy for object");
ode.dunlock(_parent_scene.world);
return;
}
}
}
if (prim_geom != (IntPtr) 0) if (prim_geom != (IntPtr) 0)
{ {
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
@ -1277,8 +1254,22 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim)
{ {
if (prim_geom != IntPtr.Zero) if (prim_geom != IntPtr.Zero)
d.GeomDestroy(prim_geom); {
try
{
d.GeomDestroy(prim_geom);
prim_geom = IntPtr.Zero;
_mesh = null;
}
catch (System.AccessViolationException)
{
prim_geom = IntPtr.Zero;
m_log.Error("[PHYSICS]: PrimGeom dead");
}
}
changeadd(2f); changeadd(2f);
} }
@ -1340,66 +1331,31 @@ namespace OpenSim.Region.Physics.OdePlugin
//IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); //IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
if (mesh != null) CreateGeom(m_targetSpace, mesh);
{
setMesh(_parent_scene, mesh);
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
d.Quaternion myrot = new d.Quaternion();
myrot.X = _orientation.X;
myrot.Y = _orientation.Y;
myrot.Z = _orientation.Z;
myrot.W = _orientation.W;
d.GeomSetQuaternion(prim_geom, ref myrot);
//d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
if (IsPhysical && Body == (IntPtr)0) }
{ else
// Re creates body on size. {
// EnableBody also does setMass() _mesh = null;
enableBody(); CreateGeom(m_targetSpace, _mesh);
d.BodyEnable(Body); }
}
}
else
{
if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1)
{
if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z)
{
if (((_size.X / 2f) > 0f) && ((_size.X / 2f) < 1000))
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
SetGeom(d.CreateSphere(m_targetSpace, _size.X / 2));
}
else
{
m_log.Info("[PHYSICS]: Failed to load a sphere bad size");
_parent_scene.waitForSpaceUnlock(m_targetSpace);
SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
}
} d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
else d.Quaternion myrot = new d.Quaternion();
{ myrot.X = _orientation.X;
_parent_scene.waitForSpaceUnlock(m_targetSpace); myrot.Y = _orientation.Y;
SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); myrot.Z = _orientation.Z;
} myrot.W = _orientation.W;
} d.GeomSetQuaternion(prim_geom, ref myrot);
else //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
{ if (IsPhysical && Body == (IntPtr)0)
_parent_scene.waitForSpaceUnlock(m_targetSpace); {
SetGeom(prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z)); // Re creates body on size.
} // EnableBody also does setMass()
//prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); enableBody();
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); d.BodyEnable(Body);
d.Quaternion myrot = new d.Quaternion();
myrot.X = _orientation.X;
myrot.Y = _orientation.Y;
myrot.Z = _orientation.Z;
myrot.W = _orientation.W;
d.GeomSetQuaternion(prim_geom, ref myrot);
}
} }
_parent_scene.geom_name_map[prim_geom] = oldname; _parent_scene.geom_name_map[prim_geom] = oldname;
@ -1609,7 +1565,15 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
disableBody(); disableBody();
} }
d.GeomDestroy(prim_geom); try
{
d.GeomDestroy(prim_geom);
}
catch (System.AccessViolationException)
{
prim_geom = IntPtr.Zero;
m_log.Error("[PHYSICS]: PrimGeom dead");
}
prim_geom = (IntPtr) 0; prim_geom = (IntPtr) 0;
// we don't need to do space calculation because the client sends a position update also. // we don't need to do space calculation because the client sends a position update also.
if (_size.X <= 0) _size.X = 0.01f; if (_size.X <= 0) _size.X = 0.01f;
@ -1626,128 +1590,32 @@ namespace OpenSim.Region.Physics.OdePlugin
meshlod = _parent_scene.MeshSculptphysicalLOD; meshlod = _parent_scene.MeshSculptphysicalLOD;
IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
// createmesh returns null when it's a shape that isn't a cube. // createmesh returns null when it doesn't mesh.
if (mesh != null) CreateGeom(m_targetSpace, mesh);
{
setMesh(_parent_scene, mesh);
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
d.Quaternion myrot = new d.Quaternion();
myrot.X = _orientation.X;
myrot.Y = _orientation.Y;
myrot.Z = _orientation.Z;
myrot.W = _orientation.W;
d.GeomSetQuaternion(prim_geom, ref myrot);
//d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
if (IsPhysical && Body == (IntPtr)0)
{
// Re creates body on size.
// EnableBody also does setMass()
enableBody();
}
}
else
{
if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1)
{
if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z)
{
if (((_size.X / 2f) > 0f) && ((_size.X / 2f) < 1000))
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
SetGeom(d.CreateSphere(m_targetSpace, _size.X / 2));
}
else
{
m_log.Info("[PHYSICS]: Failed to load a sphere bad size");
_parent_scene.waitForSpaceUnlock(m_targetSpace);
SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
}
}
else
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
}
}
//else if (_pbs.ProfileShape == ProfileShape.Circle && _pbs.PathCurve == (byte)Extrusion.Straight)
//{
//Cyllinder
//if (_size.X == _size.Y)
//{
// prim_geom = d.CreateCylinder(m_targetSpace, _size.X / 2, _size.Z);
//}
//else
//{
//prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
//}
//}
else
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
SetGeom(prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
}
//prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
d.Quaternion myrot = new d.Quaternion();
myrot.X = _orientation.X;
myrot.Y = _orientation.Y;
myrot.Z = _orientation.Z;
myrot.W = _orientation.W;
d.GeomSetQuaternion(prim_geom, ref myrot);
}
} }
else else
{ {
if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1) _mesh = null;
{ CreateGeom(m_targetSpace, null);
if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z)
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
SetGeom(d.CreateSphere(m_targetSpace, _size.X / 2));
}
else
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
}
}
//else if (_pbs.ProfileShape == ProfileShape.Circle && _pbs.PathCurve == (byte)Extrusion.Straight)
//{
//Cyllinder
//if (_size.X == _size.Y)
//{
//prim_geom = d.CreateCylinder(m_targetSpace, _size.X / 2, _size.Z);
//}
//else
//{
//prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
//}
//}
else
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
SetGeom(d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
}
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
d.Quaternion myrot = new d.Quaternion();
//myrot.W = _orientation.w;
myrot.W = _orientation.W;
myrot.X = _orientation.X;
myrot.Y = _orientation.Y;
myrot.Z = _orientation.Z;
d.GeomSetQuaternion(prim_geom, ref myrot);
//d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
if (IsPhysical && Body == (IntPtr)0)
{
// Re creates body on size.
// EnableBody also does setMass()
enableBody();
d.BodyEnable(Body);
}
} }
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
d.Quaternion myrot = new d.Quaternion();
//myrot.W = _orientation.w;
myrot.W = _orientation.W;
myrot.X = _orientation.X;
myrot.Y = _orientation.Y;
myrot.Z = _orientation.Z;
d.GeomSetQuaternion(prim_geom, ref myrot);
//d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
if (IsPhysical && Body == (IntPtr)0)
{
// Re creates body on size.
// EnableBody also does setMass()
enableBody();
d.BodyEnable(Body);
}
_parent_scene.geom_name_map[prim_geom] = oldname; _parent_scene.geom_name_map[prim_geom] = oldname;
changeSelectedStatus(timestamp); changeSelectedStatus(timestamp);

View File

@ -1042,6 +1042,7 @@ namespace OpenSim.Region.Physics.OdePlugin
lock (_activeprims) lock (_activeprims)
{ {
List<OdePrim> removeprims = null;
foreach (OdePrim chr in _activeprims) foreach (OdePrim chr in _activeprims)
{ {
if (d.BodyIsEnabled(chr.Body) && (!chr.m_disabled)) if (d.BodyIsEnabled(chr.Body) && (!chr.m_disabled))
@ -1056,7 +1057,12 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
else else
{ {
m_log.Debug("[PHYSICS]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed"); if (removeprims == null)
{
removeprims = new List<OdePrim>();
}
removeprims.Add(chr);
m_log.Debug("[PHYSICS]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!");
} }
} }
} }
@ -1066,6 +1072,13 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
} }
if (removeprims != null)
{
foreach (OdePrim chr in removeprims)
{
_activeprims.Remove(chr);
}
}
} }
} }
@ -1466,6 +1479,7 @@ namespace OpenSim.Region.Physics.OdePlugin
staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero); staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero);
d.GeomSetCategoryBits(staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY], (int)CollisionCategories.Space); d.GeomSetCategoryBits(staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY], (int)CollisionCategories.Space);
waitForSpaceUnlock(space); waitForSpaceUnlock(space);
d.SpaceSetSublevel(space, 1);
d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]); d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]);
return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]; return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY];
} }
@ -1522,72 +1536,112 @@ namespace OpenSim.Region.Physics.OdePlugin
// //if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle && pbs.ProfileCurve == (byte)Primitive.ProfileCurve.Circle && pbs.PathScaleY <= 0.75f) // //if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle && pbs.ProfileCurve == (byte)Primitive.ProfileCurve.Circle && pbs.PathScaleY <= 0.75f)
// //Console.WriteLine("needsMeshing: " + " pathCurve: " + pbs.PathCurve.ToString() + " profileCurve: " + pbs.ProfileCurve.ToString() + " pathScaleY: " + Primitive.UnpackPathScale(pbs.PathScaleY).ToString()); // //Console.WriteLine("needsMeshing: " + " pathCurve: " + pbs.PathCurve.ToString() + " profileCurve: " + pbs.ProfileCurve.ToString() + " pathScaleY: " + Primitive.UnpackPathScale(pbs.PathScaleY).ToString());
int iPropertiesNotSupportedDefault = 0;
if (pbs.SculptEntry && !meshSculptedPrim) if (pbs.SculptEntry && !meshSculptedPrim)
{ {
#if SPAM
m_log.Warn("NonMesh");
#endif
return false; return false;
} }
// if it's a standard box or sphere with no cuts or hollows or twist, return false since ODE can use an internal representation for the prim // if it's a standard box or sphere with no cuts or hollows or twist, return false since ODE can use an internal representation for the prim
//if ((pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight) if ((pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight)
// || (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1 || (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1
// && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z)) && 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)
// return false;
//}
// if (pbs.ProfileHollow != 0) if (pbs.ProfileBegin == 0 && pbs.ProfileEnd == 0
// return true; && 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)
{
#if SPAM
m_log.Warn("NonMesh");
#endif
return false;
}
}
// if (((Int16)pbs.PathTwistBegin != 0) || ((Int16)pbs.PathTwist != 0)) if (pbs.ProfileHollow != 0)
// return true; iPropertiesNotSupportedDefault++;
// if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0) if (((Int16)pbs.PathTwistBegin != 0) || ((Int16)pbs.PathTwist != 0))
// return true; iPropertiesNotSupportedDefault++;
// if ((pbs.PathScaleX != 100) || (pbs.PathScaleY != 100)) if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0)
// return true; iPropertiesNotSupportedDefault++;
// if ((pbs.PathShearX != 0) || (pbs.PathShearY != 0)) if ((pbs.PathScaleX != 100) || (pbs.PathScaleY != 100))
// return true; iPropertiesNotSupportedDefault++;
// if (pbs.ProfileShape == ProfileShape.Circle && pbs.PathCurve == (byte)Extrusion.Straight) if ((pbs.PathShearX != 0) || (pbs.PathShearY != 0))
// return true; iPropertiesNotSupportedDefault++;
// //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.HalfCircle && pbs.PathCurve == (byte) Extrusion.Curve1) if (pbs.ProfileShape == ProfileShape.Circle && pbs.PathCurve == (byte)Extrusion.Straight)
// return true; iPropertiesNotSupportedDefault++;
// // test for torus 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))
// if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle iPropertiesNotSupportedDefault++;
// && (pbs.ProfileCurve & 0x07) == (byte)Primitive.ProfileCurve.Circle
// && Primitive.UnpackPathScale(pbs.PathScaleY) <= 0.75f)
// return true;
// // test for tube if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte) Extrusion.Curve1)
// if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle iPropertiesNotSupportedDefault++;
// && (pbs.ProfileCurve & 0x07) == (byte)Primitive.ProfileCurve.EqualTriangle)
// return true;
// // test for ring // test for torus
// if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.Square)
// && (pbs.ProfileCurve & 0x07) == (byte)Primitive.ProfileCurve.EqualTriangle) {
// return true; if (pbs.PathCurve == (byte)Extrusion.Curve1)
{
iPropertiesNotSupportedDefault++;
}
}
else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.Circle)
{
if (pbs.PathCurve == (byte)Extrusion.Straight)
{
iPropertiesNotSupportedDefault++;
}
// if (pbs.ProfileShape == ProfileShape.EquilateralTriangle) // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits
// return true; else if (pbs.PathCurve == (byte)Extrusion.Curve1)
{
iPropertiesNotSupportedDefault++;
}
}
else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle)
{
if (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 (iPropertiesNotSupportedDefault == 0)
// return false; {
#if SPAM
return true; // assume the mesher will return a default shape or null and later code can deal with this m_log.Warn("NonMesh");
#endif
return false;
}
#if SPAM
m_log.Debug("Mesh");
#endif
return true;
} }
/// <summary> /// <summary>