本文整理汇总了C++中PxBounds3::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ PxBounds3::contains方法的具体用法?C++ PxBounds3::contains怎么用?C++ PxBounds3::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PxBounds3
的用法示例。
在下文中一共展示了PxBounds3::contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTrianglesFast
void Gu::TriangleMesh::debugVisualize(
Cm::RenderOutput& out, const Cm::Matrix34& absPose, const PxBounds3& cullbox,
const PxU64 mask, const PxReal fscale) const
{
bool cscale = !!(mask & ((PxU64)1 << PxVisualizationParameter::eCULL_BOX));
const PxMat44 midt = PxMat44::createIdentity();
const PxU32 nbTriangles = mesh.getNumTriangles();
const PxU32 nbVertices = mesh.getNumVertices();
const PxVec3* vertices = mesh.getVertices();
const void* indices = getTrianglesFast();
const bool has16BitIndices = mesh.has16BitIndices();
if (fscale)
{
const PxU32 fcolor = PxDebugColor::eARGB_DARKRED;
for (PxU32 i=0; i<nbTriangles; i++)
{
PxVec3 wp[3];
getTriangle(*this, i, wp, vertices, indices, absPose, has16BitIndices);
const PxVec3 center = (wp[0] + wp[1] + wp[2]) / 3.0f;
PxVec3 normal = (wp[0] - wp[1]).cross(wp[0] - wp[2]);
PX_ASSERT(!normal.isZero());
normal = normal.getNormalized();
if (!cscale || cullbox.contains(center))
out << midt << fcolor <<
Cm::DebugArrow(center, normal * fscale);
}
}
if (mask & ((PxU64)1 << PxVisualizationParameter::eCOLLISION_SHAPES))
{
const PxU32 scolor = PxDebugColor::eARGB_MAGENTA;
out << midt << scolor; // PT: no need to output this for each segment!
// PT: transform vertices only once
PxVec3* transformed = (PxVec3*)PX_ALLOC(sizeof(PxVec3)*nbVertices);
for(PxU32 i=0;i<nbVertices;i++)
transformed[i] = absPose.transform(vertices[i]);
for (PxU32 i=0; i<nbTriangles; i++)
{
PxVec3 wp[3];
getTriangle(*this, i, wp, transformed, indices, has16BitIndices);
if (!cscale || (cullbox.contains(wp[0]) && cullbox.contains(wp[1]) && cullbox.contains(wp[2])))
{
out.outputSegment(wp[0], wp[1]);
out.outputSegment(wp[1], wp[2]);
out.outputSegment(wp[2], wp[0]);
}
}
PX_FREE(transformed);
}
if (mask & ((PxU64)1 << PxVisualizationParameter::eCOLLISION_EDGES))
{
const PxU32 ecolor = PxDebugColor::eARGB_YELLOW;
for (PxU32 i=0; i<nbTriangles; i++)
{
PxVec3 wp[3];
getTriangle(*this, i, wp, vertices, indices, absPose, has16BitIndices);
const PxU32 flags = mesh.getTrigSharedEdgeFlags(i);
if(flags & Gu::ETD_CONVEX_EDGE_01)
{
if (!cscale || (cullbox.contains(wp[0]) && cullbox.contains(wp[1])))
out << midt << ecolor << Cm::RenderOutput::LINES << wp[0] << wp[1];
}
if(flags & Gu::ETD_CONVEX_EDGE_12)
{
if (!cscale || (cullbox.contains(wp[1]) && cullbox.contains(wp[2])))
out << midt << ecolor << Cm::RenderOutput::LINES << wp[1] << wp[2];
}
if(flags & Gu::ETD_CONVEX_EDGE_20)
{
if (!cscale || (cullbox.contains(wp[0]) && cullbox.contains(wp[2])))
out << midt << ecolor << Cm::RenderOutput::LINES << wp[0] << wp[2];
}
}
}
}