- fixed some leftover references to the software renderer.

SVN r3264 (trunk)
This commit is contained in:
Christoph Oelckers 2011-07-07 19:53:42 +00:00
parent 5bfcaab25c
commit 4ef68ded5d
14 changed files with 154 additions and 171 deletions

View file

@ -165,7 +165,6 @@ extern bool demorecording;
extern bool M_DemoNoPlay; // [RH] if true, then skip any demos in the loop
extern bool insave;
extern cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
// PUBLIC DATA DEFINITIONS -------------------------------------------------
@ -2469,97 +2468,3 @@ void FStartupScreen::NetMessage(char const *,...) {}
void FStartupScreen::NetDone(void) {}
bool FStartupScreen::NetLoop(bool (*)(void *),void *) { return false; }
//==========================================================================
//
// STAT fps
//
// Displays statistics about rendering times
//
//==========================================================================
//==========================================================================
//
// STAT fps
//
// Displays statistics about rendering times
//
//==========================================================================
ADD_STAT (fps)
{
FString out;
out.Format("frame=%04.1f ms walls=%04.1f ms planes=%04.1f ms masked=%04.1f ms",
FrameCycles.TimeMS(), WallCycles.TimeMS(), PlaneCycles.TimeMS(), MaskedCycles.TimeMS());
return out;
}
static double f_acc, w_acc,p_acc,m_acc;
static int acc_c;
ADD_STAT (fps_accumulated)
{
f_acc += FrameCycles.TimeMS();
w_acc += WallCycles.TimeMS();
p_acc += PlaneCycles.TimeMS();
m_acc += MaskedCycles.TimeMS();
acc_c++;
FString out;
out.Format("frame=%04.1f ms walls=%04.1f ms planes=%04.1f ms masked=%04.1f ms %d counts",
f_acc/acc_c, w_acc/acc_c, p_acc/acc_c, m_acc/acc_c, acc_c);
Printf(PRINT_LOG, "%s\n", out.GetChars());
return out;
}
//==========================================================================
//
// STAT wallcycles
//
// Displays the minimum number of cycles spent drawing walls
//
//==========================================================================
static double bestwallcycles = HUGE_VAL;
ADD_STAT (wallcycles)
{
FString out;
double cycles = WallCycles.Time();
if (cycles && cycles < bestwallcycles)
bestwallcycles = cycles;
out.Format ("%g", bestwallcycles);
return out;
}
//==========================================================================
//
// CCMD clearwallcycles
//
// Resets the count of minimum wall drawing cycles
//
//==========================================================================
CCMD (clearwallcycles)
{
bestwallcycles = HUGE_VAL;
}
#if 1
// To use these, also uncomment the clock/unclock in wallscan
static double bestscancycles = HUGE_VAL;
ADD_STAT (scancycles)
{
FString out;
double scancycles = WallScanCycles.Time();
if (scancycles && scancycles < bestscancycles)
bestscancycles = scancycles;
out.Format ("%g", bestscancycles);
return out;
}
CCMD (clearscancycles)
{
bestscancycles = HUGE_VAL;
}
#endif

View file

