本文整理汇总了C++中Box3F::getCenter方法的典型用法代码示例。如果您正苦于以下问题:C++ Box3F::getCenter方法的具体用法?C++ Box3F::getCenter怎么用?C++ Box3F::getCenter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box3F
的用法示例。
在下文中一共展示了Box3F::getCenter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void OrientedBox3F::set( const MatrixF& transform, const Box3F& aabb )
{
mCenter = aabb.getCenter();
transform.mulP( mCenter );
mAxes[ RightVector ] = transform.getRightVector();
mAxes[ ForwardVector ] = transform.getForwardVector();
mAxes[ UpVector ] = transform.getUpVector();
mHalfExtents[ 0 ] = aabb.len_x() / 2.f;
mHalfExtents[ 1 ] = aabb.len_y() / 2.f;
mHalfExtents[ 2 ] = aabb.len_z() / 2.f;
_initPoints();
}
示例2: computeBounds
void ColladaShapeLoader::computeBounds(Box3F& bounds)
{
TSShapeLoader::computeBounds(bounds);
// Check if the model origin needs adjusting
if ( bounds.isValidBox() &&
(ColladaUtils::getOptions().adjustCenter ||
ColladaUtils::getOptions().adjustFloor) )
{
// Compute shape offset
Point3F shapeOffset = Point3F::Zero;
if ( ColladaUtils::getOptions().adjustCenter )
{
bounds.getCenter( &shapeOffset );
shapeOffset = -shapeOffset;
}
if ( ColladaUtils::getOptions().adjustFloor )
shapeOffset.z = -bounds.minExtents.z;
// Adjust bounds
bounds.minExtents += shapeOffset;
bounds.maxExtents += shapeOffset;
// Now adjust all positions for root level nodes (nodes with no parent)
for (S32 iNode = 0; iNode < shape->nodes.size(); iNode++)
{
if ( !appNodes[iNode]->isParentRoot() )
continue;
// Adjust default translation
shape->defaultTranslations[iNode] += shapeOffset;
// Adjust animated translations
for (S32 iSeq = 0; iSeq < shape->sequences.size(); iSeq++)
{
const TSShape::Sequence& seq = shape->sequences[iSeq];
if ( seq.translationMatters.test(iNode) )
{
for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++)
{
S32 index = seq.baseTranslation + seq.translationMatters.count(iNode)*seq.numKeyframes + iFrame;
shape->nodeTranslations[index] += shapeOffset;
}
}
}
}
}
}
示例3: buildConvex
void GroundPlane::buildConvex( const Box3F& box, Convex* convex )
{
mConvexList->collectGarbage();
Box3F planeBox = getPlaneBox();
if ( !box.isOverlapped( planeBox ) )
return;
// See if we already have a convex in the working set.
BoxConvex *boxConvex = NULL;
CollisionWorkingList &wl = convex->getWorkingList();
CollisionWorkingList *itr = wl.wLink.mNext;
for ( ; itr != &wl; itr = itr->wLink.mNext )
{
if ( itr->mConvex->getType() == BoxConvexType &&
itr->mConvex->getObject() == this )
{
boxConvex = (BoxConvex*)itr->mConvex;
break;
}
}
if ( !boxConvex )
{
boxConvex = new BoxConvex;
mConvexList->registerObject( boxConvex );
boxConvex->init( this );
convex->addToWorkingList( boxConvex );
}
// Update our convex to best match the queried box
if ( boxConvex )
{
Point3F queryCenter = box.getCenter();
boxConvex->mCenter = Point3F( queryCenter.x, queryCenter.y, -GROUND_PLANE_BOX_HEIGHT_HALF );
boxConvex->mSize = Point3F( box.getExtents().x,
box.getExtents().y,
GROUND_PLANE_BOX_HEIGHT_HALF );
}
}
示例4: createPhysShape
//----------------------------------------------------------------------------
void RigidBody::createPhysShape()
{
//Physics* physics = isServerObject() ? gServerPhysics : gClientPhysics;
Physics* physics = Physics::getPhysics(isServerObject());
if (physics)
{
PhysInfo physDescr;
//transform into radian
VectorF angleRadians = mDataBlock->mRotation/180.f*float(M_PI);
physDescr.transform.set(angleRadians, mDataBlock->mPos);
physDescr.owner = this;
physDescr.shapeType = (PhysInfo::ShapeType)mDataBlock->mShapeType;
physDescr.mass = mDataBlock->mass;
if (physDescr.shapeType==PhysInfo::ST_SPHERE)
{
Box3F scaledObjBox = mObjBox;
scaledObjBox.minExtents.convolve(mObjScale);
scaledObjBox.maxExtents.convolve(mObjScale);
F32 radius = (scaledObjBox.maxExtents - scaledObjBox.getCenter()).len();
physDescr.params = VectorF(radius,0.f,0.f);
}
else //if (physDescr.shapeType==PhysInfo::ST_BOX)
{
Box3F rotBox = mObjBox;
physDescr.transform.mul(rotBox);
VectorF length = VectorF(rotBox.len_x(),rotBox.len_y(),rotBox.len_z());
length.convolve(mObjScale);
physDescr.params = length;
}
//physDescr.params = VectorF(1.f,1.f,1.f);
//physDescr.shapeType = PhysInfo::ST_SPHERE;
//physDescr.mass = 5.f;
//physDescr.params = VectorF(0.5f,0.f,0.f);
mPhysShape = physics->createPhysShape(physDescr);
mPhysShape->setTransform(mObjToWorld);
mPhysShape->setForce(mForce);
mPhysShape->setTorque(mTorque);
mPhysShape->setLinVelocity(mLinVelocity);
mPhysShape->setAngVelocity(mAngVelocity);
}
}
示例5: drawCube
void GFXDrawUtil::drawCube( const GFXStateBlockDesc &desc, const Box3F &box, const ColorI &color, const MatrixF *xfm )
{
drawCube( desc, box.getExtents(), box.getCenter(), color, xfm );
}