本文整理汇总了C++中NxBounds3::getCenter方法的典型用法代码示例。如果您正苦于以下问题:C++ NxBounds3::getCenter方法的具体用法?C++ NxBounds3::getCenter怎么用?C++ NxBounds3::getCenter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxBounds3
的用法示例。
在下文中一共展示了NxBounds3::getCenter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addAABB
void CCTDebugData::addAABB(const NxBounds3& bounds, NxU32 color, bool renderFrame)
{
// Reuse OBB code...
NxVec3 center; bounds.getCenter(center);
NxVec3 extents; bounds.getExtents(extents);
NxMat33 id; id.id();
addOBB(NxBox(center, extents, id), color, renderFrame);
}
示例2: shapeBBox
//-----------------------------------------------------------------------------
// CalcBBox
//-----------------------------------------------------------------------------
NxBox CPhysicModelSimple::CalcBBox (void) const
{
NxBounds3 bounds;
for (int i = 0; i < (int)m_ActorDesc.shapes.size(); i++)
{
NxShapeDesc* pShapeDesc = m_ActorDesc.shapes[i];
switch (pShapeDesc->getType())
{
case NX_SHAPE_BOX:
{
NxBoxShapeDesc* pBoxShape = (NxBoxShapeDesc*) pShapeDesc;
NxBox shapeBBox (pBoxShape->localPose.t, pBoxShape->dimensions, pBoxShape->localPose.M);
NxBounds3 shapeBounds;
shapeBounds.boundsOfOBB( shapeBBox.rot, shapeBBox.center, shapeBBox.extents );
bounds.combine (shapeBounds);
}
break;
case NX_SHAPE_SPHERE:
{
NxSphereShapeDesc* pSphereShape = (NxSphereShapeDesc*) pShapeDesc;
NxBox shapeBBox (pSphereShape->localPose.t, NxVec3(pSphereShape->radius), pSphereShape->localPose.M);
NxBounds3 shapeBounds;
shapeBounds.boundsOfOBB( shapeBBox.rot, shapeBBox.center, shapeBBox.extents );
bounds.combine (shapeBounds);
}
break;
default:
// Caso no soportado
assert(0);
break;
}
}
NxBox result;
bounds.getCenter (result.center);
bounds.getExtents (result.extents);
return result;
}
示例3: draw
// -----------------------------------------------------------------------
void MyCloth::draw(bool shadows)
{
static NxU32 numVertices = mNumVertices;
NxU32 numElements = mNumIndices;
numVertices = mNumVertices;
// Disable pressure if tearing occurs
if (mTeared && (mCloth->getFlags() & NX_CLF_PRESSURE))
{
// Disable Pressure
mCloth->setFlags(mCloth->getFlags() & ~NX_CLF_PRESSURE);
mCloth->setPressure(0);
// Reduce tearing factor
NxReal oldTearing = mCloth->getTearFactor();
oldTearing = (oldTearing - 1) / 3 + 1;
mCloth->setTearFactor(oldTearing);
// Reduce bending stiffness
if (mCloth->getBendingStiffness() > 0.9f)
mCloth->setBendingStiffness(0.2f);
// Apply explosion in the middle of the cloth
NxBounds3 bounds;
mCloth->getWorldBounds(bounds);
NxVec3 center;
bounds.getCenter(center);
NxReal radius = bounds.min.distance(bounds.max);
mCloth->addForceAtPos(center, 7 * NxMath::pow(radius,3), radius, NX_IMPULSE);
printf("Pressure disabled\n");
}
if (mTexId > 0)
{
updateTextureCoordinates();
}
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, sizeof(RenderBufferVertexElement), numVertices, &(mVertexRenderBuffer[0].position.x));
glNormalPointer(GL_FLOAT, sizeof(RenderBufferVertexElement), numVertices, &(mVertexRenderBuffer[0].normal.x));
if (mTexId) {
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, sizeof(RenderBufferVertexElement), numVertices, &(mVertexRenderBuffer[0].texCoord[0]));
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, mTexId);
glColor4f(1.0f, 1.0f, 1.0f,1.0f);
}
#ifdef __CELLOS_LV2__
glDrawRangeElements(GL_TRIANGLES, 0, numVertices-1, numElements, GL_UNSIGNED_INT, mIndexRenderBuffer);
#else
glDrawElements(GL_TRIANGLES, numElements, GL_UNSIGNED_INT, mIndexRenderBuffer);
#endif
if (mTexId) {
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisable(GL_TEXTURE_2D);
}
if (shadows) {
const static float ShadowMat[]={ 1,0,0,0, 0,0,0,0, 0,0,1,0, 0,0,0,1 };
glPushMatrix();
glMultMatrixf(ShadowMat);
glDisable(GL_LIGHTING);
glColor4f(0.05f, 0.1f, 0.15f,1.0f);
#ifdef __CELLOS_LV2__
glDrawRangeElements(GL_TRIANGLES, 0, numVertices-1, numElements, GL_UNSIGNED_INT, mIndexRenderBuffer);
#else
glDrawElements(GL_TRIANGLES, numElements, GL_UNSIGNED_INT, mIndexRenderBuffer);
#endif
glColor4f(1.0f, 1.0f, 1.0f,1.0f);
glEnable(GL_LIGHTING);
glPopMatrix();
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
}