mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
Move software renderer into its own namespace to isolate its globals and make
any access explicit. This reveals the places in the code where they are being accessed where they shouldn't and prevents accidental usage.
This commit is contained in:
parent
1bed6feadc
commit
9416d436fe
37 changed files with 231 additions and 157 deletions
|
@ -1377,15 +1377,16 @@ void OpenGLSWFrameBuffer::Draw3DPart(bool copy3d)
|
||||||
uint32_t color0, color1;
|
uint32_t color0, color1;
|
||||||
if (Accel2D)
|
if (Accel2D)
|
||||||
{
|
{
|
||||||
if (realfixedcolormap == nullptr)
|
auto &map = swrenderer::realfixedcolormap;
|
||||||
|
if (map == nullptr)
|
||||||
{
|
{
|
||||||
color0 = 0;
|
color0 = 0;
|
||||||
color1 = 0xFFFFFFF;
|
color1 = 0xFFFFFFF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
color0 = ColorValue(realfixedcolormap->ColorizeStart[0] / 2, realfixedcolormap->ColorizeStart[1] / 2, realfixedcolormap->ColorizeStart[2] / 2, 0);
|
color0 = ColorValue(map->ColorizeStart[0] / 2, map->ColorizeStart[1] / 2, map->ColorizeStart[2] / 2, 0);
|
||||||
color1 = ColorValue(realfixedcolormap->ColorizeEnd[0] / 2, realfixedcolormap->ColorizeEnd[1] / 2, realfixedcolormap->ColorizeEnd[2] / 2, 1);
|
color1 = ColorValue(map->ColorizeEnd[0] / 2, map->ColorizeEnd[1] / 2, map->ColorizeEnd[2] / 2, 1);
|
||||||
if (IsBgra())
|
if (IsBgra())
|
||||||
SetPixelShader(Shaders[SHADER_SpecialColormap]);
|
SetPixelShader(Shaders[SHADER_SpecialColormap]);
|
||||||
else
|
else
|
||||||
|
|
|
@ -15,6 +15,11 @@
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
#include "r_3dfloors.h"
|
#include "r_3dfloors.h"
|
||||||
|
|
||||||
|
CVAR(Int, r_3dfloors, true, 0);
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
// external variables
|
// external variables
|
||||||
int fake3D;
|
int fake3D;
|
||||||
F3DFloor *fakeFloor;
|
F3DFloor *fakeFloor;
|
||||||
|
@ -28,8 +33,6 @@ HeightLevel *height_cur = NULL;
|
||||||
int CurrentMirror = 0;
|
int CurrentMirror = 0;
|
||||||
int CurrentSkybox = 0;
|
int CurrentSkybox = 0;
|
||||||
|
|
||||||
CVAR(Int, r_3dfloors, true, 0);
|
|
||||||
|
|
||||||
// private variables
|
// private variables
|
||||||
int height_max = -1;
|
int height_max = -1;
|
||||||
TArray<HeightStack> toplist;
|
TArray<HeightStack> toplist;
|
||||||
|
@ -160,3 +163,4 @@ void R_3D_LeaveSkybox()
|
||||||
CurrentSkybox--;
|
CurrentSkybox--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,11 @@
|
||||||
|
|
||||||
#include "p_3dfloors.h"
|
#include "p_3dfloors.h"
|
||||||
|
|
||||||
|
EXTERN_CVAR(Int, r_3dfloors);
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
// special types
|
// special types
|
||||||
|
|
||||||
struct HeightLevel
|
struct HeightLevel
|
||||||
|
@ -57,7 +62,6 @@ extern HeightLevel *height_top;
|
||||||
extern HeightLevel *height_cur;
|
extern HeightLevel *height_cur;
|
||||||
extern int CurrentMirror;
|
extern int CurrentMirror;
|
||||||
extern int CurrentSkybox;
|
extern int CurrentSkybox;
|
||||||
EXTERN_CVAR(Int, r_3dfloors);
|
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
void R_3D_DeleteHeights();
|
void R_3D_DeleteHeights();
|
||||||
|
@ -67,4 +71,6 @@ void R_3D_ResetClip();
|
||||||
void R_3D_EnterSkybox();
|
void R_3D_EnterSkybox();
|
||||||
void R_3D_LeaveSkybox();
|
void R_3D_LeaveSkybox();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -58,6 +58,12 @@
|
||||||
#include "po_man.h"
|
#include "po_man.h"
|
||||||
#include "r_data/colormaps.h"
|
#include "r_data/colormaps.h"
|
||||||
|
|
||||||
|
CVAR (Bool, r_drawflat, false, 0) // [RH] Don't texture segs?
|
||||||
|
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
seg_t* curline;
|
seg_t* curline;
|
||||||
side_t* sidedef;
|
side_t* sidedef;
|
||||||
line_t* linedef;
|
line_t* linedef;
|
||||||
|
@ -104,8 +110,6 @@ TArray<PortalDrawseg> WallPortals(1000); // note: this array needs to go away as
|
||||||
|
|
||||||
subsector_t *InSubsector;
|
subsector_t *InSubsector;
|
||||||
|
|
||||||
CVAR (Bool, r_drawflat, false, 0) // [RH] Don't texture segs?
|
|
||||||
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
|
||||||
|
|
||||||
|
|
||||||
void R_StoreWallRange (int start, int stop);
|
void R_StoreWallRange (int start, int stop);
|
||||||
|
@ -1396,3 +1400,5 @@ void R_RenderBSPNode (void *node)
|
||||||
}
|
}
|
||||||
R_Subsector ((subsector_t *)((BYTE *)node - 1));
|
R_Subsector ((subsector_t *)((BYTE *)node - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -27,6 +27,11 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "r_defs.h"
|
#include "r_defs.h"
|
||||||
|
|
||||||
|
EXTERN_CVAR (Bool, r_drawflat) // [RH] Don't texture segs?
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
// The 3072 below is just an arbitrary value picked to avoid
|
// The 3072 below is just an arbitrary value picked to avoid
|
||||||
// drawing lines the player is too close to that would overflow
|
// drawing lines the player is too close to that would overflow
|
||||||
// the texture calculations.
|
// the texture calculations.
|
||||||
|
@ -109,8 +114,6 @@ extern WORD MirrorFlags;
|
||||||
|
|
||||||
typedef void (*drawfunc_t) (int start, int stop);
|
typedef void (*drawfunc_t) (int start, int stop);
|
||||||
|
|
||||||
EXTERN_CVAR (Bool, r_drawflat) // [RH] Don't texture segs?
|
|
||||||
|
|
||||||
// BSP?
|
// BSP?
|
||||||
void R_ClearClipSegs (short left, short right);
|
void R_ClearClipSegs (short left, short right);
|
||||||
void R_ClearDrawSegs ();
|
void R_ClearDrawSegs ();
|
||||||
|
@ -119,5 +122,6 @@ void R_RenderBSPNode (void *node);
|
||||||
// killough 4/13/98: fake floors/ceilings for deep water / fake ceilings:
|
// killough 4/13/98: fake floors/ceilings for deep water / fake ceilings:
|
||||||
sector_t *R_FakeFlat(sector_t *, sector_t *, int *, int *, bool);
|
sector_t *R_FakeFlat(sector_t *, sector_t *, int *, int *, bool);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -59,7 +59,7 @@ enum
|
||||||
SIL_BOTH
|
SIL_BOTH
|
||||||
};
|
};
|
||||||
|
|
||||||
extern size_t MaxDrawSegs;
|
namespace swrenderer { extern size_t MaxDrawSegs; }
|
||||||
struct FDisplacement;
|
struct FDisplacement;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -47,6 +47,14 @@
|
||||||
|
|
||||||
#undef RANGECHECK
|
#undef RANGECHECK
|
||||||
|
|
||||||
|
EXTERN_CVAR (Int, r_drawfuzz)
|
||||||
|
EXTERN_CVAR (Bool, r_drawtrans)
|
||||||
|
EXTERN_CVAR (Float, transsouls)
|
||||||
|
EXTERN_CVAR (Int, r_columnmethod)
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
// status bar height at bottom of screen
|
// status bar height at bottom of screen
|
||||||
// [RH] status bar position at bottom of screen
|
// [RH] status bar position at bottom of screen
|
||||||
extern int ST_Y;
|
extern int ST_Y;
|
||||||
|
@ -194,7 +202,6 @@ FDynamicColormap identitycolormap;
|
||||||
|
|
||||||
bool drawer_needs_pal_input;
|
bool drawer_needs_pal_input;
|
||||||
|
|
||||||
EXTERN_CVAR (Int, r_columnmethod)
|
|
||||||
|
|
||||||
void R_InitShadeMaps()
|
void R_InitShadeMaps()
|
||||||
{
|
{
|
||||||
|
@ -2734,9 +2741,6 @@ void R_InitColumnDrawers ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// [RH] Choose column drawers in a single place
|
// [RH] Choose column drawers in a single place
|
||||||
EXTERN_CVAR (Int, r_drawfuzz)
|
|
||||||
EXTERN_CVAR (Bool, r_drawtrans)
|
|
||||||
EXTERN_CVAR (Float, transsouls)
|
|
||||||
|
|
||||||
static FDynamicColormap *basecolormapsave;
|
static FDynamicColormap *basecolormapsave;
|
||||||
|
|
||||||
|
@ -3122,3 +3126,5 @@ void R_SetDSColorMapLight(FSWColormap *base_colormap, float light, int shade)
|
||||||
ds_colormap = base_colormap->Maps + (GETPALOOKUP(light, shade) << COLORMAPSHIFT);
|
ds_colormap = base_colormap->Maps + (GETPALOOKUP(light, shade) << COLORMAPSHIFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
19
src/r_draw.h
19
src/r_draw.h
|
@ -25,14 +25,23 @@
|
||||||
|
|
||||||
#include "r_defs.h"
|
#include "r_defs.h"
|
||||||
|
|
||||||
|
struct FSWColormap;
|
||||||
|
|
||||||
|
EXTERN_CVAR(Bool, r_multithreaded);
|
||||||
|
EXTERN_CVAR(Bool, r_magfilter);
|
||||||
|
EXTERN_CVAR(Bool, r_minfilter);
|
||||||
|
EXTERN_CVAR(Bool, r_mipmap);
|
||||||
|
EXTERN_CVAR(Float, r_lod_bias);
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
// Spectre/Invisibility.
|
// Spectre/Invisibility.
|
||||||
#define FUZZTABLE 50
|
#define FUZZTABLE 50
|
||||||
extern "C" int fuzzoffset[FUZZTABLE + 1]; // [RH] +1 for the assembly routine
|
extern "C" int fuzzoffset[FUZZTABLE + 1]; // [RH] +1 for the assembly routine
|
||||||
extern "C" int fuzzpos;
|
extern "C" int fuzzpos;
|
||||||
extern "C" int fuzzviewheight;
|
extern "C" int fuzzviewheight;
|
||||||
|
|
||||||
struct FSWColormap;
|
|
||||||
|
|
||||||
struct ShadeConstants
|
struct ShadeConstants
|
||||||
{
|
{
|
||||||
uint16_t light_alpha;
|
uint16_t light_alpha;
|
||||||
|
@ -395,10 +404,6 @@ void R_DrawDoubleSkyCol4_rgba(uint32_t solid_top, uint32_t solid_bottom);
|
||||||
|
|
||||||
extern bool r_swtruecolor;
|
extern bool r_swtruecolor;
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_multithreaded);
|
}
|
||||||
EXTERN_CVAR(Bool, r_magfilter);
|
|
||||||
EXTERN_CVAR(Bool, r_minfilter);
|
|
||||||
EXTERN_CVAR(Bool, r_mipmap);
|
|
||||||
EXTERN_CVAR(Float, r_lod_bias);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,11 +46,6 @@
|
||||||
#include "x86.h"
|
#include "x86.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
extern "C" short spanend[MAXHEIGHT];
|
|
||||||
extern float rw_light;
|
|
||||||
extern float rw_lightstep;
|
|
||||||
extern int wallshade;
|
|
||||||
|
|
||||||
// Use linear filtering when scaling up
|
// Use linear filtering when scaling up
|
||||||
CVAR(Bool, r_magfilter, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
CVAR(Bool, r_magfilter, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||||
|
|
||||||
|
@ -63,6 +58,14 @@ CVAR(Bool, r_mipmap, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||||
// Level of detail texture bias
|
// Level of detail texture bias
|
||||||
CVAR(Float, r_lod_bias, -1.5, 0); // To do: add CVAR_ARCHIVE | CVAR_GLOBALCONFIG when a good default has been decided
|
CVAR(Float, r_lod_bias, -1.5, 0); // To do: add CVAR_ARCHIVE | CVAR_GLOBALCONFIG when a good default has been decided
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
|
extern "C" short spanend[MAXHEIGHT];
|
||||||
|
extern float rw_light;
|
||||||
|
extern float rw_lightstep;
|
||||||
|
extern int wallshade;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class DrawSpanLLVMCommand : public DrawerCommand
|
class DrawSpanLLVMCommand : public DrawerCommand
|
||||||
|
@ -1622,3 +1625,5 @@ void R_DrawFogBoundary_rgba(int x1, int x2, short *uclip, short *dclip)
|
||||||
R_DrawFogBoundarySection_rgba(t2, b2, x1);
|
R_DrawFogBoundarySection_rgba(t2, b2, x1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -36,6 +36,9 @@ struct FSpecialColormap;
|
||||||
EXTERN_CVAR(Bool, r_mipmap)
|
EXTERN_CVAR(Bool, r_mipmap)
|
||||||
EXTERN_CVAR(Float, r_lod_bias)
|
EXTERN_CVAR(Float, r_lod_bias)
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Drawer functions:
|
// Drawer functions:
|
||||||
|
|
||||||
|
@ -285,4 +288,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -47,6 +47,9 @@
|
||||||
#include "r_things.h"
|
#include "r_things.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
// I should have commented this stuff better.
|
// I should have commented this stuff better.
|
||||||
//
|
//
|
||||||
// dc_temp is the buffer R_DrawColumnHoriz writes into.
|
// dc_temp is the buffer R_DrawColumnHoriz writes into.
|
||||||
|
@ -1130,3 +1133,5 @@ void R_FillColumnHorizP_C (void)
|
||||||
dest += 8;
|
dest += 8;
|
||||||
} while (--count);
|
} while (--count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -45,6 +45,9 @@
|
||||||
#include "r_draw_rgba.h"
|
#include "r_draw_rgba.h"
|
||||||
#include "r_drawers.h"
|
#include "r_drawers.h"
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
extern unsigned int dc_tspans[4][MAXHEIGHT];
|
extern unsigned int dc_tspans[4][MAXHEIGHT];
|
||||||
extern unsigned int *dc_ctspan[4];
|
extern unsigned int *dc_ctspan[4];
|
||||||
extern unsigned int *horizspan[4];
|
extern unsigned int *horizspan[4];
|
||||||
|
@ -506,3 +509,5 @@ void R_FillColumnHoriz_rgba (void)
|
||||||
|
|
||||||
DrawerCommandQueue::QueueCommand<FillColumnHorizRGBACommand>();
|
DrawerCommandQueue::QueueCommand<FillColumnHorizRGBACommand>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -62,6 +62,34 @@
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
CVAR (String, r_viewsize, "", CVAR_NOSET)
|
||||||
|
CVAR (Bool, r_shadercolormaps, true, CVAR_ARCHIVE)
|
||||||
|
|
||||||
|
CUSTOM_CVAR (Int, r_columnmethod, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
|
{
|
||||||
|
if (self != 0 && self != 1)
|
||||||
|
{
|
||||||
|
self = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // Trigger the change
|
||||||
|
setsizeneeded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CVAR(Int, r_portal_recursions, 4, CVAR_ARCHIVE)
|
||||||
|
CVAR(Bool, r_highlight_portals, false, CVAR_ARCHIVE)
|
||||||
|
|
||||||
|
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
|
||||||
|
|
||||||
|
extern cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
|
||||||
|
extern cycle_t FrameCycles;
|
||||||
|
|
||||||
|
extern bool r_showviewer;
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -91,7 +119,6 @@ extern short *openings;
|
||||||
extern bool r_fakingunderwater;
|
extern bool r_fakingunderwater;
|
||||||
extern "C" int fuzzviewheight;
|
extern "C" int fuzzviewheight;
|
||||||
extern subsector_t *InSubsector;
|
extern subsector_t *InSubsector;
|
||||||
extern bool r_showviewer;
|
|
||||||
|
|
||||||
|
|
||||||
// PRIVATE DATA DECLARATIONS -----------------------------------------------
|
// PRIVATE DATA DECLARATIONS -----------------------------------------------
|
||||||
|
@ -103,9 +130,6 @@ bool r_dontmaplines;
|
||||||
|
|
||||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||||
|
|
||||||
CVAR (String, r_viewsize, "", CVAR_NOSET)
|
|
||||||
CVAR (Bool, r_shadercolormaps, true, CVAR_ARCHIVE)
|
|
||||||
|
|
||||||
bool r_swtruecolor;
|
bool r_swtruecolor;
|
||||||
|
|
||||||
double r_BaseVisibility;
|
double r_BaseVisibility;
|
||||||
|
@ -366,26 +390,6 @@ void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight,
|
||||||
R_SetVisibility(R_GetVisibility());
|
R_SetVisibility(R_GetVisibility());
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// CVAR r_columnmethod
|
|
||||||
//
|
|
||||||
// Selects which version of the seg renderers to use.
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
CUSTOM_CVAR (Int, r_columnmethod, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|
||||||
{
|
|
||||||
if (self != 0 && self != 1)
|
|
||||||
{
|
|
||||||
self = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // Trigger the change
|
|
||||||
setsizeneeded = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// R_Init
|
// R_Init
|
||||||
|
@ -450,8 +454,6 @@ void R_CopyStackedViewParameters()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
|
|
||||||
|
|
||||||
void R_SetupColormap(player_t *player)
|
void R_SetupColormap(player_t *player)
|
||||||
{
|
{
|
||||||
realfixedcolormap = NULL;
|
realfixedcolormap = NULL;
|
||||||
|
@ -569,9 +571,6 @@ void R_SetupFreelook()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
CVAR(Int, r_portal_recursions, 4, CVAR_ARCHIVE)
|
|
||||||
CVAR(Bool, r_highlight_portals, false, CVAR_ARCHIVE)
|
|
||||||
|
|
||||||
void R_HighlightPortal (PortalDrawseg* pds)
|
void R_HighlightPortal (PortalDrawseg* pds)
|
||||||
{
|
{
|
||||||
// [ZZ] NO OVERFLOW CHECKS HERE
|
// [ZZ] NO OVERFLOW CHECKS HERE
|
||||||
|
@ -1023,8 +1022,6 @@ void R_MultiresInit ()
|
||||||
// Displays statistics about rendering times
|
// Displays statistics about rendering times
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
extern cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
|
|
||||||
extern cycle_t FrameCycles;
|
|
||||||
|
|
||||||
ADD_STAT (fps)
|
ADD_STAT (fps)
|
||||||
{
|
{
|
||||||
|
@ -1104,3 +1101,5 @@ CCMD (clearscancycles)
|
||||||
bestscancycles = HUGE_VAL;
|
bestscancycles = HUGE_VAL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
12
src/r_main.h
12
src/r_main.h
|
@ -28,6 +28,13 @@
|
||||||
#include "v_palette.h"
|
#include "v_palette.h"
|
||||||
#include "r_data/colormaps.h"
|
#include "r_data/colormaps.h"
|
||||||
|
|
||||||
|
extern double ViewCos;
|
||||||
|
extern double ViewSin;
|
||||||
|
extern int viewwindowx;
|
||||||
|
extern int viewwindowy;
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
typedef BYTE lighttable_t; // This could be wider for >8 bit display.
|
typedef BYTE lighttable_t; // This could be wider for >8 bit display.
|
||||||
|
|
||||||
|
@ -35,16 +42,12 @@ typedef BYTE lighttable_t; // This could be wider for >8 bit display.
|
||||||
// POV related.
|
// POV related.
|
||||||
//
|
//
|
||||||
extern bool bRenderingToCanvas;
|
extern bool bRenderingToCanvas;
|
||||||
extern double ViewCos;
|
|
||||||
extern double ViewSin;
|
|
||||||
extern fixed_t viewingrangerecip;
|
extern fixed_t viewingrangerecip;
|
||||||
extern double FocalLengthX, FocalLengthY;
|
extern double FocalLengthX, FocalLengthY;
|
||||||
extern double InvZtoScale;
|
extern double InvZtoScale;
|
||||||
|
|
||||||
extern double WallTMapScale2;
|
extern double WallTMapScale2;
|
||||||
|
|
||||||
extern int viewwindowx;
|
|
||||||
extern int viewwindowy;
|
|
||||||
|
|
||||||
extern double CenterX;
|
extern double CenterX;
|
||||||
extern double CenterY;
|
extern double CenterY;
|
||||||
|
@ -152,5 +155,6 @@ extern DAngle stacked_angle;
|
||||||
|
|
||||||
extern void R_CopyStackedViewParameters();
|
extern void R_CopyStackedViewParameters();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // __R_MAIN_H__
|
#endif // __R_MAIN_H__
|
||||||
|
|
|
@ -64,10 +64,14 @@
|
||||||
#pragma warning(disable:4244)
|
#pragma warning(disable:4244)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
CVAR(Bool, r_linearsky, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||||
|
CVAR(Bool, tilt, false, 0);
|
||||||
|
CVAR(Bool, r_skyboxes, true, 0)
|
||||||
|
|
||||||
EXTERN_CVAR(Int, r_skymode)
|
EXTERN_CVAR(Int, r_skymode)
|
||||||
|
|
||||||
//EXTERN_CVAR (Int, tx)
|
namespace swrenderer
|
||||||
//EXTERN_CVAR (Int, ty)
|
{
|
||||||
|
|
||||||
extern subsector_t *InSubsector;
|
extern subsector_t *InSubsector;
|
||||||
|
|
||||||
|
@ -889,7 +893,6 @@ static DWORD lastskycol_bgra[MAXSKYBUF];
|
||||||
static int skycolplace;
|
static int skycolplace;
|
||||||
static int skycolplace_bgra;
|
static int skycolplace_bgra;
|
||||||
|
|
||||||
CVAR(Bool, r_linearsky, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
|
||||||
|
|
||||||
// Get a column of sky when there is only one sky texture.
|
// Get a column of sky when there is only one sky texture.
|
||||||
static const BYTE *R_GetOneSkyColumn (FTexture *fronttex, int x)
|
static const BYTE *R_GetOneSkyColumn (FTexture *fronttex, int x)
|
||||||
|
@ -1312,8 +1315,6 @@ static void R_DrawSkyStriped (visplane_t *pl)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
CVAR (Bool, tilt, false, 0);
|
|
||||||
//CVAR (Int, pa, 0, 0)
|
|
||||||
|
|
||||||
int R_DrawPlanes ()
|
int R_DrawPlanes ()
|
||||||
{
|
{
|
||||||
|
@ -1450,7 +1451,6 @@ void R_DrawSinglePlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske
|
||||||
// 9. Put the camera back where it was to begin with.
|
// 9. Put the camera back where it was to begin with.
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
CVAR (Bool, r_skyboxes, true, 0)
|
|
||||||
static int numskyboxes;
|
static int numskyboxes;
|
||||||
|
|
||||||
void R_DrawPortals ()
|
void R_DrawPortals ()
|
||||||
|
@ -2190,3 +2190,5 @@ bool R_PlaneInitData ()
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
|
|
||||||
class ASkyViewpoint;
|
class ASkyViewpoint;
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
//
|
//
|
||||||
// The infamous visplane
|
// The infamous visplane
|
||||||
//
|
//
|
||||||
|
@ -121,4 +124,6 @@ bool R_PlaneInitData (void);
|
||||||
extern visplane_t* floorplane;
|
extern visplane_t* floorplane;
|
||||||
extern visplane_t* ceilingplane;
|
extern visplane_t* ceilingplane;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // __R_PLANE_H__
|
#endif // __R_PLANE_H__
|
||||||
|
|
|
@ -46,16 +46,16 @@ RenderPolyScene *RenderPolyScene::Instance()
|
||||||
void RenderPolyScene::RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines)
|
void RenderPolyScene::RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines)
|
||||||
{
|
{
|
||||||
const bool savedviewactive = viewactive;
|
const bool savedviewactive = viewactive;
|
||||||
const bool savedoutputformat = r_swtruecolor;
|
const bool savedoutputformat = swrenderer::r_swtruecolor;
|
||||||
|
|
||||||
viewwidth = width;
|
viewwidth = width;
|
||||||
RenderTarget = canvas;
|
RenderTarget = canvas;
|
||||||
bRenderingToCanvas = true;
|
swrenderer::bRenderingToCanvas = true;
|
||||||
R_SetWindow(12, width, height, height, true);
|
R_SetWindow(12, width, height, height, true);
|
||||||
viewwindowx = x;
|
viewwindowx = x;
|
||||||
viewwindowy = y;
|
viewwindowy = y;
|
||||||
viewactive = true;
|
viewactive = true;
|
||||||
r_swtruecolor = canvas->IsBgra();
|
swrenderer::r_swtruecolor = canvas->IsBgra();
|
||||||
|
|
||||||
canvas->Lock(true);
|
canvas->Lock(true);
|
||||||
|
|
||||||
|
@ -64,17 +64,17 @@ void RenderPolyScene::RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x,
|
||||||
canvas->Unlock();
|
canvas->Unlock();
|
||||||
|
|
||||||
RenderTarget = screen;
|
RenderTarget = screen;
|
||||||
bRenderingToCanvas = false;
|
swrenderer::bRenderingToCanvas = false;
|
||||||
R_ExecuteSetViewSize();
|
R_ExecuteSetViewSize();
|
||||||
viewactive = savedviewactive;
|
viewactive = savedviewactive;
|
||||||
r_swtruecolor = savedoutputformat;
|
swrenderer::r_swtruecolor = savedoutputformat;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPolyScene::RenderActorView(AActor *actor, bool dontmaplines)
|
void RenderPolyScene::RenderActorView(AActor *actor, bool dontmaplines)
|
||||||
{
|
{
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
|
||||||
r_dontmaplines = dontmaplines;
|
//swrenderer::r_dontmaplines = dontmaplines;
|
||||||
|
|
||||||
P_FindParticleSubsectors();
|
P_FindParticleSubsectors();
|
||||||
PO_LinkToSubsectors();
|
PO_LinkToSubsectors();
|
||||||
|
|
|
@ -135,7 +135,7 @@ void RenderPolyDecal::Render(const TriMatrix &worldToClip, const Vec4f &clipPlan
|
||||||
args.uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
args.SetColormap(front->ColorMap);
|
args.SetColormap(front->ColorMap);
|
||||||
args.SetTexture(tex, decal->Translation, true);
|
args.SetTexture(tex, decal->Translation, true);
|
||||||
if (fullbrightSprite || fixedlightlev >= 0 || fixedcolormap)
|
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
||||||
{
|
{
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
args.uniforms.flags |= TriUniforms::fixed_light;
|
args.uniforms.flags |= TriUniforms::fixed_light;
|
||||||
|
@ -146,7 +146,7 @@ void RenderPolyDecal::Render(const TriMatrix &worldToClip, const Vec4f &clipPlan
|
||||||
}
|
}
|
||||||
args.uniforms.subsectorDepth = subsectorDepth;
|
args.uniforms.subsectorDepth = subsectorDepth;
|
||||||
|
|
||||||
if (r_swtruecolor)
|
if (swrenderer::r_swtruecolor)
|
||||||
{
|
{
|
||||||
args.uniforms.color = 0xff000000 | decal->AlphaColor;
|
args.uniforms.color = 0xff000000 | decal->AlphaColor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ void RenderPolyParticle::Render(const TriMatrix &worldToClip, const Vec4f &clipP
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
|
|
||||||
if (fullbrightSprite || fixedlightlev >= 0 || fixedcolormap)
|
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
||||||
{
|
{
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
args.uniforms.flags = TriUniforms::fixed_light;
|
args.uniforms.flags = TriUniforms::fixed_light;
|
||||||
|
@ -84,7 +84,7 @@ void RenderPolyParticle::Render(const TriMatrix &worldToClip, const Vec4f &clipP
|
||||||
}
|
}
|
||||||
args.uniforms.subsectorDepth = subsectorDepth;
|
args.uniforms.subsectorDepth = subsectorDepth;
|
||||||
|
|
||||||
if (r_swtruecolor)
|
if (swrenderer::r_swtruecolor)
|
||||||
{
|
{
|
||||||
uint32_t alpha = particle->trans;
|
uint32_t alpha = particle->trans;
|
||||||
args.uniforms.color = (alpha << 24) | (particle->color & 0xffffff);
|
args.uniforms.color = (alpha << 24) | (particle->color & 0xffffff);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "r_poly_plane.h"
|
#include "r_poly_plane.h"
|
||||||
#include "r_poly_portal.h"
|
#include "r_poly_portal.h"
|
||||||
#include "r_poly.h"
|
#include "r_poly.h"
|
||||||
#include "r_sky.h" // for skyflatnum
|
#include "r_sky.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Int, r_3dfloors)
|
EXTERN_CVAR(Int, r_3dfloors)
|
||||||
|
|
||||||
|
@ -96,10 +96,10 @@ void RenderPolyPlane::Render3DFloor(const TriMatrix &worldToClip, const Vec4f &c
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int lightlevel = 255;
|
int lightlevel = 255;
|
||||||
if (fixedlightlev < 0 && sub->sector->e->XFloor.lightlist.Size())
|
if (swrenderer::fixedlightlev < 0 && sub->sector->e->XFloor.lightlist.Size())
|
||||||
{
|
{
|
||||||
lightlist_t *light = P_GetPlaneLight(sub->sector, &sub->sector->ceilingplane, false);
|
lightlist_t *light = P_GetPlaneLight(sub->sector, &sub->sector->ceilingplane, false);
|
||||||
basecolormap = light->extra_colormap;
|
swrenderer::basecolormap = light->extra_colormap;
|
||||||
lightlevel = *light->p_lightlevel;
|
lightlevel = *light->p_lightlevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ void RenderPolyPlane::Render3DFloor(const TriMatrix &worldToClip, const Vec4f &c
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.uniforms.light = (uint32_t)(lightlevel / 255.0f * 256.0f);
|
args.uniforms.light = (uint32_t)(lightlevel / 255.0f * 256.0f);
|
||||||
if (fixedlightlev >= 0 || fixedcolormap)
|
if (swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
args.uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
args.uniforms.subsectorDepth = subsectorDepth;
|
args.uniforms.subsectorDepth = subsectorDepth;
|
||||||
|
@ -251,7 +251,7 @@ void RenderPolyPlane::Render(const TriMatrix &worldToClip, const Vec4f &clipPlan
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.uniforms.light = (uint32_t)(frontsector->lightlevel / 255.0f * 256.0f);
|
args.uniforms.light = (uint32_t)(frontsector->lightlevel / 255.0f * 256.0f);
|
||||||
if (fixedlightlev >= 0 || fixedcolormap)
|
if (swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
args.uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
args.uniforms.subsectorDepth = isSky ? RenderPolyPortal::SkySubsectorDepth : subsectorDepth;
|
args.uniforms.subsectorDepth = isSky ? RenderPolyPortal::SkySubsectorDepth : subsectorDepth;
|
||||||
|
|
|
@ -143,14 +143,14 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
|
||||||
double tx = sx - BaseXCenter;
|
double tx = sx - BaseXCenter;
|
||||||
|
|
||||||
tx -= tex->GetScaledLeftOffset();
|
tx -= tex->GetScaledLeftOffset();
|
||||||
int x1 = xs_RoundToInt(CenterX + tx * pspritexscale);
|
int x1 = xs_RoundToInt(swrenderer::CenterX + tx * swrenderer::pspritexscale);
|
||||||
|
|
||||||
// off the right side
|
// off the right side
|
||||||
if (x1 > viewwidth)
|
if (x1 > viewwidth)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tx += tex->GetScaledWidth();
|
tx += tex->GetScaledWidth();
|
||||||
int x2 = xs_RoundToInt(CenterX + tx * pspritexscale);
|
int x2 = xs_RoundToInt(swrenderer::CenterX + tx * swrenderer::pspritexscale);
|
||||||
|
|
||||||
// off the left side
|
// off the left side
|
||||||
if (x2 <= 0)
|
if (x2 <= 0)
|
||||||
|
@ -183,19 +183,19 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
|
||||||
|
|
||||||
int clipped_x1 = MAX(x1, 0);
|
int clipped_x1 = MAX(x1, 0);
|
||||||
int clipped_x2 = MIN(x2, viewwidth);
|
int clipped_x2 = MIN(x2, viewwidth);
|
||||||
double xscale = pspritexscale / tex->Scale.X;
|
double xscale = swrenderer::pspritexscale / tex->Scale.X;
|
||||||
double yscale = pspriteyscale / tex->Scale.Y;
|
double yscale = swrenderer::pspriteyscale / tex->Scale.Y;
|
||||||
uint32_t translation = 0; // [RH] Use default colors
|
uint32_t translation = 0; // [RH] Use default colors
|
||||||
|
|
||||||
double xiscale, startfrac;
|
double xiscale, startfrac;
|
||||||
if (flip)
|
if (flip)
|
||||||
{
|
{
|
||||||
xiscale = -pspritexiscale * tex->Scale.X;
|
xiscale = -swrenderer::pspritexiscale * tex->Scale.X;
|
||||||
startfrac = 1;
|
startfrac = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xiscale = pspritexiscale * tex->Scale.X;
|
xiscale = swrenderer::pspritexiscale * tex->Scale.X;
|
||||||
startfrac = 0;
|
startfrac = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
|
||||||
int actualextralight = foggy ? 0 : extralight << 4;
|
int actualextralight = foggy ? 0 : extralight << 4;
|
||||||
int spriteshade = LIGHT2SHADE(owner->Sector->lightlevel + actualextralight);
|
int spriteshade = LIGHT2SHADE(owner->Sector->lightlevel + actualextralight);
|
||||||
double minz = double((2048 * 4) / double(1 << 20));
|
double minz = double((2048 * 4) / double(1 << 20));
|
||||||
visstyle.ColormapNum = GETPALOOKUP(r_SpriteVisibility / minz, spriteshade);
|
visstyle.ColormapNum = GETPALOOKUP(swrenderer::r_SpriteVisibility / minz, spriteshade);
|
||||||
|
|
||||||
if (sprite->GetID() < PSP_TARGETCENTER)
|
if (sprite->GetID() < PSP_TARGETCENTER)
|
||||||
{
|
{
|
||||||
|
|
|
@ -163,7 +163,7 @@ void RenderPolyPortal::RenderLine(subsector_t *sub, seg_t *line, sector_t *front
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Tell automap we saw this
|
// Tell automap we saw this
|
||||||
if (!r_dontmaplines && line->linedef)
|
if (!swrenderer::r_dontmaplines && line->linedef)
|
||||||
{
|
{
|
||||||
line->linedef->flags |= ML_MAPPED;
|
line->linedef->flags |= ML_MAPPED;
|
||||||
sub->flags |= SSECF_DRAWN;
|
sub->flags |= SSECF_DRAWN;
|
||||||
|
@ -367,7 +367,7 @@ void PolyDrawSectorPortal::SaveGlobals()
|
||||||
savedextralight = extralight;
|
savedextralight = extralight;
|
||||||
savedpos = ViewPos;
|
savedpos = ViewPos;
|
||||||
savedangle = ViewAngle;
|
savedangle = ViewAngle;
|
||||||
savedvisibility = R_GetVisibility();
|
savedvisibility = swrenderer::R_GetVisibility();
|
||||||
savedcamera = camera;
|
savedcamera = camera;
|
||||||
savedsector = viewsector;
|
savedsector = viewsector;
|
||||||
|
|
||||||
|
@ -376,14 +376,14 @@ void PolyDrawSectorPortal::SaveGlobals()
|
||||||
// Don't let gun flashes brighten the sky box
|
// Don't let gun flashes brighten the sky box
|
||||||
ASkyViewpoint *sky = barrier_cast<ASkyViewpoint*>(Portal->mSkybox);
|
ASkyViewpoint *sky = barrier_cast<ASkyViewpoint*>(Portal->mSkybox);
|
||||||
extralight = 0;
|
extralight = 0;
|
||||||
R_SetVisibility(sky->args[0] * 0.25f);
|
swrenderer::R_SetVisibility(sky->args[0] * 0.25f);
|
||||||
ViewPos = sky->InterpolatedPosition(r_TicFracF);
|
ViewPos = sky->InterpolatedPosition(r_TicFracF);
|
||||||
ViewAngle = savedangle + (sky->PrevAngles.Yaw + deltaangle(sky->PrevAngles.Yaw, sky->Angles.Yaw) * r_TicFracF);
|
ViewAngle = savedangle + (sky->PrevAngles.Yaw + deltaangle(sky->PrevAngles.Yaw, sky->Angles.Yaw) * r_TicFracF);
|
||||||
}
|
}
|
||||||
else //if (Portal->mType == PORTS_STACKEDSECTORTHING || Portal->mType == PORTS_PORTAL || Portal->mType == PORTS_LINKEDPORTAL)
|
else //if (Portal->mType == PORTS_STACKEDSECTORTHING || Portal->mType == PORTS_PORTAL || Portal->mType == PORTS_LINKEDPORTAL)
|
||||||
{
|
{
|
||||||
//extralight = pl->extralight;
|
//extralight = pl->extralight;
|
||||||
//R_SetVisibility(pl->visibility);
|
//swrenderer::R_SetVisibility(pl->visibility);
|
||||||
ViewPos.X += Portal->mDisplacement.X;
|
ViewPos.X += Portal->mDisplacement.X;
|
||||||
ViewPos.Y += Portal->mDisplacement.Y;
|
ViewPos.Y += Portal->mDisplacement.Y;
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ void PolyDrawSectorPortal::RestoreGlobals()
|
||||||
camera = savedcamera;
|
camera = savedcamera;
|
||||||
viewsector = savedsector;
|
viewsector = savedsector;
|
||||||
ViewPos = savedpos;
|
ViewPos = savedpos;
|
||||||
R_SetVisibility(savedvisibility);
|
swrenderer::R_SetVisibility(savedvisibility);
|
||||||
extralight = savedextralight;
|
extralight = savedextralight;
|
||||||
ViewAngle = savedangle;
|
ViewAngle = savedangle;
|
||||||
R_SetViewAngle();
|
R_SetViewAngle();
|
||||||
|
|
|
@ -85,7 +85,7 @@ void PolySkyDome::RenderRow(PolyDrawArgs &args, int row)
|
||||||
void PolySkyDome::RenderCapColorRow(PolyDrawArgs &args, FTexture *skytex, int row, bool bottomCap)
|
void PolySkyDome::RenderCapColorRow(PolyDrawArgs &args, FTexture *skytex, int row, bool bottomCap)
|
||||||
{
|
{
|
||||||
uint32_t solid = skytex->GetSkyCapColor(bottomCap);
|
uint32_t solid = skytex->GetSkyCapColor(bottomCap);
|
||||||
if (!r_swtruecolor)
|
if (!swrenderer::r_swtruecolor)
|
||||||
solid = RGB32k.RGB[(RPART(solid) >> 3)][(GPART(solid) >> 3)][(BPART(solid) >> 3)];
|
solid = RGB32k.RGB[(RPART(solid) >> 3)][(GPART(solid) >> 3)][(BPART(solid) >> 3)];
|
||||||
|
|
||||||
args.vinput = &mVertices[mPrimStart[row]];
|
args.vinput = &mVertices[mPrimStart[row]];
|
||||||
|
|
|
@ -119,7 +119,7 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, const Vec4f &clipPla
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
if (fullbrightSprite || fixedlightlev >= 0 || fixedcolormap)
|
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
||||||
{
|
{
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
args.uniforms.flags |= TriUniforms::fixed_light;
|
args.uniforms.flags |= TriUniforms::fixed_light;
|
||||||
|
@ -228,7 +228,7 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, const Vec4f &clipPla
|
||||||
args.SetTexture(tex, thing->Translation, true);
|
args.SetTexture(tex, thing->Translation, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!r_swtruecolor)
|
if (!swrenderer::r_swtruecolor)
|
||||||
{
|
{
|
||||||
uint32_t r = (args.uniforms.color >> 16) & 0xff;
|
uint32_t r = (args.uniforms.color >> 16) & 0xff;
|
||||||
uint32_t g = (args.uniforms.color >> 8) & 0xff;
|
uint32_t g = (args.uniforms.color >> 8) & 0xff;
|
||||||
|
@ -309,9 +309,9 @@ visstyle_t RenderPolySprite::GetSpriteVisStyle(AActor *thing, double z)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get light level
|
// get light level
|
||||||
if (fixedcolormap != nullptr)
|
if (swrenderer::fixedcolormap != nullptr)
|
||||||
{ // fixed map
|
{ // fixed map
|
||||||
visstyle.BaseColormap = fixedcolormap;
|
visstyle.BaseColormap = swrenderer::fixedcolormap;
|
||||||
visstyle.ColormapNum = 0;
|
visstyle.ColormapNum = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -320,10 +320,10 @@ visstyle_t RenderPolySprite::GetSpriteVisStyle(AActor *thing, double z)
|
||||||
{
|
{
|
||||||
mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate);
|
mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate);
|
||||||
}
|
}
|
||||||
if (fixedlightlev >= 0)
|
if (swrenderer::fixedlightlev >= 0)
|
||||||
{
|
{
|
||||||
visstyle.BaseColormap = mybasecolormap;
|
visstyle.BaseColormap = mybasecolormap;
|
||||||
visstyle.ColormapNum = fixedlightlev >> COLORMAPSHIFT;
|
visstyle.ColormapNum = swrenderer::fixedlightlev >> COLORMAPSHIFT;
|
||||||
}
|
}
|
||||||
else if (!foggy && ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT)))
|
else if (!foggy && ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT)))
|
||||||
{ // full bright
|
{ // full bright
|
||||||
|
@ -333,7 +333,7 @@ visstyle_t RenderPolySprite::GetSpriteVisStyle(AActor *thing, double z)
|
||||||
else
|
else
|
||||||
{ // diminished light
|
{ // diminished light
|
||||||
double minz = double((2048 * 4) / double(1 << 20));
|
double minz = double((2048 * 4) / double(1 << 20));
|
||||||
visstyle.ColormapNum = GETPALOOKUP(r_SpriteVisibility / MAX(z, minz), spriteshade);
|
visstyle.ColormapNum = GETPALOOKUP(swrenderer::r_SpriteVisibility / MAX(z, minz), spriteshade);
|
||||||
visstyle.BaseColormap = mybasecolormap;
|
visstyle.BaseColormap = mybasecolormap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -498,8 +498,8 @@ TriMatrix TriMatrix::viewToClip()
|
||||||
float near = 5.0f;
|
float near = 5.0f;
|
||||||
float far = 65536.0f;
|
float far = 65536.0f;
|
||||||
float width = (float)(FocalTangent * near);
|
float width = (float)(FocalTangent * near);
|
||||||
float top = (float)(CenterY / InvZtoScale * near);
|
float top = (float)(swrenderer::CenterY / swrenderer::InvZtoScale * near);
|
||||||
float bottom = (float)(top - viewheight / InvZtoScale * near);
|
float bottom = (float)(top - viewheight / swrenderer::InvZtoScale * near);
|
||||||
return frustum(-width, width, bottom, top, near, far);
|
return frustum(-width, width, bottom, top, near, far);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
{
|
{
|
||||||
textureWidth = texture->GetWidth();
|
textureWidth = texture->GetWidth();
|
||||||
textureHeight = texture->GetHeight();
|
textureHeight = texture->GetHeight();
|
||||||
if (r_swtruecolor)
|
if (swrenderer::r_swtruecolor)
|
||||||
texturePixels = (const uint8_t *)texture->GetPixelsBgra();
|
texturePixels = (const uint8_t *)texture->GetPixelsBgra();
|
||||||
else
|
else
|
||||||
texturePixels = texture->GetPixels();
|
texturePixels = texture->GetPixels();
|
||||||
|
@ -84,7 +84,7 @@ public:
|
||||||
FRemapTable *table = TranslationToTable(translationID);
|
FRemapTable *table = TranslationToTable(translationID);
|
||||||
if (table != nullptr && !table->Inactive)
|
if (table != nullptr && !table->Inactive)
|
||||||
{
|
{
|
||||||
if (r_swtruecolor)
|
if (swrenderer::r_swtruecolor)
|
||||||
translation = (uint8_t*)table->Palette;
|
translation = (uint8_t*)table->Palette;
|
||||||
else
|
else
|
||||||
translation = table->Remap;
|
translation = table->Remap;
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "r_poly_wall.h"
|
#include "r_poly_wall.h"
|
||||||
#include "r_poly_decal.h"
|
#include "r_poly_decal.h"
|
||||||
#include "r_poly.h"
|
#include "r_poly.h"
|
||||||
#include "r_sky.h" // for skyflatnum
|
#include "r_sky.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_drawmirrors)
|
EXTERN_CVAR(Bool, r_drawmirrors)
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ FTexture *RenderPolyWall::GetTexture()
|
||||||
|
|
||||||
int RenderPolyWall::GetLightLevel()
|
int RenderPolyWall::GetLightLevel()
|
||||||
{
|
{
|
||||||
if (fixedlightlev >= 0 || fixedcolormap)
|
if (swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
||||||
{
|
{
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ void RenderPolyWallSprite::Render(const TriMatrix &worldToClip, const Vec4f &cli
|
||||||
bool fullbrightSprite = ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT));
|
bool fullbrightSprite = ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT));
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
if (fullbrightSprite || fixedlightlev >= 0 || fixedcolormap)
|
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
||||||
{
|
{
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
args.uniforms.flags = TriUniforms::fixed_light;
|
args.uniforms.flags = TriUniforms::fixed_light;
|
||||||
|
|
|
@ -56,12 +56,14 @@
|
||||||
|
|
||||||
#define WALLYREPEAT 8
|
#define WALLYREPEAT 8
|
||||||
|
|
||||||
|
|
||||||
CVAR(Bool, r_np2, true, 0)
|
CVAR(Bool, r_np2, true, 0)
|
||||||
|
CVAR(Bool, r_fogboundary, true, 0)
|
||||||
|
CVAR(Bool, r_drawmirrors, true, 0)
|
||||||
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
||||||
|
EXTERN_CVAR(Bool, r_mipmap)
|
||||||
|
|
||||||
//CVAR (Int, ty, 8, 0)
|
namespace swrenderer
|
||||||
//CVAR (Int, tx, 8, 0)
|
{
|
||||||
|
|
||||||
#define HEIGHTBITS 12
|
#define HEIGHTBITS 12
|
||||||
#define HEIGHTSHIFT (FRACBITS-HEIGHTBITS)
|
#define HEIGHTSHIFT (FRACBITS-HEIGHTBITS)
|
||||||
|
@ -142,16 +144,6 @@ void wallscan_np2(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t
|
||||||
static void wallscan_np2_ds(drawseg_t *ds, int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat);
|
static void wallscan_np2_ds(drawseg_t *ds, int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat);
|
||||||
static void call_wallscan(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, bool mask);
|
static void call_wallscan(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, bool mask);
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
//
|
|
||||||
// CVAR r_fogboundary
|
|
||||||
//
|
|
||||||
// If true, makes fog look more "real" by shading the walls separating two
|
|
||||||
// sectors with different fog.
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
CVAR(Bool, r_fogboundary, true, 0)
|
|
||||||
|
|
||||||
inline bool IsFogBoundary (sector_t *front, sector_t *back)
|
inline bool IsFogBoundary (sector_t *front, sector_t *back)
|
||||||
{
|
{
|
||||||
return r_fogboundary && fixedcolormap == NULL && front->ColorMap->Fade &&
|
return r_fogboundary && fixedcolormap == NULL && front->ColorMap->Fade &&
|
||||||
|
@ -159,14 +151,6 @@ inline bool IsFogBoundary (sector_t *front, sector_t *back)
|
||||||
(front->GetTexture(sector_t::ceiling) != skyflatnum || back->GetTexture(sector_t::ceiling) != skyflatnum);
|
(front->GetTexture(sector_t::ceiling) != skyflatnum || back->GetTexture(sector_t::ceiling) != skyflatnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
//
|
|
||||||
// CVAR r_drawmirrors
|
|
||||||
//
|
|
||||||
// Set to false to disable rendering of mirrors
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
CVAR(Bool, r_drawmirrors, true, 0)
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_RenderMaskedSegRange
|
// R_RenderMaskedSegRange
|
||||||
|
@ -1065,7 +1049,6 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_mipmap)
|
|
||||||
|
|
||||||
struct WallscanSampler
|
struct WallscanSampler
|
||||||
{
|
{
|
||||||
|
@ -3162,3 +3145,5 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
|
||||||
done:
|
done:
|
||||||
WallC = savecoord;
|
WallC = savecoord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
#ifndef __R_SEGS_H__
|
#ifndef __R_SEGS_H__
|
||||||
#define __R_SEGS_H__
|
#define __R_SEGS_H__
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
struct drawseg_t;
|
struct drawseg_t;
|
||||||
|
|
||||||
void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2);
|
void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2);
|
||||||
|
@ -70,4 +73,6 @@ extern int CurrentPortalUniq;
|
||||||
extern bool CurrentPortalInSkybox;
|
extern bool CurrentPortalInSkybox;
|
||||||
extern TArray<PortalDrawseg> WallPortals;
|
extern TArray<PortalDrawseg> WallPortals;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -80,7 +80,7 @@ extern int numgamesubsectors;
|
||||||
extern AActor* camera; // [RH] camera instead of viewplayer
|
extern AActor* camera; // [RH] camera instead of viewplayer
|
||||||
extern sector_t* viewsector; // [RH] keep track of sector viewing from
|
extern sector_t* viewsector; // [RH] keep track of sector viewing from
|
||||||
|
|
||||||
extern angle_t xtoviewangle[MAXWIDTH+1];
|
namespace swrenderer { extern angle_t xtoviewangle[MAXWIDTH+1]; }
|
||||||
extern DAngle FieldOfView;
|
extern DAngle FieldOfView;
|
||||||
|
|
||||||
int R_FindSkin (const char *name, int pclass); // [RH] Find a skin
|
int R_FindSkin (const char *name, int pclass); // [RH] Find a skin
|
||||||
|
|
|
@ -58,11 +58,18 @@ CUSTOM_CVAR(Bool, r_polyrenderer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight, float trueratio);
|
void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight, float trueratio);
|
||||||
void R_SetupColormap(player_t *);
|
void R_SetupColormap(player_t *);
|
||||||
void R_SetupFreelook();
|
void R_SetupFreelook();
|
||||||
void R_InitRenderer();
|
void R_InitRenderer();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace swrenderer;
|
||||||
|
|
||||||
FSoftwareRenderer::FSoftwareRenderer()
|
FSoftwareRenderer::FSoftwareRenderer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,19 @@
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "p_maputl.h"
|
#include "p_maputl.h"
|
||||||
|
|
||||||
|
EXTERN_CVAR(Bool, st_scale)
|
||||||
|
EXTERN_CVAR(Bool, r_shadercolormaps)
|
||||||
|
EXTERN_CVAR(Int, r_drawfuzz)
|
||||||
|
EXTERN_CVAR(Bool, r_deathcamera);
|
||||||
|
EXTERN_CVAR(Bool, r_drawplayersprites)
|
||||||
|
EXTERN_CVAR(Bool, r_drawvoxels)
|
||||||
|
|
||||||
|
CVAR(Bool, r_fullbrightignoresectorcolor, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||||
|
CVAR(Bool, r_splitsprites, true, CVAR_ARCHIVE)
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
// [RH] A c-buffer. Used for keeping track of offscreen voxel spans.
|
// [RH] A c-buffer. Used for keeping track of offscreen voxel spans.
|
||||||
|
|
||||||
struct FCoverageBuffer
|
struct FCoverageBuffer
|
||||||
|
@ -96,12 +109,6 @@ extern float MaskedScaleY;
|
||||||
#define BASEXCENTER (160)
|
#define BASEXCENTER (160)
|
||||||
#define BASEYCENTER (100)
|
#define BASEYCENTER (100)
|
||||||
|
|
||||||
EXTERN_CVAR (Bool, st_scale)
|
|
||||||
EXTERN_CVAR(Bool, r_shadercolormaps)
|
|
||||||
EXTERN_CVAR(Int, r_drawfuzz)
|
|
||||||
EXTERN_CVAR(Bool, r_deathcamera);
|
|
||||||
CVAR(Bool, r_fullbrightignoresectorcolor, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Sprite rotation 0 is facing the viewer,
|
// Sprite rotation 0 is facing the viewer,
|
||||||
// rotation 1 is one angle turn CLOCKWISE around the axis.
|
// rotation 1 is one angle turn CLOCKWISE around the axis.
|
||||||
|
@ -133,8 +140,6 @@ FTexture *WallSpriteTile;
|
||||||
short zeroarray[MAXWIDTH];
|
short zeroarray[MAXWIDTH];
|
||||||
short screenheightarray[MAXWIDTH];
|
short screenheightarray[MAXWIDTH];
|
||||||
|
|
||||||
EXTERN_CVAR (Bool, r_drawplayersprites)
|
|
||||||
EXTERN_CVAR (Bool, r_drawvoxels)
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// INITIALIZATION FUNCTIONS
|
// INITIALIZATION FUNCTIONS
|
||||||
|
@ -1903,8 +1908,6 @@ static int sd_comparex (const void *arg1, const void *arg2)
|
||||||
return (*(drawseg_t **)arg2)->x2 - (*(drawseg_t **)arg1)->x2;
|
return (*(drawseg_t **)arg2)->x2 - (*(drawseg_t **)arg1)->x2;
|
||||||
}
|
}
|
||||||
|
|
||||||
CVAR (Bool, r_splitsprites, true, CVAR_ARCHIVE)
|
|
||||||
|
|
||||||
// Split up vissprites that intersect drawsegs
|
// Split up vissprites that intersect drawsegs
|
||||||
void R_SplitVisSprites ()
|
void R_SplitVisSprites ()
|
||||||
{
|
{
|
||||||
|
@ -3446,3 +3449,5 @@ void R_CheckOffscreenBuffer(int width, int height, bool spansonly)
|
||||||
OffscreenBufferWidth = width;
|
OffscreenBufferWidth = width;
|
||||||
OffscreenBufferHeight = height;
|
OffscreenBufferHeight = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,12 @@
|
||||||
|
|
||||||
#include "r_bsp.h"
|
#include "r_bsp.h"
|
||||||
|
|
||||||
|
struct particle_t;
|
||||||
|
struct FVoxel;
|
||||||
|
|
||||||
|
namespace swrenderer
|
||||||
|
{
|
||||||
|
|
||||||
// A vissprite_t is a thing
|
// A vissprite_t is a thing
|
||||||
// that will be drawn during a refresh.
|
// that will be drawn during a refresh.
|
||||||
// I.e. a sprite object that is partly visible.
|
// I.e. a sprite object that is partly visible.
|
||||||
|
@ -94,8 +100,6 @@ struct vissprite_t
|
||||||
vissprite_t() {}
|
vissprite_t() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct particle_t;
|
|
||||||
|
|
||||||
extern void(*R_DrawParticle)(vissprite_t *);
|
extern void(*R_DrawParticle)(vissprite_t *);
|
||||||
void R_DrawParticle_C (vissprite_t *);
|
void R_DrawParticle_C (vissprite_t *);
|
||||||
void R_DrawParticle_rgba (vissprite_t *);
|
void R_DrawParticle_rgba (vissprite_t *);
|
||||||
|
@ -148,5 +152,6 @@ void R_DrawVoxel(const FVector3 &viewpos, FAngle viewangle,
|
||||||
|
|
||||||
void R_ClipVisSprite (vissprite_t *vis, int xl, int xh);
|
void R_ClipVisSprite (vissprite_t *vis, int xl, int xh);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -99,7 +99,7 @@ protected:
|
||||||
void DetectRangeError(uint32_t *&dest, int &dest_y, int &count)
|
void DetectRangeError(uint32_t *&dest, int &dest_y, int &count)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER) && defined(_DEBUG)
|
#if defined(_MSC_VER) && defined(_DEBUG)
|
||||||
if (dest_y < 0 || count < 0 || dest_y + count > dc_destheight)
|
if (dest_y < 0 || count < 0 || dest_y + count > swrenderer::dc_destheight)
|
||||||
__debugbreak(); // Buffer overrun detected!
|
__debugbreak(); // Buffer overrun detected!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -107,24 +107,26 @@ protected:
|
||||||
{
|
{
|
||||||
count += dest_y;
|
count += dest_y;
|
||||||
dest_y = 0;
|
dest_y = 0;
|
||||||
dest = (uint32_t*)dc_destorg;
|
dest = (uint32_t*)swrenderer::dc_destorg;
|
||||||
}
|
}
|
||||||
else if (dest_y >= dc_destheight)
|
else if (dest_y >= swrenderer::dc_destheight)
|
||||||
{
|
{
|
||||||
dest_y = 0;
|
dest_y = 0;
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count < 0 || count > MAXHEIGHT) count = 0;
|
if (count < 0 || count > MAXHEIGHT) count = 0;
|
||||||
if (dest_y + count >= dc_destheight)
|
if (dest_y + count >= swrenderer::dc_destheight)
|
||||||
count = dc_destheight - dest_y;
|
count = swrenderer::dc_destheight - dest_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DrawerCommand()
|
DrawerCommand()
|
||||||
{
|
{
|
||||||
_dest_y = static_cast<int>((dc_dest - dc_destorg) / (dc_pitch * 4));
|
_dest_y = static_cast<int>((swrenderer::dc_dest - swrenderer::dc_destorg) / (swrenderer::dc_pitch * 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual ~DrawerCommand() { }
|
||||||
|
|
||||||
virtual void Execute(DrawerThread *thread) = 0;
|
virtual void Execute(DrawerThread *thread) = 0;
|
||||||
virtual FString DebugInfo() = 0;
|
virtual FString DebugInfo() = 0;
|
||||||
|
|
|
@ -133,6 +133,8 @@ void DCanvas::DrawTexture (FTexture *img, double x, double y, int tags_first, ..
|
||||||
void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
|
void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
|
||||||
{
|
{
|
||||||
#ifndef NO_SWRENDER
|
#ifndef NO_SWRENDER
|
||||||
|
using namespace swrenderer;
|
||||||
|
|
||||||
static short bottomclipper[MAXWIDTH], topclipper[MAXWIDTH];
|
static short bottomclipper[MAXWIDTH], topclipper[MAXWIDTH];
|
||||||
const BYTE *translation = NULL;
|
const BYTE *translation = NULL;
|
||||||
|
|
||||||
|
@ -1026,7 +1028,7 @@ void DCanvas::PUTTRANSDOT (int xx, int yy, int basecolor, int level)
|
||||||
{
|
{
|
||||||
uint32_t *spot = (uint32_t*)GetBuffer() + oldyyshifted + xx;
|
uint32_t *spot = (uint32_t*)GetBuffer() + oldyyshifted + xx;
|
||||||
|
|
||||||
uint32_t fg = LightBgra::shade_pal_index_simple(basecolor, LightBgra::calc_light_multiplier(0));
|
uint32_t fg = swrenderer::LightBgra::shade_pal_index_simple(basecolor, swrenderer::LightBgra::calc_light_multiplier(0));
|
||||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||||
uint32_t fg_blue = fg & 0xff;
|
uint32_t fg_blue = fg & 0xff;
|
||||||
|
@ -1359,6 +1361,8 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
||||||
FDynamicColormap *colormap, int lightlevel, int bottomclip)
|
FDynamicColormap *colormap, int lightlevel, int bottomclip)
|
||||||
{
|
{
|
||||||
#ifndef NO_SWRENDER
|
#ifndef NO_SWRENDER
|
||||||
|
using namespace swrenderer;
|
||||||
|
|
||||||
// Use an equation similar to player sprites to determine shade
|
// Use an equation similar to player sprites to determine shade
|
||||||
fixed_t shade = LIGHT2SHADE(lightlevel) - 12*FRACUNIT;
|
fixed_t shade = LIGHT2SHADE(lightlevel) - 12*FRACUNIT;
|
||||||
float topy, boty, leftx, rightx;
|
float topy, boty, leftx, rightx;
|
||||||
|
|
|
@ -1405,17 +1405,16 @@ void D3DFB::Draw3DPart(bool copy3d)
|
||||||
D3DCOLOR color0, color1;
|
D3DCOLOR color0, color1;
|
||||||
if (Accel2D)
|
if (Accel2D)
|
||||||
{
|
{
|
||||||
if (realfixedcolormap == NULL)
|
auto &map = swrenderer::realfixedcolormap;
|
||||||
|
if (map == NULL)
|
||||||
{
|
{
|
||||||
color0 = 0;
|
color0 = 0;
|
||||||
color1 = 0xFFFFFFF;
|
color1 = 0xFFFFFFF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
color0 = D3DCOLOR_COLORVALUE(realfixedcolormap->ColorizeStart[0]/2,
|
color0 = D3DCOLOR_COLORVALUE(map->ColorizeStart[0]/2, map->ColorizeStart[1]/2, map->ColorizeStart[2]/2, 0);
|
||||||
realfixedcolormap->ColorizeStart[1]/2, realfixedcolormap->ColorizeStart[2]/2, 0);
|
color1 = D3DCOLOR_COLORVALUE(map->ColorizeEnd[0]/2, map->ColorizeEnd[1]/2, map->ColorizeEnd[2]/2, 1);
|
||||||
color1 = D3DCOLOR_COLORVALUE(realfixedcolormap->ColorizeEnd[0]/2,
|
|
||||||
realfixedcolormap->ColorizeEnd[1]/2, realfixedcolormap->ColorizeEnd[2]/2, 1);
|
|
||||||
if (IsBgra())
|
if (IsBgra())
|
||||||
SetPixelShader(Shaders[SHADER_SpecialColormap]);
|
SetPixelShader(Shaders[SHADER_SpecialColormap]);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue