本文整理汇总了C++中Projection::get_right方法的典型用法代码示例。如果您正苦于以下问题:C++ Projection::get_right方法的具体用法?C++ Projection::get_right怎么用?C++ Projection::get_right使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projection
的用法示例。
在下文中一共展示了Projection::get_right方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Extract
void Frustum::Extract(const Matrix44f &view, const Projection &proj) {
static const int LBN = kLBNCorner, LTN = kLTNCorner, LBF = kLBFCorner,
LTF = kLTFCorner, RBN = kRBNCorner, RTN = kRTNCorner,
RBF = kRBFCorner, RTF = kRTFCorner;
const float lnear = -proj.get_near();
const float lfar = -proj.get_far();
const Vec3f nearNorm(0.0f, 0.0f, -1.0f);
const Vec3f farNorm(0.0f, 0.0f, 1.0f);
// kLeftPlane plane
const Vec3f ltn(proj.get_left(), proj.get_top(), lnear),
lbn(proj.get_left(), proj.get_bottom(), lnear),
ltf(proj.get_far_left(), proj.get_far_top(), lfar),
lbf(proj.get_far_left(), proj.get_far_bottom(), lfar);
const Vec3f leftNorm = vecNormal(
vecCross(lbn - ltn, ltf - ltn));
// kRightPlane plane
const Vec3f rtn(proj.get_right(), proj.get_top(), lnear), // right top near
rbn(proj.get_right(), proj.get_bottom(), lnear), // right bottom near
rtf(proj.get_far_right(), proj.get_far_top(), lfar); // right top far
const Vec3f rightNorm = vecNormal(vecCross(rtf - rtn, rbn - rtn));
// kTopPlane plane
const Vec3f topNorm = vecNormal(vecCross(ltf - ltn, rtn - ltn));
// kBottomPlane plane lbn rbf
const Vec3f rbf(proj.get_far_right(), proj.get_far_bottom(), lfar);
const Vec3f botNorm = vecNormal(vecCross(rbf - rbn, lbn - rbn));
Matrix44f viewSpace, viewSpaceN;
matrixInverse(view, &viewSpace);
viewSpaceN = matrixTranspose(view);
m_conners[LBN] = lbn * viewSpace;
m_conners[LTN] = ltn * viewSpace;
m_conners[LBF] = lbf * viewSpace;
m_conners[LTF] = ltf * viewSpace;
m_conners[RBN] = rbn * viewSpace;
m_conners[RTN] = rtn * viewSpace;
m_conners[RBF] = rbf * viewSpace;
m_conners[RTF] = rtf * viewSpace;
m_planes[kLeftPlane] = Planef(leftNorm * viewSpaceN, m_conners[LTN]);
m_planes[kRightPlane] = Planef(rightNorm * viewSpaceN, m_conners[RTN]);
m_planes[kTopPlane] = Planef(topNorm * viewSpaceN, m_conners[RTN]);
m_planes[kBottomPlane] = Planef(botNorm * viewSpaceN, m_conners[LBN]);
m_planes[kNearPlane] = Planef(nearNorm * viewSpaceN, m_conners[LBN]);
m_planes[kFarPlane] = Planef(farNorm * viewSpaceN, m_conners[RTF]);
}