mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-28 06:22:05 +00:00
OpenGL: Implement rendering overlay textures on 3D floor sides
This commit is contained in:
parent
61e48af0dc
commit
525cb3fd91
3 changed files with 139 additions and 183 deletions
|
@ -1237,52 +1237,43 @@ static void HWR_RenderMidtexture(INT32 gl_midtexture, float cliplow, float cliph
|
|||
HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap);
|
||||
}
|
||||
|
||||
static void HWR_GetExtraTextureCoords(unsigned which, fixed_t *top, fixed_t *bottom, fixed_t *topslope, fixed_t *bottomslope, fixed_t worldtop, fixed_t worldbottom, fixed_t worldhigh, fixed_t worldlow, fixed_t worldtopslope, fixed_t worldbottomslope, fixed_t worldhighslope, fixed_t worldlowslope, fixed_t midtexheight)
|
||||
static void HWR_GetExtraTextureCoords(unsigned which, side_t *side, sector_t *sec_front, sector_t *sec_back, fixed_t *top, fixed_t *bottom, fixed_t *topslope, fixed_t *bottomslope, fixed_t worldtop, fixed_t worldbottom, fixed_t worldhigh, fixed_t worldlow, fixed_t worldtopslope, fixed_t worldbottomslope, fixed_t worldhighslope, fixed_t worldlowslope, fixed_t midtexheight)
|
||||
{
|
||||
fixed_t polytop, polybottom;
|
||||
fixed_t polytopslope, polybottomslope;
|
||||
|
||||
fixed_t rowoffset = FixedDiv(gl_sidedef->rowoffset + gl_sidedef->overlays[which].offsety, abs(gl_sidedef->overlays[which].scaley));
|
||||
fixed_t rowoffset = FixedDiv(side->rowoffset + side->overlays[which].offsety, abs(side->overlays[which].scaley));
|
||||
|
||||
if (gl_sidedef->overlays[which].flags & SIDEOVERLAYFLAG_NOSKEW)
|
||||
if (side->overlays[which].flags & SIDEOVERLAYFLAG_NOSKEW)
|
||||
{
|
||||
if (IS_TOP_EDGE_TEXTURE(which))
|
||||
{
|
||||
if (gl_backsector)
|
||||
if (sec_back)
|
||||
{
|
||||
if (IS_UPPER_EDGE_TEXTURE(which))
|
||||
polybottom = max(gl_frontsector->ceilingheight, gl_backsector->ceilingheight);
|
||||
polytop = max(sec_front->ceilingheight, sec_back->ceilingheight);
|
||||
else
|
||||
{
|
||||
polybottom = min(gl_frontsector->ceilingheight, gl_backsector->ceilingheight);
|
||||
polybottom += midtexheight;
|
||||
}
|
||||
polytop = min(sec_front->ceilingheight, sec_back->ceilingheight) + midtexheight;
|
||||
}
|
||||
else
|
||||
polybottom = gl_frontsector->ceilingheight;
|
||||
|
||||
polybottom += rowoffset;
|
||||
polytop = polybottom - midtexheight;
|
||||
polytop = sec_front->ceilingheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gl_backsector)
|
||||
if (sec_back)
|
||||
{
|
||||
if (IS_UPPER_EDGE_TEXTURE(which))
|
||||
polytop = max(gl_frontsector->floorheight, gl_backsector->floorheight);
|
||||
polytop = max(sec_front->floorheight, sec_back->floorheight);
|
||||
else
|
||||
{
|
||||
polytop = min(gl_frontsector->floorheight, gl_backsector->floorheight);
|
||||
polytop += midtexheight;
|
||||
}
|
||||
polytop = min(sec_front->floorheight, sec_back->floorheight) + midtexheight;
|
||||
}
|
||||
else
|
||||
polytop = gl_frontsector->floorheight;
|
||||
|
||||
polytop += rowoffset;
|
||||
polybottom = polytop + midtexheight;
|
||||
polytop = sec_front->floorheight + midtexheight;
|
||||
}
|
||||
|
||||
polytop += rowoffset;
|
||||
polybottom = polytop - midtexheight;
|
||||
|
||||
// The right side's coordinates are the the same as the left side
|
||||
polytopslope = polytop;
|
||||
polybottomslope = polybottom;
|
||||
|
@ -1328,7 +1319,7 @@ static void HWR_GetExtraTextureCoords(unsigned which, fixed_t *top, fixed_t *bot
|
|||
*bottomslope = polybottomslope;
|
||||
}
|
||||
|
||||
static void HWR_DoExtraTextureCut(UINT8 intersected, UINT8 which, v2d_t vs, v2d_t ve, float t, fixed_t midtexheight, fixed_t *polytop, fixed_t *polytopslope, fixed_t *polybottom, fixed_t *polybottomslope, float *ptx, float *pty, fixed_t *worldtop, fixed_t *worldbottom, fixed_t *worldhigh, fixed_t *worldlow, fixed_t *worldtopslope, fixed_t *worldbottomslope, fixed_t *worldhighslope, fixed_t *worldlowslope)
|
||||
static void HWR_DoExtraTextureCut(UINT8 intersected, UINT8 which, side_t *side, sector_t *sec_front, sector_t *sec_back, v2d_t vs, v2d_t ve, float t, fixed_t midtexheight, fixed_t *polytop, fixed_t *polytopslope, fixed_t *polybottom, fixed_t *polybottomslope, float *ptx, float *pty, fixed_t *worldtop, fixed_t *worldbottom, fixed_t *worldhigh, fixed_t *worldlow, fixed_t *worldtopslope, fixed_t *worldbottomslope, fixed_t *worldhighslope, fixed_t *worldlowslope)
|
||||
{
|
||||
fixed_t v1x = FloatToFixed(vs.x);
|
||||
fixed_t v1y = FloatToFixed(vs.y);
|
||||
|
@ -1352,20 +1343,20 @@ static void HWR_DoExtraTextureCut(UINT8 intersected, UINT8 which, v2d_t vs, v2d_
|
|||
}
|
||||
|
||||
// Get new coordinates based on this split
|
||||
*worldtop = P_GetSectorCeilingZAt(gl_frontsector, v1x, v1y);
|
||||
*worldtopslope = P_GetSectorCeilingZAt(gl_frontsector, v2x, v2y);
|
||||
*worldbottom = P_GetSectorFloorZAt(gl_frontsector, v1x, v1y);
|
||||
*worldbottomslope = P_GetSectorFloorZAt(gl_frontsector, v2x, v2y);
|
||||
*worldtop = P_GetSectorCeilingZAt(sec_front, v1x, v1y);
|
||||
*worldtopslope = P_GetSectorCeilingZAt(sec_front, v2x, v2y);
|
||||
*worldbottom = P_GetSectorFloorZAt(sec_front, v1x, v1y);
|
||||
*worldbottomslope = P_GetSectorFloorZAt(sec_front, v2x, v2y);
|
||||
|
||||
if (gl_backsector)
|
||||
if (sec_back)
|
||||
{
|
||||
*worldhigh = P_GetSectorCeilingZAt(gl_backsector, v1x, v1y);
|
||||
*worldhighslope = P_GetSectorCeilingZAt(gl_backsector, v2x, v2y);
|
||||
*worldlow = P_GetSectorFloorZAt(gl_backsector, v1x, v1y);
|
||||
*worldlowslope = P_GetSectorFloorZAt(gl_backsector, v2x, v2y);
|
||||
*worldhigh = P_GetSectorCeilingZAt(sec_back, v1x, v1y);
|
||||
*worldhighslope = P_GetSectorCeilingZAt(sec_back, v2x, v2y);
|
||||
*worldlow = P_GetSectorFloorZAt(sec_back, v1x, v1y);
|
||||
*worldlowslope = P_GetSectorFloorZAt(sec_back, v2x, v2y);
|
||||
}
|
||||
|
||||
HWR_GetExtraTextureCoords(which, polytop, polybottom, polytopslope, polybottomslope, *worldtop, *worldbottom, *worldhigh, *worldlow, *worldtopslope, *worldbottomslope, *worldhighslope, *worldlowslope, midtexheight);
|
||||
HWR_GetExtraTextureCoords(which, side, sec_front, sec_back, polytop, polybottom, polytopslope, polybottomslope, *worldtop, *worldbottom, *worldhigh, *worldlow, *worldtopslope, *worldbottomslope, *worldhighslope, *worldlowslope, midtexheight);
|
||||
}
|
||||
|
||||
static void HWR_SetWallStartCoordsOffset(FOutVector wallVerts[4], float wallx1, float wally1, angle_t wallang, fixed_t wallpush)
|
||||
|
@ -1387,9 +1378,9 @@ static void HWR_SetWallEndCoordsOffset(FOutVector wallVerts[4], float wallx2, fl
|
|||
}
|
||||
|
||||
// Draws an extra texture
|
||||
static void HWR_RenderExtraTexture(unsigned which, v2d_t vs, v2d_t ve, float xcliplow, float xcliphigh, UINT32 lightnum)
|
||||
static void HWR_RenderExtraTexture(unsigned which, side_t *side, sector_t *sec_front, sector_t *sec_back, v2d_t vs, v2d_t ve, float xcliplow, float xcliphigh, UINT32 lightnum)
|
||||
{
|
||||
side_overlay_t *overlay = &gl_sidedef->overlays[which];
|
||||
side_overlay_t *overlay = &side->overlays[which];
|
||||
|
||||
INT32 texnum = R_GetTextureNum(overlay->texture);
|
||||
if (texnum <= 0 || texnum >= numtextures)
|
||||
|
@ -1405,64 +1396,18 @@ static void HWR_RenderExtraTexture(unsigned which, v2d_t vs, v2d_t ve, float xcl
|
|||
|
||||
float flength = gl_curline->flength;
|
||||
|
||||
fixed_t worldtop = P_GetSectorCeilingZAt(gl_frontsector, v1x, v1y);
|
||||
fixed_t worldtopslope = P_GetSectorCeilingZAt(gl_frontsector, v2x, v2y);
|
||||
fixed_t worldbottom = P_GetSectorFloorZAt(gl_frontsector, v1x, v1y);
|
||||
fixed_t worldbottomslope = P_GetSectorFloorZAt(gl_frontsector, v2x, v2y);
|
||||
// Shouldn't I be using P_GetFFloorTopZAt and P_GetFFloorBottomZAt if this happens to be for a 3D floor?
|
||||
// Yeah, but I kinda don't care...
|
||||
fixed_t worldtop = P_GetSectorCeilingZAt(sec_front, v1x, v1y);
|
||||
fixed_t worldtopslope = P_GetSectorCeilingZAt(sec_front, v2x, v2y);
|
||||
fixed_t worldbottom = P_GetSectorFloorZAt(sec_front, v1x, v1y);
|
||||
fixed_t worldbottomslope = P_GetSectorFloorZAt(sec_front, v2x, v2y);
|
||||
|
||||
fixed_t worldhigh = 0, worldhighslope = 0, worldlow = 0, worldlowslope = 0;
|
||||
|
||||
fixed_t texheight = FixedDiv(textureheight[texnum], abs(overlay->scaley));
|
||||
|
||||
INT32 repeats;
|
||||
|
||||
if (overlay->flags & SIDEOVERLAYFLAG_WRAP)
|
||||
{
|
||||
fixed_t high, low;
|
||||
|
||||
if (gl_backsector)
|
||||
{
|
||||
if (IS_TOP_EDGE_TEXTURE(which))
|
||||
{
|
||||
high = max(
|
||||
P_GetSectorCeilingZAt(gl_frontsector, v1x, v1y),
|
||||
P_GetSectorCeilingZAt(gl_frontsector, v2x, v2y)
|
||||
);
|
||||
low = min(
|
||||
P_GetSectorCeilingZAt(gl_backsector, v1x, v1y),
|
||||
P_GetSectorCeilingZAt(gl_backsector, v2x, v2y)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
high = max(
|
||||
P_GetSectorFloorZAt(gl_frontsector, v1x, v1y),
|
||||
P_GetSectorFloorZAt(gl_frontsector, v2x, v2y)
|
||||
);
|
||||
low = min(
|
||||
P_GetSectorFloorZAt(gl_backsector, v1x, v1y),
|
||||
P_GetSectorFloorZAt(gl_backsector, v2x, v2y)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
high = max(
|
||||
P_GetSectorCeilingZAt(gl_frontsector, v1x, v1y),
|
||||
P_GetSectorCeilingZAt(gl_frontsector, v2x, v2y)
|
||||
);
|
||||
low = min(
|
||||
P_GetSectorFloorZAt(gl_frontsector, v1x, v1y),
|
||||
P_GetSectorFloorZAt(gl_frontsector, v2x, v2y)
|
||||
);
|
||||
}
|
||||
|
||||
repeats = (high - low) / texheight;
|
||||
if ((high - low) % texheight)
|
||||
repeats++; // tile an extra time to fill the gap -- Monster Iestyn
|
||||
}
|
||||
else
|
||||
repeats = 1;
|
||||
INT32 repeats = R_GetOverlayTextureRepeats(which, side, texnum, sec_front, sec_back, v1x, v1y, v2x, v2y);
|
||||
|
||||
GLMapTexture_t *grTex = HWR_GetTexture(texnum);
|
||||
float xscale = FixedToFloat(overlay->scalex);
|
||||
|
@ -1477,45 +1422,48 @@ static void HWR_RenderExtraTexture(unsigned which, v2d_t vs, v2d_t ve, float xcl
|
|||
// Find the wall's coordinates
|
||||
fixed_t midtexheight = texheight * repeats;
|
||||
|
||||
if (gl_backsector)
|
||||
if (sec_back)
|
||||
{
|
||||
worldhigh = P_GetSectorCeilingZAt(gl_backsector, v1x, v1y);
|
||||
worldhighslope = P_GetSectorCeilingZAt(gl_backsector, v2x, v2y);
|
||||
worldlow = P_GetSectorFloorZAt(gl_backsector, v1x, v1y);
|
||||
worldlowslope = P_GetSectorFloorZAt(gl_backsector, v2x, v2y);
|
||||
worldhigh = P_GetSectorCeilingZAt(sec_back, v1x, v1y);
|
||||
worldhighslope = P_GetSectorCeilingZAt(sec_back, v2x, v2y);
|
||||
worldlow = P_GetSectorFloorZAt(sec_back, v1x, v1y);
|
||||
worldlowslope = P_GetSectorFloorZAt(sec_back, v2x, v2y);
|
||||
}
|
||||
|
||||
HWR_GetExtraTextureCoords(which, &polytop, &polybottom, &polytopslope, &polybottomslope, worldtop, worldbottom, worldhigh, worldlow, worldtopslope, worldbottomslope, worldhighslope, worldlowslope, midtexheight);
|
||||
HWR_GetExtraTextureCoords(which, side, sec_front, sec_back, &polytop, &polybottom, &polytopslope, &polybottomslope, worldtop, worldbottom, worldhigh, worldlow, worldtopslope, worldbottomslope, worldhighslope, worldlowslope, midtexheight);
|
||||
|
||||
// Find where to cut it
|
||||
fixed_t lowcut, highcut;
|
||||
fixed_t lowcutslope, highcutslope;
|
||||
|
||||
if (!gl_backsector)
|
||||
{
|
||||
lowcut = worldbottom;
|
||||
highcut = worldtop;
|
||||
lowcutslope = worldbottomslope;
|
||||
highcutslope = worldtopslope;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IS_TOP_EDGE_TEXTURE(which))
|
||||
{
|
||||
lowcut = worldhigh;
|
||||
highcut = worldtop;
|
||||
lowcutslope = worldhighslope;
|
||||
highcutslope = worldtopslope;
|
||||
}
|
||||
else
|
||||
{
|
||||
lowcut = worldbottom;
|
||||
highcut = worldlow;
|
||||
lowcutslope = worldbottomslope;
|
||||
highcutslope = worldlowslope;
|
||||
}
|
||||
#define GET_CLIP_HEIGHTS() \
|
||||
if (!sec_back) \
|
||||
{ \
|
||||
lowcut = worldbottom; \
|
||||
highcut = worldtop; \
|
||||
lowcutslope = worldbottomslope; \
|
||||
highcutslope = worldtopslope; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (IS_TOP_EDGE_TEXTURE(which)) \
|
||||
{ \
|
||||
lowcut = worldhigh; \
|
||||
highcut = worldtop; \
|
||||
lowcutslope = worldhighslope; \
|
||||
highcutslope = worldtopslope; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
lowcut = worldbottom; \
|
||||
highcut = worldlow; \
|
||||
lowcutslope = worldbottomslope; \
|
||||
highcutslope = worldlowslope; \
|
||||
} \
|
||||
}
|
||||
|
||||
GET_CLIP_HEIGHTS();
|
||||
|
||||
// Time to render the wall (or so you thought)
|
||||
fixed_t h = polytop;
|
||||
fixed_t l = polybottom;
|
||||
|
@ -1590,7 +1538,7 @@ static void HWR_RenderExtraTexture(unsigned which, v2d_t vs, v2d_t ve, float xcl
|
|||
|
||||
if (intersected)
|
||||
{
|
||||
HWR_DoExtraTextureCut(intersected, which, vs, ve, t, midtexheight,
|
||||
HWR_DoExtraTextureCut(intersected, which, side, sec_front, sec_back, vs, ve, t, midtexheight,
|
||||
&polytop, &polytopslope, &polybottom, &polybottomslope,
|
||||
&ptx, &pty,
|
||||
&worldtop, &worldbottom, &worldhigh, &worldlow,
|
||||
|
@ -1619,32 +1567,9 @@ static void HWR_RenderExtraTexture(unsigned which, v2d_t vs, v2d_t ve, float xcl
|
|||
xcliplow = xcliplowbase;
|
||||
xcliphigh = xcliplow + (flength*FRACUNIT);
|
||||
|
||||
HWR_GetExtraTextureCoords(which, &polytop, &polybottom, &polytopslope, &polybottomslope, worldtop, worldbottom, worldhigh, worldlow, worldtopslope, worldbottomslope, worldhighslope, worldlowslope, midtexheight);
|
||||
HWR_GetExtraTextureCoords(which, side, sec_front, sec_back, &polytop, &polybottom, &polytopslope, &polybottomslope, worldtop, worldbottom, worldhigh, worldlow, worldtopslope, worldbottomslope, worldhighslope, worldlowslope, midtexheight);
|
||||
|
||||
if (!gl_backsector)
|
||||
{
|
||||
lowcut = worldbottom;
|
||||
highcut = worldtop;
|
||||
lowcutslope = worldbottomslope;
|
||||
highcutslope = worldtopslope;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IS_TOP_EDGE_TEXTURE(which))
|
||||
{
|
||||
lowcut = worldhigh;
|
||||
highcut = worldtop;
|
||||
lowcutslope = worldhighslope;
|
||||
highcutslope = worldtopslope;
|
||||
}
|
||||
else
|
||||
{
|
||||
lowcut = worldbottom;
|
||||
highcut = worldlow;
|
||||
lowcutslope = worldbottomslope;
|
||||
highcutslope = worldlowslope;
|
||||
}
|
||||
}
|
||||
GET_CLIP_HEIGHTS();
|
||||
|
||||
h = polytop;
|
||||
l = polybottom;
|
||||
|
@ -1745,7 +1670,7 @@ static void HWR_RenderExtraTexture(unsigned which, v2d_t vs, v2d_t ve, float xcl
|
|||
// If it did, split the wall
|
||||
if (intersected)
|
||||
{
|
||||
HWR_DoExtraTextureCut(intersected, which, vs, ve, t, midtexheight,
|
||||
HWR_DoExtraTextureCut(intersected, which, side, sec_front, sec_back, vs, ve, t, midtexheight,
|
||||
&polytop, &polytopslope, &polybottom, &polybottomslope,
|
||||
&ptx, &pty,
|
||||
&worldtop, &worldbottom, &worldhigh, &worldlow,
|
||||
|
@ -1821,10 +1746,13 @@ static void HWR_RenderExtraTexture(unsigned which, v2d_t vs, v2d_t ve, float xcl
|
|||
|
||||
extracolormap_t *colormap = gl_frontsector->extra_colormap;
|
||||
|
||||
if (gl_frontsector->numlights)
|
||||
HWR_SplitWall(gl_frontsector, wallVerts, texnum, &Surf, FOF_CUTLEVEL, NULL, blendmode);
|
||||
else
|
||||
HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap);
|
||||
if (!(h == l && hS == lS))
|
||||
{
|
||||
if (gl_frontsector->numlights)
|
||||
HWR_SplitWall(gl_frontsector, wallVerts, texnum, &Surf, FOF_CUTLEVEL, NULL, blendmode);
|
||||
else
|
||||
HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap);
|
||||
}
|
||||
|
||||
if (!intersected)
|
||||
return;
|
||||
|
@ -1852,26 +1780,33 @@ static void HWR_RenderExtraTexture(unsigned which, v2d_t vs, v2d_t ve, float xcl
|
|||
v2x = FloatToFixed(ve.x);
|
||||
v2y = FloatToFixed(ve.y);
|
||||
|
||||
worldtop = P_GetSectorCeilingZAt(gl_frontsector, v1x, v1y);
|
||||
worldtopslope = P_GetSectorCeilingZAt(gl_frontsector, v2x, v2y);
|
||||
worldbottom = P_GetSectorFloorZAt(gl_frontsector, v1x, v1y);
|
||||
worldbottomslope = P_GetSectorFloorZAt(gl_frontsector, v2x, v2y);
|
||||
worldtop = P_GetSectorCeilingZAt(sec_front, v1x, v1y);
|
||||
worldtopslope = P_GetSectorCeilingZAt(sec_front, v2x, v2y);
|
||||
worldbottom = P_GetSectorFloorZAt(sec_front, v1x, v1y);
|
||||
worldbottomslope = P_GetSectorFloorZAt(sec_front, v2x, v2y);
|
||||
|
||||
if (gl_backsector)
|
||||
if (sec_back)
|
||||
{
|
||||
worldhigh = P_GetSectorCeilingZAt(gl_backsector, v1x, v1y);
|
||||
worldhighslope = P_GetSectorCeilingZAt(gl_backsector, v2x, v2y);
|
||||
worldlow = P_GetSectorFloorZAt(gl_backsector, v1x, v1y);
|
||||
worldlowslope = P_GetSectorFloorZAt(gl_backsector, v2x, v2y);
|
||||
worldhigh = P_GetSectorCeilingZAt(sec_back, v1x, v1y);
|
||||
worldhighslope = P_GetSectorCeilingZAt(sec_back, v2x, v2y);
|
||||
worldlow = P_GetSectorFloorZAt(sec_back, v1x, v1y);
|
||||
worldlowslope = P_GetSectorFloorZAt(sec_back, v2x, v2y);
|
||||
}
|
||||
|
||||
HWR_GetExtraTextureCoords(which, &polytop, &polybottom, &polytopslope, &polybottomslope, worldtop, worldbottom, worldhigh, worldlow, worldtopslope, worldbottomslope, worldhighslope, worldlowslope, midtexheight);
|
||||
HWR_GetExtraTextureCoords(which, side, sec_front, sec_back, &polytop, &polybottom, &polytopslope, &polybottomslope, worldtop, worldbottom, worldhigh, worldlow, worldtopslope, worldbottomslope, worldhighslope, worldlowslope, midtexheight);
|
||||
|
||||
GET_CLIP_HEIGHTS();
|
||||
|
||||
#undef GET_CLIP_HEIGHTS
|
||||
|
||||
h = max(lowcut, min(highcut, polytop));
|
||||
l = min(highcut, max(polybottom, lowcut));
|
||||
hS = max(lowcutslope, min(highcutslope, polytopslope));
|
||||
lS = min(highcutslope, max(polybottomslope, lowcutslope));
|
||||
|
||||
if (h == l && hS == lS)
|
||||
return;
|
||||
|
||||
wallVerts[3].y = FixedToFloat(h);
|
||||
wallVerts[0].y = FixedToFloat(l);
|
||||
wallVerts[2].y = FixedToFloat(hS);
|
||||
|
@ -1908,6 +1843,15 @@ static void HWR_RenderExtraTexture(unsigned which, v2d_t vs, v2d_t ve, float xcl
|
|||
HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap);
|
||||
}
|
||||
|
||||
static void HWR_RenderFFloorExtraTextures(ffloor_t *pfloor, v2d_t vs, v2d_t ve, float xcliplow, float xcliphigh, UINT32 lightnum)
|
||||
{
|
||||
side_t *pside = &sides[pfloor->master->sidenum[0]];
|
||||
sector_t *psector = pfloor->master->frontsector;
|
||||
|
||||
HWR_RenderExtraTexture(EDGE_TEXTURE_TOP_UPPER, pside, psector, NULL, vs, ve, xcliplow, xcliphigh, lightnum);
|
||||
HWR_RenderExtraTexture(EDGE_TEXTURE_BOTTOM_LOWER, pside, psector, NULL, vs, ve, xcliplow, xcliphigh, lightnum);
|
||||
}
|
||||
|
||||
//
|
||||
// HWR_ProcessSeg
|
||||
// A portion or all of a wall segment will be drawn, from startfrac to endfrac,
|
||||
|
@ -2202,7 +2146,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
|||
{
|
||||
// Render extra textures
|
||||
for (unsigned i = 0; i < NUM_WALL_OVERLAYS; i++)
|
||||
HWR_RenderExtraTexture(i, vs, ve, cliplow, cliphigh, lightnum);
|
||||
HWR_RenderExtraTexture(i, gl_sidedef, gl_frontsector, gl_backsector, vs, ve, cliplow, cliphigh, lightnum);
|
||||
|
||||
// Sky culling
|
||||
// No longer so much a mess as before!
|
||||
|
@ -2287,8 +2231,8 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
|||
if (!gl_curline->polyseg)
|
||||
{
|
||||
// Render extra textures
|
||||
HWR_RenderExtraTexture(EDGE_TEXTURE_TOP_UPPER, vs, ve, cliplow, cliphigh, lightnum);
|
||||
HWR_RenderExtraTexture(EDGE_TEXTURE_BOTTOM_LOWER, vs, ve, cliplow, cliphigh, lightnum);
|
||||
HWR_RenderExtraTexture(EDGE_TEXTURE_TOP_UPPER, gl_sidedef, gl_frontsector, gl_backsector, vs, ve, cliplow, cliphigh, lightnum);
|
||||
HWR_RenderExtraTexture(EDGE_TEXTURE_BOTTOM_LOWER, gl_sidedef, gl_frontsector, gl_backsector, vs, ve, cliplow, cliphigh, lightnum);
|
||||
|
||||
if (gl_frontsector->ceilingpic == skyflatnum) // It's a single-sided line with sky for its sector
|
||||
{
|
||||
|
@ -2475,6 +2419,8 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
|||
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap);
|
||||
}
|
||||
}
|
||||
|
||||
HWR_RenderFFloorExtraTextures(rover, vs, ve, cliplow, cliphigh, lightnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2597,6 +2543,8 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
|||
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap);
|
||||
}
|
||||
}
|
||||
|
||||
HWR_RenderFFloorExtraTextures(rover, vs, ve, cliplow, cliphigh, lightnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
49
src/r_segs.c
49
src/r_segs.c
|
@ -205,21 +205,21 @@ transnum_t R_GetLinedefTransTable(fixed_t alpha)
|
|||
return (20*(FRACUNIT - alpha - 1) + FRACUNIT) >> (FRACBITS+1);
|
||||
}
|
||||
|
||||
static INT32 R_GetOverlayTextureRepeats(drawseg_t *ds, unsigned which, sector_t *sec_front, sector_t *sec_back)
|
||||
INT32 R_GetOverlayTextureRepeats(unsigned which, side_t *side, INT32 texnum, sector_t *sec_front, sector_t *sec_back, fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t v2y)
|
||||
{
|
||||
INT32 repeats = 1;
|
||||
|
||||
if (!(sidedef->overlays[which].flags & SIDEOVERLAYFLAG_WRAP))
|
||||
if (!(side->overlays[which].flags & SIDEOVERLAYFLAG_WRAP))
|
||||
return repeats;
|
||||
|
||||
fixed_t high, low;
|
||||
fixed_t texheight = textureheight[overlaytexture[which]];
|
||||
fixed_t texheight = textureheight[texnum];
|
||||
|
||||
if (sec_back)
|
||||
{
|
||||
if (IS_TOP_EDGE_TEXTURE(which))
|
||||
{
|
||||
if (sidedef->overlays[which].flags & SIDEOVERLAYFLAG_NOSKEW)
|
||||
if (side->overlays[which].flags & SIDEOVERLAYFLAG_NOSKEW)
|
||||
{
|
||||
high = sec_front->ceilingheight;
|
||||
low = sec_back->ceilingheight;
|
||||
|
@ -227,18 +227,18 @@ static INT32 R_GetOverlayTextureRepeats(drawseg_t *ds, unsigned which, sector_t
|
|||
else
|
||||
{
|
||||
high = max(
|
||||
P_GetSectorCeilingZAt(sec_front, ds->leftpos.x, ds->leftpos.y),
|
||||
P_GetSectorCeilingZAt(sec_front, ds->rightpos.x, ds->rightpos.y)
|
||||
P_GetSectorCeilingZAt(sec_front, v1x, v1y),
|
||||
P_GetSectorCeilingZAt(sec_front, v2x, v2y)
|
||||
);
|
||||
low = min(
|
||||
P_GetSectorCeilingZAt(sec_back, ds->leftpos.x, ds->leftpos.y),
|
||||
P_GetSectorCeilingZAt(sec_back, ds->rightpos.x, ds->rightpos.y)
|
||||
P_GetSectorCeilingZAt(sec_back, v1x, v1y),
|
||||
P_GetSectorCeilingZAt(sec_back, v2x, v2y)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sidedef->overlays[which].flags & SIDEOVERLAYFLAG_NOSKEW)
|
||||
if (side->overlays[which].flags & SIDEOVERLAYFLAG_NOSKEW)
|
||||
{
|
||||
high = sec_back->floorheight;
|
||||
low = sec_back->floorheight;
|
||||
|
@ -246,19 +246,19 @@ static INT32 R_GetOverlayTextureRepeats(drawseg_t *ds, unsigned which, sector_t
|
|||
else
|
||||
{
|
||||
high = max(
|
||||
P_GetSectorFloorZAt(sec_front, ds->leftpos.x, ds->leftpos.y),
|
||||
P_GetSectorFloorZAt(sec_front, ds->rightpos.x, ds->rightpos.y)
|
||||
P_GetSectorFloorZAt(sec_front, v1x, v1y),
|
||||
P_GetSectorFloorZAt(sec_front, v2x, v2y)
|
||||
);
|
||||
low = min(
|
||||
P_GetSectorFloorZAt(sec_back, ds->leftpos.x, ds->leftpos.y),
|
||||
P_GetSectorFloorZAt(sec_back, ds->rightpos.x, ds->rightpos.y)
|
||||
P_GetSectorFloorZAt(sec_back, v1x, v1y),
|
||||
P_GetSectorFloorZAt(sec_back, v2x, v2y)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sidedef->overlays[which].flags & SIDEOVERLAYFLAG_NOSKEW)
|
||||
if (side->overlays[which].flags & SIDEOVERLAYFLAG_NOSKEW)
|
||||
{
|
||||
high = sec_front->ceilingheight;
|
||||
low = sec_front->floorheight;
|
||||
|
@ -266,12 +266,12 @@ static INT32 R_GetOverlayTextureRepeats(drawseg_t *ds, unsigned which, sector_t
|
|||
else
|
||||
{
|
||||
high = max(
|
||||
P_GetSectorCeilingZAt(sec_front, ds->leftpos.x, ds->leftpos.y),
|
||||
P_GetSectorCeilingZAt(sec_front, ds->rightpos.x, ds->rightpos.y)
|
||||
P_GetSectorCeilingZAt(sec_front, v1x, v1y),
|
||||
P_GetSectorCeilingZAt(sec_front, v2x, v2y)
|
||||
);
|
||||
low = min(
|
||||
P_GetSectorFloorZAt(sec_front, ds->leftpos.x, ds->leftpos.y),
|
||||
P_GetSectorFloorZAt(sec_front, ds->rightpos.x, ds->rightpos.y)
|
||||
P_GetSectorFloorZAt(sec_front, v1x, v1y),
|
||||
P_GetSectorFloorZAt(sec_front, v2x, v2y)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1450,13 +1450,17 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
|||
|
||||
if (overlaytexture[EDGE_TEXTURE_TOP_UPPER])
|
||||
{
|
||||
repeats = R_GetOverlayTextureRepeats(ds, EDGE_TEXTURE_TOP_UPPER, pfloor->master->frontsector, NULL);
|
||||
repeats = R_GetOverlayTextureRepeats(EDGE_TEXTURE_TOP_UPPER, sidedef, overlaytexture[EDGE_TEXTURE_TOP_UPPER],
|
||||
pfloor->master->frontsector, NULL,
|
||||
ds->leftpos.x, ds->leftpos.y, ds->rightpos.x, ds->rightpos.y);
|
||||
R_RenderExtraTexture(EDGE_TEXTURE_TOP_UPPER, x1, x2, repeats, ds);
|
||||
}
|
||||
|
||||
if (overlaytexture[EDGE_TEXTURE_BOTTOM_LOWER])
|
||||
{
|
||||
repeats = R_GetOverlayTextureRepeats(ds, EDGE_TEXTURE_BOTTOM_LOWER, pfloor->master->frontsector, NULL);
|
||||
repeats = R_GetOverlayTextureRepeats(EDGE_TEXTURE_BOTTOM_LOWER, sidedef, overlaytexture[EDGE_TEXTURE_BOTTOM_LOWER],
|
||||
pfloor->master->frontsector, NULL,
|
||||
ds->leftpos.x, ds->leftpos.y, ds->rightpos.x, ds->rightpos.y);
|
||||
R_RenderExtraTexture(EDGE_TEXTURE_BOTTOM_LOWER, x1, x2, repeats, ds);
|
||||
}
|
||||
}
|
||||
|
@ -3534,7 +3538,10 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
{
|
||||
if (overlaytexture[i])
|
||||
{
|
||||
INT32 repeats = R_GetOverlayTextureRepeats(ds_p, i, frontsector, backsector);
|
||||
INT32 repeats = R_GetOverlayTextureRepeats(i, sidedef, overlaytexture[i],
|
||||
frontsector, backsector,
|
||||
ds_p->leftpos.x, ds_p->leftpos.y, ds_p->rightpos.x, ds_p->rightpos.y);
|
||||
|
||||
R_RenderExtraTexture(i, ds_p->x1, ds_p->x2, repeats, ds_p);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#endif
|
||||
|
||||
transnum_t R_GetLinedefTransTable(fixed_t alpha);
|
||||
INT32 R_GetOverlayTextureRepeats(unsigned which, side_t *side, INT32 texnum, sector_t *sec_front, sector_t *sec_back, fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t v2y);
|
||||
void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2);
|
||||
void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pffloor);
|
||||
void R_StoreWallRange(INT32 start, INT32 stop);
|
||||
|
|
Loading…
Reference in a new issue