本文整理汇总了C++中AABB::depth方法的典型用法代码示例。如果您正苦于以下问题:C++ AABB::depth方法的具体用法?C++ AABB::depth怎么用?C++ AABB::depth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AABB
的用法示例。
在下文中一共展示了AABB::depth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: JudgeAABBCross
//=============================================================================
// AABB同士の当たり判定
//=============================================================================
bool CCollisionManager::JudgeAABBCross(
const VECTOR3& p1, const AABB& b1,
const VECTOR3& p2, const AABB& b2)
{
VECTOR3 min_pos1;
VECTOR3 min_pos2;
min_pos1._x = p1._x + b1.Min._x;
min_pos1._y = p1._y + b1.Min._y;
min_pos1._z = p1._z + b1.Min._z;
min_pos2._x = p2._x + b2.Min._x;
min_pos2._y = p2._y + b2.Min._y;
min_pos2._z = p2._z + b2.Min._z;
bool bHitX =
min_pos1._x <= min_pos2._x + b2.width() &&
min_pos1._x >= min_pos2._x - b1.width();
bool bHitY =
min_pos1._y <= min_pos2._y + b2.height() &&
min_pos1._y >= min_pos2._y - b1.height();
bool bHitZ =
min_pos1._z <= min_pos2._z + b2.depth() &&
min_pos1._z >= min_pos2._z - b1.depth();
if(!bHitX || !bHitY || !bHitZ)
{
return false;
}
return true;
}
示例2: centerOnObject
void centerOnObject(const AABB &objectBounds) {
auto size = std::max(
{objectBounds.width(), objectBounds.height(), objectBounds.depth()});
auto cx = (objectBounds.xmax + objectBounds.xmin) / 2.f;
auto cy = (objectBounds.ymax + objectBounds.ymin) / 2.f;
auto cz = (objectBounds.zmax + objectBounds.zmin) / 2.f;
const float fov = 45.0f;
float camDist = (0.5f * size) / std::tan(0.5f * glm::radians(fov));
lookAt(cx, cy, cz);
lookDistance(camDist);
setNearFarPlanes(0.1f * camDist, 10.0f * camDist);
setFieldOfView(fov);
arcballRotation = quat{};
AG_DEBUG("near {} far {}", 0.5f * camDist, 2.0f * camDist);
}