@@ -49,6 +49,8 @@ GLSL_TEXTURES =1 # for shaders on models, leifxdither, etc
|
||||
GLSL_BACKEND =1 # for the entire backend.
|
||||
|
||||
|
||||
#Possible values "gnu90", "gnu99" and "gnu11". Note that the engine uses gnu-extensions. gnu90 is broken in the commit where this message is added. Travis does not support gnu11 at the moment.
|
||||
CFLAGS+="-std=gnu99"
|
||||
|
||||
|
||||
# You can change these although you probably don't need to
|
||||
|
@@ -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 )
|
||||
{
|
||||
|
||||
|
||||
|
||||
@@ -80,40 +82,35 @@ S_XMP_CodecOpenStream
|
||||
// FIXME: there's a memory leak here if you start the same song many many many many times.
|
||||
snd_stream_t *S_XMP_CodecOpenStream(const char *filename)
|
||||
{
|
||||
snd_stream_t *rv;
|
||||
|
||||
// First let's close whatever song we had....
|
||||
|
||||
// Open
|
||||
rv = S_CodecUtilOpen(filename, &xmp_codec);
|
||||
if(!rv)
|
||||
snd_stream_t *rv = S_CodecUtilOpen(filename, &xmp_codec);
|
||||
if(!rv) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Com_Printf("OPENSTREAM %s\n", filename);
|
||||
|
||||
{
|
||||
fileHandle_t file;
|
||||
void *buffer;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
// Allocate some memory
|
||||
long thelength = FS_ReadFile(filename, buffer);
|
||||
long thelength = FS_ReadFile(filename, NULL);
|
||||
|
||||
|
||||
buffer = Hunk_AllocateTempMemory(thelength);
|
||||
if(!buffer)
|
||||
{
|
||||
void *buffer = Hunk_AllocateTempMemory(thelength);
|
||||
if(!buffer) {
|
||||
FS_FCloseFile(file);
|
||||
Com_Printf( S_COLOR_RED "ERROR: Out of memory reading \"%s\"\n",
|
||||
filename);
|
||||
Com_Printf( S_COLOR_RED "ERROR: Out of memory reading \"%s\"\n", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -135,13 +132,11 @@ snd_stream_t *S_XMP_CodecOpenStream(const char *filename)
|
||||
if (itsloaded == 0)
|
||||
itsloaded = xmp_start_player(xmpsong, xmpspeed, 0); // TODO: do sample rate of the mixer.
|
||||
|
||||
if (itsloaded == 0){
|
||||
|
||||
if (itsloaded == 0) {
|
||||
// Com_Printf("XMP loaded our buffer of the file %s which is %i long \n", filename, thelength);
|
||||
xmp_get_module_info(xmpsong, &mi);
|
||||
// Com_Printf("Song Name: %s\n", mi.mod->name);
|
||||
// Com_Printf("CODECLOAD %s\n", filename);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -183,64 +178,30 @@ int S_XMP_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer)
|
||||
struct xmp_module_info mi;
|
||||
struct xmp_frame_info fi;
|
||||
|
||||
int bytesRead, bytesLeft, c;
|
||||
char *bufPtr;
|
||||
|
||||
// check if input is valid
|
||||
if(!(stream && buffer))
|
||||
{
|
||||
if(!(stream && buffer)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(bytes <= 0)
|
||||
{
|
||||
if(bytes <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bytesRead = 0;
|
||||
bytesLeft = bytes;
|
||||
bufPtr = buffer;
|
||||
int yeah=xmp_play_buffer(xmpsong, buffer, bytes, 0);
|
||||
|
||||
// cycle until we have the requested or all available bytes read
|
||||
while(-1)
|
||||
{
|
||||
int yeah=xmp_play_buffer(xmpsong, buffer, bytesLeft, 0);
|
||||
|
||||
if (yeah == 0){ // if we can play it...
|
||||
if (yeah == 0) { // if we can play it...
|
||||
xmp_get_frame_info(xmpsong, &fi);
|
||||
|
||||
c = fi.buffer;
|
||||
|
||||
// no more bytes are left
|
||||
if(c <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
bytesRead += c;
|
||||
bytesLeft -= c;
|
||||
bufPtr += c;
|
||||
xmp_get_module_info(xmpsong, &mi);
|
||||
|
||||
// we have enough bytes
|
||||
if(bytesLeft <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // if we can't play it JUST STOP OK
|
||||
{
|
||||
break;
|
||||
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
snd_codec_t xmp_codec =
|
||||
{
|
||||
snd_codec_t xmp_codec = {
|
||||
"umx",
|
||||
S_XMP_CodecLoad,
|
||||
S_XMP_CodecOpenStream,
|
||||
@@ -249,8 +210,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,
|
||||
@@ -259,8 +219,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,
|
||||
@@ -269,8 +228,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,
|
||||
@@ -279,8 +237,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;
|
||||
@@ -293,8 +291,8 @@ static void R_Bloom_InitTextures( void )
|
||||
byte *data;
|
||||
|
||||
// find closer power of 2 to screen size
|
||||
for (bloom.screen.width = 1;bloom.screen.width< glConfig.vidWidth;bloom.screen.width *= 2);
|
||||
for (bloom.screen.height = 1;bloom.screen.height < glConfig.vidHeight;bloom.screen.height *= 2);
|
||||
for (bloom.screen.width = 1; bloom.screen.width< glConfig.vidWidth; bloom.screen.width *= 2);
|
||||
for (bloom.screen.height = 1; bloom.screen.height < glConfig.vidHeight; bloom.screen.height *= 2);
|
||||
|
||||
bloom.screen.readW = glConfig.vidWidth / (float)bloom.screen.width;
|
||||
bloom.screen.readH = glConfig.vidHeight / (float)bloom.screen.height;
|
||||
@@ -303,8 +301,8 @@ static void R_Bloom_InitTextures( void )
|
||||
bloom.work.width = r_bloom_sample_size->integer;
|
||||
bloom.work.height = bloom.work.width * ( glConfig.vidWidth / glConfig.vidHeight );
|
||||
|
||||
for (bloom.effect.width = 1;bloom.effect.width < bloom.work.width;bloom.effect.width *= 2);
|
||||
for (bloom.effect.height = 1;bloom.effect.height < bloom.work.height;bloom.effect.height *= 2);
|
||||
for (bloom.effect.width = 1; bloom.effect.width < bloom.work.width; bloom.effect.width *= 2);
|
||||
for (bloom.effect.height = 1; bloom.effect.height < bloom.work.height; bloom.effect.height *= 2);
|
||||
|
||||
bloom.effect.readW = bloom.work.width / (float)bloom.effect.width;
|
||||
bloom.effect.readH = bloom.work.height / (float)bloom.effect.height;
|
||||
@@ -369,7 +367,7 @@ static void R_Bloom_DrawEffect( void )
|
||||
float alpha=r_bloom_alpha->value;
|
||||
GL_Bind( bloom.effect.texture );
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
|
||||
if(r_bloom_cascade->integer){
|
||||
if(r_bloom_cascade->integer) {
|
||||
alpha=r_bloom_cascade_alpha->value;
|
||||
}
|
||||
qglColor4f( alpha,alpha,alpha, 1.0f );
|
||||
@@ -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;
|
||||
@@ -475,7 +474,7 @@ static void R_Bloom_Cascaded( void ){
|
||||
bloom.effect2.readW, bloom.effect2.readH );
|
||||
|
||||
// go through levels.
|
||||
while(scale>1){
|
||||
while(scale>1) {
|
||||
float oldScaleInv=1.f/(float)scale;
|
||||
scale>>=1;
|
||||
oldWorkH=newWorkH;
|
||||
@@ -488,14 +487,15 @@ static void R_Bloom_Cascaded( void ){
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, oldWorkW, oldWorkH);
|
||||
|
||||
// maginfy the previous level.
|
||||
if(r_bloom_cascade_blur->value<.01f){
|
||||
if(r_bloom_cascade_blur->value<.01f) {
|
||||
// don't blur.
|
||||
qglColor4f( 1.f, 1.f, 1.f, 1.0 );
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO );
|
||||
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,18 +644,20 @@ 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;
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO );
|
||||
GL_Bind( bloom.screen.texture );
|
||||
qglColor4f( dry,dry,dry, 1 );
|
||||
if(dry<.99f){
|
||||
if(dry<.99f) {
|
||||
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,11 +671,9 @@ 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 ) {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
static void ID_INLINE R_Bloom_QuadTV( int width, int height, float texX, float texY, float texWidth, float texHeight, int aa )
|
||||
{
|
||||
float aspcenter = 0;
|
||||
int aspoff = 0;
|
||||
float raa = r_retroAA->value;
|
||||
if (raa < 1) raa = 1;
|
||||
|
||||
@@ -678,17 +681,32 @@ static void ID_INLINE R_Bloom_QuadTV( int width, int height, float texX, float t
|
||||
float ypix = 1.0f / height / (4 / raa);
|
||||
float xaa;
|
||||
float yaa;
|
||||
x = 0;
|
||||
y = 0;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -699,20 +717,18 @@ static void ID_INLINE R_Bloom_QuadTV( int width, int height, float texX, float t
|
||||
texWidth += texX;
|
||||
texHeight += texY;
|
||||
|
||||
if (tvAspectW != 1.0){
|
||||
if (tvAspectW != 1.0) {
|
||||
aspcenter = tvWidth * ((1.0f - tvAspectW) / 2);
|
||||
// leilei - also do a quad that is 100% black, hiding our actual rendered viewport
|
||||
|
||||
// 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 );
|
||||
}
|
||||
@@ -725,11 +741,7 @@ static void ID_INLINE R_Bloom_QuadTV( int width, int height, float texX, float t
|
||||
qglColor4f( 1.0, 1.0, 1.0, 1 );
|
||||
}
|
||||
|
||||
|
||||
//aspcenter = 0;
|
||||
aspoff = tvWidth * tvAspectW;
|
||||
|
||||
if (!aa){
|
||||
if (!aa) {
|
||||
qglViewport(aspcenter, 0, (tvWidth * tvAspectW), tvHeight );
|
||||
qglScissor(aspcenter, 0, (tvWidth * tvAspectW), tvHeight );
|
||||
}
|
||||
@@ -749,33 +761,79 @@ 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;
|
||||
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];}
|
||||
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];
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
if (vertexShaders) R_GLSL_UseProgram(tr.postprocessingProgram);
|
||||
// Feed GLSL postprocess program
|
||||
program=tr.programs[tr.postprocessingProgram];
|
||||
}
|
||||
if (!program) {
|
||||
//If leifsmode has been set to something invalid we have to bail out or we will dereference a null pointer
|
||||
Com_Printf( S_COLOR_YELLOW"WARNING: 'leifxmode' has an invalid value\n" );
|
||||
return;
|
||||
}
|
||||
if (program->u_ScreenSizeX > -1) R_GLSL_SetUniform_u_ScreenSizeX(program, glConfig.vidWidth);
|
||||
|
||||
if (program->u_ScreenSizeY > -1) R_GLSL_SetUniform_u_ScreenSizeY(program, glConfig.vidHeight);
|
||||
@@ -800,7 +858,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);
|
||||
@@ -811,7 +871,7 @@ static void R_Bloom_RestoreScreen_Postprocessed( void ) {
|
||||
GL_Bind( postproc.depth.texture );
|
||||
|
||||
// motion blur crap
|
||||
if( r_motionblur->integer > 2){
|
||||
if( r_motionblur->integer > 2) {
|
||||
if (program->u_mpasses > -1) R_GLSL_SetUniform_u_mpasses(program, mpasses);
|
||||
GL_SelectTexture(2);
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO );
|
||||
@@ -845,17 +905,17 @@ static void R_Bloom_RestoreScreen_Postprocessed( void ) {
|
||||
|
||||
// if (leifxmode == 778)
|
||||
// return;
|
||||
if (leifxmode == 1234){
|
||||
if (leifxmode == 1234) {
|
||||
{
|
||||
R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 0 );
|
||||
}
|
||||
}
|
||||
else if (leifxmode == 1236){
|
||||
else if (leifxmode == 1236) {
|
||||
{
|
||||
R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 0 );
|
||||
}
|
||||
}
|
||||
else if (leifxmode == 1233){
|
||||
else if (leifxmode == 1233) {
|
||||
|
||||
|
||||
R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 1 );
|
||||
@@ -867,8 +927,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 );
|
||||
}
|
||||
@@ -1021,7 +1080,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 );
|
||||
@@ -1062,18 +1122,17 @@ static void R_Postprocess_InitTextures( void )
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
byte *data;
|
||||
int vidinted = glConfig.vidHeight * 0.55f;
|
||||
int intdiv = 1;
|
||||
|
||||
force32upload = 1;
|
||||
// find closer power of 2 to screen size
|
||||
for (postproc.screen.width = 1;postproc.screen.width< glConfig.vidWidth;postproc.screen.width *= 2);
|
||||
for (postproc.screen.width = 1; postproc.screen.width< glConfig.vidWidth; postproc.screen.width *= 2) {}
|
||||
|
||||
// if (r_tvMode->integer > 1) // interlaced
|
||||
|
||||
// for (postproc.screen.height = 1;postproc.screen.height < vidinted;postproc.screen.height *= 2);
|
||||
//else
|
||||
for (postproc.screen.height = 1;postproc.screen.height < glConfig.vidHeight;postproc.screen.height *= 2);
|
||||
for (postproc.screen.height = 1; postproc.screen.height < glConfig.vidHeight; postproc.screen.height *= 2) {}
|
||||
|
||||
// if (r_tvMode->integer > 1)
|
||||
// intdiv = 2;
|
||||
@@ -1088,8 +1147,8 @@ static void R_Postprocess_InitTextures( void )
|
||||
postproc.work.width = r_bloom_sample_size->integer;
|
||||
postproc.work.height = postproc.work.width * ( glConfig.vidWidth / glConfig.vidHeight );
|
||||
|
||||
for (postproc.effect.width = 1;postproc.effect.width < postproc.work.width;postproc.effect.width *= 2);
|
||||
for (postproc.effect.height = 1;postproc.effect.height < postproc.work.height;postproc.effect.height *= 2);
|
||||
for (postproc.effect.width = 1; postproc.effect.width < postproc.work.width; postproc.effect.width *= 2) {}
|
||||
for (postproc.effect.height = 1; postproc.effect.height < postproc.work.height; postproc.effect.height *= 2) {}
|
||||
|
||||
postproc.effect.readW = postproc.work.width / (float)postproc.effect.width;
|
||||
postproc.effect.readH = postproc.work.height / (float)postproc.effect.height;
|
||||
@@ -1116,10 +1175,10 @@ static void R_Postprocess_InitTextures( void )
|
||||
|
||||
// leilei - tv output texture
|
||||
|
||||
if (r_tvMode->integer > -1){
|
||||
if (r_tvMode->integer > -1) {
|
||||
// find closer power of 2 to screen size
|
||||
for (postproc.tv.width = 1;postproc.tv.width< tvWidth;postproc.tv.width *= 2);
|
||||
for (postproc.tv.height = 1;postproc.tv.height < tvHeight;postproc.tv.height *= 2);
|
||||
for (postproc.tv.width = 1; postproc.tv.width< tvWidth; postproc.tv.width *= 2);
|
||||
for (postproc.tv.height = 1; postproc.tv.height < tvHeight; postproc.tv.height *= 2);
|
||||
|
||||
//postproc.tv.height /= intdiv; // interlacey
|
||||
|
||||
@@ -1133,11 +1192,13 @@ static void R_Postprocess_InitTextures( void )
|
||||
|
||||
// postproc.tvwork.height /= intdiv; // interlacey
|
||||
|
||||
for (postproc.tveffect.width = 1;postproc.tveffect.width < postproc.tvwork.width;postproc.tveffect.width *= 2);
|
||||
if (intdiv > 1)
|
||||
for (postproc.tveffect.height = 1;(postproc.tveffect.height/2) < postproc.tvwork.height;postproc.tveffect.height *= 2);
|
||||
else
|
||||
for (postproc.tveffect.height = 1;postproc.tveffect.height < postproc.tvwork.height;postproc.tveffect.height *= 2);
|
||||
for (postproc.tveffect.width = 1; postproc.tveffect.width < postproc.tvwork.width; postproc.tveffect.width *= 2) {}
|
||||
if (intdiv > 1) {
|
||||
for (postproc.tveffect.height = 1; (postproc.tveffect.height/2) < postproc.tvwork.height; postproc.tveffect.height *= 2) {}
|
||||
}
|
||||
else {
|
||||
for (postproc.tveffect.height = 1; postproc.tveffect.height < postproc.tvwork.height; postproc.tveffect.height *= 2) {}
|
||||
}
|
||||
|
||||
postproc.tveffect.readW = postproc.tvwork.width / (float)postproc.tveffect.width;
|
||||
postproc.tveffect.readH = postproc.tvwork.height / (float)postproc.tveffect.height;
|
||||
@@ -1152,7 +1213,7 @@ if (intdiv > 1)
|
||||
|
||||
// leilei - motion blur textures!
|
||||
|
||||
if (r_motionblur->integer > 2){
|
||||
if (r_motionblur->integer > 2) {
|
||||
data = ri.Hunk_AllocateTempMemory( postproc.screen.width * postproc.screen.height * 4 );
|
||||
Com_Memset( data, 0, postproc.screen.width * postproc.screen.height * 4 );
|
||||
postproc.motion1.texture = R_CreateImage( "***motionblur1 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE );
|
||||
@@ -1203,7 +1264,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 );
|
||||
@@ -1252,7 +1314,8 @@ void R_PostprocessScreen( void )
|
||||
|
||||
|
||||
|
||||
void R_PostprocessingInit(void) {
|
||||
void R_PostprocessingInit(void)
|
||||
{
|
||||
#ifdef GLSL_POSTPROCESSING
|
||||
memset( &postproc, 0, sizeof( postproc ));
|
||||
#endif
|
||||
@@ -1269,7 +1332,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;
|
||||
@@ -1336,7 +1400,7 @@ void R_LeiFXPostprocessDitherScreen( void )
|
||||
R_LeiFX_Stupid_Hack();
|
||||
|
||||
|
||||
if (r_leifx->integer > 1){
|
||||
if (r_leifx->integer > 1) {
|
||||
leifxmode = 1; // reduct and dither - 1 pass
|
||||
R_Postprocess_BackupScreen();
|
||||
R_Bloom_RestoreScreen_Postprocessed();
|
||||
@@ -1365,21 +1429,22 @@ void R_LeiFXPostprocessFilterScreen( void )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !backEnd.projection2D )
|
||||
if ( !backEnd.projection2D ) {
|
||||
RB_SetGL2D();
|
||||
}
|
||||
force32upload = 1;
|
||||
|
||||
// postprocess = 1;
|
||||
|
||||
/* if (r_leifx->integer == 3){
|
||||
/* if (r_leifx->integer == 3){
|
||||
leifxmode = 2; // gamma - 1 pass
|
||||
// The stupidest hack in america
|
||||
R_LeiFX_Stupid_Hack();
|
||||
R_Postprocess_BackupScreen();
|
||||
R_Bloom_RestoreScreen_Postprocessed();
|
||||
}
|
||||
*/ // Gamma disabled because r_alternateBrightness 2 makes it redundant now.
|
||||
if (r_leifx->integer > 3){
|
||||
*/ // Gamma disabled because r_alternateBrightness 2 makes it redundant now.
|
||||
if (r_leifx->integer > 3) {
|
||||
leifxmode = 3; // filter - 4 pass
|
||||
// The stupidest hack in america
|
||||
R_LeiFX_Stupid_Hack();
|
||||
@@ -1432,8 +1497,9 @@ void R_NTSCScreen( void )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !backEnd.projection2D )
|
||||
if ( !backEnd.projection2D ) {
|
||||
RB_SetGL2D();
|
||||
}
|
||||
force32upload = 1;
|
||||
|
||||
int ntsc_bleed = 0;
|
||||
@@ -1441,12 +1507,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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1454,20 +1542,20 @@ void R_NTSCScreen( void )
|
||||
// qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||
|
||||
R_LeiFX_Stupid_Hack();
|
||||
if (ntsc_encode){
|
||||
if (ntsc_encode) {
|
||||
leifxmode = 632; // Encode to composite
|
||||
R_Postprocess_BackupScreen();
|
||||
R_Bloom_RestoreScreen_Postprocessed();
|
||||
}
|
||||
|
||||
|
||||
if (ntsc_decode){
|
||||
if (ntsc_decode) {
|
||||
leifxmode = 633; // Decode to RGB
|
||||
R_Postprocess_BackupScreen();
|
||||
R_Bloom_RestoreScreen_Postprocessed();
|
||||
}
|
||||
|
||||
if (ntsc_bleed){
|
||||
if (ntsc_bleed) {
|
||||
leifxmode = 634; // Encode to YUV and decode to RGB
|
||||
R_Postprocess_BackupScreen();
|
||||
R_Bloom_RestoreScreen_Postprocessed();
|
||||
@@ -1475,12 +1563,11 @@ void R_NTSCScreen( void )
|
||||
|
||||
|
||||
|
||||
if (ntsc_bleed == 666){
|
||||
if (ntsc_bleed == 666) {
|
||||
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();
|
||||
}
|
||||
@@ -1501,7 +1588,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;
|
||||
@@ -1545,7 +1633,7 @@ void R_BrightItUp (int dst, int src, float intensity)
|
||||
|
||||
void R_BrightScreen( void )
|
||||
{
|
||||
int mode; // 0 = none; 1 = blend; 2 = shader
|
||||
int mode = 0; // 0 = none; 1 = blend; 2 = shader
|
||||
if( !r_alternateBrightness->integer)
|
||||
return;
|
||||
if ( backEnd.doneAltBrightness)
|
||||
@@ -1554,18 +1642,18 @@ 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 )
|
||||
if ( vertexShaders ) {
|
||||
mode = 2;
|
||||
else
|
||||
}
|
||||
else {
|
||||
mode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
@@ -1595,14 +1683,16 @@ void R_BrightScreen( void )
|
||||
else if (mode == 1)
|
||||
#endif
|
||||
{
|
||||
|
||||
int eh, ah;
|
||||
if ((r_overBrightBits->integer))
|
||||
{
|
||||
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
|
||||
@@ -1612,13 +1702,13 @@ void R_BrightScreen( void )
|
||||
|
||||
backEnd.doneAltBrightness = qtrue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
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 );
|
||||
@@ -1638,7 +1728,6 @@ void R_AltBrightnessInit( void ) {
|
||||
void R_FilmScreen( void )
|
||||
{
|
||||
vec3_t tone, toneinv, tonecont;
|
||||
vec3_t tonework;
|
||||
|
||||
if( !r_film->integer )
|
||||
return;
|
||||
@@ -1653,8 +1742,8 @@ void R_FilmScreen( void )
|
||||
tone[1] = 0.9f;
|
||||
tone[2] = 1.0f;
|
||||
//VectorCopy( backEnd.currentEntity->ambientLight, tone );
|
||||
if (backEnd.currentEntity){
|
||||
if (backEnd.currentEntity->ambientLight[0] > 0.001f && backEnd.currentEntity->ambientLight[1] > 0.001f && backEnd.currentEntity->ambientLight[2] > 0.001f){
|
||||
if (backEnd.currentEntity) {
|
||||
if (backEnd.currentEntity->ambientLight[0] > 0.001f && backEnd.currentEntity->ambientLight[1] > 0.001f && backEnd.currentEntity->ambientLight[2] > 0.001f) {
|
||||
tone[0] = backEnd.currentEntity->ambientLight[0];
|
||||
tone[1] = backEnd.currentEntity->ambientLight[1];
|
||||
tone[2] = backEnd.currentEntity->ambientLight[2];
|
||||
@@ -1685,46 +1774,53 @@ 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 +1934,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,12 +2059,9 @@ 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;
|
||||
|
||||
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
@@ -1953,7 +2077,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 );
|
||||
@@ -1996,7 +2121,7 @@ void R_TVScreen( void )
|
||||
|
||||
// postprocess = 1;
|
||||
|
||||
if (backEnd.refdef.time > tvtime){
|
||||
if (backEnd.refdef.time > tvtime) {
|
||||
tvinterlace *= -1;
|
||||
tvtime = backEnd.refdef.time + (1000.0f / 60); // 60hz
|
||||
}
|
||||
@@ -2012,12 +2137,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 +2246,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!
|
||||
}
|
||||
|
||||
|
@@ -110,7 +110,8 @@ int flareCoeff;
|
||||
R_SetFlareCoeff
|
||||
==================
|
||||
*/
|
||||
static void R_SetFlareCoeff( void ) {
|
||||
static void R_SetFlareCoeff( void )
|
||||
{
|
||||
|
||||
if(r_flareCoeff->value == 0.0f)
|
||||
flareCoeff = atof(FLARE_STDCOEFF);
|
||||
@@ -128,7 +129,8 @@ static int pvrhack = 0; // leilei = powervr workarounds
|
||||
R_ClearFlares
|
||||
==================
|
||||
*/
|
||||
void R_ClearFlares( void ) {
|
||||
void R_ClearFlares( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
Com_Memset( r_flareStructs, 0, sizeof( r_flareStructs ) );
|
||||
@@ -155,9 +157,10 @@ float flaredsize; // leilei - dirty flare fix for widescreens
|
||||
|
||||
|
||||
|
||||
void RB_AddFlare(srfFlare_t *surface, int fogNum, vec3_t point, vec3_t color, vec3_t normal, int radii, int efftype, float scaled, int type) {
|
||||
void RB_AddFlare(srfFlare_t *surface, int fogNum, vec3_t point, vec3_t color, vec3_t normal, int radii, int efftype, float scaled, int type)
|
||||
{
|
||||
int i;
|
||||
flare_t *f, *oldest;
|
||||
flare_t *f;
|
||||
vec3_t local;
|
||||
float d = 1;
|
||||
vec4_t eye, clip, normalized, window;
|
||||
@@ -166,8 +169,7 @@ void RB_AddFlare(srfFlare_t *surface, int fogNum, vec3_t point, vec3_t color, ve
|
||||
|
||||
// fade the intensity of the flare down as the
|
||||
// light surface turns away from the viewer
|
||||
if(normal && (normal[0] || normal[1] || normal[2]) )
|
||||
{
|
||||
if(normal && (normal[0] || normal[1] || normal[2]) ) {
|
||||
VectorSubtract( backEnd.viewParms.or.origin, point, local );
|
||||
VectorNormalizeFast(local);
|
||||
d = DotProduct(local, normal);
|
||||
@@ -201,7 +203,6 @@ void RB_AddFlare(srfFlare_t *surface, int fogNum, vec3_t point, vec3_t color, ve
|
||||
}
|
||||
|
||||
// see if a flare with a matching surface, scene, and view exists
|
||||
oldest = r_flareStructs;
|
||||
for ( f = r_activeFlares ; f ; f = f->next ) {
|
||||
if ( f->surface == surface && f->frameSceneNum == backEnd.viewParms.frameSceneNum
|
||||
&& f->inPortal == backEnd.viewParms.isPortal ) {
|
||||
@@ -298,7 +299,8 @@ void RB_AddFlare(srfFlare_t *surface, int fogNum, vec3_t point, vec3_t color, ve
|
||||
RB_AddDlightFlares
|
||||
==================
|
||||
*/
|
||||
void RB_AddDlightFlares( void ) {
|
||||
void RB_AddDlightFlares( void )
|
||||
{
|
||||
dlight_t *l;
|
||||
int i, j, k;
|
||||
fog_t *fog = NULL;
|
||||
@@ -315,8 +317,7 @@ void RB_AddDlightFlares( void ) {
|
||||
|
||||
for (i=0 ; i<backEnd.refdef.num_dlights ; i++, l++) {
|
||||
|
||||
if(fog)
|
||||
{
|
||||
if(fog) {
|
||||
// find which fog volume the light is in
|
||||
for ( j = 1 ; j < tr.world->numfogs ; j++ ) {
|
||||
fog = &tr.world->fogs[j];
|
||||
@@ -360,7 +361,8 @@ RB_TestFlareFast
|
||||
faster simple one.
|
||||
==================
|
||||
*/
|
||||
static void RB_TestFlareFast( flare_t *f, int dotrace ) {
|
||||
static void RB_TestFlareFast( flare_t *f, int dotrace )
|
||||
{
|
||||
float depth;
|
||||
qboolean visible;
|
||||
float fade;
|
||||
@@ -374,22 +376,21 @@ static void RB_TestFlareFast( flare_t *f, int dotrace ) {
|
||||
glState.finishCalled = qfalse;
|
||||
if (f->type == 2) dotrace = 0; // sun cant trace
|
||||
// leilei - do trace, then complain
|
||||
if (dotrace){
|
||||
if (dotrace) {
|
||||
trace_t yeah;
|
||||
CM_Trace( &yeah, f->origin, backEnd.or.viewOrigin, NULL, NULL, NULL, f->origin, 1, NULL, NULL );
|
||||
if (yeah.fraction < 1){
|
||||
CM_Trace( &yeah, f->origin, backEnd.or.viewOrigin, NULL, NULL, 0, f->origin, 1, 0, NULL );
|
||||
if (yeah.fraction < 1) {
|
||||
visible = 0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
visible = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// leilei - delay hack, to speed up the renderer
|
||||
|
||||
if (backEnd.refdef.time > f->delay){
|
||||
if (backEnd.refdef.time > f->delay) {
|
||||
|
||||
// read back the z buffer contents
|
||||
|
||||
@@ -413,7 +414,8 @@ static void RB_TestFlareFast( flare_t *f, int dotrace ) {
|
||||
{
|
||||
fade = ( ( backEnd.refdef.time - f->fadeTime ) / 1000.0f ) * r_flareFade->value;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if ( f->visible ) {
|
||||
f->visible = qfalse;
|
||||
f->fadeTime = backEnd.refdef.time - 1;
|
||||
@@ -437,8 +439,7 @@ static void RB_TestFlareFast( flare_t *f, int dotrace ) {
|
||||
if (f->visible) {
|
||||
f->drawIntensity = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
f->drawIntensity = 0;
|
||||
}
|
||||
}
|
||||
@@ -450,7 +451,8 @@ static void RB_TestFlareFast( flare_t *f, int dotrace ) {
|
||||
RB_TestFlare
|
||||
==================
|
||||
*/
|
||||
static void RB_TestFlare( flare_t *f, int dotrace ) {
|
||||
static void RB_TestFlare( flare_t *f, int dotrace )
|
||||
{
|
||||
float depth;
|
||||
qboolean visible;
|
||||
float fade;
|
||||
@@ -466,15 +468,14 @@ static void RB_TestFlare( flare_t *f, int dotrace ) {
|
||||
|
||||
if (f->type == 2) dotrace = 0; // sun cant trace
|
||||
// leilei - do trace, then complain
|
||||
if (dotrace){
|
||||
if (dotrace) {
|
||||
trace_t yeah;
|
||||
CM_Trace( &yeah, f->origin, backEnd.or.viewOrigin, NULL, NULL, NULL, f->origin, 1, NULL, NULL );
|
||||
if (yeah.fraction < 1){
|
||||
CM_Trace( &yeah, f->origin, backEnd.or.viewOrigin, NULL, NULL, 0, f->origin, 1, 0, NULL );
|
||||
if (yeah.fraction < 1) {
|
||||
visible = 0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
visible = 1;
|
||||
}
|
||||
}
|
||||
@@ -500,7 +501,8 @@ static void RB_TestFlare( flare_t *f, int dotrace ) {
|
||||
{
|
||||
fade = ( ( backEnd.refdef.time - f->fadeTime ) / 1000.0f ) * r_flareFade->value;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if ( f->visible ) {
|
||||
f->visible = qfalse;
|
||||
f->fadeTime = backEnd.refdef.time - 1;
|
||||
@@ -519,11 +521,10 @@ static void RB_TestFlare( flare_t *f, int dotrace ) {
|
||||
|
||||
}
|
||||
|
||||
static void RB_TestFlareTraceOnly( flare_t *f ) {
|
||||
float depth;
|
||||
static void RB_TestFlareTraceOnly( flare_t *f )
|
||||
{
|
||||
qboolean visible;
|
||||
float fade;
|
||||
float screenZ;
|
||||
|
||||
backEnd.pc.c_flareTests++;
|
||||
|
||||
@@ -534,13 +535,12 @@ static void RB_TestFlareTraceOnly( flare_t *f ) {
|
||||
|
||||
// read from a traceline
|
||||
trace_t yeah;
|
||||
CM_Trace( &yeah, f->origin, backEnd.or.viewOrigin, NULL, NULL, NULL, f->origin, 1, NULL, NULL );
|
||||
if (yeah.fraction < 1){
|
||||
CM_Trace( &yeah, f->origin, backEnd.or.viewOrigin, NULL, NULL, 0, f->origin, 1, 0, NULL );
|
||||
if (yeah.fraction < 1) {
|
||||
visible = 0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
visible = 1;
|
||||
}
|
||||
|
||||
@@ -553,7 +553,8 @@ static void RB_TestFlareTraceOnly( flare_t *f ) {
|
||||
{
|
||||
fade = ( ( backEnd.refdef.time - f->fadeTime ) / 1000.0f ) * r_flareFade->value;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if ( f->visible ) {
|
||||
f->visible = qfalse;
|
||||
f->fadeTime = backEnd.refdef.time - 1;
|
||||
@@ -580,7 +581,8 @@ RB_RenderFlare
|
||||
==================
|
||||
*/
|
||||
|
||||
void RB_RenderFlare( flare_t *f ) {
|
||||
void RB_RenderFlare( flare_t *f )
|
||||
{
|
||||
float size;
|
||||
vec3_t color;
|
||||
int iColor[3];
|
||||
@@ -599,8 +601,7 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
else
|
||||
distance = -f->eyeZ;
|
||||
|
||||
if ( (r_flaresDlightShrink->integer) && (f->type == 1) ) // leilei - dynamic light flares shrinking when close
|
||||
{
|
||||
if ( (r_flaresDlightShrink->integer) && (f->type == 1) ) { // leilei - dynamic light flares shrinking when close
|
||||
|
||||
float newd = distance / (48.0f);
|
||||
if (newd > 1) newd = 1.0f;
|
||||
@@ -614,19 +615,19 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
|
||||
// calculate the flare size..
|
||||
|
||||
/*
|
||||
/*
|
||||
* This is an alternative to intensity scaling. It changes the size of the flare on screen instead
|
||||
* with growing distance. See in the description at the top why this is not the way to go.
|
||||
*/
|
||||
*/
|
||||
// size will change ~ 1/r.
|
||||
if (r_flareMethod->integer == 1 || r_flareMethod->integer == 4 ){ // The "not the way to go" method.
|
||||
if (r_flareMethod->integer == 1 || r_flareMethod->integer == 4 ) { // The "not the way to go" method.
|
||||
// seen in EF
|
||||
size = flaredsize * (r_flareSize->value / (distance * -2.0f));
|
||||
}
|
||||
else if (r_flareMethod->integer == 2){ // Raven method
|
||||
size = flaredsize * ( r_flareSize->value/640.0f + 8 / -f->eyeZ ); }
|
||||
else
|
||||
{
|
||||
else if (r_flareMethod->integer == 2) { // Raven method
|
||||
size = flaredsize * ( r_flareSize->value/640.0f + 8 / -f->eyeZ );
|
||||
}
|
||||
else {
|
||||
|
||||
size = flaredsize * ( (r_flareSize->value) /640.0f + 8 / distance );
|
||||
|
||||
@@ -638,7 +639,7 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* As flare sizes stay nearly constant with increasing distance we must decrease the intensity
|
||||
* to achieve a reasonable visual result. The intensity is ~ (size^2 / distance^2) which can be
|
||||
* got by considering the ratio of
|
||||
@@ -661,8 +662,7 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
else
|
||||
intensity = flareCoeff * size * size / (factor * factor);
|
||||
|
||||
if (r_flareMethod->integer == 1) // leilei - stupid hack to fix the not the way method
|
||||
{
|
||||
if (r_flareMethod->integer == 1) { // leilei - stupid hack to fix the not the way method
|
||||
if (intensity > 1) intensity = 1;
|
||||
|
||||
}
|
||||
@@ -678,8 +678,7 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
|
||||
|
||||
// Calculations for fogging
|
||||
if(tr.world && f->fogNum > 0 && f->fogNum < tr.world->numfogs)
|
||||
{
|
||||
if(tr.world && f->fogNum > 0 && f->fogNum < tr.world->numfogs) {
|
||||
tess.numVertexes = 1;
|
||||
VectorCopy(f->origin, tess.xyz[0]);
|
||||
tess.fogNum = f->fogNum;
|
||||
@@ -705,20 +704,17 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
|
||||
|
||||
float halfer = 1;
|
||||
if (f->ftype == 5 || f->ftype == 6 || f->ftype == 7 || f->ftype == 166){
|
||||
if (f->ftype == 5 || f->ftype == 6 || f->ftype == 7 || f->ftype == 166) {
|
||||
RB_BeginSurface( tr.flareShaderAtlas, f->fogNum );
|
||||
halfer = 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
|
||||
|
||||
if (r_flareQuality->integer) // leilei - high quality flares get no depth testing
|
||||
{
|
||||
if (r_flareQuality->integer) { // leilei - high quality flares get no depth testing
|
||||
int index;
|
||||
|
||||
for(index = 0; index <f->theshader->numUnfoggedPasses; index++)
|
||||
{
|
||||
for(index = 0; index <f->theshader->numUnfoggedPasses; index++) {
|
||||
f->theshader->stages[index]->adjustColorsForFog = ACFF_NONE;
|
||||
f->theshader->stages[index]->stateBits |= GLS_DEPTHTEST_DISABLE;
|
||||
}
|
||||
@@ -783,7 +779,7 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
|
||||
// reflections -- tcpparena
|
||||
|
||||
if(f->ftype == 2 || f->ftype == 4){
|
||||
if(f->ftype == 2 || f->ftype == 4) {
|
||||
|
||||
// renders sharp lens flare.
|
||||
|
||||
@@ -799,7 +795,7 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
int n;
|
||||
cx=backEnd.viewParms.viewportX+(backEnd.viewParms.viewportWidth>>1);
|
||||
cy=backEnd.viewParms.viewportY+(backEnd.viewParms.viewportHeight>>1);
|
||||
for(n=0;n<5;n++){
|
||||
for(n=0; n<5; n++) {
|
||||
dx=(f->windowX-cx)*poses[n]+cx;
|
||||
dy=(f->windowY-cy)*poses[n]+cy;
|
||||
size2=sizes[n]*backEnd.viewParms.viewportWidth*.25f;
|
||||
@@ -888,7 +884,7 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
|
||||
|
||||
|
||||
if(f->ftype == 3 || f->ftype == 4){
|
||||
if(f->ftype == 3 || f->ftype == 4) {
|
||||
|
||||
// renders fuzzy lens flare.
|
||||
|
||||
@@ -905,7 +901,7 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
cy=backEnd.viewParms.viewportY+(backEnd.viewParms.viewportHeight>>1);
|
||||
|
||||
|
||||
for(n=0;n<2;n++){
|
||||
for(n=0; n<2; n++) {
|
||||
dx=(f->windowX-cx)*poses[n]+cx;
|
||||
dy=(f->windowY-cy)*poses[n]+cy;
|
||||
size2=sizes[n]*flaredsize2*.25f;
|
||||
@@ -969,7 +965,7 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
|
||||
float drak;
|
||||
|
||||
if(f->ftype == 5 || f->ftype == 6 || f->ftype == 7 || f->ftype == 166){
|
||||
if(f->ftype == 5 || f->ftype == 6 || f->ftype == 7 || f->ftype == 166) {
|
||||
|
||||
// renders special atlas lens flare like fuzzy but not fuzzy
|
||||
int modess;
|
||||
@@ -981,7 +977,7 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
float size2;
|
||||
float poses[]= {-1.0f, -0.75f, -0.64f, -0.57f, -0.37f, -0.35f, -0.3f, 1.2f, -.21f, 0.15f, .38f, .56f, .52f, 0.6f, 1.2f, 1.37f};
|
||||
float sizes[]= {1.15f, 0.7f, 0.2f, 0.35f, 0.24f, .86f, .357f, 2.3f, 0.15f, 0.09f, 0.21f, 0.7f, 0.37f, 0.23f, 0.3f, 1.2f};
|
||||
float atlases[]={4, 2, 1, 2, 2, 2, 2, 1, 1, 1, 2, 7, 8, 2, 3, 2};
|
||||
float atlases[]= {4, 2, 1, 2, 2, 2, 2, 1, 1, 1, 2, 7, 8, 2, 3, 2};
|
||||
|
||||
float downsize1 = 0.25f;
|
||||
float downsize2 = 0.25f;
|
||||
@@ -997,38 +993,52 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
cy=backEnd.viewParms.viewportY+(backEnd.viewParms.viewportHeight>>1);
|
||||
|
||||
|
||||
for(n=0;n<16;n++){
|
||||
for(n=0; n<16; n++) {
|
||||
dx=(f->windowX-cx)*poses[n]+cx;
|
||||
dy=(f->windowY-cy)*poses[n]+cy;
|
||||
size2=sizes[n]*flaredsize2*.25f;
|
||||
|
||||
drak = f->radius * 0.07;
|
||||
if (atlases[n] == 1){ downsize1 = 1; downsize2 = 1; };
|
||||
if (atlases[n] == 3){ downsize1 = 1; downsize2 = -1; };
|
||||
if (atlases[n] == 4){ downsize1 = -1; downsize2 = -1; };
|
||||
if (atlases[n] == 2){ downsize1 = -1; downsize2 = 1; };
|
||||
if (atlases[n] == 1) {
|
||||
downsize1 = 1;
|
||||
downsize2 = 1;
|
||||
};
|
||||
if (atlases[n] == 3) {
|
||||
downsize1 = 1;
|
||||
downsize2 = -1;
|
||||
};
|
||||
if (atlases[n] == 4) {
|
||||
downsize1 = -1;
|
||||
downsize2 = -1;
|
||||
};
|
||||
if (atlases[n] == 2) {
|
||||
downsize1 = -1;
|
||||
downsize2 = 1;
|
||||
};
|
||||
|
||||
|
||||
if (modess == 1){
|
||||
if (modess == 1) {
|
||||
brightness1[n] = brightness1[n] + brightness2[n] + brightness3[n] * 0.0100;
|
||||
brightness2[n] = brightness1[n]; brightness3[n] = brightness1[n];
|
||||
brightness2[n] = brightness1[n];
|
||||
brightness3[n] = brightness1[n];
|
||||
}
|
||||
brightness1[n]=(int)(brightness1[n]*r_lensReflectionBrightness->value) * drak;
|
||||
brightness2[n]=(int)(brightness2[n]*r_lensReflectionBrightness->value) * drak;
|
||||
brightness3[n]=(int)(brightness3[n]*r_lensReflectionBrightness->value) * drak;
|
||||
|
||||
if (modess == 2){
|
||||
iColor[0] = 32.0f; iColor[1] = 32.0f; iColor[2] = 32.0f;
|
||||
if (modess == 2) {
|
||||
iColor[0] = 32.0f;
|
||||
iColor[1] = 32.0f;
|
||||
iColor[2] = 32.0f;
|
||||
}
|
||||
|
||||
if (pvrhack){
|
||||
if (modess == 2){
|
||||
if (pvrhack) {
|
||||
if (modess == 2) {
|
||||
colarz[0] = ceil(iColor[0]*brightness1[n]);
|
||||
colarz[1] = ceil(iColor[1]*brightness2[n]);
|
||||
colarz[2] = ceil(iColor[2]*brightness3[n]);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
colarz[0] = ceil(iColor[0]);
|
||||
colarz[1] = ceil(iColor[1]);
|
||||
colarz[2] = ceil(iColor[2]);
|
||||
@@ -1098,7 +1108,7 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
}
|
||||
}
|
||||
|
||||
if(f->ftype == 8 ){
|
||||
if(f->ftype == 8 ) {
|
||||
|
||||
// renders anamorphic flare
|
||||
// JUST LIKE TEH MOVEEZ!!!!!!!!!
|
||||
@@ -1117,7 +1127,7 @@ void RB_RenderFlare( flare_t *f ) {
|
||||
cy=backEnd.viewParms.viewportY+(backEnd.viewParms.viewportHeight>>1);
|
||||
|
||||
drak = f->radius * 0.02;
|
||||
for(n=0;n<3;n++){
|
||||
for(n=0; n<3; n++) {
|
||||
dx=(f->windowX-cx)*poses[n]+cx;
|
||||
dy=(f->windowY-cy)*poses[n]+cy;
|
||||
size2=sizes[n]*flaredsize2 * drak*.25f;
|
||||
@@ -1200,7 +1210,8 @@ when occluded by something in the main view, and portal flares that should
|
||||
extend past the portal edge will be overwritten.
|
||||
==================
|
||||
*/
|
||||
void RB_RenderFlares (void) {
|
||||
void RB_RenderFlares (void)
|
||||
{
|
||||
flare_t *f;
|
||||
flare_t **prev;
|
||||
qboolean draw;
|
||||
@@ -1213,8 +1224,7 @@ void RB_RenderFlares (void) {
|
||||
// a very very very very nasty error relating to the trace checks
|
||||
// leading to recursive startup in te OA3 menu
|
||||
|
||||
if(r_flareCoeff->modified)
|
||||
{
|
||||
if(r_flareCoeff->modified) {
|
||||
R_SetFlareCoeff();
|
||||
r_flareCoeff->modified = qfalse;
|
||||
}
|
||||
@@ -1258,7 +1268,8 @@ void RB_RenderFlares (void) {
|
||||
|
||||
if ( f->drawIntensity ) {
|
||||
draw = qtrue;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// this flare has completely faded out, so remove it from the chain
|
||||
*prev = f->next;
|
||||
f->next = r_inactiveFlares;
|
||||
@@ -1302,7 +1313,8 @@ void RB_RenderFlares (void) {
|
||||
|
||||
|
||||
|
||||
void RB_DrawSunFlare( void ) {
|
||||
void RB_DrawSunFlare( void )
|
||||
{
|
||||
float size;
|
||||
float dist;
|
||||
vec3_t origin, vec1, vec2;
|
||||
@@ -1354,7 +1366,7 @@ void RB_DrawSunFlare( void ) {
|
||||
|
||||
|
||||
int g;
|
||||
for (g=0;g<3;g++)
|
||||
for (g=0; g<3; g++)
|
||||
if (coll[g] > 1) coll[g] = 1;
|
||||
|
||||
VectorCopy( origin, temp );
|
||||
|
@@ -285,8 +285,7 @@ static void InitOpenGL( void )
|
||||
// - r_gamma
|
||||
//
|
||||
|
||||
if ( glConfig.vidWidth == 0 )
|
||||
{
|
||||
if ( glConfig.vidWidth == 0 ) {
|
||||
GLint temp;
|
||||
|
||||
GLimp_Init();
|
||||
@@ -300,8 +299,7 @@ static void InitOpenGL( void )
|
||||
glConfig.maxTextureSize = temp;
|
||||
|
||||
// stubbed or broken drivers may have reported 0...
|
||||
if ( glConfig.maxTextureSize <= 0 )
|
||||
{
|
||||
if ( glConfig.maxTextureSize <= 0 ) {
|
||||
glConfig.maxTextureSize = 0;
|
||||
}
|
||||
}
|
||||
@@ -315,7 +313,8 @@ static void InitOpenGL( void )
|
||||
GL_CheckErrors
|
||||
==================
|
||||
*/
|
||||
void GL_CheckErrors( void ) {
|
||||
void GL_CheckErrors( void )
|
||||
{
|
||||
int err;
|
||||
char s[64];
|
||||
|
||||
@@ -357,15 +356,13 @@ void GL_CheckErrors( void ) {
|
||||
/*
|
||||
** R_GetModeInfo
|
||||
*/
|
||||
typedef struct vidmode_s
|
||||
{
|
||||
typedef struct vidmode_s {
|
||||
const char *description;
|
||||
int width, height;
|
||||
float pixelAspect; // pixel width / height
|
||||
} vidmode_t;
|
||||
|
||||
vidmode_t r_vidModes[] =
|
||||
{
|
||||
vidmode_t r_vidModes[] = {
|
||||
{ "Mode 0: 320x240", 320, 240, 1 },
|
||||
{ "Mode 1: 400x300", 400, 300, 1 },
|
||||
{ "Mode 2: 512x384", 512, 384, 1 },
|
||||
@@ -397,7 +394,8 @@ vidmode_t r_vidModes[] =
|
||||
};
|
||||
static int s_numVidModes = ARRAY_LEN( r_vidModes );
|
||||
|
||||
qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode ) {
|
||||
qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode )
|
||||
{
|
||||
vidmode_t *vm;
|
||||
float pixelAspect;
|
||||
|
||||
@@ -412,7 +410,8 @@ qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode )
|
||||
*width = r_customwidth->integer;
|
||||
*height = r_customheight->integer;
|
||||
pixelAspect = r_customPixelAspect->value;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
vm = &r_vidModes[mode];
|
||||
|
||||
*width = vm->width;
|
||||
@@ -433,8 +432,7 @@ static void R_ModeList_f( void )
|
||||
int i;
|
||||
|
||||
ri.Printf( PRINT_ALL, "\n" );
|
||||
for ( i = 0; i < s_numVidModes; i++ )
|
||||
{
|
||||
for ( i = 0; i < s_numVidModes; i++ ) {
|
||||
ri.Printf( PRINT_ALL, "%s\n", r_vidModes[i].description );
|
||||
}
|
||||
ri.Printf( PRINT_ALL, "\n" );
|
||||
@@ -532,12 +530,10 @@ void RB_TakeScreenshot(int x, int y, int width, int height, char *fileName)
|
||||
srcptr = destptr = allbuf + offset;
|
||||
endmem = srcptr + (linelen + padlen) * height;
|
||||
|
||||
while(srcptr < endmem)
|
||||
{
|
||||
while(srcptr < endmem) {
|
||||
endline = srcptr + linelen;
|
||||
|
||||
while(srcptr < endline)
|
||||
{
|
||||
while(srcptr < endline) {
|
||||
temp = srcptr[0];
|
||||
*destptr++ = srcptr[2];
|
||||
*destptr++ = srcptr[1];
|
||||
@@ -594,13 +590,14 @@ RB_TakeScreenshotCmd
|
||||
extern int tvWidth;
|
||||
extern int tvHeight;
|
||||
|
||||
const void *RB_TakeScreenshotCmd( const void *data ) {
|
||||
const void *RB_TakeScreenshotCmd( const void *data )
|
||||
{
|
||||
const screenshotCommand_t *cmd;
|
||||
|
||||
cmd = (const screenshotCommand_t *)data;
|
||||
|
||||
// leilei - hack for tvmode
|
||||
if (r_tvMode->integer > -1){
|
||||
if (r_tvMode->integer > -1) {
|
||||
|
||||
if (cmd->jpeg)
|
||||
RB_TakeScreenshotJPEG( cmd->x, cmd->y, tvWidth, tvHeight, cmd->fileName);
|
||||
@@ -621,7 +618,8 @@ const void *RB_TakeScreenshotCmd( const void *data ) {
|
||||
R_TakeScreenshot
|
||||
==================
|
||||
*/
|
||||
void R_TakeScreenshot( int x, int y, int width, int height, char *name, qboolean jpeg ) {
|
||||
void R_TakeScreenshot( int x, int y, int width, int height, char *name, qboolean jpeg )
|
||||
{
|
||||
static char fileName[MAX_OSPATH]; // bad things if two screenshots per frame?
|
||||
screenshotCommand_t *cmd;
|
||||
|
||||
@@ -645,7 +643,8 @@ void R_TakeScreenshot( int x, int y, int width, int height, char *name, qboolean
|
||||
R_ScreenshotFilename
|
||||
==================
|
||||
*/
|
||||
void R_ScreenshotFilename( int lastNumber, char *fileName ) {
|
||||
void R_ScreenshotFilename( int lastNumber, char *fileName )
|
||||
{
|
||||
int a,b,c,d;
|
||||
|
||||
if ( lastNumber < 0 || lastNumber > 9999 ) {
|
||||
@@ -670,7 +669,8 @@ void R_ScreenshotFilename( int lastNumber, char *fileName ) {
|
||||
R_ScreenshotFilename
|
||||
==================
|
||||
*/
|
||||
void R_ScreenshotFilenameJPEG( int lastNumber, char *fileName ) {
|
||||
void R_ScreenshotFilenameJPEG( int lastNumber, char *fileName )
|
||||
{
|
||||
int a,b,c,d;
|
||||
|
||||
if ( lastNumber < 0 || lastNumber > 9999 ) {
|
||||
@@ -698,7 +698,8 @@ levelshots are specialized 128*128 thumbnails for
|
||||
the menu system, sampled down from full screen distorted images
|
||||
====================
|
||||
*/
|
||||
void R_LevelShot( void ) {
|
||||
void R_LevelShot( void )
|
||||
{
|
||||
char checkname[MAX_OSPATH];
|
||||
byte *buffer;
|
||||
byte *source, *allsource;
|
||||
@@ -769,7 +770,8 @@ screenshot [filename]
|
||||
Doesn't print the pacifier message if there is a second arg
|
||||
==================
|
||||
*/
|
||||
void R_ScreenShot_f (void) {
|
||||
void R_ScreenShot_f (void)
|
||||
{
|
||||
char checkname[MAX_OSPATH];
|
||||
static int lastNumber = -1;
|
||||
qboolean silent;
|
||||
@@ -781,14 +783,16 @@ void R_ScreenShot_f (void) {
|
||||
|
||||
if ( !strcmp( ri.Cmd_Argv(1), "silent" ) ) {
|
||||
silent = qtrue;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
silent = qfalse;
|
||||
}
|
||||
|
||||
if ( ri.Cmd_Argc() == 2 && !silent ) {
|
||||
// explicit filename
|
||||
Com_sprintf( checkname, MAX_OSPATH, "screenshots/%s.tga", ri.Cmd_Argv( 1 ) );
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// scan for a free filename
|
||||
|
||||
// if we have saved a previous screenshot, don't scan
|
||||
@@ -801,8 +805,7 @@ void R_ScreenShot_f (void) {
|
||||
for ( ; lastNumber <= 9999 ; lastNumber++ ) {
|
||||
R_ScreenshotFilename( lastNumber, checkname );
|
||||
|
||||
if (!ri.FS_FileExists( checkname ))
|
||||
{
|
||||
if (!ri.FS_FileExists( checkname )) {
|
||||
break; // file doesn't exist
|
||||
}
|
||||
}
|
||||
@@ -822,7 +825,8 @@ void R_ScreenShot_f (void) {
|
||||
}
|
||||
}
|
||||
|
||||
void R_ScreenShotJPEG_f (void) {
|
||||
void R_ScreenShotJPEG_f (void)
|
||||
{
|
||||
char checkname[MAX_OSPATH];
|
||||
static int lastNumber = -1;
|
||||
qboolean silent;
|
||||
@@ -834,14 +838,16 @@ void R_ScreenShotJPEG_f (void) {
|
||||
|
||||
if ( !strcmp( ri.Cmd_Argv(1), "silent" ) ) {
|
||||
silent = qtrue;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
silent = qfalse;
|
||||
}
|
||||
|
||||
if ( ri.Cmd_Argc() == 2 && !silent ) {
|
||||
// explicit filename
|
||||
Com_sprintf( checkname, MAX_OSPATH, "screenshots/%s.jpg", ri.Cmd_Argv( 1 ) );
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// scan for a free filename
|
||||
|
||||
// if we have saved a previous screenshot, don't scan
|
||||
@@ -854,8 +860,7 @@ void R_ScreenShotJPEG_f (void) {
|
||||
for ( ; lastNumber <= 9999 ; lastNumber++ ) {
|
||||
R_ScreenshotFilenameJPEG( lastNumber, checkname );
|
||||
|
||||
if (!ri.FS_FileExists( checkname ))
|
||||
{
|
||||
if (!ri.FS_FileExists( checkname )) {
|
||||
break; // file doesn't exist
|
||||
}
|
||||
}
|
||||
@@ -914,15 +919,13 @@ const void *RB_TakeVideoFrameCmd( const void *data )
|
||||
if(glConfig.deviceSupportsGamma)
|
||||
R_GammaCorrect(cBuf, memcount);
|
||||
|
||||
if(cmd->motionJpeg)
|
||||
{
|
||||
if(cmd->motionJpeg) {
|
||||
memcount = RE_SaveJPGToBuffer(cmd->encodeBuffer, linelen * cmd->height,
|
||||
r_aviMotionJpegQuality->integer,
|
||||
cmd->width, cmd->height, cBuf, padlen);
|
||||
ri.CL_WriteAVIVideoFrame(cmd->encodeBuffer, memcount);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
byte *lineend, *memend;
|
||||
byte *srcptr, *destptr;
|
||||
|
||||
@@ -931,11 +934,9 @@ const void *RB_TakeVideoFrameCmd( const void *data )
|
||||
memend = srcptr + memcount;
|
||||
|
||||
// swap R and B and remove line paddings
|
||||
while(srcptr < memend)
|
||||
{
|
||||
while(srcptr < memend) {
|
||||
lineend = srcptr + linelen;
|
||||
while(srcptr < lineend)
|
||||
{
|
||||
while(srcptr < lineend) {
|
||||
*destptr++ = srcptr[2];
|
||||
*destptr++ = srcptr[1];
|
||||
*destptr++ = srcptr[0];
|
||||
@@ -1008,14 +1009,14 @@ R_PrintLongString
|
||||
Workaround for ri.Printf's 1024 characters buffer limit.
|
||||
================
|
||||
*/
|
||||
void R_PrintLongString(const char *string) {
|
||||
void R_PrintLongString(const char *string)
|
||||
{
|
||||
char buffer[1024];
|
||||
const char *p;
|
||||
int size = strlen(string);
|
||||
|
||||
p = string;
|
||||
while(size > 0)
|
||||
{
|
||||
while(size > 0) {
|
||||
Q_strncpyz(buffer, p, sizeof (buffer) );
|
||||
ri.Printf( PRINT_ALL, "%s", buffer );
|
||||
p += 1023;
|
||||
@@ -1030,13 +1031,11 @@ GfxInfo_f
|
||||
*/
|
||||
void GfxInfo_f( void )
|
||||
{
|
||||
const char *enablestrings[] =
|
||||
{
|
||||
const char *enablestrings[] = {
|
||||
"disabled",
|
||||
"enabled"
|
||||
};
|
||||
const char *fsstrings[] =
|
||||
{
|
||||
const char *fsstrings[] = {
|
||||
"windowed",
|
||||
"fullscreen"
|
||||
};
|
||||
@@ -1051,20 +1050,16 @@ void GfxInfo_f( void )
|
||||
ri.Printf( PRINT_ALL, "GL_MAX_TEXTURE_UNITS_ARB: %d\n", glConfig.numTextureUnits );
|
||||
ri.Printf( PRINT_ALL, "\nPIXELFORMAT: color(%d-bits) Z(%d-bit) stencil(%d-bits)\n", glConfig.colorBits, glConfig.depthBits, glConfig.stencilBits );
|
||||
ri.Printf( PRINT_ALL, "MODE: %d, %d x %d %s hz:", r_mode->integer, glConfig.vidWidth, glConfig.vidHeight, fsstrings[r_fullscreen->integer == 1] );
|
||||
if ( glConfig.displayFrequency )
|
||||
{
|
||||
if ( glConfig.displayFrequency ) {
|
||||
ri.Printf( PRINT_ALL, "%d\n", glConfig.displayFrequency );
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ri.Printf( PRINT_ALL, "N/A\n" );
|
||||
}
|
||||
if ( glConfig.deviceSupportsGamma )
|
||||
{
|
||||
if ( glConfig.deviceSupportsGamma ) {
|
||||
ri.Printf( PRINT_ALL, "GAMMA: hardware w/ %d overbright bits\n", tr.overbrightBits );
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ri.Printf( PRINT_ALL, "GAMMA: software w/ %d overbright bits\n", tr.overbrightBits );
|
||||
}
|
||||
|
||||
@@ -1078,17 +1073,21 @@ void GfxInfo_f( void )
|
||||
if ( primitives == 0 ) {
|
||||
if ( qglLockArraysEXT ) {
|
||||
primitives = 2;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
primitives = 1;
|
||||
}
|
||||
}
|
||||
if ( primitives == -1 ) {
|
||||
ri.Printf( PRINT_ALL, "none\n" );
|
||||
} else if ( primitives == 2 ) {
|
||||
}
|
||||
else if ( primitives == 2 ) {
|
||||
ri.Printf( PRINT_ALL, "single glDrawElements\n" );
|
||||
} else if ( primitives == 1 ) {
|
||||
}
|
||||
else if ( primitives == 1 ) {
|
||||
ri.Printf( PRINT_ALL, "multiple glArrayElement\n" );
|
||||
} else if ( primitives == 3 ) {
|
||||
}
|
||||
else if ( primitives == 3 ) {
|
||||
ri.Printf( PRINT_ALL, "multiple glColor4ubv + glTexCoord2fv + glVertex3fv\n" );
|
||||
}
|
||||
}
|
||||
@@ -1101,22 +1100,19 @@ void GfxInfo_f( void )
|
||||
ri.Printf( PRINT_ALL, "texenv add: %s\n", enablestrings[glConfig.textureEnvAddAvailable != 0] );
|
||||
ri.Printf( PRINT_ALL, "compressed textures: %s\n", enablestrings[glConfig.textureCompression!=TC_NONE] );
|
||||
ri.Printf( PRINT_ALL, "glsl programs: %s\n", enablestrings[vertexShaders] );
|
||||
if ( r_vertexLight->integer || glConfig.hardwareType == GLHW_PERMEDIA2 )
|
||||
{
|
||||
if ( r_vertexLight->integer || glConfig.hardwareType == GLHW_PERMEDIA2 ) {
|
||||
ri.Printf( PRINT_ALL, "HACK: using vertex lightmap approximation\n" );
|
||||
}
|
||||
if ( glConfig.hardwareType == GLHW_RAGEPRO )
|
||||
{
|
||||
if ( glConfig.hardwareType == GLHW_RAGEPRO ) {
|
||||
ri.Printf( PRINT_ALL, "HACK: ragePro approximations\n" );
|
||||
}
|
||||
if ( glConfig.hardwareType == GLHW_RIVA128 )
|
||||
{
|
||||
if ( glConfig.hardwareType == GLHW_RIVA128 ) {
|
||||
ri.Printf( PRINT_ALL, "HACK: riva128 approximations\n" );
|
||||
}
|
||||
if ( r_finish->integer ) {
|
||||
ri.Printf( PRINT_ALL, "Forcing glFinish\n" );
|
||||
}
|
||||
if (voodootype){
|
||||
if (voodootype) {
|
||||
|
||||
if (voodootype == 1)
|
||||
ri.Printf( PRINT_ALL, "3Dfx Voodoo Graphics assumed\n" );
|
||||
@@ -1140,9 +1136,9 @@ R_Register
|
||||
*/
|
||||
void R_Register( void )
|
||||
{
|
||||
#ifdef USE_RENDERER_DLOPEN
|
||||
#ifdef USE_RENDERER_DLOPEN
|
||||
com_altivec = ri.Cvar_Get("com_altivec", "1", CVAR_ARCHIVE);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined( _WIN32 )
|
||||
// leilei - Get some version info first, code torn from quake
|
||||
@@ -1385,7 +1381,8 @@ void R_Register( void )
|
||||
* R_GLSL_AllocProgram
|
||||
* Reserve memory for program
|
||||
*/
|
||||
static glslProgram_t *R_GLSL_AllocProgram(void) {
|
||||
static glslProgram_t *R_GLSL_AllocProgram(void)
|
||||
{
|
||||
glslProgram_t *program;
|
||||
|
||||
if (tr.numPrograms == MAX_PROGRAMS)
|
||||
@@ -1446,7 +1443,8 @@ static glslProgram_t *R_GLSL_AllocProgram(void) {
|
||||
* Load all default GLSL programs which are not loaded via the q3 shader system
|
||||
*/
|
||||
|
||||
void R_GLSL_Init(void) {
|
||||
void R_GLSL_Init(void)
|
||||
{
|
||||
#ifdef GLSL_BACKEND
|
||||
glslProgram_t *program;
|
||||
char programVertexObjects[MAX_PROGRAM_OBJECTS][MAX_QPATH];
|
||||
@@ -1549,8 +1547,7 @@ void R_GLSL_Init(void) {
|
||||
Q_strncpyz(programFragmentObjects[0], "glsl/ntsc_bleed_fp.glsl", sizeof(programFragmentObjects[0]));
|
||||
tr.NTSCBleedProgram = RE_GLSL_RegisterProgram("ntsc_bleed", (const char *)programVertexObjects, 1, (const char *)programFragmentObjects, 1);
|
||||
|
||||
if (strcmp( (const char *)r_postprocess->string, "none" ))
|
||||
{
|
||||
if (strcmp( (const char *)r_postprocess->string, "none" )) {
|
||||
sprintf(p,"glsl/%s_vp.glsl",r_postprocess->string);
|
||||
Q_strncpyz(programVertexObjects[0], (const char *)&p, sizeof(programVertexObjects[0]));
|
||||
sprintf(p,"glsl/%s_fp.glsl",r_postprocess->string);
|
||||
@@ -1570,7 +1567,8 @@ extern qboolean initparticles;
|
||||
R_Init
|
||||
===============
|
||||
*/
|
||||
void R_Init( void ) {
|
||||
void R_Init( void )
|
||||
{
|
||||
int err;
|
||||
int i;
|
||||
byte *ptr;
|
||||
@@ -1595,26 +1593,21 @@ void R_Init( void ) {
|
||||
//
|
||||
// init function tables
|
||||
//
|
||||
for ( i = 0; i < FUNCTABLE_SIZE; i++ )
|
||||
{
|
||||
for ( i = 0; i < FUNCTABLE_SIZE; i++ ) {
|
||||
tr.sinTable[i] = sin( DEG2RAD( i * 360.0f / ( ( float ) ( FUNCTABLE_SIZE - 1 ) ) ) );
|
||||
tr.squareTable[i] = ( i < FUNCTABLE_SIZE/2 ) ? 1.0f : -1.0f;
|
||||
tr.sawToothTable[i] = (float)i / FUNCTABLE_SIZE;
|
||||
tr.inverseSawToothTable[i] = 1.0f - tr.sawToothTable[i];
|
||||
|
||||
if ( i < FUNCTABLE_SIZE / 2 )
|
||||
{
|
||||
if ( i < FUNCTABLE_SIZE / 4 )
|
||||
{
|
||||
if ( i < FUNCTABLE_SIZE / 2 ) {
|
||||
if ( i < FUNCTABLE_SIZE / 4 ) {
|
||||
tr.triangleTable[i] = ( float ) i / ( FUNCTABLE_SIZE / 4 );
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
tr.triangleTable[i] = 1.0f - tr.triangleTable[i-FUNCTABLE_SIZE / 4];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
tr.triangleTable[i] = -tr.triangleTable[i-FUNCTABLE_SIZE/2];
|
||||
}
|
||||
}
|
||||
@@ -1672,7 +1665,8 @@ void R_Init( void ) {
|
||||
RE_Shutdown
|
||||
===============
|
||||
*/
|
||||
void RE_Shutdown( qboolean destroyWindow ) {
|
||||
void RE_Shutdown( qboolean destroyWindow )
|
||||
{
|
||||
|
||||
ri.Printf( PRINT_ALL, "RE_Shutdown( %i )\n", destroyWindow );
|
||||
|
||||
@@ -1715,7 +1709,8 @@ RE_EndRegistration
|
||||
Touch all images to make sure they are resident
|
||||
=============
|
||||
*/
|
||||
void RE_EndRegistration( void ) {
|
||||
void RE_EndRegistration( void )
|
||||
{
|
||||
R_IssuePendingRenderCommands();
|
||||
if (!ri.Sys_LowPhysicalMemory()) {
|
||||
RB_ShowImages();
|
||||
@@ -1730,9 +1725,11 @@ GetRefAPI
|
||||
@@@@@@@@@@@@@@@@@@@@@
|
||||
*/
|
||||
#ifdef USE_RENDERER_DLOPEN
|
||||
Q_EXPORT refexport_t* QDECL GetRefAPI ( int apiVersion, refimport_t *rimp ) {
|
||||
Q_EXPORT refexport_t* QDECL GetRefAPI ( int apiVersion, refimport_t *rimp )
|
||||
{
|
||||
#else
|
||||
refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp ) {
|
||||
refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp )
|
||||
{
|
||||
#endif
|
||||
|
||||
static refexport_t re;
|
||||
|
@@ -2373,18 +2373,18 @@ void R_MotionBlur_BackupScreen(int which);
|
||||
void R_AddParticles (void);
|
||||
void R_RenderParticles (void);
|
||||
void R_ClearParticles (void);
|
||||
void R_LFX_Spark (vec3_t org, vec3_t dir, float spread, float speed, vec4_t color1, vec4_t color2, vec4_t color3, vec4_t color4, vec4_t color5, int count, int duration, float scaleup, int blendfunc);
|
||||
void R_LFX_Smoke (vec3_t org, vec3_t dir, float spread, float speed, vec4_t color1, vec4_t color2, vec4_t color3, vec4_t color4, vec4_t color5, int count, int duration, float scaleup, int blendfunc);
|
||||
void R_LFX_Smoke2 (vec3_t org, vec3_t dir, float spread, float speed, vec4_t color1, vec4_t color2, vec4_t color3, vec4_t color4, vec4_t color5, int count, int duration, float scale, float scaleup, int blendfunc);
|
||||
void R_LFX_Shock (vec3_t org, vec3_t dir, float spread, float speed, vec4_t color1, vec4_t color2, vec4_t color3, vec4_t color4, vec4_t color5, int count, int duration, float scaleup, int blendfunc);
|
||||
void R_LFX_Burst (vec3_t org, vec3_t dir, float spread, float speed, vec4_t color1, vec4_t color2, vec4_t color3, vec4_t color4, vec4_t color5, int count, int duration, float scaleup, int blendfunc);
|
||||
void R_LFX_PushSmoke (vec3_t there, float force);
|
||||
void R_LFX_Spark (const vec3_t org, const vec3_t dir, float spread, float speed, vec4_t color1, vec4_t color2, vec4_t color3, vec4_t color4, vec4_t color5, int count, int duration, float scaleup, int blendfunc);
|
||||
void R_LFX_Smoke (const vec3_t org, const vec3_t dir, float spread, float speed, vec4_t color1, vec4_t color2, vec4_t color3, vec4_t color4, vec4_t color5, int count, int duration, float scaleup, int blendfunc);
|
||||
void R_LFX_Smoke2 (const vec3_t org, const vec3_t dir, float spread, float speed, vec4_t color1, vec4_t color2, vec4_t color3, vec4_t color4, vec4_t color5, int count, int duration, float scale, float scaleup, int blendfunc);
|
||||
void R_LFX_Shock (const vec3_t org, const vec3_t dir, float spread, float speed, vec4_t color1, vec4_t color2, vec4_t color3, vec4_t color4, vec4_t color5, int count, int duration, float scaleup, int blendfunc);
|
||||
void R_LFX_Burst (const vec3_t org, const vec3_t dir, float spread, float speed, vec4_t color1, vec4_t color2, vec4_t color3, vec4_t color4, vec4_t color5, int count, int duration, float scaleup, int blendfunc);
|
||||
void R_LFX_PushSmoke (const vec3_t there, float force);
|
||||
|
||||
void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
|
||||
void R_QarticleExplosion(vec3_t org);
|
||||
void R_LFX_Blood (vec3_t org, vec3_t dir, float pressure) ;
|
||||
void R_RunParticleEffect (const vec3_t org, const vec3_t dir, int color, int count);
|
||||
void R_QarticleExplosion(const vec3_t org);
|
||||
void R_LFX_Blood (const vec3_t org, const vec3_t dir, float pressure) ;
|
||||
void LFX_ShaderInit(void);
|
||||
void LFX_ParticleEffect (int effect, vec3_t org, vec3_t dir);
|
||||
void LFX_ParticleEffect (int effect, const vec3_t org, const vec3_t dir);
|
||||
|
||||
#endif //TR_LOCAL_H
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user