本文整理汇总了C++中AABB::getMaximum方法的典型用法代码示例。如果您正苦于以下问题:C++ AABB::getMaximum方法的具体用法?C++ AABB::getMaximum怎么用?C++ AABB::getMaximum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AABB
的用法示例。
在下文中一共展示了AABB::getMaximum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTextWidth
static int getTextWidth(const wchar_t* str,DWORD font = fontDefault)
{
AABB aabb;
gGlobalClient->getFont(font)->getAABB(str, aabb);
int w = aabb.getMaximum().x - aabb.getMinimum().x;
if (w < 0) w = -w;
return w;
}
示例2: createBoundingBoxBody
PhysicsInterface::BodyObject Bullet::createBoundingBoxBody(const AABB& aabb, float mass, bool fixed,
const Entity* entity,
const SimpleTransform& initialTransform)
{
auto collisionShape = new btBoxShape(toBullet((aabb.getMaximum() - aabb.getMinimum()) * 0.5f));
// Calculate inertia
auto localInertia = btVector3(0.0f, 0.0f, 0.0f);
if (!fixed)
collisionShape->calculateLocalInertia(mass, localInertia);
// Motion state for this body
auto motionState = new btDefaultMotionState(toBullet(initialTransform),
btTransform(btQuaternion::getIdentity(), toBullet(aabb.getCenter())));
// Create Bullet rigid body
auto bulletBody = new btRigidBody(
btRigidBody::btRigidBodyConstructionInfo(fixed ? 0.0f : mass, motionState, collisionShape, localInertia));
bulletBody->setDamping(DefaultLinearDamping, DefaultAngularDamping);
bulletBody->setSleepingThresholds(DefaultLinearSleepingThreshold, DefaultAngularSleepingThreshold);
bulletBody->setRestitution(0.0f);
// Add body to the simulation
dynamicsWorld_->addRigidBody(bulletBody);
// Create local body
auto body = new Body(bulletBody, entity, fixed);
bodies_.append(body);
body->ownedCollisionShape = collisionShape;
bulletBody->setUserPointer(body);
return body;
}