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();
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
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)
{
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);
}
}
}
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();
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();
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)
{
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 (visiblevolumes)
+ {
qglEnable(GL_CULL_FACE);
+ qglDisable(GL_SCISSOR_TEST);
+ }
else
R_Shadow_Stage_End();
- qglDisable(GL_SCISSOR_TEST);
}
static void R_SetFrustum (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();
}
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;
R_MoveExplosions();
R_TimeReport("mexplosion");
+ qglPolygonOffset(0, 0);
+ qglEnable(GL_POLYGON_OFFSET_FILL);
+
R_Textures_Frame();
R_SetupFrame();
R_SetFrustum();
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);
R_DrawModels();
R_TimeReport("models");
- if (r_shadow_realtime_world.integer || r_shadow_realtime_dlight.integer)
- {
- R_ShadowVolumeLighting(false);
- R_TimeReport("dynlight");
- }
+ R_ShadowVolumeLighting(false);
+ R_TimeReport("rtlights");
R_DrawLightningBeams();
R_TimeReport("lightning");
R_Mesh_Finish();
R_TimeReport("meshfinish");
+
+ qglPolygonOffset(0, 0);
+ qglDisable(GL_POLYGON_OFFSET_FILL);
}
/*