mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
Move R_GetColumn to walldraw and create header file
This commit is contained in:
parent
f8010854c3
commit
259d724106
5 changed files with 46 additions and 36 deletions
|
@ -496,23 +496,6 @@ namespace swrenderer
|
|||
basecolormap = basecolormapsave;
|
||||
}
|
||||
|
||||
const uint8_t *R_GetColumn(FTexture *tex, int col)
|
||||
{
|
||||
int width;
|
||||
|
||||
// If the texture's width isn't a power of 2, then we need to make it a
|
||||
// positive offset for proper clamping.
|
||||
if (col < 0 && (width = tex->GetWidth()) != (1 << tex->WidthBits))
|
||||
{
|
||||
col = width + (col % width);
|
||||
}
|
||||
|
||||
if (r_swtruecolor)
|
||||
return (const uint8_t *)tex->GetColumnBgra(col, nullptr);
|
||||
else
|
||||
return tex->GetColumn(col, nullptr);
|
||||
}
|
||||
|
||||
DrawerFunc R_GetTransMaskDrawer()
|
||||
{
|
||||
if (colfunc == &SWPixelFormatDrawers::DrawAddColumn)
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include "r_data/colormaps.h"
|
||||
#include "swrenderer/drawers/r_draw_rgba.h"
|
||||
#include "gl/dynlights/gl_dynlight.h"
|
||||
#include "r_walldraw.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4244)
|
||||
|
@ -155,7 +156,6 @@ static double xstepscale, ystepscale;
|
|||
static double basexfrac, baseyfrac;
|
||||
|
||||
void R_DrawSinglePlane (visplane_t *, fixed_t alpha, bool additive, bool masked);
|
||||
void R_DrawSkySegment(visplane_t *vis, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const uint8_t *(*getcol)(FTexture *tex, int col));
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -1135,7 +1135,7 @@ static void R_DrawSky (visplane_t *pl)
|
|||
lastskycol[x] = 0xffffffff;
|
||||
lastskycol_bgra[x] = 0xffffffff;
|
||||
}
|
||||
R_DrawSkySegment (pl, (short *)pl->top, (short *)pl->bottom, swall, lwall,
|
||||
R_DrawSkySegment (pl->left, pl->right, (short *)pl->top, (short *)pl->bottom, swall, lwall,
|
||||
frontyScale, backskytex == NULL ? R_GetOneSkyColumn : R_GetTwoSkyColumns);
|
||||
}
|
||||
else
|
||||
|
@ -1173,7 +1173,7 @@ static void R_DrawSkyStriped (visplane_t *pl)
|
|||
lastskycol[x] = 0xffffffff;
|
||||
lastskycol_bgra[x] = 0xffffffff;
|
||||
}
|
||||
R_DrawSkySegment (pl, top, bot, swall, lwall, rw_pic->Scale.Y,
|
||||
R_DrawSkySegment (pl->left, pl->right, top, bot, swall, lwall, rw_pic->Scale.Y,
|
||||
backskytex == NULL ? R_GetOneSkyColumn : R_GetTwoSkyColumns);
|
||||
yl = yh;
|
||||
yh += drawheight;
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "swrenderer/drawers/r_draw.h"
|
||||
#include "v_palette.h"
|
||||
#include "r_data/colormaps.h"
|
||||
#include "r_walldraw.h"
|
||||
|
||||
#define WALLYREPEAT 8
|
||||
|
||||
|
@ -60,7 +61,6 @@ namespace swrenderer
|
|||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
void R_DrawWallSegment(FTexture *rw_pic, int x1, int x2, short *walltop, short *wallbottom, float *swall, fixed_t *lwall, double yscale, double top, double bottom, bool mask, FLightNode *light_list = nullptr);
|
||||
void R_DrawDrawSeg(drawseg_t *ds, int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat);
|
||||
|
||||
#define HEIGHTBITS 12
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "r_data/colormaps.h"
|
||||
#include "gl/dynlights/gl_dynlight.h"
|
||||
#include "swrenderer/drawers/r_drawers.h"
|
||||
#include "r_walldraw.h"
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
|
@ -52,20 +53,22 @@ namespace swrenderer
|
|||
extern FTexture *rw_pic;
|
||||
extern int wallshade;
|
||||
|
||||
struct WallSampler
|
||||
static const uint8_t *R_GetColumn(FTexture *tex, int col)
|
||||
{
|
||||
WallSampler() { }
|
||||
WallSampler(int y1, float swal, double yrepeat, fixed_t xoffset, double xmagnitude, FTexture *texture, const BYTE*(*getcol)(FTexture *texture, int x));
|
||||
int width;
|
||||
|
||||
uint32_t uv_pos;
|
||||
uint32_t uv_step;
|
||||
uint32_t uv_max;
|
||||
// If the texture's width isn't a power of 2, then we need to make it a
|
||||
// positive offset for proper clamping.
|
||||
if (col < 0 && (width = tex->GetWidth()) != (1 << tex->WidthBits))
|
||||
{
|
||||
col = width + (col % width);
|
||||
}
|
||||
|
||||
const BYTE *source;
|
||||
const BYTE *source2;
|
||||
uint32_t texturefracx;
|
||||
uint32_t height;
|
||||
};
|
||||
if (r_swtruecolor)
|
||||
return (const uint8_t *)tex->GetColumnBgra(col, nullptr);
|
||||
else
|
||||
return tex->GetColumn(col, nullptr);
|
||||
}
|
||||
|
||||
WallSampler::WallSampler(int y1, float swal, double yrepeat, fixed_t xoffset, double xmagnitude, FTexture *texture, const BYTE*(*getcol)(FTexture *texture, int x))
|
||||
{
|
||||
|
@ -596,11 +599,9 @@ void R_DrawWallSegment(FTexture *rw_pic, int x1, int x2, short *walltop, short *
|
|||
dc_light_list = nullptr;
|
||||
}
|
||||
|
||||
void R_DrawSkySegment(visplane_t *pl, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x))
|
||||
void R_DrawSkySegment(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x))
|
||||
{
|
||||
ProcessNormalWall(pl->left, pl->right, uwal, dwal, swal, lwal, yrepeat, getcol);
|
||||
ProcessNormalWall(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
26
src/swrenderer/scene/r_walldraw.h
Normal file
26
src/swrenderer/scene/r_walldraw.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
class FTexture;
|
||||
struct FLightNode;
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
struct WallSampler
|
||||
{
|
||||
WallSampler() { }
|
||||
WallSampler(int y1, float swal, double yrepeat, fixed_t xoffset, double xmagnitude, FTexture *texture, const BYTE*(*getcol)(FTexture *texture, int x));
|
||||
|
||||
uint32_t uv_pos;
|
||||
uint32_t uv_step;
|
||||
uint32_t uv_max;
|
||||
|
||||
const BYTE *source;
|
||||
const BYTE *source2;
|
||||
uint32_t texturefracx;
|
||||
uint32_t height;
|
||||
};
|
||||
|
||||
void R_DrawWallSegment(FTexture *rw_pic, int x1, int x2, short *walltop, short *wallbottom, float *swall, fixed_t *lwall, double yscale, double top, double bottom, bool mask, FLightNode *light_list = nullptr);
|
||||
void R_DrawSkySegment(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const uint8_t *(*getcol)(FTexture *tex, int col));
|
||||
}
|
Loading…
Reference in a new issue