mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 06:53:40 +00:00
- Apply kgsws-CZ's fixes:
* Added new cvar, r_3dfloors for testing, so for example, you can see the FPS difference. * ds_p->bkup is not always allocated. * Fixed particles visible through 3D floors. * Fixed FAKE3D flag names. SVN r3178 (trunk)
This commit is contained in:
parent
7ae888e726
commit
0d39257eaf
5 changed files with 19 additions and 16 deletions
|
@ -12,7 +12,7 @@
|
|||
#include "r_local.h"
|
||||
#include "r_bsp.h"
|
||||
#include "r_plane.h"
|
||||
|
||||
#include "c_cvars.h"
|
||||
#include "r_3dfloors.h"
|
||||
|
||||
// external variables
|
||||
|
@ -28,6 +28,8 @@ HeightLevel *height_cur = NULL;
|
|||
int CurrentMirror = 0;
|
||||
int CurrentSkybox = 0;
|
||||
|
||||
CVAR(Int, r_3dfloors, true, 0);
|
||||
|
||||
// private variables
|
||||
int height_max = -1;
|
||||
TArray<HeightStack> toplist;
|
||||
|
|
|
@ -37,13 +37,13 @@ enum
|
|||
FAKE3D_FAKECEILING = 2, // fake ceiling, mark seg as FAKE
|
||||
FAKE3D_FAKEBACK = 4, // R_AddLine with fake backsector, mark seg as FAKE
|
||||
FAKE3D_FAKEMASK = 7,
|
||||
FAKE3D_CLIPBOTFRONT = 8, // use front sector clipping info (bottom)
|
||||
FAKE3D_CLIPTOPFRONT = 16, // use front sector clipping info (top)
|
||||
|
||||
// sorting stage:
|
||||
FAKE3D_CLIPBOTTOM = 1, // clip bottom
|
||||
FAKE3D_CLIPTOP = 2, // clip top
|
||||
FAKE3D_REFRESHCLIP = 4, // refresh clip info
|
||||
FAKE3D_DOWN2UP = 8, // rendering from down to up (floors)
|
||||
FAKE3D_16 = 16, // what is this?
|
||||
};
|
||||
|
||||
extern int fake3D;
|
||||
|
@ -57,6 +57,7 @@ extern HeightLevel *height_top;
|
|||
extern HeightLevel *height_cur;
|
||||
extern int CurrentMirror;
|
||||
extern int CurrentSkybox;
|
||||
EXTERN_CVAR(Int, r_3dfloors);
|
||||
|
||||
// functions
|
||||
void R_3D_DeleteHeights();
|
||||
|
|
|
@ -1238,7 +1238,7 @@ void R_Subsector (subsector_t *sub)
|
|||
) : NULL;
|
||||
|
||||
// kg3D - fake planes rendering
|
||||
if (frontsector->e && frontsector->e->XFloor.ffloors.Size())
|
||||
if (r_3dfloors && frontsector->e && frontsector->e->XFloor.ffloors.Size())
|
||||
{
|
||||
backupfp = floorplane;
|
||||
backupcp = ceilingplane;
|
||||
|
@ -1399,7 +1399,7 @@ void R_Subsector (subsector_t *sub)
|
|||
if (!outersubsector || line->sidedef == NULL || !(line->sidedef->Flags & WALLF_POLYOBJ))
|
||||
{
|
||||
// kg3D - fake planes bounding calculation
|
||||
if (line->backsector && frontsector->e && line->backsector->e->XFloor.ffloors.Size())
|
||||
if (r_3dfloors && line->backsector && frontsector->e && line->backsector->e->XFloor.ffloors.Size())
|
||||
{
|
||||
backupfp = floorplane;
|
||||
backupcp = ceilingplane;
|
||||
|
@ -1423,11 +1423,11 @@ void R_Subsector (subsector_t *sub)
|
|||
}
|
||||
if (frontsector->CenterFloor() >= backsector->CenterFloor())
|
||||
{
|
||||
fake3D |= FAKE3D_DOWN2UP;
|
||||
fake3D |= FAKE3D_CLIPBOTFRONT;
|
||||
}
|
||||
if (frontsector->CenterCeiling() <= backsector->CenterCeiling())
|
||||
{
|
||||
fake3D |= FAKE3D_16;
|
||||
fake3D |= FAKE3D_CLIPTOPFRONT;
|
||||
}
|
||||
R_AddLine(line); // fake
|
||||
}
|
||||
|
@ -1455,7 +1455,6 @@ void R_Subsector (subsector_t *sub)
|
|||
void R_RenderBSPNode (void *node)
|
||||
{
|
||||
if (numnodes == 0)
|
||||
{
|
||||
R_Subsector (subsectors);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1614,7 +1614,7 @@ void R_RenderSegLoop ()
|
|||
// kg3D - fake planes clipping
|
||||
if (fake3D & FAKE3D_REFRESHCLIP)
|
||||
{
|
||||
if (fake3D & FAKE3D_DOWN2UP)
|
||||
if (fake3D & FAKE3D_CLIPBOTFRONT)
|
||||
{
|
||||
memcpy (fakeFloor->floorclip+x1, wallbottom+x1, (x2-x1)*sizeof(short));
|
||||
}
|
||||
|
@ -1626,7 +1626,7 @@ void R_RenderSegLoop ()
|
|||
}
|
||||
memcpy (fakeFloor->floorclip+x1, walllower+x1, (x2-x1)*sizeof(short));
|
||||
}
|
||||
if (fake3D & FAKE3D_16)
|
||||
if (fake3D & FAKE3D_CLIPTOPFRONT)
|
||||
{
|
||||
memcpy (fakeFloor->ceilingclip+x1, walltop+x1, (x2-x1)*sizeof(short));
|
||||
}
|
||||
|
@ -2241,7 +2241,7 @@ void R_StoreWallRange (int start, int stop)
|
|||
}
|
||||
}
|
||||
|
||||
if(!ds_p->fake && backsector->e && backsector->e->XFloor.ffloors.Size()) {
|
||||
if(!ds_p->fake && r_3dfloors && backsector->e && backsector->e->XFloor.ffloors.Size()) {
|
||||
for(i = 0; i < (int)backsector->e->XFloor.ffloors.Size(); i++) {
|
||||
F3DFloor *rover = backsector->e->XFloor.ffloors[i];
|
||||
if(rover->flags & FF_RENDERSIDES && (!(rover->flags & FF_INVERTSIDES) || rover->flags & FF_ALLSIDES)) {
|
||||
|
@ -2250,7 +2250,7 @@ void R_StoreWallRange (int start, int stop)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(!ds_p->fake && frontsector->e && frontsector->e->XFloor.ffloors.Size()) {
|
||||
if(!ds_p->fake && r_3dfloors && frontsector->e && frontsector->e->XFloor.ffloors.Size()) {
|
||||
for(i = 0; i < (int)frontsector->e->XFloor.ffloors.Size(); i++) {
|
||||
F3DFloor *rover = frontsector->e->XFloor.ffloors[i];
|
||||
if(rover->flags & FF_RENDERSIDES && (rover->flags & FF_ALLSIDES || rover->flags & FF_INVERTSIDES)) {
|
||||
|
@ -2274,6 +2274,10 @@ void R_StoreWallRange (int start, int stop)
|
|||
|
||||
maskedtexture = true;
|
||||
|
||||
// kg3D - backup for mid and fake walls
|
||||
ds_p->bkup = R_NewOpening(stop - start);
|
||||
memcpy(openings + ds_p->bkup, &ceilingclip[start], sizeof(short)*(stop - start));
|
||||
|
||||
ds_p->bFogBoundary = IsFogBoundary (frontsector, backsector);
|
||||
if (sidedef->GetTexture(side_t::mid).isValid() || ds_p->bFakeBoundary)
|
||||
{
|
||||
|
@ -2369,9 +2373,6 @@ void R_StoreWallRange (int start, int stop)
|
|||
{
|
||||
ds_p->sprtopclip = R_NewOpening (stop - start);
|
||||
memcpy (openings + ds_p->sprtopclip, &ceilingclip[start], sizeof(short)*(stop-start));
|
||||
// kg3D - backup for mid and fake walls
|
||||
ds_p->bkup = R_NewOpening (stop - start);
|
||||
memcpy (openings + ds_p->bkup, &ceilingclip[start], sizeof(short)*(stop-start));
|
||||
}
|
||||
|
||||
if ( ((ds_p->silhouette & SIL_BOTTOM) || maskedtexture) && ds_p->sprbottomclip == -1)
|
||||
|
|
|
@ -3410,7 +3410,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
|
|||
vis->cx = tx;
|
||||
vis->gx = particle->x;
|
||||
vis->gy = particle->y;
|
||||
vis->texturemid = particle->z; // kg3D
|
||||
vis->gz = particle->z; // kg3D
|
||||
vis->gzb = y1;
|
||||
vis->gzt = y2;
|
||||
vis->x1 = x1;
|
||||
|
|
Loading…
Reference in a new issue