mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-01-18 14:31:52 +00:00
Made D3D compile, check this and rearrange however you like. Removed "gammaworks", copied GL_RoundDimensions and modded it for D3D (ugly, fix this), removed GetPalette and D_FlushCaches from vid_d3d9.c since it's already declared in vid_d3d.c, inserted vid_gamma (and I have no idea what this is good for, it seems it could just as well be a #define).
Happy time! git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2597 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
11588468c7
commit
71076ab1ca
7 changed files with 75 additions and 23 deletions
|
@ -65,6 +65,10 @@ cvar_t r_aliastransadj = SCVAR("r_aliastransadj", "100");
|
|||
cvar_t d_smooth = SCVAR("d_smooth", "0");
|
||||
cvar_t sw_surfcachesize = SCVARF("sw_surfcachesize", "0", CVAR_RENDERERLATCH);
|
||||
#endif
|
||||
#if defined(RGLQUAKE) || defined(D3DQUAKE)
|
||||
cvar_t gl_contrast = SCVAR("gl_contrast", "1");
|
||||
cvar_t gl_polyblend = SCVAR("gl_polyblend","1");
|
||||
#endif
|
||||
cvar_t gl_skyboxdist = SCVAR("gl_skyboxdist", "2300");
|
||||
|
||||
cvar_t r_vertexdlights = SCVAR("r_vertexdlights", "1");
|
||||
|
|
|
@ -311,7 +311,7 @@ qbyte gammatable[256]; // palette is sent through this
|
|||
|
||||
|
||||
unsigned short ramps[3][256];
|
||||
extern qboolean gammaworks;
|
||||
//extern qboolean gammaworks;
|
||||
float v_blend[4]; // rgba 0.0 - 1.0
|
||||
/*
|
||||
void BuildGammaTable (float g)
|
||||
|
@ -614,8 +614,9 @@ V_CalcBlend
|
|||
|
||||
void GLV_CalcBlendServer (float colors[4])
|
||||
{
|
||||
extern qboolean gammaworks;
|
||||
if (gammaworks || !v_blend[3])
|
||||
// extern qboolean gammaworks;
|
||||
// if (gammaworks || !v_blend[3])
|
||||
if (!v_blend[3])
|
||||
{ //regular cshifts work through hardware gamma
|
||||
//server sent cshifts do not.
|
||||
colors[0] = cl.cshifts[CSHIFT_SERVER].destcolor[0]/255.0f;
|
||||
|
@ -688,7 +689,7 @@ V_UpdatePalette
|
|||
*/
|
||||
void GLV_UpdatePalette (qboolean force)
|
||||
{
|
||||
qboolean ogw;
|
||||
// qboolean ogw;
|
||||
int i, j;
|
||||
qboolean update;
|
||||
// qbyte *basepal, *newpal;
|
||||
|
@ -754,12 +755,12 @@ void GLV_UpdatePalette (qboolean force)
|
|||
ramps[2][i] = gammatable[ib]<<8;
|
||||
}
|
||||
|
||||
ogw = gammaworks;
|
||||
VID_ShiftPalette (NULL);
|
||||
if (ogw != gammaworks)
|
||||
{
|
||||
Con_DPrintf("Gamma working state %i\n", gammaworks);
|
||||
}
|
||||
// ogw = gammaworks;
|
||||
// VID_ShiftPalette (NULL);
|
||||
// if (ogw != gammaworks)
|
||||
// {
|
||||
// Con_DPrintf("Gamma working state %i\n", gammaworks);
|
||||
// }
|
||||
}
|
||||
|
||||
RSpeedEnd(RSPEED_PALETTEFLASHES);
|
||||
|
|
|
@ -883,9 +883,10 @@ void D3D_DrawWorld(void)
|
|||
|
||||
currententity = &ent;
|
||||
#ifdef TERRAIN
|
||||
if (currentmodel->type == mod_heightmap)
|
||||
GL_DrawHeightmapModel(currententity);
|
||||
else
|
||||
// FIXME: Dunno what needs to be fixed here?
|
||||
// if (currentmodel->type == mod_heightmap)
|
||||
// D3D_DrawHeightmapModel(currententity);
|
||||
// else
|
||||
#endif
|
||||
{
|
||||
// qglColor3f (1,1,1);
|
||||
|
|
|
@ -11,6 +11,9 @@ void *d3dballtexture;
|
|||
LPDIRECT3DBASETEXTURE9 d3d9chars_tex;
|
||||
mpic_t *conback_tex;
|
||||
|
||||
extern cvar_t gl_picmip;
|
||||
extern cvar_t gl_picmip2d;
|
||||
|
||||
typedef struct d3dcachepic_s
|
||||
{
|
||||
char name[MAX_QPATH];
|
||||
|
@ -101,6 +104,49 @@ static void Upload_Texture_32(LPDIRECT3DTEXTURE9 surf, unsigned int *data, int w
|
|||
IDirect3DTexture9_UnlockRect(surf, 0);
|
||||
}
|
||||
|
||||
void D3D9_RoundDimensions(int *scaled_width, int *scaled_height, qboolean mipmap)
|
||||
{
|
||||
// if (gl_config.arb_texture_non_power_of_two) //NPOT is a simple extension that relaxes errors.
|
||||
// {
|
||||
// TRACE(("dbg: GL_RoundDimensions: GL_ARB_texture_non_power_of_two\n"));
|
||||
// }
|
||||
// else
|
||||
{
|
||||
int width = *scaled_width;
|
||||
int height = *scaled_height;
|
||||
for (*scaled_width = 1 ; *scaled_width < width ; *scaled_width<<=1)
|
||||
;
|
||||
for (*scaled_height = 1 ; *scaled_height < height ; *scaled_height<<=1)
|
||||
;
|
||||
}
|
||||
|
||||
if (mipmap)
|
||||
{
|
||||
TRACE(("dbg: GL_RoundDimensions: %f\n", gl_picmip.value));
|
||||
*scaled_width >>= (int)gl_picmip.value;
|
||||
*scaled_height >>= (int)gl_picmip.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
*scaled_width >>= (int)gl_picmip2d.value;
|
||||
*scaled_height >>= (int)gl_picmip2d.value;
|
||||
}
|
||||
|
||||
TRACE(("dbg: GL_RoundDimensions: %f\n", gl_max_size.value));
|
||||
if (gl_max_size.value)
|
||||
{
|
||||
if (*scaled_width > gl_max_size.value)
|
||||
*scaled_width = gl_max_size.value;
|
||||
if (*scaled_height > gl_max_size.value)
|
||||
*scaled_height = gl_max_size.value;
|
||||
}
|
||||
|
||||
if (*scaled_width < 1)
|
||||
*scaled_width = 1;
|
||||
if (*scaled_height < 1)
|
||||
*scaled_height = 1;
|
||||
}
|
||||
|
||||
void D3D9_MipMap (qbyte *out, qbyte *in, int width, int height)
|
||||
{
|
||||
int i, j;
|
||||
|
@ -135,7 +181,7 @@ LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_32(char *name, unsigned int *data, int w
|
|||
|
||||
nwidth = width;
|
||||
nheight = height;
|
||||
GL_RoundDimensions(&nwidth, &nheight, flags & TF_MIPMAP);
|
||||
D3D9_RoundDimensions(&nwidth, &nheight, flags & TF_MIPMAP);
|
||||
|
||||
IDirect3DDevice9_CreateTexture(pD3DDev9, nwidth, nheight, 0, 0|((flags & TF_MIPMAP)?D3DUSAGE_AUTOGENMIPMAP:0), D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &newsurf, NULL);
|
||||
|
||||
|
|
|
@ -1296,9 +1296,10 @@ void D3D9_DrawWorld(void)
|
|||
|
||||
currententity = &ent;
|
||||
#ifdef TERRAIN
|
||||
if (currentmodel->type == mod_heightmap)
|
||||
GL_DrawHeightmapModel(currententity);
|
||||
else
|
||||
// FIXME: Dunno what needs to be fixed here?
|
||||
// if (currentmodel->type == mod_heightmap)
|
||||
// D3D9_DrawHeightmapModel(currententity);
|
||||
// else
|
||||
#endif
|
||||
{
|
||||
// qglColor3f (1,1,1);
|
||||
|
|
|
@ -75,7 +75,7 @@ qboolean r_cache_thrash; // set if thrashing the surface cache
|
|||
mpic_t *draw_disc; // also used on sbar
|
||||
|
||||
int d3d9width, d3d9height;
|
||||
|
||||
#if 0
|
||||
#if !defined(SWQUAKE) && !defined(RGLQUAKE)
|
||||
qbyte GetPalette(int red, int green, int blue)
|
||||
{
|
||||
|
@ -104,6 +104,7 @@ qbyte GetPalette(int red, int green, int blue)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void BuildGammaTable (float g, float c);
|
||||
void D3D9_VID_GenPaletteTables (unsigned char *palette)
|
||||
|
@ -175,13 +176,13 @@ void D3D9_VID_GenPaletteTables (unsigned char *palette)
|
|||
if (pD3DDev9)
|
||||
IDirect3DDevice9_SetGammaRamp(pD3DDev9, 0, D3DSGR_NO_CALIBRATION, ramps);
|
||||
}
|
||||
|
||||
#if 0
|
||||
#if !defined(SWQUAKE) && !defined(GLQUAKE)
|
||||
void D_FlushCaches (void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
|
@ -1067,7 +1068,7 @@ index_t d3d9quadindexes[6] = {
|
|||
};
|
||||
|
||||
extern cvar_t gl_contrast;
|
||||
extern float vid_gamma;
|
||||
float vid_gamma = 1.0;
|
||||
float f;
|
||||
unsigned int colour;
|
||||
|
||||
|
|
|
@ -111,12 +111,10 @@ cvar_t gl_clear = SCVAR("gl_clear","0");
|
|||
cvar_t gl_cull = SCVAR("gl_cull","1");
|
||||
cvar_t gl_smoothmodels = SCVAR("gl_smoothmodels","1");
|
||||
cvar_t gl_affinemodels = SCVAR("gl_affinemodels","0");
|
||||
cvar_t gl_polyblend = SCVAR("gl_polyblend","1");
|
||||
cvar_t gl_playermip = SCVAR("gl_playermip","0");
|
||||
cvar_t gl_keeptjunctions = SCVAR("gl_keeptjunctions","1");
|
||||
cvar_t gl_reporttjunctions = SCVAR("gl_reporttjunctions","0");
|
||||
cvar_t gl_finish = SCVAR("gl_finish","0");
|
||||
cvar_t gl_contrast = SCVAR("gl_contrast", "1");
|
||||
cvar_t gl_dither = SCVAR("gl_dither", "1");
|
||||
cvar_t gl_maxdist = SCVAR("gl_maxdist", "8192");
|
||||
extern cvar_t gl_mindist;
|
||||
|
|
Loading…
Reference in a new issue