[qfusion-cvs-commits] SF.net SVN: l33t: [786] trunk/qfusion/source/ref_gl
Brought to you by:
digiman
|
From: qfusion s. c. <l33...@li...> - 2007-12-03 18:42:42
|
Revision: 786
http://l33t.svn.sourceforge.net/l33t/?rev=786&view=rev
Author: digiman
Date: 2007-12-03 10:42:41 -0800 (Mon, 03 Dec 2007)
Log Message:
-----------
Default r_bloom_sample_size to 320 and make it possible to have NPOT sampling texture
Modified Paths:
--------------
trunk/qfusion/source/ref_gl/r_bloom.c
trunk/qfusion/source/ref_gl/r_register.c
Modified: trunk/qfusion/source/ref_gl/r_bloom.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_bloom.c 2007-12-03 15:53:38 UTC (rev 785)
+++ trunk/qfusion/source/ref_gl/r_bloom.c 2007-12-03 18:42:41 UTC (rev 786)
@@ -141,30 +141,21 @@
static void R_Bloom_InitEffectTexture( void )
{
qbyte *data;
- float bloomsizecheck;
+ int limit;
if( r_bloom_sample_size->integer < 32 )
- Cvar_SetValue ("r_bloom_sample_size", 32);
+ Cvar_ForceSet( "r_bloom_sample_size", "32" );
- // make sure bloom size is a power of 2
- BLOOM_SIZE = r_bloom_sample_size->integer;
- bloomsizecheck = (float)BLOOM_SIZE;
- while( bloomsizecheck > 1.0f )
- bloomsizecheck /= 2.0f;
-
- if( bloomsizecheck != 1.0f ) {
- BLOOM_SIZE = 32;
- while( BLOOM_SIZE < r_bloom_sample_size->integer )
- BLOOM_SIZE *= 2;
- }
-
// make sure bloom size doesn't have stupid values
- if( BLOOM_SIZE > screen_texture_width ||
- BLOOM_SIZE > screen_texture_height )
- BLOOM_SIZE = min( screen_texture_width, screen_texture_height );
+ limit = min( r_bloom_sample_size->integer, min( screen_texture_width, screen_texture_height ) );
+ if( glConfig.ext.texture_non_power_of_two )
+ BLOOM_SIZE = limit;
+ else // make sure bloom size is a power of 2
+ for( BLOOM_SIZE = 32; (BLOOM_SIZE<<1) <= limit; BLOOM_SIZE <<= 1 );
+
if( BLOOM_SIZE != r_bloom_sample_size->integer )
- Cvar_SetValue ("r_bloom_sample_size", BLOOM_SIZE);
+ Cvar_ForceSet( "r_bloom_sample_size", va( "%i", BLOOM_SIZE ) );
data = Mem_TempMalloc( BLOOM_SIZE * BLOOM_SIZE * 4 );
memset( data, 0, BLOOM_SIZE * BLOOM_SIZE * 4 );
@@ -189,17 +180,14 @@
screen_texture_height = glState.height;
} else {
// find closer power of 2 to screen size
- for (screen_texture_width = 1;screen_texture_width < glState.width;screen_texture_width <<= 1);
- for (screen_texture_height = 1;screen_texture_height < glState.height;screen_texture_height <<= 1);
+ for( screen_texture_width = 1; screen_texture_width < glState.width; screen_texture_width <<= 1 );
+ for( screen_texture_height = 1; screen_texture_height < glState.height; screen_texture_height <<= 1 );
}
- // disable blooms if we can't handle a texture of that size
- if( screen_texture_width > glConfig.maxTextureSize ||
- screen_texture_height > glConfig.maxTextureSize ) {
- screen_texture_width = screen_texture_height = 0;
- Cvar_ForceSet( "r_bloom", "0" );
- Com_Printf( S_COLOR_YELLOW"WARNING: 'R_InitBloomScreenTexture' too high resolution for light bloom, effect disabled\n" );
- return;
+ // make sure we don't go off limits
+ if( screen_texture_width > glConfig.maxTextureSize || screen_texture_height > glConfig.maxTextureSize ) {
+ screen_texture_width = glConfig.maxTextureSize;
+ screen_texture_height = glConfig.maxTextureSize;
}
// init the screen texture
Modified: trunk/qfusion/source/ref_gl/r_register.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_register.c 2007-12-03 15:53:38 UTC (rev 785)
+++ trunk/qfusion/source/ref_gl/r_register.c 2007-12-03 18:42:41 UTC (rev 786)
@@ -546,7 +546,7 @@
r_bloom_diamond_size = Cvar_Get( "r_bloom_diamond_size", "8", CVAR_ARCHIVE );
r_bloom_intensity = Cvar_Get( "r_bloom_intensity", "1.3", CVAR_ARCHIVE );
r_bloom_darken = Cvar_Get( "r_bloom_darken", "4", CVAR_ARCHIVE );
- r_bloom_sample_size = Cvar_Get( "r_bloom_sample_size", "128", CVAR_ARCHIVE|CVAR_LATCH_VIDEO );
+ r_bloom_sample_size = Cvar_Get( "r_bloom_sample_size", "320", CVAR_ARCHIVE|CVAR_LATCH_VIDEO );
r_bloom_fast_sample = Cvar_Get( "r_bloom_fast_sample", "0", CVAR_ARCHIVE|CVAR_LATCH_VIDEO );
r_environment_color = Cvar_Get( "r_environment_color", "0 0 0", CVAR_ARCHIVE );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|