- Use openings for extra plane clipping.

SVN r3148 (3dfloors3)
This commit is contained in:
Randy Heit 2011-02-12 02:41:17 +00:00
parent bc1e0193db
commit 2b43d022e0
6 changed files with 24 additions and 24 deletions

View file

@ -12,6 +12,7 @@
#include "r_local.h"
#include "r_bsp.h"
#include "r_plane.h"
#include "r_segs.h"
#include "r_3dfloors.h"
@ -180,10 +181,10 @@ vissubsector_t *R_3D_EnterSubsector(subsector_t *sub)
vsub->Planes = NULL;
vsub->MinX = SHRT_MAX;
vsub->MaxX = SHRT_MIN;
vsub->uclip = (short *)VisXPlaneArena.Alloc(sizeof(short) * viewwidth * 2);
vsub->dclip = vsub->uclip + viewwidth;
memcpy(vsub->uclip, ceilingclip, sizeof(*ceilingclip)*viewwidth);
memcpy(vsub->dclip, floorclip, sizeof(*floorclip)*viewwidth);
vsub->uclip = R_NewOpening(viewwidth);
vsub->dclip = R_NewOpening(viewwidth);
memcpy(openings + vsub->uclip, ceilingclip, sizeof(*ceilingclip)*viewwidth);
memcpy(openings + vsub->dclip, floorclip, sizeof(*floorclip)*viewwidth);
if (sub->sector->e != NULL)
{
@ -269,8 +270,8 @@ static void AddVisXPlane(vissubsector_t *vsub, sector_t *sec, F3DFloor *ffloor,
vsub->Planes = xplane;
// Initialize with current floor/ceilingclip.
memcpy(xplane->UClip, ceilingclip, sizeof(short)*viewwidth);
memcpy(xplane->DClip, floorclip, sizeof(short)*viewwidth);
memcpy(openings + xplane->UClip, ceilingclip, sizeof(short)*viewwidth);
memcpy(openings + xplane->DClip, floorclip, sizeof(short)*viewwidth);
}
//=============================================================================
@ -284,12 +285,11 @@ static void AddVisXPlane(vissubsector_t *vsub, sector_t *sec, F3DFloor *ffloor,
visxplane_t *R_NewVisXPlane()
{
visxplane_t *xplane = (visxplane_t *)VisXPlaneArena.Alloc(sizeof(visxplane_t) +
sizeof(short)*viewwidth * 2);
visxplane_t *xplane = (visxplane_t *)VisXPlaneArena.Alloc(sizeof(visxplane_t));
xplane->Next = NULL;
xplane->UClip = (unsigned short *)((BYTE *)xplane + sizeof(visxplane_t));
xplane->DClip = xplane->UClip + viewwidth;
xplane->UClip = R_NewOpening(viewwidth);
xplane->DClip = R_NewOpening(viewwidth);
xplane->PlaneRef = NULL;
xplane->LightLevel = 0;
xplane->Orientation = -1;
@ -333,13 +333,13 @@ void R_3D_MarkPlanes(vissubsector_t *vsub, EMarkPlaneEdge edge, vertex_t *v1, ve
for (visxplane_t *xplane = vsub->Planes; xplane != NULL; xplane = xplane->Next)
{
short most[MAXWIDTH], *in;
unsigned short *out, *uclip, *dclip;
short *out, *uclip, *dclip;
WallMost(most, xplane->Plane, v1, v2);
// Clip to existing bounds.
uclip = xplane->UClip;
dclip = xplane->DClip;
uclip = openings + xplane->UClip;
dclip = openings + xplane->DClip;
if (xplane->Orientation == sector_t::ceiling)
{ // For a ceiling, the near edge is the top, and the far edge is the bottom.
out = edge == MARK_NEAR ? uclip : dclip;

View file

@ -1215,8 +1215,8 @@ struct FCoverageBuffer
struct visxplane_t
{
visxplane_t *Next;
unsigned short *UClip; // Clipping for the top edge of the plane.
unsigned short *DClip; // Clipping for the bottom edge of the plane.
ptrdiff_t UClip; // Clipping for the top edge of the plane.
ptrdiff_t DClip; // Clipping for the bottom edge of the plane.
F3DFloor::planeref *PlaneRef; // Source plane
F3DFloor *FakeFloor; // Source 3D floor
FDynamicColormap *Colormap; // Colormap for plane
@ -1231,8 +1231,8 @@ struct vissubsector_t
visxplane_t *Planes;
short MinX; // Left edge, inclusive
short MaxX; // Right edge, exclusive
short *uclip; // Snapshot of ceilingclip at subsector entry
short *dclip; // Snapshot of floorclip at subsector entry
ptrdiff_t uclip; // Snapshot of ceilingclip at subsector entry
ptrdiff_t dclip; // Snapshot of floorclip at subsector entry
};
extern TArray<vissubsector_t> VisSubsectors;

View file

@ -972,7 +972,7 @@ static void R_DrawSkyStriped (visplane_t *pl)
//
//==========================================================================
void R_DrawXPlane(visxplane_t *xpl, short *uclip, short *dclip, int min, int max)
void R_DrawXPlane(visxplane_t *xpl, int min, int max)
{
visplane_t pl;
@ -990,8 +990,8 @@ void R_DrawXPlane(visxplane_t *xpl, short *uclip, short *dclip, int min, int max
pl.angle = 0;
pl.sky = 0;
pl.skybox = NULL;
pl.top = xpl->UClip;
pl.bottom = xpl->DClip;
pl.top = (unsigned short *)(openings + xpl->UClip);
pl.bottom = (unsigned short *)(openings + xpl->DClip);
R_DrawSinglePlane(&pl, FRACUNIT, false);
}

View file

@ -92,7 +92,7 @@ void R_DrawSkyPlane (visplane_t *pl);
void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool masked);
void R_DrawTiltedPlane (visplane_t *pl, fixed_t alpha, bool masked);
void R_MapVisPlane (visplane_t *pl, void (*mapfunc)(int y, int x1));
void R_DrawXPlane(visxplane_t *xpl, short *uclip, short *dclip, int min, int max);
void R_DrawXPlane(visxplane_t *xpl, int min, int max);
visplane_t *R_FindPlane
( const secplane_t &height,

View file

@ -3096,13 +3096,13 @@ static void R_RecurseXPlane(vissubsector_t *vsub, visxplane_t *xplane)
// Upon entry, draw the ceiling.
if (xplane->Orientation == sector_t::ceiling)
{
R_DrawXPlane(xplane, vsub->uclip, vsub->dclip, vsub->MinX, vsub->MaxX);
R_DrawXPlane(xplane, vsub->MinX, vsub->MaxX);
}
R_RecurseXPlane(vsub, xplane->Next);
// Upon exit, draw the floor.
if (xplane->Orientation == sector_t::floor)
{
R_DrawXPlane(xplane, vsub->uclip, vsub->dclip, vsub->MinX, vsub->MaxX);
R_DrawXPlane(xplane, vsub->MinX, vsub->MaxX);
}
}

View file

@ -287,7 +287,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="src\win32;src\sound;src;zlib;src\g_shared;src\g_doom;src\g_raven;src\g_heretic;src\g_hexen;src\g_strife;&quot;jpeg-6b&quot;;&quot;game-music-emu\gme&quot;;gdtoa;bzip2;lzma\C"
PreprocessorDefinitions="WIN32,_DEBUG,_WIN32,_WINDOWS,_CRTDBG_MAP_ALLOC,HAVE_STRUPR,HAVE_FILELENGTH;NO_VA_COPY,BACKPATCH,HAVE_FLUIDSYNTH,DYN_FLUIDSYNTH,NOASM"
PreprocessorDefinitions="WIN32,_DEBUG,_WIN32,_WINDOWS,_CRTDBG_MAP_ALLOC,HAVE_STRUPR,HAVE_FILELENGTH;NO_VA_COPY,BACKPATCH,HAVE_FLUIDSYNTH,DYN_FLUIDSYNTH"
MinimalRebuild="true"
RuntimeLibrary="1"
EnableFunctionLevelLinking="true"