skyrendersphere = false;
skyrenderbox = false;
skyrendermasked = false;
- if (r_sky.integer && !fogenabled)
+ if (r_sky.integer && !r_refdef.fogenabled)
{
if (skyboxside[0] || skyboxside[1] || skyboxside[2] || skyboxside[3] || skyboxside[4] || skyboxside[5])
skyrenderbox = true;
- else if (r_refdef.worldmodel->brush.solidskytexture)
+ else if (r_refdef.worldmodel && r_refdef.worldmodel->brush.solidskytexture)
skyrendersphere = true;
// for depth-masked sky, render the sky on the first sky surface encountered
skyrendernow = true;
if (strlen(sky) > 1000)
{
- Con_Printf("sky name too long (%i, max is 1000)\n", strlen(sky));
+ Con_Printf("sky name too long (%i, max is 1000)\n", (int)strlen(sky));
return false;
}
- strcpy(skyname, sky);
+ strlcpy(skyname, sky, sizeof(skyname));
return R_LoadSkyBox();
}
static void R_SkyBox(void)
{
int i;
- GL_Color(1, 1, 1, 1);
+ // FIXME: fixed function path can't properly handle r_view.colorscale > 1
+ GL_Color(1 * r_view.colorscale, 1 * r_view.colorscale, 1 * r_view.colorscale, 1);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(false);
GL_DepthTest(false); // don't modify or read zbuffer
speedscale -= (int)speedscale;
Matrix4x4_CreateTranslate(&scroll2matrix, speedscale, speedscale, 0);
- GL_Color(1, 1, 1, 1);
+ // FIXME: fixed function path can't properly handle r_view.colorscale > 1
+ GL_Color(1 * r_view.colorscale, 1 * r_view.colorscale, 1 * r_view.colorscale, 1);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(true);
GL_DepthTest(false); // don't modify or read zbuffer
R_Mesh_TexBind(0, R_GetTexture(r_refdef.worldmodel->brush.solidskytexture));
R_Mesh_TexCoordPointer(0, 2, skysphere_texcoord2f);
R_Mesh_TexMatrix(0, &scroll1matrix);
- if (r_textureunits.integer >= 2)
+ if (r_textureunits.integer >= 2 && r_view.colorscale == 1)
{
// one pass using GL_DECAL or GL_INTERPOLATE_ARB for alpha layer
R_Mesh_TexBind(1, R_GetTexture(r_refdef.worldmodel->brush.alphaskytexture));
matrix4x4_t skymatrix;
if (skyrendermasked)
{
- Matrix4x4_CreateTranslate(&skymatrix, r_vieworigin[0], r_vieworigin[1], r_vieworigin[2]);
+ Matrix4x4_CreateTranslate(&skymatrix, r_view.origin[0], r_view.origin[1], r_view.origin[2]);
R_Mesh_Matrix(&skymatrix);
if (skyrendersphere)
{