本文整理汇总了C++中NxShape::isHeightField方法的典型用法代码示例。如果您正苦于以下问题:C++ NxShape::isHeightField方法的具体用法?C++ NxShape::isHeightField怎么用?C++ NxShape::isHeightField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxShape
的用法示例。
在下文中一共展示了NxShape::isHeightField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateVisualization
void PhysicsLib::updateVisualization(const VC3 &cameraPosition, float range, bool forceUpdate)
{
bool visualizeCollisionShapes = data->featureMap[PhysicsLib::VISUALIZE_COLLISION_SHAPES];
bool visualizeDynamic = data->featureMap[PhysicsLib::VISUALIZE_DYNAMIC];
bool visualizeStatic = data->featureMap[PhysicsLib::VISUALIZE_STATIC];
bool visualizeCollisionContacts = data->featureMap[PhysicsLib::VISUALIZE_COLLISION_CONTACTS];
bool visualizeFluids = data->featureMap[PhysicsLib::VISUALIZE_FLUIDS];
bool visualizeJoints = data->featureMap[PhysicsLib::VISUALIZE_JOINTS];
bool visualizeCCD = data->featureMap[PhysicsLib::VISUALIZE_CCD];
if (forceUpdate
|| visualizeCollisionShapes
|| visualizeDynamic
|| visualizeStatic
|| visualizeCollisionContacts
|| visualizeFluids
|| visualizeJoints
|| visualizeCCD)
{
// (do the update)
} else {
// do not unnecessarily do this stuff!
return;
}
float rangeSq = range * range;
int actorAmount = data->scene->getNbActors();
NxActor **actorArray = data->scene->getActors();
if(visualizeCollisionShapes || visualizeStatic || visualizeCollisionContacts)
data->sdk->setParameter(NX_VISUALIZE_COLLISION_SHAPES, 1);
else
data->sdk->setParameter(NX_VISUALIZE_COLLISION_SHAPES, 0);
if(visualizeDynamic)
data->sdk->setParameter(NX_VISUALIZE_BODY_MASS_AXES, 1);
else
data->sdk->setParameter(NX_VISUALIZE_BODY_MASS_AXES, 0);
data->sdk->setParameter(NX_VISUALIZE_CONTACT_NORMAL, visualizeCollisionContacts);
data->sdk->setParameter(NX_VISUALIZE_CONTACT_FORCE, visualizeCollisionContacts);
data->sdk->setParameter(NX_VISUALIZE_CONTACT_POINT, visualizeCollisionContacts);
data->sdk->setParameter(NX_VISUALIZE_COLLISION_SKELETONS, visualizeCCD);
for(int i = 0; i < actorAmount; ++i)
{
NxActor *actor = actorArray[i];
if(!actor)
continue;
NxVec3 nxpos = actor->getGlobalPosition();
VC3 pos(nxpos.x, nxpos.y, nxpos.z);
VC3 diff = (pos - cameraPosition);
diff.y = 0; // ignore height
bool inRange = false;
if (diff.GetSquareLength() < rangeSq)
inRange = true;
if(actor->isDynamic())
{
//if(visualizeDynamic && inRange)
if(visualizeDynamic)
actor->raiseBodyFlag(NX_BF_VISUALIZATION);
else
actor->clearBodyFlag(NX_BF_VISUALIZATION);
}
int shapeAmount = actor->getNbShapes();
NxShape *const*shapes = actor->getShapes();
while(shapeAmount--)
{
NxShape *shape = shapes[shapeAmount];
if(actor->isDynamic())
{
//if(visualizeCollisionShapes && inRange)
if(visualizeCollisionShapes)
shape->setFlag(NX_SF_VISUALIZATION, true);
else
shape->setFlag(NX_SF_VISUALIZATION, false);
}
else
{
if(visualizeStatic && !shape->isHeightField() && inRange)
shape->setFlag(NX_SF_VISUALIZATION, true);
else
shape->setFlag(NX_SF_VISUALIZATION, false);
}
}
}
}