]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_rmain.c
call reset functions in init code (not necessary currently, as the compilers currentl...
[xonotic/darkplaces.git] / gl_rmain.c
index 73e776687c625a8fb6bb1aaa1a84f8a2965d1313..968f8210fbed222b98348c1dcabf2597e5a8b734 100644 (file)
@@ -524,7 +524,6 @@ void R_TestAndDrawShadowVolume(entity_render_t *ent, vec3_t lightorigin, float c
 
 void R_Shadow_DrawWorldLightShadowVolume(matrix4x4_t *matrix, worldlight_t *light);
 
-extern void R_Model_Brush_DrawLightForSurfaceList(entity_render_t *ent, vec3_t relativelightorigin, vec3_t relativeeyeorigin, float lightradius, float *lightcolor, msurface_t **surflist, int numsurfaces, const matrix4x4_t *matrix_modeltofilter, const matrix4x4_t *matrix_modeltoattenuationxyz, const matrix4x4_t *matrix_modeltoattenuationz);
 void R_ShadowVolumeLighting(int visiblevolumes)
 {
        int i;
@@ -585,8 +584,8 @@ void R_ShadowVolumeLighting(int visiblevolumes)
                                if (!visiblevolumes)
                                        R_Shadow_Stage_ShadowVolumes();
                                ent = &cl_entities[0].render;
-                               if (wl->shadowvolume && r_shadow_staticworldlights.integer)
-                                       R_Shadow_DrawWorldLightShadowVolume(&ent->matrix, wl);
+                               if (r_shadow_staticworldlights.integer)
+                                       R_Shadow_DrawStaticWorldLight_Shadow(wl, &ent->matrix);
                                else
                                        R_TestAndDrawShadowVolume(ent, wl->origin, cullradius, lightradius, wl->mins, wl->maxs, clipmins, clipmaxs, true);
                                if (r_drawentities.integer)
@@ -622,8 +621,8 @@ void R_ShadowVolumeLighting(int visiblevolumes)
                                        Matrix4x4_Concat(&matrix_modeltofilter, &matrix_worldtofilter, &ent->matrix);
                                        Matrix4x4_Concat(&matrix_modeltoattenuationxyz, &matrix_worldtoattenuationxyz, &ent->matrix);
                                        Matrix4x4_Concat(&matrix_modeltoattenuationz, &matrix_worldtoattenuationz, &ent->matrix);
-                                       if (wl->numsurfaces)
-                                               R_Model_Brush_DrawLightForSurfaceList(ent, relativelightorigin, relativeeyeorigin, lightradius, lightcolor, wl->surfaces, wl->numsurfaces, &matrix_modeltofilter, &matrix_modeltoattenuationxyz, &matrix_modeltoattenuationz);
+                                       if (r_shadow_staticworldlights.integer)
+                                               R_Shadow_DrawStaticWorldLight_Light(wl, &ent->matrix, relativelightorigin, relativeeyeorigin, lightradius, lightcolor, &matrix_modeltofilter, &matrix_modeltoattenuationxyz, &matrix_modeltoattenuationz);
                                        else
                                                ent->model->DrawLight(ent, relativelightorigin, relativeeyeorigin, lightradius / ent->scale, lightcolor, &matrix_modeltofilter, &matrix_modeltoattenuationxyz, &matrix_modeltoattenuationz);
                                }
@@ -665,7 +664,7 @@ void R_ShadowVolumeLighting(int visiblevolumes)
                        cullradius = RadiusFromBoundsAndOrigin(clipmins, clipmaxs, rd->origin);
                        VectorScale(rd->light, (1.0f / 4096.0f), lightcolor);
 
-                       if (gl_stencil || visiblevolumes)
+                       if (r_shadow_shadows.integer && (gl_stencil || visiblevolumes))
                        {
                                if (!visiblevolumes)
                                        R_Shadow_Stage_ShadowVolumes();
@@ -684,7 +683,7 @@ void R_ShadowVolumeLighting(int visiblevolumes)
 
                        if (!visiblevolumes)
                        {
-                               if (gl_stencil)
+                               if (r_shadow_shadows.integer && gl_stencil)
                                        R_Shadow_Stage_LightWithShadows();
                                else
                                        R_Shadow_Stage_LightWithoutShadows();
@@ -845,7 +844,7 @@ void R_RenderView (void)
        {
                if (!gl_stencil)
                {
-                       Con_Printf("Stencil not enabled, turning off r_shadow_realtime_world, please type vid_stencil 1;vid_bitsperpixel 32;vid_restart and try again\n");
+                       Con_Printf("Realtime world lighting requires 32bit color turning off r_shadow_realtime_world, please type vid_bitsperpixel 32;vid_restart and try again\n");
                        Cvar_SetValueQuick(&r_shadow_realtime_world, 0);
                }
        }
@@ -876,7 +875,7 @@ void R_RenderView (void)
        R_TimeReport("markentity");
 
        GL_SetupView_ViewPort(r_refdef.x, r_refdef.y, r_refdef.width, r_refdef.height);
-       if (r_shadow_realtime_world.integer || gl_stencil)
+       if ((r_shadow_realtime_world.integer || r_shadow_shadows.integer) && gl_stencil)
                GL_SetupView_Mode_PerspectiveInfiniteFarClip(r_refdef.fov_x, r_refdef.fov_y, 1.0f);
        else
                GL_SetupView_Mode_Perspective(r_refdef.fov_x, r_refdef.fov_y, 1.0f, r_farclip);