本文整理汇总了C++中Planet::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ Planet::draw方法的具体用法?C++ Planet::draw怎么用?C++ Planet::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Planet
的用法示例。
在下文中一共展示了Planet::draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void StarSystem::draw() {
// now draw the sun
star->draw();
// and the planets
Planet *p;
for (std::list<Planet *>::iterator i = planets.begin(); i != planets.end(); ++i) {
p = *i;
p->draw();
}
Node::draw();
}
示例2: run
//.........这里部分代码省略.........
//cam.at = vec3(radius * sin(cam_yaw) * cos(cam_pitch), radius * sin(cam_pitch), radius * cos(cam_yaw) * cos(cam_pitch)) + cam.pos;
//cam.up = cam.pos;
//cam.up.normalize();
cam.updateFrustum();
cam.apply();
planet.updateDetail(cam);
vec3 light(light_radius * sin(light_rotation) * cos(light_inclination),
light_radius * sin(light_inclination),
light_radius * cos(light_rotation) * cos(light_inclination));
glUseProgram(0);
glPushMatrix();
glTranslatef(light.x, light.y, light.z);
glColor3f(1, 1, 0);
gluSphere(quadric, 1e6, 4, 8);
glPopMatrix();
glEnable(GL_TEXTURE_2D);
normalsShader.use();
glUniform1i(normalsShader.uniform("tex_color"), 0);
glUniform1i(normalsShader.uniform("tex_normals"), 1);
glUniform3f(normalsShader.uniform("lightPos"), light.x, light.y, light.z);
//Draw the planet.
/*for (int y = 0; y < 18; y++) {
for (int x = 0; x < 36; x++) {
DecadePatch &p = planet.patches[x][y];
if (p.angularQuality < 0)
continue;
glColor3f(1 - p.angularQuality, p.angularQuality, 0);
p.draw();
}
}*/
planet.draw();
if (wireframe) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
//Prepare for post effects.
glColor3f(1, 1, 1);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glEnable(GL_TEXTURE_2D);
//Extract the overbright areas of the scene.
sceneColor.bind();
downsampleFBO[0][1]->bind();
extractHighlightsShader.use();
glUniform1i(extractHighlightsShader.uniform("tex"), 0);
glBegin(GL_QUADS);
glTexCoord2f(0, 1); glVertex2f(-1, 1);
glTexCoord2f(1, 1); glVertex2f( 1, 1);
glTexCoord2f(1, 0); glVertex2f( 1, -1);
glTexCoord2f(0, 0); glVertex2f(-1, -1);
glEnd();
//Downsample and bloom the overbright areas.
blur0Shader.use();
glUniform1i(blur0Shader.uniform("tex"), 0);
blur1Shader.use();