void Game_Draw() { // set projection MFView_SetAspectRatio(MFDisplay_GetNativeAspectRatio()); MFView_SetProjection(); // render the mesh MFRenderer_AddModel(pModel, NULL, MFView_GetViewState()); }
void Game_Draw() { if(!bShowModel) { MFView_SetOrtho(); // draw model list if(models.size() > 0) { for(int a=0; a<(int)models.size(); ++a) { MFFont_DrawText2(MFFont_GetDebugFont(), 100.f, 100.f + (-menuIndex*20 + a*20), 20.f, a == menuIndex ? MFVector::yellow : MFVector::white, models[a].CStr()); } } else { MFFont_DrawText2(MFFont_GetDebugFont(), 100.f, 100.f, 20.f, MFVector::red, "No models found!"); } } else { if(pModel) { // set projection MFView_ConfigureProjection(MFDEGREES(60.f), 0.1f, 10000.f); MFView_SetAspectRatio(MFDisplay_GetNativeAspectRatio()); MFView_SetProjection(); // render the mesh MFRenderer_AddModel(pModel, NULL, MFView_GetViewState()); } else { MFView_SetOrtho(); MFFont_DrawText2(MFFont_GetDebugFont(), 100.f, 100.f, 20.f, MFVector::red, "Failed to load model!"); } } }
void Game_Draw() { MFCALLSTACK; MFRenderer_SetClearColour(0.f, 0.f, 0.2f, 1.f); MFRenderer_ClearScreen(); // Set identity camera (no camera) MFView_Push(); MFView_SetAspectRatio(MFDisplay_GetNativeAspectRatio()); MFView_SetProjection(); MFMaterial_SetMaterial(MFMaterial_GetStockMaterial(MFMat_White)); // set the world matrix to identity MFMatrix world = MFMatrix::identity; // move the box into the scene (along the z axis) world.Translate(MakeVector(0, 0, 5)); // increment rotation static float rotation = 0.0f; rotation += MFSystem_TimeDelta(); // rotate the box world.RotateYPR(rotation, rotation * 2.0f, rotation * 0.5f); // begin rendering the box MFPrimitive(PT_TriList); MFSetMatrix(world); // begin rendering 12 triangles (12 * 3 vertices) MFBegin(3 * 12); // draw a bunch of triangles MFSetColour(1,0,0,1); MFSetPosition(-1,-1, -1); MFSetPosition(-1, 1, -1); MFSetPosition( 1, 1, -1); MFSetPosition(-1,-1, -1); MFSetPosition( 1, 1, -1); MFSetPosition( 1,-1, -1); MFSetColour(0,1,0,1); MFSetPosition(-1,-1,1); MFSetPosition( 1,-1,1); MFSetPosition( 1, 1,1); MFSetPosition(-1,-1,1); MFSetPosition( 1, 1,1); MFSetPosition(-1, 1,1); MFSetColour(0,0,1,1); MFSetPosition( 1,-1,1); MFSetPosition( 1,-1,-1); MFSetPosition( 1, 1,-1); MFSetPosition( 1,-1,1); MFSetPosition( 1, 1,-1); MFSetPosition( 1, 1,1); MFSetColour(1,0,1,1); MFSetPosition(-1,-1,1); MFSetPosition(-1, 1,1); MFSetPosition(-1, 1,-1); MFSetPosition(-1,-1,1); MFSetPosition(-1, 1,-1); MFSetPosition(-1,-1,-1); MFSetColour(1,1,0,1); MFSetPosition(-1, 1,1); MFSetPosition( 1, 1,1); MFSetPosition( 1, 1,-1); MFSetPosition(-1, 1,1); MFSetPosition( 1, 1,-1); MFSetPosition(-1, 1,-1); MFSetColour(0,1,1,1); MFSetPosition(-1,-1,1); MFSetPosition(-1,-1,-1); MFSetPosition( 1,-1,-1); MFSetPosition(-1,-1,1); MFSetPosition( 1,-1,-1); MFSetPosition( 1,-1,1); MFEnd(); MFRect disp; MFDisplay_GetDisplayRect(&disp); MFView_SetOrtho(&disp); pUI->Draw(); MFView_Pop(); }