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


C++ ObjectData::getModelMatrix方法代码示例

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


在下文中一共展示了ObjectData::getModelMatrix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update

void update()
{

    glm::vec3 tempPlayerOne = glm::vec3(objectsDataList.getModelMatrix(1)[3][0], objectsDataList.getModelMatrix(1)[3][1], objectsDataList.getModelMatrix(1)[3][2]);

    //glm::vec3 tempPlayerTwo = glm::vec3(objectsDataList.getModelMatrix(2)[3][0], objectsDataList.getModelMatrix(2)[3][1], objectsDataList.getModelMatrix(2)[3][2]);

    //glm::vec3 puckLoc = glm::vec3(objectsDataList.getModelMatrix(3)[3][0], objectsDataList.getModelMatrix(3)[3][1], objectsDataList.getModelMatrix(3)[3][2]);

    //cout << "Makes it to update!" << endl;
    float dt = getDT();
    int counter; 

    // pass dt to all objects and let them update themselves based on their
    // current flags/status
    if(!pauseBool)
    {
        dynamicsWorld->setGravity(btVector3(gravityX, -10, gravityZ)); 
        dynamicsWorld->stepSimulation(dt, 10.0f);

        for (counter = 0; counter < globalObjCount; counter++)
        {
            objectsDataList.updateObject(counter);
        }
    }

    switch(viewNum)
        {
            case 0:
                 view = glm::lookAt( glm::vec3(camX, camY, camZ), //Eye Position
                                glm::vec3(0, 0.0, 0.0), //Focus point
                                glm::vec3(0.0, 0.0, 1.0)); //Positive Y is up
                break;

            case 1:
                view = glm::lookAt( glm::vec3(tempPlayerOne.x + camX + offsetX, 30.0 + offsetY, tempPlayerOne.z + camZ + offsetZ), //Eye Position
                        glm::vec3(tempPlayerOne.x + offsetX, tempPlayerOne.y + offsetY, tempPlayerOne.z + offsetZ), //Focus point
                        glm::vec3(0.0, 0.0, 1.0)); //Positive Y is up
                break;

            case 2:
                //view = glm::lookAt( glm::vec3(tempPlayerTwo.x, 40.0, tempPlayerTwo.z), //Eye Position
                        //glm::vec3(tempPlayerTwo.x, tempPlayerTwo.y, tempPlayerTwo.z), //Focus point
                        //glm::vec3(0.0, 0.0, 1.0)); //Positive Y is up
                break;

        }

    //checkGoal();
   
    // Update the state of the scene
    glutPostRedisplay();//call the display callback    
}
开发者ID:alexwardCS480,项目名称:CS480Ward,代码行数:53,代码来源:main.cpp

示例2: render

//--Implementations
void render()
{
    int counter;
    //clear the screen
    glClearColor(1.0, 1.0, 1.0, 1.0); 
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    //enable the shader program
    glUseProgram(program);

    glUniform1f(loc_lightType, lightTypeVal);
    glUniform1f(loc_lightType2, lightTypeVal2);


    for(counter = 0; counter < globalObjCount; counter++)
    {
        //matrix MVP for planet    
        mvp = projection * view * objectsDataList.getModelMatrix(counter);

        // load each objects mvp
        renderObject( mvp, counter );
    }

    score();                      
  
    //Render Text
    string playerOneStr = "Player One Score:" + numToStr(scoreOne);
    string elapsedTime = "Elapsed Time:" + numToStr(elapsedDT());

    glColor3d(0.0, 0.0, 0.0);
    glMatrixMode(GL_PROJECTION);
    //glPushMatrix();
    glLoadIdentity();
    gluOrtho2D(0, w, 0, h);
    glScalef(1, -1, 1);
    glTranslatef(0, -h, 0);
    //glMatrixMode(GL_MODELVIEW);
    //glLoadIdentity();
    renderBitmapString(30,40,(void *)GLUT_BITMAP_HELVETICA_18,playerOneStr);
    glColor3d(0.0, 0.0, 0.0);
    renderBitmapString(30,60,(void *)GLUT_BITMAP_HELVETICA_18,elapsedTime);
    glPushMatrix();
    //glMatrixMode(GL_PROJECTION);
    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);
       

    //clean up
    glDisableVertexAttribArray(loc_position);
    glDisableVertexAttribArray(loc_uv);
    glDisableVertexAttribArray(loc_normal);

    //enable depth testing
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);

    //swap the buffers
    glutSwapBuffers();
}
开发者ID:alexwardCS480,项目名称:CS480Ward,代码行数:60,代码来源:main.cpp

示例3: render

//--Implementations
void render()
{
    //cout << "Makes it to Render!" << endl;
    int counter;
    //clear the screen
    glClearColor(0.2, 0.2, 0.2, 1.0); 
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    //enable the shader program
    glUseProgram(program);


    for(counter = 0; counter < globalObjCount; counter++)
    {
        //matrix MVP for planet    
        mvp = projection * view * objectsDataList.getModelMatrix(counter);

        // load each objects mvp
        renderObject( mvp, counter );
    }
                           
    //swap the buffers
    glutSwapBuffers();
}
开发者ID:alexwardCS480,项目名称:CS480Ward,代码行数:25,代码来源:main.cpp


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