From 04eed5bdae420e4d28638a8d14065406ae651b33 Mon Sep 17 00:00:00 2001 From: Alex Lo Date: Sun, 27 May 2018 23:32:30 +0100 Subject: [PATCH] Begin/end scene when rendering weather depth map --- codemp/rd-rend2/tr_weather.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/codemp/rd-rend2/tr_weather.cpp b/codemp/rd-rend2/tr_weather.cpp index aec553a153..2cd0e7eebf 100644 --- a/codemp/rd-rend2/tr_weather.cpp +++ b/codemp/rd-rend2/tr_weather.cpp @@ -109,6 +109,16 @@ namespace orientationr_t orientation; R_SetOrientationOriginAndAxis(orientation, viewOrigin, left, forward, up); + refdef_t refdef = {}; + refdef.width = tr.weatherDepthFbo->width; + refdef.height = tr.weatherDepthFbo->height; + VectorCopy(orientation.origin, refdef.vieworg); + for (int i = 0; i < 3; ++i) + VectorCopy(orientation.axis[i], refdef.viewaxis[i]); + + RE_BeginScene(&refdef); + RE_ClearScene(); + R_SetupViewParmsForOrthoRendering( tr.weatherDepthFbo->width, tr.weatherDepthFbo->height, @@ -119,13 +129,13 @@ namespace const int firstDrawSurf = tr.refdef.numDrawSurfs; - RE_ClearScene(); R_GenerateDrawSurfs(&tr.viewParms, &tr.refdef); R_SortAndSubmitDrawSurfs( tr.refdef.drawSurfs + firstDrawSurf, tr.refdef.numDrawSurfs - firstDrawSurf); R_IssuePendingRenderCommands(); R_InitNextFrame(); + RE_EndScene(); } void RB_SimulateWeather(weatherSystem_t& ws)