]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
changed r_bloom_resolution behavior to have a non-square texture to match the view...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 23 Dec 2004 00:18:03 +0000 (00:18 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 23 Dec 2004 00:18:03 +0000 (00:18 +0000)
changed default r_bloom_resolution from 256 to 320
changed r_bloom_blur to adapt to resolutions (using 320 as a base value - blur 8 is 8 pixel blur at resolution 320, 16 pixel blur at 640, etc)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4887 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 4c73adcf48262927dace2309909d5e9863262440..285b82804ef5b54f29456ccb0d13a12fa59e023e 100644 (file)
@@ -104,7 +104,7 @@ cvar_t r_watershader = {CVAR_SAVE, "r_watershader", "1"};
 cvar_t r_bloom = {CVAR_SAVE, "r_bloom", "0"};
 cvar_t r_bloom_intensity = {CVAR_SAVE, "r_bloom_intensity", "2"};
 cvar_t r_bloom_blur = {CVAR_SAVE, "r_bloom_blur", "8"};
-cvar_t r_bloom_resolution = {CVAR_SAVE, "r_bloom_resolution", "256"};
+cvar_t r_bloom_resolution = {CVAR_SAVE, "r_bloom_resolution", "320"};
 cvar_t r_bloom_power = {CVAR_SAVE, "r_bloom_power", "4"};
 rtexturepool_t *r_main_texturepool;
 rtexture_t *r_bloom_texture_screen;
@@ -217,9 +217,7 @@ void gl_main_start(void)
 
 void gl_main_shutdown(void)
 {
-       // this seems to cause a already freed crash after a couple vid_restarts...
-       //R_FreeTexturePool(&r_main_texturepool);
-       r_main_texturepool = NULL;
+       R_FreeTexturePool(&r_main_texturepool);
        r_bloom_texture_screen = NULL;
        r_bloom_texture_bloom = NULL;
 }
@@ -547,7 +545,7 @@ static void R_BlendView(void)
                for (screenwidth = 1;screenwidth < vid.realwidth;screenwidth *= 2);
                for (screenheight = 1;screenheight < vid.realheight;screenheight *= 2);
                bloomwidth = min(r_view_width, r_bloom_resolution.integer);
-               bloomheight = min(r_view_height, r_bloom_resolution.integer);
+               bloomheight = min(r_view_height, bloomwidth * r_view_height / r_view_width);
                varray_texcoord2f[0][0] = 0;
                varray_texcoord2f[0][1] = (float)r_view_height / (float)screenheight;
                varray_texcoord2f[0][2] = (float)r_view_width / (float)screenwidth;
@@ -605,7 +603,7 @@ static void R_BlendView(void)
                c_bloomcopypixels += bloomwidth * bloomheight;
                // blend on at multiple offsets vertically
                // TODO: do offset blends using GLSL
-               range = r_bloom_blur.integer;//(int)(r_bloom_blur.value * bloomwidth / 320);
+               range = r_bloom_blur.integer * bloomwidth / 320;
                GL_BlendFunc(GL_ONE, GL_ZERO);
                for (x = -range;x <= range;x++)
                {
@@ -635,7 +633,7 @@ static void R_BlendView(void)
                c_bloomcopypixels += bloomwidth * bloomheight;
                // blend on at multiple offsets horizontally
                // TODO: do offset blends using GLSL
-               range = r_bloom_blur.integer * bloomheight / r_view_height;//(int)(r_bloom_blur.value * bloomwidth / 320);
+               range = r_bloom_blur.integer * bloomwidth / 320;
                GL_BlendFunc(GL_ONE, GL_ZERO);
                for (x = -range;x <= range;x++)
                {