mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- added some checks to the wall rendering code that will allow to disable the clip planes in many cases, even when a plane mirror portal is active. This also solves the precision issue with using world coordinates for clip checks.
This commit is contained in:
parent
00fcf4bc06
commit
9230a20f18
2 changed files with 10 additions and 4 deletions
|
@ -794,9 +794,8 @@ void GLPlaneMirrorPortal::DrawContents()
|
|||
validcount++;
|
||||
|
||||
float f = FIXED2FLOAT(planez);
|
||||
// the coordinate fudging is needed because for some reason this is nowhere near precise and leaves gaps. Strange...
|
||||
if (PlaneMirrorMode < 0) gl_RenderState.SetClipHeightTop(f+0.3f); // ceiling mirror: clip everytihng with a z lower than the portal's ceiling
|
||||
else gl_RenderState.SetClipHeightBottom(f-0.3f); // floor mirror: clip everything with a z higher than the portal's floor
|
||||
if (PlaneMirrorMode < 0) gl_RenderState.SetClipHeightTop(f); // ceiling mirror: clip everytihng with a z lower than the portal's ceiling
|
||||
else gl_RenderState.SetClipHeightBottom(f); // floor mirror: clip everything with a z higher than the portal's floor
|
||||
|
||||
PlaneMirrorFlag++;
|
||||
GLRenderer->SetupView(viewx, viewy, viewz, viewangle, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
|
||||
|
|
|
@ -225,7 +225,7 @@ void GLWall::SetupLights()
|
|||
|
||||
void GLWall::RenderWall(int textured, ADynamicLight * light, unsigned int *store)
|
||||
{
|
||||
texcoord tcs[4];
|
||||
static texcoord tcs[4]; // making this variable static saves us a relatively costly stack integrity check.
|
||||
bool split = (gl_seamless && !(textured&RWF_NOSPLIT) && seg->sidedef != NULL && !(seg->sidedef->Flags & WALLF_POLYOBJ));
|
||||
|
||||
if (!light)
|
||||
|
@ -249,7 +249,14 @@ void GLWall::RenderWall(int textured, ADynamicLight * light, unsigned int *store
|
|||
|
||||
if (!(textured & RWF_NORENDER))
|
||||
{
|
||||
// disable the clip plane if it isn't needed (which can be determined by a simple check.)
|
||||
float ct = gl_RenderState.GetClipHeightTop();
|
||||
float cb = gl_RenderState.GetClipHeightBottom();
|
||||
if (ztop[0] <= ct && ztop[1] <= ct) gl_RenderState.SetClipHeightTop(65536.f);
|
||||
if (zbottom[0] >= cb && zbottom[1] >= cb) gl_RenderState.SetClipHeightBottom(-65536.f);
|
||||
gl_RenderState.Apply();
|
||||
gl_RenderState.SetClipHeightTop(ct);
|
||||
gl_RenderState.SetClipHeightBottom(cb);
|
||||
}
|
||||
|
||||
// the rest of the code is identical for textured rendering and lights
|
||||
|
|
Loading…
Reference in a new issue