本文整理汇总了C++中vec3f::sqLen3D方法的典型用法代码示例。如果您正苦于以下问题:C++ vec3f::sqLen3D方法的具体用法?C++ vec3f::sqLen3D怎么用?C++ vec3f::sqLen3D使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vec3f
的用法示例。
在下文中一共展示了vec3f::sqLen3D方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawPotentiallyVisibleSquares
void CSMFRenderer::DrawPotentiallyVisibleSquares(const Camera* cam, int, int) {
const CReadMap* rm = readMap;
const float* hm = rm->GetHeightmap();
// const vec3f* nm = &rm->facenormals[0];
// each square is drawn clockwise topside-up
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glFrontFace(GL_CW);
// our normals are always unit-length
glDisable(GL_NORMALIZE);
glPolygonMode(GL_FRONT, GL_FILL);
for (int i = 0; i < numSquares; i++) {
Square& q = squares[i];
if (!SquareRowVisible(q.idx, rm, cam)) {
// advance to start of next row
i += (numSquaresX - (i % numSquaresX));
continue;
}
// note: slightly inefficient, would be better to use y-extremes of <q>
vec3f minBounds = q.GetMinBounds(); minBounds.y = rm->currMinHeight;
vec3f maxBounds = q.GetMaxBounds(); maxBounds.y = rm->currMaxHeight;
const vec3f v = (cam->pos - q.mid);
const float dSq = v.sqLen3D();
const bool draw = (dSq < viewRadiusSq && cam->InView(minBounds, maxBounds));
if (draw) {
DrawSquare(q, v, rm, hm);
}
}
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_NORMALIZE);
glDisable(GL_CULL_FACE);
glFrontFace(GL_CCW);
}