本文整理汇总了C++中Point2F::length方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2F::length方法的具体用法?C++ Point2F::length怎么用?C++ Point2F::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2F
的用法示例。
在下文中一共展示了Point2F::length方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
//.........这里部分代码省略.........
glEnable(GL_CULL_FACE);
glEnable(GL_ALPHA);
glEnable(GL_MULTISAMPLE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//Camera
viewMatrix = glm::mat4x4(1);
viewMatrix = glm::rotate(viewMatrix, pitch, glm::vec3(1, 0, 0));
viewMatrix = glm::rotate(viewMatrix, yaw, glm::vec3(0, 1, 0));
viewMatrix = glm::rotate(viewMatrix, -90.0f, glm::vec3(1, 0, 0));
// viewMatrix = glm::translate(viewMatrix, -cameraPosition);
viewMatrix = glm::translate(viewMatrix, cameraPosition);
glLoadMatrixf(&modelviewMatrix[0][0]);
//Clear
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
glLightfv(GL_LIGHT0, GL_POSITION, gLightDirection);
Point3F offset = {0.f, 0.f, 0.f};
if (listNeedsDisplay) {
displayList = glGenLists(1);
glNewList(displayList, GL_COMPILE_AND_EXECUTE);
for (U32 index = 0; index < difCount; index ++) {
difs[index]->render();
}
glEndList();
listNeedsDisplay = false;
} else {
glCallList(displayList);
}
sphere->render(ColorF(1, 1, 0, 1));
glDisable(GL_CULL_FACE);
if (selection.hasSelection) {
Surface surface = selection.interior->surface[selection.surfaceIndex];
TexGenEq texGenEq = selection.interior->texGenEq[surface.texGenIndex];
Point3F normal = selection.interior->normal[selection.interior->plane[surface.planeIndex].normalIndex];
Point3F first = selection.interior->point[selection.interior->index[surface.windingStart]];
F32 len = 0;
glBegin(GL_TRIANGLE_STRIP);
for (U32 i = 0; i < surface.windingCount; i ++) {
Point3F vert = selection.interior->point[selection.interior->index[surface.windingStart + i]];
glVertex3f(vert.x, vert.y, vert.z);
Point2F point = point3F_project_plane(vert, normal, first);
F32 distance = point.length();
len = (distance > len ? distance : len);
}
glEnd();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(-1, 1, -1, 1, -100, 100);
glMatrixMode(GL_MODELVIEW);
glDisable(GL_LIGHTING);
glEnable(GL_TEXTURE_2D);
glLoadIdentity();
Texture *texture = selection.interior->texture[surface.textureIndex];
if (texture) {
if (!texture->generated) {
texture->generateBuffer();
}
texture->activate();
}
glBegin(GL_TRIANGLE_STRIP);
int w, h;
SDL_GetWindowSize(window, &w, &h);
GLfloat aspect = (GLfloat)w / (GLfloat)h;
for (U32 i = 0; i < surface.windingCount; i ++) {
Point3F vert = selection.interior->point[selection.interior->index[surface.windingStart + i]];
Point2F texuv = Point2F(planeF_distance_to_point(texGenEq.planeX, vert), planeF_distance_to_point(texGenEq.planeY, vert));
glTexCoord2fv(&texuv.x);
Point2F point = point3F_project_plane(vert, (surface.planeFlipped ? normal * -1 : normal), first);
glVertex3f(point.x / len / aspect, point.y / len, 0);
}
glEnd();
if (texture)
texture->deactivate();
glDisable(GL_TEXTURE_2D);
glEnable(GL_LIGHTING);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
}
#endif
}