- remove WallSampler

This commit is contained in:
Magnus Norddahl 2018-12-28 13:04:54 +01:00
parent c980f1c27f
commit c499c563a0
2 changed files with 320 additions and 319 deletions

View file

@ -54,284 +54,7 @@
namespace swrenderer
{
WallSampler::WallSampler(RenderViewport *viewport, int y1, double texturemid, float swal, double yrepeat, fixed_t xoffset, double xmagnitude, FSoftwareTexture *texture)
{
xoffset += FLOAT2FIXED(xmagnitude * 0.5);
xoffset *= texture->GetPhysicalScale();
if (!viewport->RenderTarget->IsBgra())
{
height = texture->GetPhysicalHeight();
int uv_fracbits = 32 - texture->GetHeightBits();
if (uv_fracbits != 32)
{
uv_max = height << uv_fracbits;
// Find start uv in [0-base_height[ range.
// Not using xs_ToFixed because it rounds the result and we need something that always rounds down to stay within the range.
double uv_stepd = swal * yrepeat;
double v = (texturemid + uv_stepd * (y1 - viewport->CenterY + 0.5)) / texture->GetHeight();
v = v - floor(v);
v *= height;
v *= (1 << uv_fracbits);
uv_pos = (uint32_t)(int64_t)v;
uv_step = xs_ToFixed(uv_fracbits, uv_stepd * texture->GetPhysicalScale());
if (uv_step == 0) // To prevent divide by zero elsewhere
uv_step = 1;
}
else
{ // Hack for one pixel tall textures
uv_pos = 0;
uv_step = 0;
uv_max = 1;
}
int col = xoffset >> FRACBITS;
// If the texture's width isn't a power of 2, then we need to make it a
// positive offset for proper clamping.
int width;
if (col < 0 && (width = texture->GetPhysicalWidth()) != (1 << texture->GetWidthBits()))
{
col = width + (col % width);
}
source = texture->GetColumn(DefaultRenderStyle(), col, nullptr);
source2 = nullptr;
texturefracx = 0;
}
else
{
// Normalize to 0-1 range:
double uv_stepd = swal * yrepeat;
double v = (texturemid + uv_stepd * (y1 - viewport->CenterY + 0.5)) / texture->GetHeight();
v = v - floor(v);
double v_step = uv_stepd / texture->GetHeight();
if (std::isnan(v) || std::isnan(v_step)) // this should never happen, but it apparently does..
{
uv_stepd = 0.0;
v = 0.0;
v_step = 0.0;
}
// Convert to uint32_t:
uv_pos = (uint32_t)(int64_t)(v * 0x100000000LL);
uv_step = (uint32_t)(int64_t)(v_step * 0x100000000LL);
uv_max = 0;
// Texture mipmap and filter selection:
double ymagnitude = fabs(uv_stepd);
double magnitude = MAX(ymagnitude, xmagnitude);
double min_lod = -1000.0;
double lod = MAX(log2(magnitude) + r_lod_bias, min_lod);
bool magnifying = lod < 0.0f;
int mipmap_offset = 0;
int mip_width = texture->GetPhysicalWidth();
int mip_height = texture->GetPhysicalHeight();
if (r_mipmap && texture->Mipmapped() && mip_width > 1 && mip_height > 1)
{
uint32_t xpos = (uint32_t)((((uint64_t)xoffset) << FRACBITS) / mip_width);
int level = (int)lod;
while (level > 0 && mip_width > 1 && mip_height > 1)
{
mipmap_offset += mip_width * mip_height;
level--;
mip_width = MAX(mip_width >> 1, 1);
mip_height = MAX(mip_height >> 1, 1);
}
xoffset = (xpos >> FRACBITS) * mip_width;
}
const uint32_t *pixels = texture->GetPixelsBgra() + mipmap_offset;
bool filter_nearest = (magnifying && !r_magfilter) || (!magnifying && !r_minfilter);
if (filter_nearest)
{
int tx = (xoffset >> FRACBITS) % mip_width;
if (tx < 0)
tx += mip_width;
source = (uint8_t*)(pixels + tx * mip_height);
source2 = nullptr;
height = mip_height;
texturefracx = 0;
}
else
{
xoffset -= FRACUNIT / 2;
int tx0 = (xoffset >> FRACBITS) % mip_width;
if (tx0 < 0)
tx0 += mip_width;
int tx1 = (tx0 + 1) % mip_width;
source = (uint8_t*)(pixels + tx0 * mip_height);
source2 = (uint8_t*)(pixels + tx1 * mip_height);
height = mip_height;
texturefracx = (xoffset >> (FRACBITS - 4)) & 15;
}
}
}
// Draw a column with support for non-power-of-two ranges
void RenderWallPart::Draw1Column(int x, int y1, int y2, WallSampler &sampler)
{
// Find column position in view space
float w1 = 1.0f / WallC.sz1;
float w2 = 1.0f / WallC.sz2;
float t = (x - WallC.sx1 + 0.5f) / (WallC.sx2 - WallC.sx1);
float wcol = w1 * (1.0f - t) + w2 * t;
float zcol = 1.0f / wcol;
float zbufferdepth = 1.0f / (zcol / Thread->Viewport->viewwindow.FocalTangent);
if (r_dynlights && light_list)
{
auto viewport = Thread->Viewport.get();
int tx = x;
bool mirror = !!(Thread->Portal->MirrorFlags & RF_XFLIP);
if (mirror)
tx = viewwidth - tx - 1;
drawerargs.dc_viewpos.X = (float)((tx + 0.5 - viewport->CenterX) / viewport->CenterX * zcol);
drawerargs.dc_viewpos.Y = zcol;
drawerargs.dc_viewpos.Z = (float)((viewport->CenterY - y1 - 0.5) / viewport->InvZtoScale * zcol);
drawerargs.dc_viewpos_step.Z = (float)(-zcol / viewport->InvZtoScale);
// Calculate max lights that can touch column so we can allocate memory for the list
int max_lights = 0;
FLightNode *cur_node = light_list;
while (cur_node)
{
if (!(cur_node->lightsource->flags2&MF2_DORMANT))
max_lights++;
cur_node = cur_node->nextLight;
}
drawerargs.dc_num_lights = 0;
drawerargs.dc_lights = Thread->FrameMemory->AllocMemory<DrawerLight>(max_lights);
// Setup lights for column
cur_node = light_list;
while (cur_node)
{
if (!(cur_node->lightsource->flags2&MF2_DORMANT))
{
double lightX = cur_node->lightsource->X() - Thread->Viewport->viewpoint.Pos.X;
double lightY = cur_node->lightsource->Y() - Thread->Viewport->viewpoint.Pos.Y;
double lightZ = cur_node->lightsource->Z() - Thread->Viewport->viewpoint.Pos.Z;
float lx = (float)(lightX * Thread->Viewport->viewpoint.Sin - lightY * Thread->Viewport->viewpoint.Cos) - drawerargs.dc_viewpos.X;
float ly = (float)(lightX * Thread->Viewport->viewpoint.TanCos + lightY * Thread->Viewport->viewpoint.TanSin) - drawerargs.dc_viewpos.Y;
float lz = (float)lightZ;
// Precalculate the constant part of the dot here so the drawer doesn't have to.
bool is_point_light = (cur_node->lightsource->lightflags & LF_ATTENUATE) != 0;
float lconstant = lx * lx + ly * ly;
float nlconstant = is_point_light ? lx * drawerargs.dc_normal.X + ly * drawerargs.dc_normal.Y : 0.0f;
// Include light only if it touches this column
float radius = cur_node->lightsource->GetRadius();
if (radius * radius >= lconstant && nlconstant >= 0.0f)
{
uint32_t red = cur_node->lightsource->GetRed();
uint32_t green = cur_node->lightsource->GetGreen();
uint32_t blue = cur_node->lightsource->GetBlue();
auto &light = drawerargs.dc_lights[drawerargs.dc_num_lights++];
light.x = lconstant;
light.y = nlconstant;
light.z = lz;
light.radius = 256.0f / cur_node->lightsource->GetRadius();
light.color = (red << 16) | (green << 8) | blue;
}
}
cur_node = cur_node->nextLight;
}
}
else
{
drawerargs.dc_num_lights = 0;
}
if (Thread->Viewport->RenderTarget->IsBgra())
{
int count = y2 - y1;
drawerargs.SetTexture(sampler.source, sampler.source2, sampler.height);
drawerargs.SetTextureUPos(sampler.texturefracx);
drawerargs.SetDest(Thread->Viewport.get(), x, y1);
drawerargs.SetCount(count);
drawerargs.SetTextureVStep(sampler.uv_step);
drawerargs.SetTextureVPos(sampler.uv_pos);
drawerargs.DrawColumn(Thread);
if (r_modelscene)
drawerargs.DrawDepthColumn(Thread, zbufferdepth);
uint64_t step64 = sampler.uv_step;
uint64_t pos64 = sampler.uv_pos;
sampler.uv_pos = (uint32_t)(pos64 + step64 * count);
}
else
{
if (sampler.uv_max == 0 || sampler.uv_step == 0) // power of two
{
int count = y2 - y1;
drawerargs.SetTexture(sampler.source, sampler.source2, sampler.height);
drawerargs.SetTextureUPos(sampler.texturefracx);
drawerargs.SetDest(Thread->Viewport.get(), x, y1);
drawerargs.SetCount(count);
drawerargs.SetTextureVStep(sampler.uv_step);
drawerargs.SetTextureVPos(sampler.uv_pos);
drawerargs.DrawColumn(Thread);
if (r_modelscene)
drawerargs.DrawDepthColumn(Thread, zbufferdepth);
uint64_t step64 = sampler.uv_step;
uint64_t pos64 = sampler.uv_pos;
sampler.uv_pos = (uint32_t)(pos64 + step64 * count);
}
else
{
uint32_t uv_pos = sampler.uv_pos;
uint32_t left = y2 - y1;
int y = y1;
while (left > 0)
{
uint32_t available = sampler.uv_max - uv_pos;
uint32_t next_uv_wrap = available / sampler.uv_step;
if (available % sampler.uv_step != 0)
next_uv_wrap++;
uint32_t count = MIN(left, next_uv_wrap);
drawerargs.SetTexture(sampler.source, sampler.source2, sampler.height);
drawerargs.SetTextureUPos(sampler.texturefracx);
drawerargs.SetDest(Thread->Viewport.get(), x, y);
drawerargs.SetCount(count);
drawerargs.SetTextureVStep(sampler.uv_step);
drawerargs.SetTextureVPos(uv_pos);
drawerargs.DrawColumn(Thread);
if (r_modelscene)
drawerargs.DrawDepthColumn(Thread, zbufferdepth);
y += count;
left -= count;
uv_pos += sampler.uv_step * count;
if (uv_pos >= sampler.uv_max)
uv_pos -= sampler.uv_max;
}
sampler.uv_pos = uv_pos;
}
}
}
void RenderWallPart::ProcessWallWorker(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal)
void RenderWallPart::ProcessNormalWall(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal)
{
if (rw_pic == nullptr)
return;
@ -344,6 +67,7 @@ namespace swrenderer
texturemid = 0;
}
WallDrawerArgs drawerargs;
drawerargs.SetTextureFracBits(Thread->Viewport->RenderTarget->IsBgra() ? FRACBITS : fracbits);
// Textures that aren't masked can use the faster opaque drawer
@ -356,42 +80,334 @@ namespace swrenderer
drawerargs.SetStyle(mask, additive, alpha, mLight.GetBaseColormap());
}
CameraLight *cameraLight = CameraLight::Instance();
bool fixed = (cameraLight->FixedColormap() != NULL || cameraLight->FixedLightLevel() >= 0);
RenderViewport *viewport = Thread->Viewport.get();
float dx = WallC.tright.X - WallC.tleft.X;
float dy = WallC.tright.Y - WallC.tleft.Y;
float length = sqrt(dx * dx + dy * dy);
drawerargs.dc_normal.X = dy / length;
drawerargs.dc_normal.Y = -dx / length;
drawerargs.dc_normal.Z = 0.0f;
CameraLight *cameraLight = CameraLight::Instance();
bool fixed = (cameraLight->FixedColormap() || cameraLight->FixedLightLevel() >= 0);
bool haslights = r_dynlights && light_list;
if (haslights)
{
float dx = WallC.tright.X - WallC.tleft.X;
float dy = WallC.tright.Y - WallC.tleft.Y;
float length = sqrt(dx * dx + dy * dy);
drawerargs.dc_normal.X = dy / length;
drawerargs.dc_normal.Y = -dx / length;
drawerargs.dc_normal.Z = 0.0f;
}
double xmagnitude = 1.0;
float curlight = mLight.GetLightPos(x1);
for (int x = x1; x < x2; x++, curlight += mLight.GetLightStep())
float lightstep = mLight.GetLightStep();
if (viewport->RenderTarget->IsBgra())
{
int y1 = uwal[x];
int y2 = dwal[x];
if (y2 <= y1)
continue;
for (int x = x1; x < x2; x++, curlight += lightstep)
{
int y1 = uwal[x];
int y2 = dwal[x];
if (y2 <= y1)
continue;
if (!fixed)
drawerargs.SetLight(curlight, mLight.GetLightLevel(), mLight.GetFoggy(), Thread->Viewport.get());
if (!fixed)
drawerargs.SetLight(curlight, mLight.GetLightLevel(), mLight.GetFoggy(), viewport);
if (x + 1 < x2) xmagnitude = fabs(FIXED2DBL(lwal[x + 1]) - FIXED2DBL(lwal[x]));
if (x + 1 < x2) xmagnitude = fabs(FIXED2DBL(lwal[x + 1]) - FIXED2DBL(lwal[x]));
WallSampler sampler(Thread->Viewport.get(), y1, texturemid, swal[x], yrepeat, lwal[x] + xoffset, xmagnitude, rw_pic);
Draw1Column(x, y1, y2, sampler);
fixed_t xxoffset = (lwal[x] + xoffset + FLOAT2FIXED(xmagnitude * 0.5)) * rw_pic->GetPhysicalScale();
// Normalize to 0-1 range:
double uv_stepd = swal[x] * yrepeat;
double v = (texturemid + uv_stepd * (y1 - viewport->CenterY + 0.5)) / rw_pic->GetHeight();
v = v - floor(v);
double v_step = uv_stepd / rw_pic->GetHeight();
if (std::isnan(v) || std::isnan(v_step)) // this should never happen, but it apparently does..
{
uv_stepd = 0.0;
v = 0.0;
v_step = 0.0;
}
// Convert to uint32_t:
uint32_t uv_pos = (uint32_t)(int64_t)(v * 0x100000000LL);
uint32_t uv_step = (uint32_t)(int64_t)(v_step * 0x100000000LL);
// Texture mipmap and filter selection:
double ymagnitude = fabs(uv_stepd);
double magnitude = MAX(ymagnitude, xmagnitude);
double min_lod = -1000.0;
double lod = MAX(log2(magnitude) + r_lod_bias, min_lod);
bool magnifying = lod < 0.0f;
int mipmap_offset = 0;
int mip_width = rw_pic->GetPhysicalWidth();
int mip_height = rw_pic->GetPhysicalHeight();
if (r_mipmap && rw_pic->Mipmapped() && mip_width > 1 && mip_height > 1)
{
uint32_t xpos = (uint32_t)((((uint64_t)xxoffset) << FRACBITS) / mip_width);
int level = (int)lod;
while (level > 0 && mip_width > 1 && mip_height > 1)
{
mipmap_offset += mip_width * mip_height;
level--;
mip_width = MAX(mip_width >> 1, 1);
mip_height = MAX(mip_height >> 1, 1);
}
xxoffset = (xpos >> FRACBITS) * mip_width;
}
const uint32_t *pixels = rw_pic->GetPixelsBgra() + mipmap_offset;
const uint8_t *source;
const uint8_t *source2;
uint32_t texturefracx;
uint32_t height;
bool filter_nearest = (magnifying && !r_magfilter) || (!magnifying && !r_minfilter);
if (filter_nearest)
{
int tx = (xxoffset >> FRACBITS) % mip_width;
if (tx < 0)
tx += mip_width;
source = (uint8_t*)(pixels + tx * mip_height);
source2 = nullptr;
height = mip_height;
texturefracx = 0;
}
else
{
xxoffset -= FRACUNIT / 2;
int tx0 = (xxoffset >> FRACBITS) % mip_width;
if (tx0 < 0)
tx0 += mip_width;
int tx1 = (tx0 + 1) % mip_width;
source = (uint8_t*)(pixels + tx0 * mip_height);
source2 = (uint8_t*)(pixels + tx1 * mip_height);
height = mip_height;
texturefracx = (xxoffset >> (FRACBITS - 4)) & 15;
}
drawerargs.SetTexture(source, source2, height);
if (haslights)
SetLights(drawerargs, x, y1);
else
drawerargs.dc_num_lights = 0;
drawerargs.SetTextureUPos(texturefracx);
drawerargs.SetTextureVStep(uv_step);
int count = y2 - y1;
drawerargs.SetDest(viewport, x, y1);
drawerargs.SetCount(count);
drawerargs.SetTextureVPos(uv_pos);
drawerargs.DrawColumn(Thread);
}
}
else
{
uint32_t height = rw_pic->GetPhysicalHeight();
uint32_t uv_max;
int uv_fracbits = 32 - rw_pic->GetHeightBits();
if (uv_fracbits != 32)
uv_max = height << uv_fracbits;
for (int x = x1; x < x2; x++, curlight += lightstep)
{
int y1 = uwal[x];
int y2 = dwal[x];
if (y2 <= y1)
continue;
if (!fixed)
drawerargs.SetLight(curlight, mLight.GetLightLevel(), mLight.GetFoggy(), viewport);
if (x + 1 < x2) xmagnitude = fabs(FIXED2DBL(lwal[x + 1]) - FIXED2DBL(lwal[x]));
uint32_t uv_pos;
uint32_t uv_step;
fixed_t xxoffset = (lwal[x] + xoffset + FLOAT2FIXED(xmagnitude * 0.5)) * rw_pic->GetPhysicalScale();
if (uv_fracbits != 32)
{
// Find start uv in [0-base_height[ range.
// Not using xs_ToFixed because it rounds the result and we need something that always rounds down to stay within the range.
double uv_stepd = swal[x] * yrepeat;
double v = (texturemid + uv_stepd * (y1 - viewport->CenterY + 0.5)) / rw_pic->GetHeight();
v = v - floor(v);
v *= height;
v *= (1 << uv_fracbits);
uv_pos = (uint32_t)(int64_t)v;
uv_step = xs_ToFixed(uv_fracbits, uv_stepd * rw_pic->GetPhysicalScale());
if (uv_step == 0) // To prevent divide by zero elsewhere
uv_step = 1;
}
else
{ // Hack for one pixel tall textures
uv_pos = 0;
uv_step = 0;
uv_max = 1;
}
int col = xxoffset >> FRACBITS;
// If the texture's width isn't a power of 2, then we need to make it a
// positive offset for proper clamping.
int width;
if (col < 0 && (width = rw_pic->GetPhysicalWidth()) != (1 << rw_pic->GetWidthBits()))
{
col = width + (col % width);
}
drawerargs.SetTexture(rw_pic->GetColumn(DefaultRenderStyle(), col, nullptr), nullptr, height);
if (haslights)
SetLights(drawerargs, x, y1);
else
drawerargs.dc_num_lights = 0;
drawerargs.SetTextureVStep(uv_step);
if (uv_max == 0 || uv_step == 0) // power of two
{
int count = y2 - y1;
drawerargs.SetDest(viewport, x, y1);
drawerargs.SetCount(count);
drawerargs.SetTextureVPos(uv_pos);
drawerargs.DrawColumn(Thread);
}
else
{
uint32_t left = y2 - y1;
int y = y1;
while (left > 0)
{
uint32_t available = uv_max - uv_pos;
uint32_t next_uv_wrap = available / uv_step;
if (available % uv_step != 0)
next_uv_wrap++;
uint32_t count = MIN(left, next_uv_wrap);
drawerargs.SetDest(viewport, x, y);
drawerargs.SetCount(count);
drawerargs.SetTextureVPos(uv_pos);
drawerargs.DrawColumn(Thread);
y += count;
left -= count;
uv_pos += uv_step * count;
if (uv_pos >= uv_max)
uv_pos -= uv_max;
}
}
}
}
if (Thread->MainThread)
NetUpdate();
if (r_modelscene)
{
for (int x = x1; x < x2; x++)
{
int y1 = uwal[x];
int y2 = dwal[x];
if (y2 > y1)
{
int count = y2 - y1;
float w1 = 1.0f / WallC.sz1;
float w2 = 1.0f / WallC.sz2;
float t = (x - WallC.sx1 + 0.5f) / (WallC.sx2 - WallC.sx1);
float wcol = w1 * (1.0f - t) + w2 * t;
float zcol = 1.0f / wcol;
float zbufferdepth = 1.0f / (zcol / viewport->viewwindow.FocalTangent);
drawerargs.SetDest(viewport, x, y1);
drawerargs.SetCount(count);
drawerargs.DrawDepthColumn(Thread, zbufferdepth);
}
}
}
}
void RenderWallPart::ProcessNormalWall(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal)
void RenderWallPart::SetLights(WallDrawerArgs &drawerargs, int x, int y1)
{
ProcessWallWorker(uwal, dwal, texturemid, swal, lwal);
bool mirror = !!(Thread->Portal->MirrorFlags & RF_XFLIP);
int tx = x;
if (mirror)
tx = viewwidth - tx - 1;
RenderViewport *viewport = Thread->Viewport.get();
// Find column position in view space
float w1 = 1.0f / WallC.sz1;
float w2 = 1.0f / WallC.sz2;
float t = (x - WallC.sx1 + 0.5f) / (WallC.sx2 - WallC.sx1);
float wcol = w1 * (1.0f - t) + w2 * t;
float zcol = 1.0f / wcol;
drawerargs.dc_viewpos.X = (float)((tx + 0.5 - viewport->CenterX) / viewport->CenterX * zcol);
drawerargs.dc_viewpos.Y = zcol;
drawerargs.dc_viewpos.Z = (float)((viewport->CenterY - y1 - 0.5) / viewport->InvZtoScale * zcol);
drawerargs.dc_viewpos_step.Z = (float)(-zcol / viewport->InvZtoScale);
// Calculate max lights that can touch column so we can allocate memory for the list
int max_lights = 0;
FLightNode *cur_node = light_list;
while (cur_node)
{
if (!(cur_node->lightsource->flags2&MF2_DORMANT))
max_lights++;
cur_node = cur_node->nextLight;
}
drawerargs.dc_num_lights = 0;
drawerargs.dc_lights = Thread->FrameMemory->AllocMemory<DrawerLight>(max_lights);
// Setup lights for column
cur_node = light_list;
while (cur_node)
{
if (!(cur_node->lightsource->flags2&MF2_DORMANT))
{
double lightX = cur_node->lightsource->X() - viewport->viewpoint.Pos.X;
double lightY = cur_node->lightsource->Y() - viewport->viewpoint.Pos.Y;
double lightZ = cur_node->lightsource->Z() - viewport->viewpoint.Pos.Z;
float lx = (float)(lightX * viewport->viewpoint.Sin - lightY * viewport->viewpoint.Cos) - drawerargs.dc_viewpos.X;
float ly = (float)(lightX * viewport->viewpoint.TanCos + lightY * viewport->viewpoint.TanSin) - drawerargs.dc_viewpos.Y;
float lz = (float)lightZ;
// Precalculate the constant part of the dot here so the drawer doesn't have to.
bool is_point_light = (cur_node->lightsource->lightflags & LF_ATTENUATE) != 0;
float lconstant = lx * lx + ly * ly;
float nlconstant = is_point_light ? lx * drawerargs.dc_normal.X + ly * drawerargs.dc_normal.Y : 0.0f;
// Include light only if it touches this column
float radius = cur_node->lightsource->GetRadius();
if (radius * radius >= lconstant && nlconstant >= 0.0f)
{
uint32_t red = cur_node->lightsource->GetRed();
uint32_t green = cur_node->lightsource->GetGreen();
uint32_t blue = cur_node->lightsource->GetBlue();
auto &light = drawerargs.dc_lights[drawerargs.dc_num_lights++];
light.x = lconstant;
light.y = nlconstant;
light.z = lz;
light.radius = 256.0f / cur_node->lightsource->GetRadius();
light.color = (red << 16) | (green << 8) | blue;
}
}
cur_node = cur_node->nextLight;
}
}
void RenderWallPart::ProcessStripedWall(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal)
@ -530,6 +546,9 @@ namespace swrenderer
this->additive = additive;
this->alpha = alpha;
if (Thread->MainThread)
NetUpdate();
Thread->PrepareTexture(pic, DefaultRenderStyle()); // Get correct render style? Shaded won't get here.
if (rw_pic->GetHeight() != 1 << rw_pic->GetHeightBits())

View file

@ -74,8 +74,7 @@ namespace swrenderer
void ProcessWall(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal);
void ProcessStripedWall(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal);
void ProcessNormalWall(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal);
void ProcessWallWorker(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal);
void Draw1Column(int x, int y1, int y2, WallSampler &sampler);
void SetLights(WallDrawerArgs &drawerargs, int x, int y1);
int x1 = 0;
int x2 = 0;
@ -92,22 +91,5 @@ namespace swrenderer
bool mask = false;
bool additive = false;
fixed_t alpha = 0;
WallDrawerArgs drawerargs;
};
struct WallSampler
{
WallSampler() { }
WallSampler(RenderViewport *viewport, int y1, double texturemid, float swal, double yrepeat, fixed_t xoffset, double xmagnitude, FSoftwareTexture *texture);
uint32_t uv_pos;
uint32_t uv_step;
uint32_t uv_max;
const uint8_t *source;
const uint8_t *source2;
uint32_t texturefracx;
uint32_t height;
};
}