bool RageDisplay_D3D::BeginFrame() { GraphicsWindow::Update(); switch( g_pd3dDevice->TestCooperativeLevel() ) { case D3DERR_DEVICELOST: return false; case D3DERR_DEVICENOTRESET: { bool bIgnore = false; RString sError = SetD3DParams( bIgnore ); if( sError != "" ) RageException::Throw( sError ); break; } } g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 ); g_pd3dDevice->BeginScene(); return RageDisplay::BeginFrame(); }
void RenderingManagerC::update() { // Clear the backbuffer to a blue color g_pd3dDevice->Clear( 0L, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL, D3DCOLOR_XRGB(0,0,255), 1.0f, 0L ); // Begin the scene g_pd3dDevice->BeginScene(); DrawBackground(); DrawPlayer(); DrawRaycast(); DrawPortal(true); DrawPortal(false); DrawCrossHair(); //DrawBox(71.0f, 673.0f, 1218.0f, 673.0f, 0x00000000, 0xFFFFFFFF); DrawStaticObjects(); DrawTurrents(); // End the scene g_pd3dDevice->EndScene(); // Present the backbuffer contents to the display g_pd3dDevice->Present( NULL, NULL, NULL, NULL ); }
//----------------------------------------------------------------------------- // Name: Render() // Desc: Draws the scene //----------------------------------------------------------------------------- VOID Render() { // Clear the backbuffer and the zbuffer g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 ); // Begin the scene g_pd3dDevice->BeginScene(); // Setup the world, view, and projection matrices SetupMatrices(); // Meshes are divided into subsets, one for each material. Render them in // a loop for( DWORD i=0; i<g_dwNumMaterials; i++ ) { // Set the material and texture for this subset g_pd3dDevice->SetMaterial( &g_pMeshMaterials[i] ); g_pd3dDevice->SetTexture( 0, g_pMeshTextures[i] ); // Draw the mesh subset g_pMesh->DrawSubset( i ); } // End the scene g_pd3dDevice->EndScene(); // Present the backbuffer contents to the display g_pd3dDevice->Present( NULL, NULL, NULL, NULL ); }
//----------------------------------------------------------------------------- // Name: Render() // Desc: Draws the scene //----------------------------------------------------------------------------- VOID Render() { // Clear the backbuffer and the zbuffer g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 ); // Begin the scene g_pd3dDevice->BeginScene(); // Setup the lights and materials SetupLights(); // Setup the world, view, and projection matrices SetupMatrices(); // Render the vertex buffer contents g_pd3dDevice->SetStreamSource( 0, g_pVB, sizeof(CUSTOMVERTEX) ); g_pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX ); g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2*50-2 ); // End the scene g_pd3dDevice->EndScene(); // Present the backbuffer contents to the display g_pd3dDevice->Present( NULL, NULL, NULL, NULL ); }
void StartFrame() { d3ddevice->Clear( 0, NULL, D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0f, 0 ); d3ddevice->BeginScene(); }
//----------------------------------------------------------------------------- // Name: Render() // Desc: Draws the scene //----------------------------------------------------------------------------- VOID Render() { // Clear the backbuffer and the zbuffer g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 ); // Begin the scene g_pd3dDevice->BeginScene(); // Setup the world, view, and projection matrices SetupMatrices(); // Setup our texture. Using textures introduces the texture stage states, // which govern how textures get blended together (in the case of multiple // textures) and lighting information. In this case, we are modulating // (blending) our texture with the diffuse color of the vertices. g_pd3dDevice->SetTexture( 0, g_pTexture ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_DISABLE ); #ifdef SHOW_HOW_TO_USE_TCI // Note: to use D3D texture coordinate generation, use the stage state // D3DTSS_TEXCOORDINDEX, as shown below. In this example, we are using // the position of the vertex in camera space to generate texture // coordinates. The tex coord index (TCI) parameters are passed into a // texture transform, which is a 4x4 matrix which transforms the x,y,z // TCI coordinates into tu, tv texture coordinates. // In this example, the texture matrix is setup to // transform the texture from (-1,+1) position coordinates to (0,1) // texture coordinate space: // tu = 0.5*x + 0.5 // tv = -0.5*y + 0.5 D3DXMATRIX mat; mat._11 = 0.25f; mat._12 = 0.00f; mat._13 = 0.00f; mat._14 = 0.00f; mat._21 = 0.00f; mat._22 =-0.25f; mat._23 = 0.00f; mat._24 = 0.00f; mat._31 = 0.00f; mat._32 = 0.00f; mat._33 = 1.00f; mat._34 = 0.00f; mat._41 = 0.50f; mat._42 = 0.50f; mat._43 = 0.00f; mat._44 = 1.00f; g_pd3dDevice->SetTransform( D3DTS_TEXTURE0, &mat ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION ); #endif // Render the vertex buffer contents g_pd3dDevice->SetStreamSource( 0, g_pVB, sizeof(CUSTOMVERTEX) ); g_pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX ); g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2*50-2 ); // End the scene g_pd3dDevice->EndScene(); // Present the backbuffer contents to the display g_pd3dDevice->Present( NULL, NULL, NULL, NULL ); }
//----------------------------------------------------------------------------- // Name: Render() // Desc: Draws the scene //----------------------------------------------------------------------------- VOID Render() { if( NULL == g_pd3dDevice ) return; // Clear the backbuffer to a blue color g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 ); // Begin the scene g_pd3dDevice->BeginScene(); // Rendering of scene objects can happen here // End the scene g_pd3dDevice->EndScene(); // Present the backbuffer contents to the display g_pd3dDevice->Present( NULL, NULL, NULL, NULL ); }
bool RageDisplay_D3D::BeginFrame() { #if !defined(XBOX) switch( g_pd3dDevice->TestCooperativeLevel() ) { case D3DERR_DEVICELOST: return false; case D3DERR_DEVICENOTRESET: { bool bIgnore = false; CString sError = SetVideoMode( GraphicsWindow::GetParams(), bIgnore ); if( sError != "" ) RageException::Throw( sError ); break; } } #endif g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 ); g_pd3dDevice->BeginScene(); return true; }
void __cdecl main() { int screenshot = 0; InitialiseD3D(); g_pGamePads = new c_GamePads(); g_pWorld = new c_World(g_pD3DDevice, g_pGamePads); D3DVIEWPORT8 viewport; viewport.Height = 5000; viewport.Width = 5000; viewport.X = 0; viewport.Y = 0; viewport.MinZ = 0.0f; viewport.MaxZ = 1.0f; DWORD WinnerColor = D3DCOLOR_XRGB(0, 0, 100); g_pWorld->pPlayer[0]->Dead = 1; g_pWorld->pPlayer[1]->Dead = 1; //DWORD musicresult = 0; //CWMAFileStream music; //music.Initialize("D:\\song1.wma"); //XVideo video; //video.LoadVideo("D:\\test.xmv"); //video.PlayVideo(); if(g_pWorld->pPlayer[0]->Dead != 0 && g_pWorld->pPlayer[1]->Dead != 0) { WinnerColor = D3DCOLOR_XRGB(150, 0, 0); g_pWorld->pPlayer[0]->Dead = 0; g_pWorld->pPlayer[0]->TransX = 2.5f; g_pWorld->pPlayer[0]->TransY = 5.0f; g_pWorld->pPlayer[0]->Theta = 3.1415f/2.0f; g_pWorld->pPlayer[0]->Phi = 3.1415f/2.0f; g_pWorld->pPlayer[0]->Firing = 0; g_pWorld->pPlayer[1]->Dead = 0; g_pWorld->pPlayer[1]->TransX = 2.5f; g_pWorld->pPlayer[1]->TransY = 80.0f - 5.0f; g_pWorld->pPlayer[1]->Theta = -3.1415f/2.0f; g_pWorld->pPlayer[1]->Phi = 3.1415f/2.0f; g_pWorld->pPlayer[1]->Firing = 0; g_pWorld->pPlayer[2]->Dead = 0; g_pWorld->pPlayer[2]->TransX = 180.0f - 2.5f; g_pWorld->pPlayer[2]->TransY = 5.0f; g_pWorld->pPlayer[2]->Theta = 3.1415f/2.0f; g_pWorld->pPlayer[2]->Phi = 3.1415f/2.0f; g_pWorld->pPlayer[2]->Firing = 0; g_pWorld->pPlayer[3]->Dead = 0; g_pWorld->pPlayer[3]->TransX = 180.0f - 2.5f; g_pWorld->pPlayer[3]->TransY = 80.0f - 5.0f; g_pWorld->pPlayer[3]->Theta = -3.1415f/2.0f; g_pWorld->pPlayer[3]->Phi = 3.1415f/2.0f; g_pWorld->pPlayer[3]->Firing = 0; g_pWorld->bfirstblood = 0; g_pWorld->rumble->Play(0); for(int i=0; i<150; i++) { g_pWorld->Balls[i].State = 0; } g_pWorld->wait = 1200; } while(true) { //music.Process(&musicresult); //DirectSoundDoWork(); g_pGamePads->GetInput(); if( (g_pGamePads->pGP1->wButtons & XINPUT_GAMEPAD_START) && (g_pGamePads->pGP1->wButtons & XINPUT_GAMEPAD_BACK) ) ReBoot(); if(g_pGamePads->pGP1->wButtons & XINPUT_GAMEPAD_DPAD_DOWN) { if(screenshot == 0) { screenshot = 1; CaptureScreen(g_pD3DDevice, "D:\\screen.bmp"); } } if(g_pWorld->pPlayer[0]->Dead != 0 && g_pWorld->pPlayer[1]->Dead != 0) { WinnerColor = D3DCOLOR_XRGB(150, 0, 0); g_pWorld->pPlayer[0]->Dead = 0; g_pWorld->pPlayer[0]->TransX = 2.5f; g_pWorld->pPlayer[0]->TransY = 5.0f; g_pWorld->pPlayer[0]->Theta = 3.1415f/2.0f; g_pWorld->pPlayer[0]->Phi = 3.1415f/2.0f; g_pWorld->pPlayer[0]->Firing = 0; g_pWorld->pPlayer[1]->Dead = 0; g_pWorld->pPlayer[1]->TransX = 2.5f; g_pWorld->pPlayer[1]->TransY = 80.0f - 5.0f; g_pWorld->pPlayer[1]->Theta = -3.1415f/2.0f; g_pWorld->pPlayer[1]->Phi = 3.1415f/2.0f; g_pWorld->pPlayer[1]->Firing = 0; g_pWorld->pPlayer[2]->Dead = 0; g_pWorld->pPlayer[2]->TransX = 180.0f - 2.5f; g_pWorld->pPlayer[2]->TransY = 5.0f; g_pWorld->pPlayer[2]->Theta = 3.1415f/2.0f; g_pWorld->pPlayer[2]->Phi = 3.1415f/2.0f; g_pWorld->pPlayer[2]->Firing = 0; g_pWorld->pPlayer[3]->Dead = 0; g_pWorld->pPlayer[3]->TransX = 180.0f - 2.5f; g_pWorld->pPlayer[3]->TransY = 80.0f - 5.0f; g_pWorld->pPlayer[3]->Theta = -3.1415f/2.0f; g_pWorld->pPlayer[3]->Phi = 3.1415f/2.0f; g_pWorld->pPlayer[3]->Firing = 0; g_pWorld->bfirstblood = 0; g_pWorld->redwins->Play(0); (g_pWorld->CurrLevel)++; if(g_pWorld->CurrLevel == 5) g_pWorld->CurrLevel = 0; (g_pWorld->Boards) = &((g_pWorld->BoardsAll)[g_pWorld->CurrLevel][0]); for(int i=0; i<150; i++) { g_pWorld->Balls[i].State = 0; } g_pWorld->wait = 800; } if(g_pWorld->pPlayer[2]->Dead != 0 && g_pWorld->pPlayer[3]->Dead != 0) { WinnerColor = D3DCOLOR_XRGB(0, 0, 150); g_pWorld->pPlayer[0]->Dead = 0; g_pWorld->pPlayer[0]->TransX = 2.5f; g_pWorld->pPlayer[0]->TransY = 5.0f; g_pWorld->pPlayer[0]->Theta = 3.1415f/2.0f; g_pWorld->pPlayer[0]->Phi = 3.1415f/2.0f; g_pWorld->pPlayer[0]->Firing = 0; g_pWorld->pPlayer[1]->Dead = 0; g_pWorld->pPlayer[1]->TransX = 2.5f; g_pWorld->pPlayer[1]->TransY = 80.0f - 5.0f; g_pWorld->pPlayer[1]->Theta = -3.1415f/2.0f; g_pWorld->pPlayer[1]->Phi = 3.1415f/2.0f; g_pWorld->pPlayer[1]->Firing = 0; g_pWorld->pPlayer[2]->Dead = 0; g_pWorld->pPlayer[2]->TransX = 180.0f - 2.5f; g_pWorld->pPlayer[2]->TransY = 5.0f; g_pWorld->pPlayer[2]->Theta = 3.1415f/2.0f; g_pWorld->pPlayer[2]->Phi = 3.1415f/2.0f; g_pWorld->pPlayer[2]->Firing = 0; g_pWorld->pPlayer[3]->Dead = 0; g_pWorld->pPlayer[3]->TransX = 180.0f - 2.5f; g_pWorld->pPlayer[3]->TransY = 80.0f - 5.0f; g_pWorld->pPlayer[3]->Theta = -3.1415f/2.0f; g_pWorld->pPlayer[3]->Phi = 3.1415f/2.0f; g_pWorld->pPlayer[3]->Firing = 0; g_pWorld->bfirstblood = 0; g_pWorld->bluewins->Play(0); (g_pWorld->CurrLevel)++; if(g_pWorld->CurrLevel == 5) g_pWorld->CurrLevel = 0; (g_pWorld->Boards) = &((g_pWorld->BoardsAll)[g_pWorld->CurrLevel][0]); for(int i=0; i<150; i++) { g_pWorld->Balls[i].State = 0; } g_pWorld->wait = 800; } g_pD3DDevice->SetViewport(&viewport); g_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, WinnerColor, 0.0f, 0); g_pD3DDevice->BeginScene(); g_pWorld->UpdateWorld(); g_pD3DDevice->EndScene(); g_pD3DDevice->Present(NULL, NULL, NULL, NULL); } }