Hard an brutal reformatting to make it easier to see my changes
This commit is contained in:
@@ -46,13 +46,15 @@ void sound_deinit(void);
|
||||
|
||||
extern int samplingrate; // from snd_dma
|
||||
|
||||
void S_XMP_StartSong ( void ){
|
||||
void S_XMP_StartSong ( void )
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void S_XMP_EndSong ( void ){
|
||||
void S_XMP_EndSong ( void )
|
||||
{
|
||||
|
||||
|
||||
|
||||
@@ -84,8 +86,9 @@ snd_stream_t *S_XMP_CodecOpenStream(const char *filename)
|
||||
|
||||
// Open
|
||||
snd_stream_t *rv = S_CodecUtilOpen(filename, &xmp_codec);
|
||||
if(!rv)
|
||||
if(!rv) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Com_Printf("OPENSTREAM %s\n", filename);
|
||||
|
||||
@@ -94,8 +97,7 @@ snd_stream_t *S_XMP_CodecOpenStream(const char *filename)
|
||||
|
||||
// Try to open the file
|
||||
FS_FOpenFileRead(filename, &file, qtrue);
|
||||
if(!file)
|
||||
{
|
||||
if(!file) {
|
||||
Com_Printf( S_COLOR_RED "ERROR: No.\"%s\"\n",filename);
|
||||
return NULL;
|
||||
}
|
||||
@@ -106,8 +108,7 @@ snd_stream_t *S_XMP_CodecOpenStream(const char *filename)
|
||||
|
||||
|
||||
void *buffer = Hunk_AllocateTempMemory(thelength);
|
||||
if(!buffer)
|
||||
{
|
||||
if(!buffer) {
|
||||
FS_FCloseFile(file);
|
||||
Com_Printf( S_COLOR_RED "ERROR: Out of memory reading \"%s\"\n", filename);
|
||||
return NULL;
|
||||
@@ -178,13 +179,11 @@ int S_XMP_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer)
|
||||
struct xmp_frame_info fi;
|
||||
|
||||
// check if input is valid
|
||||
if(!(stream && buffer))
|
||||
{
|
||||
if(!(stream && buffer)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(bytes <= 0)
|
||||
{
|
||||
if(bytes <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -193,8 +192,7 @@ int S_XMP_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer)
|
||||
char* bufPtr = buffer;
|
||||
|
||||
// cycle until we have the requested or all available bytes read
|
||||
while(-1)
|
||||
{
|
||||
while(-1) {
|
||||
int yeah=xmp_play_buffer(xmpsong, buffer, bytesLeft, 0);
|
||||
|
||||
if (yeah == 0) { // if we can play it...
|
||||
@@ -203,8 +201,7 @@ int S_XMP_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer)
|
||||
int c = fi.buffer_size;
|
||||
|
||||
// no more bytes are left
|
||||
if(c <= 0)
|
||||
{
|
||||
if(c <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -214,15 +211,12 @@ int S_XMP_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer)
|
||||
xmp_get_module_info(xmpsong, &mi);
|
||||
|
||||
// we have enough bytes
|
||||
if(bytesLeft <= 0)
|
||||
{
|
||||
if(bytesLeft <= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // if we can't play it JUST STOP OK
|
||||
{
|
||||
else { // if we can't play it JUST STOP OK
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,8 +224,7 @@ int S_XMP_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer)
|
||||
}
|
||||
|
||||
|
||||
snd_codec_t xmp_codec =
|
||||
{
|
||||
snd_codec_t xmp_codec = {
|
||||
"umx",
|
||||
S_XMP_CodecLoad,
|
||||
S_XMP_CodecOpenStream,
|
||||
@@ -240,8 +233,7 @@ snd_codec_t xmp_codec =
|
||||
NULL
|
||||
};
|
||||
|
||||
snd_codec_t xmp_mod_codec =
|
||||
{
|
||||
snd_codec_t xmp_mod_codec = {
|
||||
"mod",
|
||||
S_XMP_CodecLoad,
|
||||
S_XMP_CodecOpenStream,
|
||||
@@ -250,8 +242,7 @@ snd_codec_t xmp_mod_codec =
|
||||
NULL
|
||||
};
|
||||
|
||||
snd_codec_t xmp_it_codec =
|
||||
{
|
||||
snd_codec_t xmp_it_codec = {
|
||||
"it",
|
||||
S_XMP_CodecLoad,
|
||||
S_XMP_CodecOpenStream,
|
||||
@@ -260,8 +251,7 @@ snd_codec_t xmp_it_codec =
|
||||
NULL
|
||||
};
|
||||
|
||||
snd_codec_t xmp_s3m_codec =
|
||||
{
|
||||
snd_codec_t xmp_s3m_codec = {
|
||||
"s3m",
|
||||
S_XMP_CodecLoad,
|
||||
S_XMP_CodecOpenStream,
|
||||
@@ -270,8 +260,7 @@ snd_codec_t xmp_s3m_codec =
|
||||
NULL
|
||||
};
|
||||
|
||||
snd_codec_t xmp_xm_codec =
|
||||
{
|
||||
snd_codec_t xmp_xm_codec = {
|
||||
"xm",
|
||||
S_XMP_CodecLoad,
|
||||
S_XMP_CodecOpenStream,
|
||||
|
@@ -156,8 +156,7 @@ extern int vresHeight;
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
static float Diamond8x[8][8] =
|
||||
{
|
||||
static float Diamond8x[8][8] = {
|
||||
{ 0.0f, 0.0f, 0.0f, 0.1f, 0.1f, 0.0f, 0.0f, 0.0f, },
|
||||
{ 0.0f, 0.0f, 0.2f, 0.3f, 0.3f, 0.2f, 0.0f, 0.0f, },
|
||||
{ 0.0f, 0.2f, 0.4f, 0.6f, 0.6f, 0.4f, 0.2f, 0.0f, },
|
||||
@@ -169,8 +168,7 @@ static float Diamond8x[8][8] =
|
||||
};
|
||||
|
||||
|
||||
static float Star8x[8][8] =
|
||||
{
|
||||
static float Star8x[8][8] = {
|
||||
{ 0.4f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.1f, 0.4f, },
|
||||
{ 0.1f, 0.6f, 0.2f, 0.0f, 0.0f, 0.2f, 0.6f, 0.1f, },
|
||||
{ 0.0f, 0.2f, 0.7f, 0.6f, 0.6f, 0.7f, 0.2f, 0.0f, },
|
||||
@@ -182,8 +180,7 @@ static float Star8x[8][8] =
|
||||
};
|
||||
|
||||
|
||||
static float Diamond6x[6][6] =
|
||||
{
|
||||
static float Diamond6x[6][6] = {
|
||||
{ 0.0f, 0.0f, 0.1f, 0.1f, 0.0f, 0.0f, },
|
||||
{ 0.0f, 0.3f, 0.5f, 0.5f, 0.3f, 0.0f, },
|
||||
{ 0.1f, 0.5f, 0.9f, 0.9f, 0.5f, 0.1f, },
|
||||
@@ -192,8 +189,7 @@ static float Diamond6x[6][6] =
|
||||
{ 0.0f, 0.0f, 0.1f, 0.1f, 0.0f, 0.0f }
|
||||
};
|
||||
|
||||
static float Diamond4x[4][4] =
|
||||
{
|
||||
static float Diamond4x[4][4] = {
|
||||
{ 0.3f, 0.4f, 0.4f, 0.3f, },
|
||||
{ 0.4f, 0.9f, 0.9f, 0.4f, },
|
||||
{ 0.4f, 0.9f, 0.9f, 0.4f, },
|
||||
@@ -224,7 +220,8 @@ static struct {
|
||||
|
||||
|
||||
|
||||
static void ID_INLINE R_Bloom_Quad( int width, int height, float texX, float texY, float texWidth, float texHeight ) {
|
||||
static void ID_INLINE R_Bloom_Quad( int width, int height, float texX, float texY, float texWidth, float texHeight )
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
x = 0;
|
||||
@@ -254,7 +251,8 @@ static void ID_INLINE R_Bloom_Quad( int width, int height, float texX, float tex
|
||||
// LEILEI - Bloom Reflection
|
||||
|
||||
|
||||
static void ID_INLINE R_Bloom_Quad_Lens(float offsert, int width, int height, float texX, float texY, float texWidth, float texHeight) {
|
||||
static void ID_INLINE R_Bloom_Quad_Lens(float offsert, int width, int height, float texX, float texY, float texWidth, float texHeight)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
x = 0;
|
||||
@@ -433,7 +431,8 @@ static void R_Bloom_LensEffect( void )
|
||||
=================
|
||||
Tcpp: sorry for my poor English skill.
|
||||
*/
|
||||
static void R_Bloom_Cascaded( void ){
|
||||
static void R_Bloom_Cascaded( void )
|
||||
{
|
||||
int scale;
|
||||
int oldWorkW, oldWorkH;
|
||||
int newWorkW, newWorkH;
|
||||
@@ -495,7 +494,8 @@ static void R_Bloom_Cascaded( void ){
|
||||
R_Bloom_Quad( newWorkW, newWorkH,
|
||||
0, 0,
|
||||
bloom.effect.readW*oldScaleInv, bloom.effect.readH*oldScaleInv );
|
||||
}else{
|
||||
}
|
||||
else {
|
||||
// blur.
|
||||
qglColor4f( .25f, .25f, .25f, 1.0 );
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO );
|
||||
@@ -575,10 +575,12 @@ static void R_Bloom_WarsowEffect( void )
|
||||
if( r_bloom_diamond_size->integer > 7 || r_bloom_diamond_size->integer <= 3 ) {
|
||||
if( r_bloom_diamond_size->integer != 8 )
|
||||
ri.Cvar_Set( "r_bloom_diamond_size", "8" );
|
||||
} else if( r_bloom_diamond_size->integer > 5 ) {
|
||||
}
|
||||
else if( r_bloom_diamond_size->integer > 5 ) {
|
||||
if( r_bloom_diamond_size->integer != 6 )
|
||||
ri.Cvar_Set( "r_bloom_diamond_size", "6" );
|
||||
} else if( r_bloom_diamond_size->integer > 3 ) {
|
||||
}
|
||||
else if( r_bloom_diamond_size->integer > 3 ) {
|
||||
if( r_bloom_diamond_size->integer != 4 )
|
||||
ri.Cvar_Set( "r_bloom_diamond_size", "4" );
|
||||
}
|
||||
@@ -630,7 +632,8 @@ R_Bloom_BackupScreen
|
||||
Backup the full original screen to a texture for downscaling and later restoration
|
||||
=================
|
||||
*/
|
||||
static void R_Bloom_BackupScreen( void ) {
|
||||
static void R_Bloom_BackupScreen( void )
|
||||
{
|
||||
GL_Bind( bloom.screen.texture );
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
}
|
||||
@@ -641,7 +644,8 @@ R_Bloom_RestoreScreen
|
||||
Restore the temporary framebuffer section we used with the backup texture
|
||||
=================
|
||||
*/
|
||||
static void R_Bloom_RestoreScreen( void ) {
|
||||
static void R_Bloom_RestoreScreen( void )
|
||||
{
|
||||
float dry=r_bloom_dry->value;
|
||||
if(r_bloom_cascade->integer)
|
||||
dry=r_bloom_cascade_dry->value;
|
||||
@@ -652,7 +656,8 @@ static void R_Bloom_RestoreScreen( void ) {
|
||||
R_Bloom_Quad( bloom.screen.width, bloom.screen.height, 0, 0,
|
||||
1.f,
|
||||
1.f );
|
||||
}else{
|
||||
}
|
||||
else {
|
||||
R_Bloom_Quad( bloom.work.width, bloom.work.height, 0, 0,
|
||||
bloom.work.width / (float)bloom.screen.width,
|
||||
bloom.work.height / (float)bloom.screen.height );
|
||||
@@ -666,7 +671,8 @@ Restore the temporary framebuffer section we used with the backup texture
|
||||
*/
|
||||
extern int mpasses;
|
||||
|
||||
static void ID_INLINE R_Bloom_QuadTV( int width, int height, float texX, float texY, float texWidth, float texHeight, int aa ) {
|
||||
static void ID_INLINE R_Bloom_QuadTV( int width, int height, float texX, float texY, float texWidth, float texHeight, int aa )
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
float aspcenter = 0;
|
||||
@@ -684,11 +690,26 @@ static void ID_INLINE R_Bloom_QuadTV( int width, int height, float texX, float t
|
||||
|
||||
|
||||
|
||||
if (aa == 0){ xaa = 0; yaa = 0; }
|
||||
if (aa == 1){ xaa = -xpix; yaa = ypix; }
|
||||
if (aa == 2){ xaa = -xpix; yaa = -ypix; }
|
||||
if (aa == 3){ xaa = xpix; yaa = -ypix; }
|
||||
if (aa == 4){ xaa = xpix; yaa = ypix; }
|
||||
if (aa == 0) {
|
||||
xaa = 0;
|
||||
yaa = 0;
|
||||
}
|
||||
if (aa == 1) {
|
||||
xaa = -xpix;
|
||||
yaa = ypix;
|
||||
}
|
||||
if (aa == 2) {
|
||||
xaa = -xpix;
|
||||
yaa = -ypix;
|
||||
}
|
||||
if (aa == 3) {
|
||||
xaa = xpix;
|
||||
yaa = -ypix;
|
||||
}
|
||||
if (aa == 4) {
|
||||
xaa = xpix;
|
||||
yaa = ypix;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -706,13 +727,11 @@ static void ID_INLINE R_Bloom_QuadTV( int width, int height, float texX, float t
|
||||
// qglViewport (0, 0, tvWidth, tvHeight );
|
||||
// qglScissor (0, 0, tvWidth, tvHeight );
|
||||
qglBegin( GL_QUADS );
|
||||
if (r_tvFilter->integer) // bilinear filter
|
||||
{
|
||||
if (r_tvFilter->integer) { // bilinear filter
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||
}
|
||||
@@ -749,24 +768,67 @@ static void ID_INLINE R_Bloom_QuadTV( int width, int height, float texX, float t
|
||||
}
|
||||
|
||||
|
||||
static void R_Bloom_RestoreScreen_Postprocessed( void ) {
|
||||
static void R_Bloom_RestoreScreen_Postprocessed( void )
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
glslProgram_t *program = NULL;
|
||||
if (leifxmode) {
|
||||
if (leifxmode == 1){ if (vertexShaders) R_GLSL_UseProgram(tr.leiFXDitherProgram); program=tr.programs[tr.leiFXDitherProgram];}
|
||||
if (leifxmode == 2){ if (vertexShaders) R_GLSL_UseProgram(tr.leiFXGammaProgram); program=tr.programs[tr.leiFXGammaProgram];}
|
||||
if (leifxmode == 3){ if (vertexShaders) R_GLSL_UseProgram(tr.leiFXFilterProgram); program=tr.programs[tr.leiFXFilterProgram];}
|
||||
if (leifxmode == 888){ if (vertexShaders) R_GLSL_UseProgram(tr.animeProgram); program=tr.programs[tr.animeProgram];}
|
||||
if (leifxmode == 999){ if (vertexShaders) R_GLSL_UseProgram(tr.animeFilmProgram); program=tr.programs[tr.animeFilmProgram];}
|
||||
if (leifxmode == 777){ if (vertexShaders) R_GLSL_UseProgram(tr.motionBlurProgram); program=tr.programs[tr.motionBlurProgram];}
|
||||
if (leifxmode == 778){ if (vertexShaders) R_GLSL_UseProgram(tr.motionBlurProgram); program=tr.programs[tr.motionBlurProgram];}
|
||||
if (leifxmode == 779){ if (vertexShaders) R_GLSL_UseProgram(tr.motionBlurPostProgram); program=tr.programs[tr.motionBlurPostProgram];}
|
||||
if (leifxmode == 632){ if (vertexShaders) R_GLSL_UseProgram(tr.NTSCEncodeProgram); program=tr.programs[tr.NTSCEncodeProgram];}
|
||||
if (leifxmode == 633){ if (vertexShaders) R_GLSL_UseProgram(tr.NTSCDecodeProgram); program=tr.programs[tr.NTSCDecodeProgram];}
|
||||
if (leifxmode == 634){ if (vertexShaders) R_GLSL_UseProgram(tr.NTSCBleedProgram); program=tr.programs[tr.NTSCBleedProgram];}
|
||||
if (leifxmode == 666){ if (vertexShaders) R_GLSL_UseProgram(tr.BrightnessProgram); program=tr.programs[tr.BrightnessProgram];}
|
||||
if (leifxmode == 1236){ if (vertexShaders) R_GLSL_UseProgram(tr.CRTProgram); program=tr.programs[tr.CRTProgram];}
|
||||
if (leifxmode == 1997){ if (vertexShaders) R_GLSL_UseProgram(tr.paletteProgram); program=tr.programs[tr.paletteProgram];}
|
||||
if (leifxmode == 1) {
|
||||
if (vertexShaders) R_GLSL_UseProgram(tr.leiFXDitherProgram);
|
||||
program=tr.programs[tr.leiFXDitherProgram];
|
||||
}
|
||||
if (leifxmode == 2) {
|
||||
if (vertexShaders) R_GLSL_UseProgram(tr.leiFXGammaProgram);
|
||||
program=tr.programs[tr.leiFXGammaProgram];
|
||||
}
|
||||
if (leifxmode == 3) {
|
||||
if (vertexShaders) R_GLSL_UseProgram(tr.leiFXFilterProgram);
|
||||
program=tr.programs[tr.leiFXFilterProgram];
|
||||
}
|
||||
if (leifxmode == 888) {
|
||||
if (vertexShaders) R_GLSL_UseProgram(tr.animeProgram);
|
||||
program=tr.programs[tr.animeProgram];
|
||||
}
|
||||
if (leifxmode == 999) {
|
||||
if (vertexShaders) R_GLSL_UseProgram(tr.animeFilmProgram);
|
||||
program=tr.programs[tr.animeFilmProgram];
|
||||
}
|
||||
if (leifxmode == 777) {
|
||||
if (vertexShaders) R_GLSL_UseProgram(tr.motionBlurProgram);
|
||||
program=tr.programs[tr.motionBlurProgram];
|
||||
}
|
||||
if (leifxmode == 778) {
|
||||
if (vertexShaders) R_GLSL_UseProgram(tr.motionBlurProgram);
|
||||
program=tr.programs[tr.motionBlurProgram];
|
||||
}
|
||||
if (leifxmode == 779) {
|
||||
if (vertexShaders) R_GLSL_UseProgram(tr.motionBlurPostProgram);
|
||||
program=tr.programs[tr.motionBlurPostProgram];
|
||||
}
|
||||
if (leifxmode == 632) {
|
||||
if (vertexShaders) R_GLSL_UseProgram(tr.NTSCEncodeProgram);
|
||||
program=tr.programs[tr.NTSCEncodeProgram];
|
||||
}
|
||||
if (leifxmode == 633) {
|
||||
if (vertexShaders) R_GLSL_UseProgram(tr.NTSCDecodeProgram);
|
||||
program=tr.programs[tr.NTSCDecodeProgram];
|
||||
}
|
||||
if (leifxmode == 634) {
|
||||
if (vertexShaders) R_GLSL_UseProgram(tr.NTSCBleedProgram);
|
||||
program=tr.programs[tr.NTSCBleedProgram];
|
||||
}
|
||||
if (leifxmode == 666) {
|
||||
if (vertexShaders) R_GLSL_UseProgram(tr.BrightnessProgram);
|
||||
program=tr.programs[tr.BrightnessProgram];
|
||||
}
|
||||
if (leifxmode == 1236) {
|
||||
if (vertexShaders) R_GLSL_UseProgram(tr.CRTProgram);
|
||||
program=tr.programs[tr.CRTProgram];
|
||||
}
|
||||
if (leifxmode == 1997) {
|
||||
if (vertexShaders) R_GLSL_UseProgram(tr.paletteProgram);
|
||||
program=tr.programs[tr.paletteProgram];
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -803,7 +865,9 @@ static void R_Bloom_RestoreScreen_Postprocessed( void ) {
|
||||
if (program->u_CC_Contrast > -1) R_GLSL_SetUniform_u_CC_Contrast(program, 1.0);
|
||||
|
||||
//
|
||||
if (leifxmode == 3){ R_GLSL_SetUniform_u_CC_Brightness(program, leifxpass); }
|
||||
if (leifxmode == 3) {
|
||||
R_GLSL_SetUniform_u_CC_Brightness(program, leifxpass);
|
||||
}
|
||||
|
||||
if (program->u_zFar > -1) R_GLSL_SetUniform_u_zFar(program, tr.viewParms.zFar);
|
||||
GL_SelectTexture(0);
|
||||
@@ -870,8 +934,7 @@ static void R_Bloom_RestoreScreen_Postprocessed( void ) {
|
||||
R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 4 );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
R_Bloom_Quad( glConfig.vidWidth, glConfig.vidHeight, 0, 0,
|
||||
postproc.screen.readW,postproc.screen.readH );
|
||||
}
|
||||
@@ -1024,7 +1087,8 @@ void R_BloomScreen( void )
|
||||
|
||||
|
||||
|
||||
void R_BloomInit( void ) {
|
||||
void R_BloomInit( void )
|
||||
{
|
||||
memset( &bloom, 0, sizeof( bloom ));
|
||||
|
||||
r_bloom = ri.Cvar_Get( "r_bloom", "0", CVAR_ARCHIVE );
|
||||
@@ -1208,7 +1272,8 @@ R_Postprocess_BackupScreen
|
||||
Backup the full original screen to a texture for downscaling and later restoration
|
||||
=================
|
||||
*/
|
||||
static void R_Postprocess_BackupScreen( void ) {
|
||||
static void R_Postprocess_BackupScreen( void )
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
GL_Bind( postproc.screen.texture );
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
@@ -1257,7 +1322,8 @@ void R_PostprocessScreen( void )
|
||||
|
||||
|
||||
|
||||
void R_PostprocessingInit(void) {
|
||||
void R_PostprocessingInit(void)
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
memset( &postproc, 0, sizeof( postproc ));
|
||||
#endif
|
||||
@@ -1274,7 +1340,8 @@ void R_PostprocessingInit(void) {
|
||||
|
||||
|
||||
|
||||
static void ID_INLINE R_LeiFX_Pointless_Quad( int width, int height, float texX, float texY, float texWidth, float texHeight ) {
|
||||
static void ID_INLINE R_LeiFX_Pointless_Quad( int width, int height, float texX, float texY, float texWidth, float texHeight )
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
x = 0;
|
||||
@@ -1448,12 +1515,34 @@ void R_NTSCScreen( void )
|
||||
int ntsc_decode = 0;
|
||||
|
||||
// TODO: Switch it up
|
||||
if (r_ntsc->integer == 1) ntsc_bleed = 1;
|
||||
else if (r_ntsc->integer == 2){ ntsc_bleed = 1; ntsc_encode = 1; ntsc_decode = 1; }
|
||||
else if (r_ntsc->integer == 3){ ntsc_bleed = 0; ntsc_encode = 1; ntsc_decode = 1; }
|
||||
else if (r_ntsc->integer == 4){ ntsc_bleed = 1; ntsc_encode = 1; ntsc_decode = 1; }
|
||||
else if (r_ntsc->integer > 6){ ntsc_bleed = 666; ntsc_encode = 0; ntsc_decode = 0; }
|
||||
else { ntsc_bleed = 0; ntsc_encode = 1; ntsc_decode = 0; }
|
||||
if (r_ntsc->integer == 1) {
|
||||
ntsc_bleed = 1;
|
||||
}
|
||||
else if (r_ntsc->integer == 2) {
|
||||
ntsc_bleed = 1;
|
||||
ntsc_encode = 1;
|
||||
ntsc_decode = 1;
|
||||
}
|
||||
else if (r_ntsc->integer == 3) {
|
||||
ntsc_bleed = 0;
|
||||
ntsc_encode = 1;
|
||||
ntsc_decode = 1;
|
||||
}
|
||||
else if (r_ntsc->integer == 4) {
|
||||
ntsc_bleed = 1;
|
||||
ntsc_encode = 1;
|
||||
ntsc_decode = 1;
|
||||
}
|
||||
else if (r_ntsc->integer > 6) {
|
||||
ntsc_bleed = 666;
|
||||
ntsc_encode = 0;
|
||||
ntsc_decode = 0;
|
||||
}
|
||||
else {
|
||||
ntsc_bleed = 0;
|
||||
ntsc_encode = 1;
|
||||
ntsc_decode = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1486,8 +1575,7 @@ void R_NTSCScreen( void )
|
||||
leifxmode = 634; // Encode to YUV and decode to RGB EXCESSIVELY
|
||||
int passasses = r_ntsc->integer;
|
||||
int j;
|
||||
for (j=0;j<passasses;j++)
|
||||
{
|
||||
for (j=0; j<passasses; j++) {
|
||||
R_Postprocess_BackupScreen();
|
||||
R_Bloom_RestoreScreen_Postprocessed();
|
||||
}
|
||||
@@ -1508,7 +1596,8 @@ void R_NTSCScreen( void )
|
||||
|
||||
extern cvar_t *r_alternateBrightness;
|
||||
// shamelessly ripped off from tr_bloom.c
|
||||
static void ID_INLINE R_Brighter_Quad( int width, int height, float texX, float texY, float texWidth, float texHeight ) {
|
||||
static void ID_INLINE R_Brighter_Quad( int width, int height, float texX, float texY, float texWidth, float texHeight )
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
x = 0;
|
||||
@@ -1561,8 +1650,7 @@ void R_BrightScreen( void )
|
||||
if (r_alternateBrightness->integer == 1)
|
||||
mode = 1; // force use blend
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
if (r_alternateBrightness->integer == 2)
|
||||
{
|
||||
if (r_alternateBrightness->integer == 2) {
|
||||
// Automatically determine from capabilities
|
||||
if ( vertexShaders ) {
|
||||
mode = 2;
|
||||
@@ -1573,8 +1661,7 @@ void R_BrightScreen( void )
|
||||
}
|
||||
|
||||
// the modern pixel shader way
|
||||
if (mode == 2)
|
||||
{
|
||||
if (mode == 2) {
|
||||
|
||||
if ( !vertexShaders )
|
||||
return; // leilei - cards without support for this should not ever activate this
|
||||
@@ -1608,8 +1695,12 @@ void R_BrightScreen( void )
|
||||
if ((r_overBrightBits->integer)) {
|
||||
|
||||
ah = r_overBrightBits->integer;
|
||||
if (ah < 1) { ah = 1; }
|
||||
if (ah > 2) { ah = 2; } // clamp so it never looks stupid
|
||||
if (ah < 1) {
|
||||
ah = 1;
|
||||
}
|
||||
if (ah > 2) {
|
||||
ah = 2; // clamp so it never looks stupid
|
||||
}
|
||||
|
||||
// Blend method
|
||||
// do a loop for every overbright bit enabled
|
||||
@@ -1624,7 +1715,8 @@ void R_BrightScreen( void )
|
||||
}
|
||||
|
||||
|
||||
void R_AltBrightnessInit( void ) {
|
||||
void R_AltBrightnessInit( void )
|
||||
{
|
||||
|
||||
r_alternateBrightness = ri.Cvar_Get( "r_alternateBrightness", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_film = ri.Cvar_Get( "r_film", "0", CVAR_ARCHIVE );
|
||||
@@ -1690,38 +1782,50 @@ void R_FilmScreen( void )
|
||||
toneinv[2] = tone[2] * -1 + 1 + tonecont[2];
|
||||
|
||||
// darken vignette.
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO);GL_Bind( tr.dlightImage ); GL_Cull( CT_TWO_SIDED );
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO);
|
||||
GL_Bind( tr.dlightImage );
|
||||
GL_Cull( CT_TWO_SIDED );
|
||||
qglColor4f( 0.941177, 0.952941, 0.968628, 1.0f );
|
||||
R_Brighter_Quad( glConfig.vidWidth, glConfig.vidHeight, 0.35f, 0.35f, 0.2f, 0.2f );
|
||||
|
||||
|
||||
|
||||
// brighten.
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ONE);GL_Bind( tr.dlightImage ); GL_Cull( CT_TWO_SIDED );
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ONE);
|
||||
GL_Bind( tr.dlightImage );
|
||||
GL_Cull( CT_TWO_SIDED );
|
||||
//qglColor4f( 0.941177, 0.952941, 0.968628, 1.0f );
|
||||
qglColor4f( (0.9f + (tone[0] * 0.5)), (0.9f + (tone[1] * 0.5)), (0.9f + (tone[2] * 0.5)), 1.0f );
|
||||
|
||||
R_Brighter_Quad( glConfig.vidWidth, glConfig.vidHeight, 0.25f, 0.25f, 0.48f, 0.48f );
|
||||
|
||||
// invert.
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE_MINUS_DST_COLOR | GLS_DSTBLEND_ONE_MINUS_SRC_COLOR);GL_Bind( tr.whiteImage ); GL_Cull( CT_TWO_SIDED );
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE_MINUS_DST_COLOR | GLS_DSTBLEND_ONE_MINUS_SRC_COLOR);
|
||||
GL_Bind( tr.whiteImage );
|
||||
GL_Cull( CT_TWO_SIDED );
|
||||
// qglColor4f(0.85098, 0.85098, 0.815686, 1.0f );
|
||||
qglColor4f( (0.8f + (toneinv[0] * 0.5)), (0.8f + (toneinv[1] * 0.5)), (0.8f + (toneinv[2] * 0.5)), 1.0f );
|
||||
R_Brighter_Quad( glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1, 1 );
|
||||
|
||||
// brighten.
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_SRC_COLOR);GL_Bind( tr.whiteImage ); GL_Cull( CT_TWO_SIDED );
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_SRC_COLOR);
|
||||
GL_Bind( tr.whiteImage );
|
||||
GL_Cull( CT_TWO_SIDED );
|
||||
qglColor4f( 0.615686, 0.615686, 0.615686, 1.0f );
|
||||
R_Brighter_Quad( glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1, 1 );
|
||||
|
||||
|
||||
// invoort.
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE_MINUS_DST_COLOR | GLS_DSTBLEND_ONE_MINUS_SRC_COLOR);GL_Bind( tr.whiteImage ); GL_Cull( CT_TWO_SIDED );
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE_MINUS_DST_COLOR | GLS_DSTBLEND_ONE_MINUS_SRC_COLOR);
|
||||
GL_Bind( tr.whiteImage );
|
||||
GL_Cull( CT_TWO_SIDED );
|
||||
qglColor4f(1.0f, 1.0f, 1.0f , 1.0f );
|
||||
R_Brighter_Quad( glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1, 1 );
|
||||
|
||||
// brighten.
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_SRC_COLOR);GL_Bind( tr.whiteImage ); GL_Cull( CT_TWO_SIDED );
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_SRC_COLOR);
|
||||
GL_Bind( tr.whiteImage );
|
||||
GL_Cull( CT_TWO_SIDED );
|
||||
// qglColor4f( 0.866667, 0.847059, 0.776471, 1.0f );
|
||||
qglColor4f( (0.73f + (toneinv[0] * 0.4)), (0.73f + (toneinv[1] * 0.4)), (0.73f + (toneinv[2] * 0.4)), 1.0f );
|
||||
R_Brighter_Quad( glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1, 1 );
|
||||
@@ -1838,20 +1942,51 @@ void R_AnimeScreen( void )
|
||||
|
||||
|
||||
// leilei - motion blur hack
|
||||
void R_MotionBlur_BackupScreen(int which) {
|
||||
void R_MotionBlur_BackupScreen(int which)
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
if( r_motionblur->integer < 3)
|
||||
return;
|
||||
if (which == 1){ GL_Bind( postproc.motion1.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // gather thee samples
|
||||
if (which == 2){ GL_Bind( postproc.motion2.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); }
|
||||
if (which == 3){ GL_Bind( postproc.motion3.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); }
|
||||
if (which == 4){ GL_Bind( postproc.motion4.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); }
|
||||
if (which == 5){ GL_Bind( postproc.motion5.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); }
|
||||
if (which == 11){ GL_Bind( postproc.mpass1.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // to accum
|
||||
if (which == 12){ GL_Bind( postproc.mpass1.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // to accum
|
||||
if (which == 13){ GL_Bind( postproc.mpass1.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // to accum
|
||||
if (which == 14){ GL_Bind( postproc.mpass1.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // to accum
|
||||
if (which == 18){ GL_Bind( postproc.screen.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // to accum
|
||||
if (which == 1) {
|
||||
GL_Bind( postproc.motion1.texture ); // gather thee samples
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
}
|
||||
if (which == 2) {
|
||||
GL_Bind( postproc.motion2.texture );
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
}
|
||||
if (which == 3) {
|
||||
GL_Bind( postproc.motion3.texture );
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
}
|
||||
if (which == 4) {
|
||||
GL_Bind( postproc.motion4.texture );
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
}
|
||||
if (which == 5) {
|
||||
GL_Bind( postproc.motion5.texture );
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
}
|
||||
if (which == 11) {
|
||||
GL_Bind( postproc.mpass1.texture ); // to accum
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
}
|
||||
if (which == 12) {
|
||||
GL_Bind( postproc.mpass1.texture ); // to accum
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
}
|
||||
if (which == 13) {
|
||||
GL_Bind( postproc.mpass1.texture ); // to accum
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
}
|
||||
if (which == 14) {
|
||||
GL_Bind( postproc.mpass1.texture ); // to accum
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
}
|
||||
if (which == 18) {
|
||||
GL_Bind( postproc.screen.texture ); // to accum
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -1932,7 +2067,8 @@ void R_MblurScreenPost( void )
|
||||
// TV MODE
|
||||
// =================================================================
|
||||
|
||||
static void R_Postprocess_BackupScreenTV( void ) {
|
||||
static void R_Postprocess_BackupScreenTV( void )
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
int intdiv;
|
||||
intdiv = 1;
|
||||
@@ -1953,7 +2089,8 @@ static void R_Postprocess_BackupScreenTV( void ) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static void R_Postprocess_ScaleTV( void ) {
|
||||
static void R_Postprocess_ScaleTV( void )
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
@@ -2012,12 +2149,10 @@ void R_TVScreen( void )
|
||||
// leifxmode = 1236; // run it through a shader
|
||||
//R_Postprocess_BackupScreen();
|
||||
|
||||
if (r_tvMode->integer > 100)
|
||||
{
|
||||
if (r_tvMode->integer > 100) {
|
||||
R_Postprocess_ScaleTV();
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
R_Postprocess_BackupScreenTV();
|
||||
|
||||
R_Bloom_RestoreScreen_Postprocessed();
|
||||
@@ -2123,12 +2258,14 @@ static void R_WaterWorks( void )
|
||||
}
|
||||
|
||||
|
||||
static void R_Water_RestoreScreen( void ) {
|
||||
static void R_Water_RestoreScreen( void )
|
||||
{
|
||||
// NO!
|
||||
}
|
||||
|
||||
|
||||
void R_WaterInit( void ) {
|
||||
void R_WaterInit( void )
|
||||
{
|
||||
// NO!
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user