当前位置: 首页>>代码示例>>C++>>正文


C++ camera::set_aty方法代码示例

本文整理汇总了C++中camera::set_aty方法的典型用法代码示例。如果您正苦于以下问题:C++ camera::set_aty方法的具体用法?C++ camera::set_aty怎么用?C++ camera::set_aty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在camera的用法示例。


在下文中一共展示了camera::set_aty方法的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);
//.........这里部分代码省略.........
开发者ID:tseale,项目名称:GTA-CarpetCity,代码行数:101,代码来源:main.cpp


注:本文中的camera::set_aty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。