void PlotDefC::BasicFullDraw() { InitRenderer(); SetupDataView(); DrawAllObjects(); CloseRenderer(); }
// Render everything in the scene void CScene::RenderScene() { // Clear the back buffer - before drawing the geometry clear the entire window to a fixed colour float ClearColor[4] = { 0.2f, 0.2f, 0.3f, 1.0f }; // Good idea to match background to ambient colour mpd3dDeviceContext->ClearRenderTargetView( RenderTargetView, ClearColor ); mpd3dDeviceContext->ClearDepthStencilView( DepthStencilView, D3D10_CLEAR_DEPTH | D3D10_CLEAR_STENCIL , 1.0f, 0 ); // Clear the depth buffer too // Pass the camera's matrices to the vertex shader ViewMatrixVar->SetMatrix( (float*)&Camera.GetViewMatrix() ); ProjMatrixVar->SetMatrix( (float*)&Camera.GetProjectionMatrix() ); //pass the camera position //V3 temp = XMF3ToFloat3( Camera->GetPosition() ); //DirectX::XMFLOAT3 temp = Camera.GetPosition(); dxCameraPos->SetRawValue( &Camera.GetPosition(), 0, 12); //pass the lighting colours //temp = XMF3ToFloat3( AmbientColour ); dxAmbientColour->SetRawValue( &AmbientColour, 0, 12 ); SetLights( DirectX::XMFLOAT3(0.0f, 0.0f, 0.0f), mpLights, miNumLights); //--------------------------- // Render each model DrawAllObjects(false); mp_openSquares.RenderBatch(WorldMatrixVar, ModelColourVar); mp_walls.RenderBatch( WorldMatrixVar, ModelColourVar ); mp_pathModel.RenderBatch(WorldMatrixVar, ModelColourVar); mp_splineModel.RenderBatch(WorldMatrixVar, ModelColourVar); mp_heavyTurretModel.RenderBatch(WorldMatrixVar, ModelColourVar); mp_mediumTurretModel.RenderBatch(WorldMatrixVar, ModelColourVar); mp_lightTurretModel.RenderBatch(WorldMatrixVar, ModelColourVar); mpSpriteBatch->Begin(); //mpSpriteFont->DrawString( mpSpriteBatch, L"Hello, world!", DirectX::XMFLOAT2( 500.0f, 500.0f ) ); FontRect.bottom = 0; FontRect.right = 0; if( mb_showBaseIM ) { DisplayText( "Base Influence Map", 0); DisplayMapText(BASE_OFFSET); } if( mb_showBase2IM ) { DisplayText( "Base 2 Influence Map", 0); DisplayMapText(BASE2_OFFSET); } if( mb_showCost ) { DisplayText( "Square Cost", 0); DisplayMapText(COST_OFFSET); } if( mb_showHTIM ) { DisplayText( "Heavy Turret Influence Map", 0 ); DisplayMapText(HEAVY_OFFSET); } if( mb_showLTIM ) { DisplayText( "Light Turret Influence Map", 0); DisplayMapText(LIGHT_OFFSET); } if( mb_showMTIM ) { DisplayText( "Medium Turret Influence Map", 0); DisplayMapText(MEDIUM_OFFSET); } if( mb_showPathIM ) { DisplayText( "Path Influence Map", 0 ); DisplayMapText( PATH_OFFSET); } if( mb_showWallIM ) { DisplayText( "Wall Influence Map", 0); DisplayMapText(WALL_OFFSET); } mpSpriteBatch->End(); TwDraw(); //--------------------------- // Display the Scene // After we've finished drawing to the off-screen back buffer, we "present" it to the front buffer (the screen) SwapChain->Present( 0, 0 ); }