Does whatever needs to be done to get D3D ready for the current frame
| 2339 | |
| 2340 | // Does whatever needs to be done to get D3D ready for the current frame |
| 2341 | void d3d_BeginFrame(int x1, int y1, int x2, int y2, int clear_flags) { |
| 2342 | HRESULT ddrval; |
| 2343 | |
| 2344 | // ASSERT (D3D_frame_started==0); |
| 2345 | |
| 2346 | ASSERT(x1 >= 0 && x1 <= D3D_state.screen_width); |
| 2347 | ASSERT(x2 >= 0 && x2 <= D3D_state.screen_width); |
| 2348 | ASSERT(y1 >= 0 && y1 <= D3D_state.screen_height); |
| 2349 | ASSERT(y2 >= 0 && y2 <= D3D_state.screen_height); |
| 2350 | |
| 2351 | D3D_state.clip_x1 = x1; |
| 2352 | D3D_state.clip_y1 = y1; |
| 2353 | D3D_state.clip_x2 = x2; |
| 2354 | D3D_state.clip_y2 = y2; |
| 2355 | |
| 2356 | ddrval = lpD3DDevice->BeginScene(); |
| 2357 | if (ddrval != D3D_OK) { |
| 2358 | mprintf(0, "D3D:Failed to begin scene!\n%s\n", d3d_ErrorString(ddrval)); |
| 2359 | return; |
| 2360 | } |
| 2361 | |
| 2362 | D3D_frame_started = 1; |
| 2363 | |
| 2364 | D3DRECT myrect; |
| 2365 | |
| 2366 | myrect.x1 = x1; |
| 2367 | myrect.x2 = x2; |
| 2368 | myrect.y1 = y1; |
| 2369 | myrect.y2 = y2; |
| 2370 | |
| 2371 | if (clear_flags & RF_CLEAR_ZBUFFER) { |
| 2372 | if (clear_flags & RF_CLEAR_COLOR) { |
| 2373 | lpViewport->Clear2(1UL, &myrect, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3D_state.cur_color, 1.0f, 0L); |
| 2374 | } else { |
| 2375 | lpViewport->Clear2(1UL, &myrect, D3DCLEAR_ZBUFFER, D3D_state.cur_color, 1.0f, 0L); |
| 2376 | } |
| 2377 | } else if (clear_flags & RF_CLEAR_COLOR) { |
| 2378 | lpViewport->Clear2(1UL, &myrect, D3DCLEAR_TARGET, D3D_state.cur_color, 1.0f, 0L); |
| 2379 | } |
| 2380 | } |
| 2381 | |
| 2382 | // Ends the frame |
| 2383 | void d3d_EndFrame() { |
no test coverage detected