]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_rmain.c
added r_worldleafvisible flags array for more exact visibility checking (VIS_CullBox...
[xonotic/darkplaces.git] / gl_rmain.c
index 4c73adcf48262927dace2309909d5e9863262440..72dd022858ccd5d2abc07f64b70dba0fb7ff1ed7 100644 (file)
@@ -25,9 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 // used for dlight push checking and other things
 int r_framecount;
 
-// used for visibility checking
-qbyte r_pvsbits[(MAX_MAP_LEAFS+7)>>3];
-
 mplane_t frustum[4];
 
 matrix4x4_t r_identitymatrix;
@@ -104,7 +101,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 +214,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;
 }
@@ -315,7 +310,7 @@ static float R_FarClip(vec3_t origin, vec3_t direction, vec_t startfarclip)
                R_FarClip_Box(r_refdef.worldmodel->normalmins, r_refdef.worldmodel->normalmaxs);
        for (i = 0;i < r_refdef.numentities;i++)
                R_FarClip_Box(r_refdef.entities[i]->mins, r_refdef.entities[i]->maxs);
-       
+
        return r_farclip_meshfarclip - r_farclip_directiondist;
 }
 
@@ -547,7 +542,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 +600,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 +630,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++)
                {
@@ -741,7 +736,7 @@ void R_RenderView(void)
        GL_ColorMask(r_refdef.colormask[0], r_refdef.colormask[1], r_refdef.colormask[2], 1);
        r_rtworld = r_shadow_realtime_world.integer;
        r_rtworldshadows = r_shadow_realtime_world_shadows.integer && gl_stencil;
-       r_rtdlight = r_shadow_realtime_world.integer || r_shadow_realtime_dlight.integer;
+       r_rtdlight = (r_shadow_realtime_world.integer || r_shadow_realtime_dlight.integer) && !gl_flashblend.integer;
        r_rtdlightshadows = r_rtdlight && (r_rtworld ? r_shadow_realtime_world_dlightshadows.integer : r_shadow_realtime_dlight_shadows.integer) && gl_stencil;
        r_lightmapintensity = r_rtworld ? r_shadow_realtime_world_lightmaps.value : 1;
 
@@ -767,7 +762,7 @@ void R_RenderView(void)
 
        R_BlendView();
        R_TimeReport("blendview");
-       
+
        GL_Scissor(0, 0, vid.realwidth, vid.realheight);
        GL_ScissorTest(false);
 }
@@ -797,8 +792,6 @@ void R_RenderScene(void)
 
        R_SkyStartFrame();
 
-       if (r_refdef.worldmodel && r_refdef.worldmodel->brush.FatPVS)
-               r_refdef.worldmodel->brush.FatPVS(r_refdef.worldmodel, r_vieworigin, 2, r_pvsbits, sizeof(r_pvsbits));
        R_WorldVisibility();
        R_TimeReport("worldvis");
 
@@ -1026,17 +1019,16 @@ void R_CalcBeam_Vertex3f (float *vert, const vec3_t org1, const vec3_t org2, flo
        vec3_t right1, right2, diff, normal;
 
        VectorSubtract (org2, org1, normal);
-       VectorNormalizeFast (normal);
 
        // calculate 'right' vector for start
        VectorSubtract (r_vieworigin, org1, diff);
-       VectorNormalizeFast (diff);
        CrossProduct (normal, diff, right1);
+       VectorNormalize (right1);
 
        // calculate 'right' vector for end
        VectorSubtract (r_vieworigin, org2, diff);
-       VectorNormalizeFast (diff);
        CrossProduct (normal, diff, right2);
+       VectorNormalize (right2);
 
        vert[ 0] = org1[0] + width * right1[0];
        vert[ 1] = org1[1] + width * right1[1];