本文整理汇总了C++中camera::set_eyez方法的典型用法代码示例。如果您正苦于以下问题:C++ camera::set_eyez方法的具体用法?C++ camera::set_eyez怎么用?C++ camera::set_eyez使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类camera
的用法示例。
在下文中一共展示了camera::set_eyez方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderScene
void renderScene(void){
//update the modelview matrix based on the camera's position
glMatrixMode(GL_MODELVIEW); //make sure we aren't changing the projection matrix!
glLoadIdentity();
glDrawBuffer( GL_BACK );
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glViewport( 0, 0, windowWidth, windowHeight);
glPushMatrix();
myCam.set_atx(porsche.getX());
myCam.set_aty(porsche.getY());
myCam.set_atz(porsche.getZ());
myCam.set_eyex(porsche.getX());
myCam.set_eyez(porsche.getZ());
myCam.update_pos_arcball();
glPushMatrix(); {
sky->drawSkybox(200, 200, 200); // draw our axes so we know how we are oriented
}; glPopMatrix();
// draw ground
glPushMatrix(); {
drawGround();
}; glPopMatrix();
for (unsigned int i=0; i<cash.size(); i++){
glPushMatrix(); {
cash.at(i)->drawCrate();
};glPopMatrix();
}
// draw the car based on the world object coordinates controlled by user interaction
glPushMatrix(); {
glTranslatef(porsche.getX(), porsche.getY(), porsche.getZ());
glRotatef(porsche.getTheta(), 0.0, 1.0, 0.0); //Rotate about the y-axis
glTranslatef(-porsche.getX(), -porsche.getY(), -porsche.getZ());
porsche.drawCar(); // draw our dodecahedron...or torus...teapot...or whatever
}; glPopMatrix();
// draw the car based on the world object coordinates controlled by user interaction
for (unsigned int i=0; i<fuzz.size(); i++){
glPushMatrix(); {
glTranslatef(fuzz.at(i)->getX(), fuzz.at(i)->getY(), fuzz.at(i)->getZ());
glRotatef(fuzz.at(i)->getTheta(), 0.0, 1.0, 0.0);
glTranslatef(-fuzz.at(i)->getX(), -fuzz.at(i)->getY(), -fuzz.at(i)->getZ());
fuzz.at(i)->drawCar();
}; glPopMatrix();
}
glPopMatrix();
glClear(GL_FRAMEBUFFER | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glDisable(GL_LIGHTING);
glPushMatrix();
glOrtho(-1,1,-1,1,-1,1);
int locationX,locationY;
if (!gameOver){
locationX=-15;
locationY=windowHeight-windowHeight/12;
}else{
locationX=windowWidth/2;
locationY=windowHeight-windowHeight/2;
}
glViewport(locationX, locationY, windowWidth/12, windowHeight/12);
glLoadIdentity();
glColor3f(1,1,1);
char c[15];
sprintf(c, "%d", score);
string temp=string(c);
glRasterPos3i(0,0,0);
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, 'S');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, 'C');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, 'O');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, 'R');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, 'E');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, ':');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, ' ');
for (unsigned int i=0; i<temp.size(); i++){
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, temp[i] );
}
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glPushMatrix();
glOrtho(-1,1,-1,1,-1,1);
if (!gameOver){
locationX=150;
locationY=windowHeight-windowHeight/12;
}else{
locationX=windowWidth/2;
locationY=windowHeight-windowHeight/2+windowWidth/12;
}
glViewport(locationX, locationY, windowWidth/12, windowHeight/12);
glLoadIdentity();
glColor3f(healthR,healthG,0);
char h[15];
sprintf(h, "%d", health);
//.........这里部分代码省略.........