本文整理汇总了C++中Sphere::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ Sphere::isNull方法的具体用法?C++ Sphere::isNull怎么用?C++ Sphere::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sphere
的用法示例。
在下文中一共展示了Sphere::isNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cull
bool cull(const Sphere& sphere) const
{
// null spheres are always visible
if (sphere.isNull())
return false;
for(unsigned i=0; i<planes().size(); ++i)
{
if ( plane(i).distance(sphere.center()) > sphere.radius() )
return true;
}
return false;
}
示例2: includes
/** Returns true if a sphere contains the specified sphere. */
bool includes(const Sphere& other) const
{
if (isNull())
return false;
else
if (other.isNull())
return true;
else
{
real distance = (center() - other.center()).length();
return radius() >= distance + other.radius();
}
}
示例3: computeNearFarOptimizedProjMatrix
//-----------------------------------------------------------------------------
void Camera::computeNearFarOptimizedProjMatrix(const Sphere& scene_bounding_sphere)
{
// near/far clipping planes optimization
if (!scene_bounding_sphere.isNull())
{
// compute the sphere in camera coordinates
Sphere camera_sphere;
scene_bounding_sphere.transformed(camera_sphere, viewMatrix());
mNearPlane = -(camera_sphere.center().z() + camera_sphere.radius() * (Real)1.01);
mFarPlane = -(camera_sphere.center().z() - camera_sphere.radius() * (Real)1.01);
#if 0
far = max(far, (Real)1.0e-5);
near = max(near, (Real)1.0e-6);
#else
// prevents z-thrashing when very large objects are zoomed a lot
Real ratio = camera_sphere.radius() * (Real)2.01 / (Real)2000.0;
mNearPlane = max(mNearPlane, ratio*1);
mFarPlane = max(mFarPlane, ratio*2);
#endif
// supports only perspective projection matrices
setProjectionAsPerspective();
}
}