Skip to content

Commit

Permalink
Merge pull request #31 from xycaleth/rend2
Browse files Browse the repository at this point in the history
Begin/end scene when rendering weather depth map
  • Loading branch information
SomaZ authored May 27, 2018
2 parents 9026b94 + 04eed5b commit dc3edb7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion codemp/rd-rend2/tr_weather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down

0 comments on commit dc3edb7

Please sign in to comment.