X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=gl_rmain.c;h=c0d23b14322d382bedc7aa9494e0b27d67487ce6;hb=61f6f92291491fe35ecd38747e37e6d569fec28d;hp=1da7d9753f0d41cbf3d4f2b6847c454cda1562f4;hpb=8a372168f84e633e32b893c88c8d059359ac0f0e;p=xonotic%2Fdarkplaces.git diff --git a/gl_rmain.c b/gl_rmain.c index 1da7d975..c0d23b14 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -583,7 +583,7 @@ void R_ShadowVolumeLighting(int visiblevolumes) VectorScale(lightcolor, f, lightcolor); } - if (wl->castshadows && (gl_stencil || visiblevolumes)) + if (r_shadow_worldshadows.integer && wl->castshadows && (gl_stencil || visiblevolumes)) { if (!visiblevolumes) R_Shadow_Stage_ShadowVolumes(); @@ -599,12 +599,13 @@ void R_ShadowVolumeLighting(int visiblevolumes) if (!visiblevolumes) { - if (wl->castshadows && gl_stencil) + if (r_shadow_worldshadows.integer && wl->castshadows && gl_stencil) R_Shadow_Stage_LightWithShadows(); else R_Shadow_Stage_LightWithoutShadows(); // calculate world to filter matrix + //Matrix4x4_CreateFromQuakeEntity(&matrix, wl->origin[0], wl->origin[1], wl->origin[2], wl->angles[0] + cl.time * 12, wl->angles[1] + cl.time * 45, wl->angles[2], lightradius); Matrix4x4_CreateFromQuakeEntity(&matrix, wl->origin[0], wl->origin[1], wl->origin[2], wl->angles[0], wl->angles[1], wl->angles[2], lightradius); Matrix4x4_Invert_Simple(&matrix_worldtofilter, &matrix); // calculate world to attenuationxyz/xy matrix @@ -628,7 +629,7 @@ void R_ShadowVolumeLighting(int visiblevolumes) 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); + ent->model->DrawLight(ent, relativelightorigin, relativeeyeorigin, lightradius / ent->scale, lightcolor, &matrix_modeltofilter, &matrix_modeltoattenuationxyz, &matrix_modeltoattenuationz, wl->cubemap); } if (r_drawentities.integer) { @@ -644,7 +645,7 @@ 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); - ent->model->DrawLight(ent, relativelightorigin, relativeeyeorigin, lightradius / ent->scale, lightcolor, &matrix_modeltofilter, &matrix_modeltoattenuationxyz, &matrix_modeltoattenuationz); + ent->model->DrawLight(ent, relativelightorigin, relativeeyeorigin, lightradius / ent->scale, lightcolor, &matrix_modeltofilter, &matrix_modeltoattenuationxyz, &matrix_modeltoattenuationz, wl->cubemap); } } } @@ -668,7 +669,7 @@ void R_ShadowVolumeLighting(int visiblevolumes) cullradius = RadiusFromBoundsAndOrigin(clipmins, clipmaxs, rd->origin); VectorScale(rd->light, (1.0f / 4096.0f), lightcolor); - if (r_shadow_shadows.integer && (gl_stencil || visiblevolumes)) + if (r_shadow_dlightshadows.integer && (gl_stencil || visiblevolumes)) { if (!visiblevolumes) R_Shadow_Stage_ShadowVolumes(); @@ -687,7 +688,7 @@ void R_ShadowVolumeLighting(int visiblevolumes) if (!visiblevolumes) { - if (r_shadow_shadows.integer && gl_stencil) + if (r_shadow_dlightshadows.integer && gl_stencil) R_Shadow_Stage_LightWithShadows(); else R_Shadow_Stage_LightWithoutShadows(); @@ -713,7 +714,7 @@ 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); - ent->model->DrawLight(ent, relativelightorigin, relativeeyeorigin, lightradius / ent->scale, lightcolor, &matrix_modeltofilter, &matrix_modeltoattenuationxyz, &matrix_modeltoattenuationz); + ent->model->DrawLight(ent, relativelightorigin, relativeeyeorigin, lightradius / ent->scale, lightcolor, &matrix_modeltofilter, &matrix_modeltoattenuationxyz, &matrix_modeltoattenuationz, NULL); } if (r_drawentities.integer) { @@ -729,7 +730,7 @@ 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); - ent->model->DrawLight(ent, relativelightorigin, relativeeyeorigin, lightradius / ent->scale, lightcolor, &matrix_modeltofilter, &matrix_modeltoattenuationxyz, &matrix_modeltoattenuationz); + ent->model->DrawLight(ent, relativelightorigin, relativeeyeorigin, lightradius / ent->scale, lightcolor, &matrix_modeltofilter, &matrix_modeltoattenuationxyz, &matrix_modeltoattenuationz, NULL); } } } @@ -796,11 +797,6 @@ static void R_SetupFrame (void) VectorNegate(r_viewleft, r_viewright); GL_SetupView_ViewPort(r_refdef.x, r_refdef.y, r_refdef.width, r_refdef.height); - 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); - GL_SetupView_Orientation_FromEntity(&r_refdef.viewentitymatrix); R_AnimateLight(); } @@ -825,7 +821,7 @@ static void R_BlendView(void) GL_DepthTest(false); // magic GL_VertexPointer(vertex3f); GL_Color(r_refdef.viewblend[0], r_refdef.viewblend[1], r_refdef.viewblend[2], r_refdef.viewblend[3]); - r = 64000; + r = 64; vertex3f[0] = r_vieworigin[0] + r_viewforward[0] * 1.5 + r_viewleft[0] * r - r_viewup[0] * r; vertex3f[1] = r_vieworigin[1] + r_viewforward[1] * 1.5 + r_viewleft[1] * r - r_viewup[1] * r; vertex3f[2] = r_vieworigin[2] + r_viewforward[2] * 1.5 + r_viewleft[2] * r - r_viewup[2] * r; @@ -887,6 +883,11 @@ void R_RenderView (void) R_FarClip_Start(r_vieworigin, r_viewforward, 768.0f); R_MarkEntities(); r_farclip = R_FarClip_Finish() + 256.0f; + if (gl_stencil && ((r_shadow_realtime_world.integer && r_shadow_worldshadows.integer) || ((r_shadow_realtime_world.integer || r_shadow_realtime_dlight.integer) && r_shadow_dlightshadows.integer))) + 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); + GL_SetupView_Orientation_FromEntity(&r_refdef.viewentitymatrix); R_TimeReport("markentity"); qglDepthFunc(GL_LEQUAL);