@ -1540,7 +1540,6 @@ static void SendSetup (DWORD playersdetected[MAXNETNODES], BYTE gotsetup[MAXNETN
// D_CheckNetGame
// Works out player numbers among the net participants
//
extern int viewangleoffset;
void D_CheckNetGame (void)
{

View file

@ -124,10 +124,6 @@ extern "C" int halfviewwidth; // [RH] Half view width, for plane drawing
// This one is related to the 3-screen display mode.
// ANG90 = left side, ANG270 = right
extern int viewangleoffset;
// Player taking events. i.e. The local player.
extern int consoleplayer;

View file

@ -4004,7 +4004,7 @@ void P_Init ()
static void P_Shutdown ()
{
R_DeinitSprites ();
R_DeinitSpriteData ();
P_DeinitKeyMessages ();
P_FreeLevelData ();
P_FreeExtraLevelData ();

View file

@ -65,6 +65,6 @@ extern BYTE OtherGameSkinRemap[256];
extern PalEntry OtherGameSkinPalette[256];
void R_InitSprites ();
void R_DeinitSprites ();
void R_DeinitSpriteData ();
#endif

View file

@ -35,6 +35,7 @@ struct FVoxel
{
int LumpNum;
int NumMips;
int VoxelIndex; // Needed by GZDoom
BYTE *Palette;
FVoxelMipLevel Mips[MAXVOXMIPS];
@ -48,6 +49,7 @@ struct FVoxelDef
FVoxel *Voxel;
int PlacedSpin; // degrees/sec to spin actors without MF_DROPPED set
int DroppedSpin; // degrees/sec to spin actors with MF_DROPPED set
int VoxeldefIndex; // Needed by GZDoom
fixed_t Scale;
angle_t AngleOffset; // added to actor's angle to compensate for wrong-facing voxels
};

View file

@ -61,15 +61,11 @@ extern int ST_Y;
BYTE* viewimage;
extern "C" {
int viewwidth;
int halfviewwidth;
int viewheight;
int ylookup[MAXHEIGHT];
BYTE *dc_destorg;
}
int scaledviewwidth;
int viewwindowx;
int viewwindowy;
// [RH] Pointers to the different column drawers.
// These get changed depending on the current

View file

@ -75,6 +75,7 @@
void R_SpanInitData ();
void RP_RenderBSPNode (void *node);
bool RP_SetupFrame (bool backside);
void R_DeinitSprites();
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
@ -114,12 +115,9 @@ fixed_t r_SkyVisibility;
fixed_t GlobVis;
fixed_t viewingrangerecip;
fixed_t FocalTangent;
fixed_t FocalLengthX;
fixed_t FocalLengthY;
float FocalLengthXfloat;
int viewangleoffset;
int validcount = 1; // increment every time a check is made
FDynamicColormap*basecolormap; // [RH] colormap currently drawing with
int fixedlightlev;
lighttable_t *fixedcolormap;
@ -127,12 +125,6 @@ FSpecialColormap *realfixedcolormap;
float WallTMapScale;
float WallTMapScale2;
extern "C" {
int centerx;
int centery;
int centerxwide;
}
bool bRenderingToCanvas; // [RH] True if rendering to a special canvas
fixed_t globaluclip, globaldclip;
@ -147,12 +139,10 @@ fixed_t InvZtoScale;
int linecount;
int loopcount;
int r_Yaspect = 200; // Why did I make this a variable? It's never set anywhere.
//
// precalculated math tables
//
int FieldOfView = 2048; // Fineangles in the SCREENWIDTH wide window
// The xtoviewangleangle[] table maps a screen pixel
// to the lowest viewangle that maps back to x ranges
@ -162,9 +152,6 @@ angle_t xtoviewangle[MAXWIDTH+1];
bool foggy; // [RH] ignore extralight and fullbright?
int r_actualextralight;
bool setsizeneeded;
void (*colfunc) (void);
void (*basecolfunc) (void);
void (*fuzzcolfunc) (void);
@ -178,8 +165,6 @@ void (STACK_ARGS *hcolfunc_post4) (int sx, int yl, int yh);
cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
FCanvasTextureInfo *FCanvasTextureInfo::List;
// PRIVATE DATA DEFINITIONS ------------------------------------------------
static int lastcenteryfrac;
@ -221,29 +206,10 @@ static inline int viewangletox(int i)
void R_InitTextureMapping ()
{
int i, x;
int fov = FieldOfView;
// For widescreen displays, increase the FOV so that the middle part of the
// screen that would be visible on a 4:3 display has the requested FOV.
if (centerxwide != centerx)
{ // centerxwide is what centerx would be if the display was not widescreen
fov = int(atan(double(centerx)*tan(double(fov)*M_PI/(FINEANGLES))/double(centerxwide))*(FINEANGLES)/M_PI);
if (fov > 170*FINEANGLES/360)
fov = 170*FINEANGLES/360;
}
/*
default: break;
case 1: fov = MIN (fov * 512/433, 170 * FINEANGLES / 360); break; // 16:9
case 2: fov = MIN (fov * 512/459, 170 * FINEANGLES / 360); break; // 16:10
}
*/
const int hitan = finetangent[FINEANGLES/4+fov/2];
// Calc focallength so FieldOfView fineangles covers viewwidth.
FocalTangent = hitan;
FocalLengthX = FixedDiv (centerxfrac, hitan);
FocalLengthY = Scale (centerxfrac, yaspectmul, hitan);
FocalLengthX = FixedDiv (centerxfrac, FocalTangent);
FocalLengthY = Scale (centerxfrac, yaspectmul, FocalTangent);
FocalLengthXfloat = (float)FocalLengthX / 65536.f;
// This is 1/FocalTangent before the widescreen extension of FOV.
@ -396,8 +362,6 @@ void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight,
halfviewwidth = (viewwidth >> 1) - 1;
lastcenteryfrac = 1<<30;
centery = viewheight/2;
centerx = viewwidth/2;
centerxfrac = centerx<<FRACBITS;
centeryfrac = centery<<FRACBITS;
@ -416,12 +380,10 @@ void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight,
if (WidescreenRatio & 4)
{
virtheight = virtheight * BaseRatioSizes[WidescreenRatio][3] / 48;
centerxwide = centerx;
}
else
{
virtwidth = virtwidth * BaseRatioSizes[WidescreenRatio][3] / 48;
centerxwide = centerx * BaseRatioSizes[WidescreenRatio][3] / 48;
}
baseyaspectmul = Scale(320 << FRACBITS, virtheight2, r_Yaspect * virtwidth2);
@ -506,6 +468,7 @@ void R_InitRenderer()
static void R_ShutdownRenderer()
{
R_DeinitSprites();
R_DeinitPlanes();
// Free openings
if (openings != NULL)
@ -954,3 +917,92 @@ void R_MultiresInit ()
R_PlaneInitData ();
}
//==========================================================================
//
// STAT fps
//
// Displays statistics about rendering times
//
//==========================================================================
extern cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
extern cycle_t FrameCycles;
ADD_STAT (fps)
{
FString out;
out.Format("frame=%04.1f ms walls=%04.1f ms planes=%04.1f ms masked=%04.1f ms",
FrameCycles.TimeMS(), WallCycles.TimeMS(), PlaneCycles.TimeMS(), MaskedCycles.TimeMS());
return out;
}
static double f_acc, w_acc,p_acc,m_acc;
static int acc_c;
ADD_STAT (fps_accumulated)
{
f_acc += FrameCycles.TimeMS();
w_acc += WallCycles.TimeMS();
p_acc += PlaneCycles.TimeMS();
m_acc += MaskedCycles.TimeMS();
acc_c++;
FString out;
out.Format("frame=%04.1f ms walls=%04.1f ms planes=%04.1f ms masked=%04.1f ms %d counts",
f_acc/acc_c, w_acc/acc_c, p_acc/acc_c, m_acc/acc_c, acc_c);
Printf(PRINT_LOG, "%s\n", out.GetChars());
return out;
}
//==========================================================================
//
// STAT wallcycles
//
// Displays the minimum number of cycles spent drawing walls
//
//==========================================================================
static double bestwallcycles = HUGE_VAL;
ADD_STAT (wallcycles)
{
FString out;
double cycles = WallCycles.Time();
if (cycles && cycles < bestwallcycles)
bestwallcycles = cycles;
out.Format ("%g", bestwallcycles);
return out;
}
//==========================================================================
//
// CCMD clearwallcycles
//
// Resets the count of minimum wall drawing cycles
//
//==========================================================================
CCMD (clearwallcycles)
{
bestwallcycles = HUGE_VAL;
}
#if 1
// To use these, also uncomment the clock/unclock in wallscan
static double bestscancycles = HUGE_VAL;
ADD_STAT (scancycles)
{
FString out;
double scancycles = WallScanCycles.Time();
if (scancycles && scancycles < bestscancycles)
bestscancycles = scancycles;
out.Format ("%g", bestscancycles);
return out;
}
CCMD (clearscancycles)
{
bestscancycles = HUGE_VAL;
}
#endif

View file

@ -45,16 +45,9 @@ extern fixed_t InvZtoScale;
extern float WallTMapScale;
extern float WallTMapScale2;
extern "C" int viewwidth;
extern "C" int viewheight;
extern int viewwindowx;
extern int viewwindowy;
extern "C" int centerx, centerxwide;
extern "C" int centery;
extern fixed_t centerxfrac;
extern fixed_t centeryfrac;
extern fixed_t yaspectmul;
@ -65,8 +58,6 @@ extern FDynamicColormap*basecolormap; // [RH] Colormap for sector currently bein
extern int linecount;
extern int loopcount;
extern int r_Yaspect;
extern bool r_dontmaplines;
//
@ -132,7 +123,6 @@ extern void (STACK_ARGS *hcolfunc_post4) (int sx, int yl, int yh);
void R_InitTextureMapping ();
void R_SetViewAngle ();
//
// REFRESH - the actual rendering functions.

View file

@ -31,7 +31,7 @@
#include "c_cvars.h"
#include "g_level.h"
#include "r_sky.h"
#include "r_main.h"
#include "r_utility.h"
#include "v_text.h"
#include "gi.h"

View file

@ -85,8 +85,6 @@ struct FCoverageBuffer
unsigned int NumLists;
};
void R_DeinitSpriteData();
extern fixed_t globaluclip, globaldclip;
@ -120,9 +118,8 @@ static int spriteshade;
short zeroarray[MAXWIDTH];
short screenheightarray[MAXWIDTH];
CVAR (Bool, r_drawplayersprites, true, 0) // [RH] Draw player sprites?
CVAR (Bool, r_drawvoxels, true, 0)
EXTERN_CVAR (Bool, r_drawplayersprites)
EXTERN_CVAR (Bool, r_drawvoxels)
//
// INITIALIZATION FUNCTIONS
@ -149,8 +146,6 @@ static int vsprcount;
void R_DeinitSprites()
{
R_DeinitSpriteData();
// Free vissprites
for (int i = 0; i < MaxVisSprites; ++i)
{
@ -1982,12 +1977,8 @@ void R_DrawMasked (void)
R_3D_DeleteHeights();
fake3D = 0;
}
// draw the psprites on top of everything but does not draw on side views
if (!viewangleoffset)
{
R_DrawPlayerSprites ();
}
}
void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade, int fakeside)

View file

@ -84,13 +84,28 @@ static bool NoInterpolateView;
CVAR (Bool, r_deathcamera, false, CVAR_ARCHIVE)
CVAR (Int, r_clearbuffer, 0, 0)
CVAR (Bool, r_drawvoxels, true, 0)
CVAR (Bool, r_drawplayersprites, true, 0) // [RH] Draw player sprites?
DCanvas *RenderTarget; // [RH] canvas to render to
int viewwindowx;
int viewwindowy;
fixed_t viewx;
fixed_t viewy;
fixed_t viewz;
int viewpitch;
extern "C"
{
int viewwidth;
int viewheight;
int centerx;
int centery;
int centerxwide;
}
int otic;
angle_t viewangle;
@ -114,8 +129,14 @@ float LastFOV;
int WidescreenRatio;
int setblocks;
int extralight;
bool setsizeneeded;
fixed_t FocalTangent;
unsigned int R_OldBlend = ~0;
int validcount = 1; // increment every time a check is made
int FieldOfView = 2048; // Fineangles in the SCREENWIDTH wide window
FCanvasTextureInfo *FCanvasTextureInfo::List;
// CODE --------------------------------------------------------------------
@ -402,6 +423,31 @@ void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight)
// [RH] Sky height fix for screens not 200 (or 240) pixels tall
R_InitSkyMap ();
centery = viewheight/2;
centerx = viewwidth/2;
if (WidescreenRatio & 4)
{
centerxwide = centerx;
}
else
{
centerxwide = centerx * BaseRatioSizes[WidescreenRatio][3] / 48;
}
int fov = FieldOfView;
// For widescreen displays, increase the FOV so that the middle part of the
// screen that would be visible on a 4:3 display has the requested FOV.
if (centerxwide != centerx)
{ // centerxwide is what centerx would be if the display was not widescreen
fov = int(atan(double(centerx)*tan(double(fov)*M_PI/(FINEANGLES))/double(centerxwide))*(FINEANGLES)/M_PI);
if (fov > 170*FINEANGLES/360)
fov = 170*FINEANGLES/360;
}
FocalTangent = finetangent[FINEANGLES/4+fov/2];
Renderer->SetWindow(windowSize, fullWidth, fullHeight, stHeight, trueratio);
}
@ -749,7 +795,7 @@ void R_SetupFrame (AActor *actor)
player = camera->player;
}
iview->nviewangle = camera->angle + viewangleoffset;
iview->nviewangle = camera->angle;
if (iview->otic == -1 || r_NoInterpolate)
{
R_ResetViewInterpolation ();

View file

@ -16,6 +16,9 @@ extern fixed_t viewy;
extern fixed_t viewz;
extern int viewpitch;
extern "C" int centerx, centerxwide;
extern "C" int centery;
extern int setblocks;
extern fixed_t viewtancos;
@ -35,6 +38,7 @@ extern DWORD r_FrameTime;
extern int extralight;
extern unsigned int R_OldBlend;
const int r_Yaspect = 200; // Why did I make this a variable? It's never set anywhere.
//==========================================================================
//
@ -61,6 +65,7 @@ void R_SetViewSize (int blocks);
void R_SetFOV (float fov);
float R_GetFOV ();
void R_SetupFrame (AActor * camera);
void R_SetViewAngle ();
// Called by startup code.
void R_Init (void);

View file

@ -41,6 +41,7 @@
#include "v_video.h"
#include "m_swap.h"
#include "r_defs.h"
#include "r_utility.h"
#ifndef NO_SWRENDER
#include "r_draw.h"
#include "r_main.h"