本文整理汇总了C++中AABB::getCorners方法的典型用法代码示例。如果您正苦于以下问题:C++ AABB::getCorners方法的具体用法?C++ AABB::getCorners怎么用?C++ AABB::getCorners使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AABB
的用法示例。
在下文中一共展示了AABB::getCorners方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getCamera
std::vector<Entity*> SceneManager::clipEntityWithFrustum(
const std::vector<Entity*>& ents) const
{
PlaneList frustumPlanes = getCamera()->getVolumePlanes(EPID_all);
std::vector<Entity*> rents;
for (int i = 0; i < (int)ents.size(); ++i) {
Entity* ent = ents[i];
Matrix4x4 worldViewMat = ent->getSceneNode()->getWorldMatrix() * getCamera()->getViewMatrix();
AABB aabb = ent->getBoundAABB();
transform(aabb, worldViewMat);
if (intersect(frustumPlanes, aabb.getCorners()) == EIC_front) continue;
Sphere sphere = ent->getBoundSphere();
transform(sphere, worldViewMat);
if (intersect(frustumPlanes, sphere) == EIC_front) continue;
rents.push_back(ent);
}
Log::instance()->addMsg("frustum clip : %d/%d", ents.size() - rents.size(), ents.size());
return rents;
}
示例2: intersect
bool ConvexHull::intersect(const AABB& aabb, const SimpleTransform& transform, const Vec3& scale) const
{
auto corners = std::array<Vec3, 8>();
aabb.getCorners(corners, transform, scale);
for (auto& plane : planes_)
{
// Check if the AABB lies on the front of this plane, if so then there is no intersection with this convex hull
for (auto j = 0U; j < 8; j++)
{
if (plane.distance(corners[j]) < 0.0f)
break;
if (j == 7)
return false;
}
}
return true;
}