if (r_shadow_rendermode == R_SHADOW_RENDERMODE_STENCIL)
{
// decrement stencil if backface is behind depthbuffer
- GL_CullFace(GL_BACK); // quake is backwards, this culls front faces
+ GL_CullFace(r_view.cullface_front);
qglStencilOp(GL_KEEP, GL_DECR, GL_KEEP);CHECKGLERROR
R_Mesh_Draw(0, numvertices, numtriangles, element3i, 0, 0);
// increment stencil if frontface is behind depthbuffer
- GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
+ GL_CullFace(r_view.cullface_back);
qglStencilOp(GL_KEEP, GL_INCR, GL_KEEP);CHECKGLERROR
}
R_Mesh_Draw(0, numvertices, numtriangles, element3i, 0, 0);
R_Mesh_ResetTextureState();
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthRange(0, 1);
+ GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
GL_DepthTest(true);
GL_DepthMask(false);
GL_Color(0, 0, 0, 1);
GL_DepthTest(true);
GL_DepthMask(false);
qglDepthFunc(GL_LEQUAL);CHECKGLERROR
- qglPolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);CHECKGLERROR
+ GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);CHECKGLERROR
qglDisable(GL_STENCIL_TEST);CHECKGLERROR
qglStencilMask(~0);CHECKGLERROR
qglStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);CHECKGLERROR
qglStencilFunc(GL_ALWAYS, 128, ~0);CHECKGLERROR
- GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
+ GL_CullFace(r_view.cullface_back);
GL_Color(1, 1, 1, 1);
GL_ColorMask(r_view.colormask[0], r_view.colormask[1], r_view.colormask[2], 1);
GL_BlendFunc(GL_ONE, GL_ZERO);
CHECKGLERROR
R_Shadow_RenderMode_Reset();
GL_ColorMask(0, 0, 0, 0);
- qglPolygonOffset(r_refdef.shadowpolygonfactor, r_refdef.shadowpolygonoffset);CHECKGLERROR
+ GL_PolygonOffset(r_refdef.shadowpolygonfactor, r_refdef.shadowpolygonoffset);CHECKGLERROR
qglDepthFunc(GL_LESS);CHECKGLERROR
qglEnable(GL_STENCIL_TEST);CHECKGLERROR
r_shadow_rendermode = r_shadow_shadowingrendermode;
if (r_shadow_rendermode == R_SHADOW_RENDERMODE_SEPARATESTENCIL)
{
GL_CullFace(GL_NONE);
- qglStencilOpSeparate(GL_BACK, GL_KEEP, GL_INCR, GL_KEEP);CHECKGLERROR // quake is backwards, this is front faces
- qglStencilOpSeparate(GL_FRONT, GL_KEEP, GL_DECR, GL_KEEP);CHECKGLERROR // quake is backwards, this is back faces
+ qglStencilOpSeparate(r_view.cullface_front, GL_KEEP, GL_INCR, GL_KEEP);CHECKGLERROR
+ qglStencilOpSeparate(r_view.cullface_back, GL_KEEP, GL_DECR, GL_KEEP);CHECKGLERROR
}
else if (r_shadow_rendermode == R_SHADOW_RENDERMODE_STENCILTWOSIDE)
{
GL_CullFace(GL_NONE);
qglEnable(GL_STENCIL_TEST_TWO_SIDE_EXT);CHECKGLERROR
- qglActiveStencilFaceEXT(GL_BACK);CHECKGLERROR // quake is backwards, this is front faces
+ qglActiveStencilFaceEXT(r_view.cullface_front);CHECKGLERROR
qglStencilMask(~0);CHECKGLERROR
qglStencilOp(GL_KEEP, GL_INCR, GL_KEEP);CHECKGLERROR
- qglActiveStencilFaceEXT(GL_FRONT);CHECKGLERROR // quake is backwards, this is back faces
+ qglActiveStencilFaceEXT(r_view.cullface_back);CHECKGLERROR
qglStencilMask(~0);CHECKGLERROR
qglStencilOp(GL_KEEP, GL_DECR, GL_KEEP);CHECKGLERROR
}
GL_DepthRange(0, 1);
GL_DepthTest(r_showshadowvolumes.integer < 2);
GL_Color(0.0, 0.0125 * r_view.colorscale, 0.1 * r_view.colorscale, 1);
- qglPolygonOffset(r_refdef.shadowpolygonfactor, r_refdef.shadowpolygonoffset);CHECKGLERROR
+ GL_PolygonOffset(r_refdef.shadowpolygonfactor, r_refdef.shadowpolygonoffset);CHECKGLERROR
GL_CullFace(GL_NONE);
r_shadow_rendermode = R_SHADOW_RENDERMODE_VISIBLEVOLUMES;
}
{
// ARB2 GLSL shader path (GFFX5200, Radeon 9500)
R_SetupSurfaceShader(lightcolorbase, false, ambientscale, diffusescale, specularscale);
- R_Mesh_TexCoordPointer(0, 2, rsurface.modeltexcoordtexture2f, rsurface.modeltexcoordtexture2f_bufferobject, rsurface.modeltexcoordtexture2f_bufferoffset);
+ R_Mesh_TexCoordPointer(0, 2, rsurface.texcoordtexture2f, rsurface.texcoordtexture2f_bufferobject, rsurface.texcoordtexture2f_bufferoffset);
R_Mesh_TexCoordPointer(1, 3, rsurface.svector3f, rsurface.svector3f_bufferobject, rsurface.svector3f_bufferoffset);
R_Mesh_TexCoordPointer(2, 3, rsurface.tvector3f, rsurface.tvector3f_bufferobject, rsurface.tvector3f_bufferoffset);
R_Mesh_TexCoordPointer(3, 3, rsurface.normal3f, rsurface.normal3f_bufferobject, rsurface.normal3f_bufferoffset);
m.pointer_texcoord_bufferoffset[0] = rsurface.vertex3f_bufferoffset;
m.texmatrix[0] = rsurface.entitytoattenuationxyz;
m.tex[1] = R_GetTexture(basetexture);
- m.pointer_texcoord[1] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[1] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[1] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[1] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[1] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[1] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[1] = rsurface.texture->currenttexmatrix;
m.texcubemap[2] = R_GetTexture(rsurface.rtlight->currentcubemap);
m.pointer_texcoord3f[2] = rsurface.vertex3f;
m.pointer_texcoord_bufferoffset[0] = rsurface.vertex3f_bufferoffset;
m.texmatrix[0] = rsurface.entitytoattenuationxyz;
m.tex[1] = R_GetTexture(basetexture);
- m.pointer_texcoord[1] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[1] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[1] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[1] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[1] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[1] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[1] = rsurface.texture->currenttexmatrix;
GL_BlendFunc(GL_ONE, GL_ONE);
}
m.pointer_texcoord_bufferoffset[1] = rsurface.vertex3f_bufferoffset;
m.texmatrix[1] = rsurface.entitytoattenuationz;
m.tex[2] = R_GetTexture(basetexture);
- m.pointer_texcoord[2] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[2] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[2] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[2] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[2] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[2] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[2] = rsurface.texture->currenttexmatrix;
if (rsurface.rtlight->currentcubemap != r_texture_whitecube)
{
m.pointer_texcoord_bufferoffset[1] = rsurface.vertex3f_bufferoffset;
m.texmatrix[1] = rsurface.entitytoattenuationz;
m.tex[2] = R_GetTexture(basetexture);
- m.pointer_texcoord[2] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[2] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[2] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[2] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[2] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[2] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[2] = rsurface.texture->currenttexmatrix;
GL_BlendFunc(GL_ONE, GL_ONE);
}
// second pass
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(basetexture);
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
if (rsurface.rtlight->currentcubemap != r_texture_whitecube)
{
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
// second pass
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(basetexture);
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
if (rsurface.rtlight->currentcubemap != r_texture_whitecube)
{
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
// second pass
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(basetexture);
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
if (rsurface.rtlight->currentcubemap != r_texture_whitecube)
{
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
// second pass
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(basetexture);
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
m.tex3d[1] = R_GetTexture(r_shadow_attenuation3dtexture);
m.pointer_texcoord3f[1] = rsurface.vertex3f;
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
// second pass
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(basetexture);
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
if (rsurface.rtlight->currentcubemap != r_texture_whitecube)
{
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
// second pass
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(basetexture);
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
if (rsurface.rtlight->currentcubemap != r_texture_whitecube)
{
// 2/0/0/1/2 3D combine blendsquare path
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(normalmaptexture);
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
// fifth pass
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(glosstexture);
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
if (rsurface.rtlight->currentcubemap != r_texture_whitecube)
{
// 2/0/0/2 3D combine blendsquare path
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(normalmaptexture);
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
// fourth pass
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(glosstexture);
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
m.tex3d[1] = R_GetTexture(r_shadow_attenuation3dtexture);
m.pointer_texcoord3f[1] = rsurface.vertex3f;
// 2/0/0/2/2 2D combine blendsquare path
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(normalmaptexture);
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
// fifth pass
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(glosstexture);
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
if (rsurface.rtlight->currentcubemap != r_texture_whitecube)
{
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(basetexture);
m.texmatrix[0] = rsurface.texture->currenttexmatrix;
- m.pointer_texcoord[0] = rsurface.modeltexcoordtexture2f;
- m.pointer_texcoord_bufferobject[0] = rsurface.modeltexcoordtexture2f_bufferobject;
- m.pointer_texcoord_bufferoffset[0] = rsurface.modeltexcoordtexture2f_bufferoffset;
+ m.pointer_texcoord[0] = rsurface.texcoordtexture2f;
+ m.pointer_texcoord_bufferobject[0] = rsurface.texcoordtexture2f_bufferobject;
+ m.pointer_texcoord_bufferoffset[0] = rsurface.texcoordtexture2f_bufferoffset;
if (r_textureunits.integer >= 2)
{
// voodoo2 or TNT
}
}
+extern cvar_t gl_lightmaps;
void R_Shadow_RenderLighting(int firstvertex, int numvertices, int numtriangles, const int *element3i, int element3i_bufferobject, size_t element3i_bufferoffset)
{
float ambientscale, diffusescale, specularscale;
vec3_t lightcolorbase, lightcolorpants, lightcolorshirt;
+ rtexture_t *nmap;
// calculate colors to render this texture with
- lightcolorbase[0] = rsurface.rtlight->currentcolor[0] * rsurface.texture->currentlayers[0].color[0] * rsurface.texture->currentlayers[0].color[3];
- lightcolorbase[1] = rsurface.rtlight->currentcolor[1] * rsurface.texture->currentlayers[0].color[1] * rsurface.texture->currentlayers[0].color[3];
- lightcolorbase[2] = rsurface.rtlight->currentcolor[2] * rsurface.texture->currentlayers[0].color[2] * rsurface.texture->currentlayers[0].color[3];
+ lightcolorbase[0] = rsurface.rtlight->currentcolor[0] * rsurface.texture->dlightcolor[0];
+ lightcolorbase[1] = rsurface.rtlight->currentcolor[1] * rsurface.texture->dlightcolor[1];
+ lightcolorbase[2] = rsurface.rtlight->currentcolor[2] * rsurface.texture->dlightcolor[2];
ambientscale = rsurface.rtlight->ambientscale;
diffusescale = rsurface.rtlight->diffusescale;
specularscale = rsurface.rtlight->specularscale * rsurface.texture->specularscale;
if ((ambientscale + diffusescale) * VectorLength2(lightcolorbase) + specularscale * VectorLength2(lightcolorbase) < (1.0f / 1048576.0f))
return;
GL_DepthRange(0, (rsurface.texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1);
+ GL_PolygonOffset(rsurface.texture->currentpolygonfactor, rsurface.texture->currentpolygonoffset);
GL_DepthTest(!(rsurface.texture->currentmaterialflags & MATERIALFLAG_NODEPTHTEST));
- GL_CullFace((rsurface.texture->currentmaterialflags & MATERIALFLAG_NOCULLFACE) ? GL_NONE : GL_FRONT); // quake is backwards, this culls back faces
- if (rsurface.texture->colormapping)
+ GL_CullFace((rsurface.texture->currentmaterialflags & MATERIALFLAG_NOCULLFACE) ? GL_NONE : r_view.cullface_back);
+ nmap = rsurface.texture->currentskinframe->nmap;
+ if (gl_lightmaps.integer)
+ nmap = r_texture_blanknormalmap;
+ if (rsurface.texture->colormapping && !gl_lightmaps.integer)
{
qboolean dopants = rsurface.texture->currentskinframe->pants != NULL && VectorLength2(rsurface.colormap_pantscolor) >= (1.0f / 1048576.0f);
qboolean doshirt = rsurface.texture->currentskinframe->shirt != NULL && VectorLength2(rsurface.colormap_shirtcolor) >= (1.0f / 1048576.0f);
{
case R_SHADOW_RENDERMODE_VISIBLELIGHTING:
GL_DepthTest(!(rsurface.texture->currentmaterialflags & MATERIALFLAG_NODEPTHTEST) && !r_showdisabledepthtest.integer);
- R_Shadow_RenderLighting_VisibleLighting(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, lightcolorpants, lightcolorshirt, rsurface.texture->basetexture, rsurface.texture->currentskinframe->pants, rsurface.texture->currentskinframe->shirt, rsurface.texture->currentskinframe->nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, dopants, doshirt);
+ R_Shadow_RenderLighting_VisibleLighting(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, lightcolorpants, lightcolorshirt, rsurface.texture->basetexture, rsurface.texture->currentskinframe->pants, rsurface.texture->currentskinframe->shirt, nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, dopants, doshirt);
break;
case R_SHADOW_RENDERMODE_LIGHT_GLSL:
- R_Shadow_RenderLighting_Light_GLSL(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, lightcolorpants, lightcolorshirt, rsurface.texture->basetexture, rsurface.texture->currentskinframe->pants, rsurface.texture->currentskinframe->shirt, rsurface.texture->currentskinframe->nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, dopants, doshirt);
+ R_Shadow_RenderLighting_Light_GLSL(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, lightcolorpants, lightcolorshirt, rsurface.texture->basetexture, rsurface.texture->currentskinframe->pants, rsurface.texture->currentskinframe->shirt, nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, dopants, doshirt);
break;
case R_SHADOW_RENDERMODE_LIGHT_DOT3:
- R_Shadow_RenderLighting_Light_Dot3(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, lightcolorpants, lightcolorshirt, rsurface.texture->basetexture, rsurface.texture->currentskinframe->pants, rsurface.texture->currentskinframe->shirt, rsurface.texture->currentskinframe->nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, dopants, doshirt);
+ R_Shadow_RenderLighting_Light_Dot3(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, lightcolorpants, lightcolorshirt, rsurface.texture->basetexture, rsurface.texture->currentskinframe->pants, rsurface.texture->currentskinframe->shirt, nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, dopants, doshirt);
break;
case R_SHADOW_RENDERMODE_LIGHT_VERTEX:
- R_Shadow_RenderLighting_Light_Vertex(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, lightcolorpants, lightcolorshirt, rsurface.texture->basetexture, rsurface.texture->currentskinframe->pants, rsurface.texture->currentskinframe->shirt, rsurface.texture->currentskinframe->nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, dopants, doshirt);
+ R_Shadow_RenderLighting_Light_Vertex(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, lightcolorpants, lightcolorshirt, rsurface.texture->basetexture, rsurface.texture->currentskinframe->pants, rsurface.texture->currentskinframe->shirt, nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, dopants, doshirt);
break;
default:
Con_Printf("R_Shadow_RenderLighting: unknown r_shadow_rendermode %i\n", r_shadow_rendermode);
{
case R_SHADOW_RENDERMODE_VISIBLELIGHTING:
GL_DepthTest(!(rsurface.texture->currentmaterialflags & MATERIALFLAG_NODEPTHTEST) && !r_showdisabledepthtest.integer);
- R_Shadow_RenderLighting_VisibleLighting(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, vec3_origin, vec3_origin, rsurface.texture->basetexture, r_texture_black, r_texture_black, rsurface.texture->currentskinframe->nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, false, false);
+ R_Shadow_RenderLighting_VisibleLighting(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, vec3_origin, vec3_origin, rsurface.texture->basetexture, r_texture_black, r_texture_black, nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, false, false);
break;
case R_SHADOW_RENDERMODE_LIGHT_GLSL:
- R_Shadow_RenderLighting_Light_GLSL(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, vec3_origin, vec3_origin, rsurface.texture->basetexture, r_texture_black, r_texture_black, rsurface.texture->currentskinframe->nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, false, false);
+ R_Shadow_RenderLighting_Light_GLSL(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, vec3_origin, vec3_origin, rsurface.texture->basetexture, r_texture_black, r_texture_black, nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, false, false);
break;
case R_SHADOW_RENDERMODE_LIGHT_DOT3:
- R_Shadow_RenderLighting_Light_Dot3(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, vec3_origin, vec3_origin, rsurface.texture->basetexture, r_texture_black, r_texture_black, rsurface.texture->currentskinframe->nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, false, false);
+ R_Shadow_RenderLighting_Light_Dot3(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, vec3_origin, vec3_origin, rsurface.texture->basetexture, r_texture_black, r_texture_black, nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, false, false);
break;
case R_SHADOW_RENDERMODE_LIGHT_VERTEX:
- R_Shadow_RenderLighting_Light_Vertex(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, vec3_origin, vec3_origin, rsurface.texture->basetexture, r_texture_black, r_texture_black, rsurface.texture->currentskinframe->nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, false, false);
+ R_Shadow_RenderLighting_Light_Vertex(firstvertex, numvertices, numtriangles, element3i, element3i_bufferobject, element3i_bufferoffset, lightcolorbase, vec3_origin, vec3_origin, rsurface.texture->basetexture, r_texture_black, r_texture_black, nmap, rsurface.texture->glosstexture, ambientscale, diffusescale, specularscale, false, false);
break;
default:
Con_Printf("R_Shadow_RenderLighting: unknown r_shadow_rendermode %i\n", r_shadow_rendermode);
// can hold
rsurface.rtlight_numfrustumplanes = 0;
+ // haven't implemented a culling path for ortho rendering
+ if (!r_view.useperspective)
+ {
+ // check if the light is on screen and copy the 4 planes if it is
+ for (i = 0;i < 4;i++)
+ if (PlaneDiff(rtlight->shadoworigin, &r_view.frustum[i]) < -0.03125)
+ break;
+ if (i == 4)
+ for (i = 0;i < 4;i++)
+ rsurface.rtlight_frustumplanes[rsurface.rtlight_numfrustumplanes++] = r_view.frustum[i];
+ return;
+ }
+
#if 1
// generate a deformed frustum that includes the light origin, this is
// used to cull shadow casting surfaces that can not possibly cast a
if (r_shadow_rendermode == R_SHADOW_RENDERMODE_STENCIL)
{
// decrement stencil if backface is behind depthbuffer
- GL_CullFace(GL_BACK); // quake is backwards, this culls front faces
+ GL_CullFace(r_view.cullface_front);
qglStencilOp(GL_KEEP, GL_DECR, GL_KEEP);CHECKGLERROR
R_Mesh_Draw(0, mesh->numverts, mesh->numtriangles, mesh->element3i, mesh->ebo, 0);
// increment stencil if frontface is behind depthbuffer
- GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
+ GL_CullFace(r_view.cullface_back);
qglStencilOp(GL_KEEP, GL_INCR, GL_KEEP);CHECKGLERROR
}
R_Mesh_Draw(0, mesh->numverts, mesh->numtriangles, mesh->element3i, mesh->ebo, 0);
// count this light in the r_speeds
r_refdef.stats.lights++;
- if (r_showshadowvolumes.integer && numsurfaces + numshadowentities + numshadowentities_noselfshadow && rtlight->shadow && (rtlight->isstatic ? r_refdef.rtworldshadows : r_refdef.rtdlightshadows))
+ if (r_showshadowvolumes.integer && r_view.showdebug && numsurfaces + numshadowentities + numshadowentities_noselfshadow && rtlight->shadow && (rtlight->isstatic ? r_refdef.rtworldshadows : r_refdef.rtdlightshadows))
{
// optionally draw visible shape of the shadow volumes
// for performance analysis by level designers
// optionally draw the illuminated areas
// for performance analysis by level designers
- if (r_showlighting.integer)
+ if (r_showlighting.integer && r_view.showdebug)
{
R_Shadow_RenderMode_VisibleLighting(!r_showdisabledepthtest.integer, false);
for (i = 0;i < numlightentities_noselfshadow;i++)
// optionally draw the illuminated areas
// for performance analysis by level designers
- if (r_showlighting.integer)
+ if (r_showlighting.integer && r_view.showdebug)
{
R_Shadow_RenderMode_VisibleLighting(!r_showdisabledepthtest.integer, false);
if (numsurfaces)
// optionally draw the illuminated areas
// for performance analysis by level designers
- if (r_showlighting.integer)
+ if (r_showlighting.integer && r_view.showdebug)
{
R_Shadow_RenderMode_VisibleLighting(false, false);
if (numsurfaces)
R_Shadow_RenderMode_End();
}
-extern void R_SetupView(const matrix4x4_t *matrix);
+extern void R_SetupView(void);
extern cvar_t r_shadows_throwdistance;
void R_DrawModelShadows(void)
{
GL_DepthRange(0, 1);
GL_DepthTest(false);
GL_DepthMask(false);
- qglPolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);CHECKGLERROR
+ GL_PolygonOffset(0, 0);CHECKGLERROR
GL_Color(0, 0, 0, 0.5);
GL_ColorMask(r_view.colormask[0], r_view.colormask[1], r_view.colormask[2], 1);
qglDepthFunc(GL_ALWAYS);CHECKGLERROR
R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
// restoring the perspective view is done by R_RenderScene
- //R_SetupView(&r_view.matrix);
+ //R_SetupView();
// restore other state to normal
R_Shadow_RenderMode_End();
{
if (!r_shadow_filters_texturepool)
r_shadow_filters_texturepool = R_AllocTexturePool();
- cubemaptexture = R_LoadTextureCubeMap(r_shadow_filters_texturepool, basename, cubemapsize, cubemappixels, TEXTYPE_RGBA, TEXF_PRECACHE, NULL);
+ cubemaptexture = R_LoadTextureCubeMap(r_shadow_filters_texturepool, basename, cubemapsize, cubemappixels, TEXTYPE_RGBA, TEXF_PRECACHE | (gl_texturecompression_lightcubemaps.integer ? TEXF_COMPRESS : 0), NULL);
Mem_Free(cubemappixels);
}
else
data = r_refdef.worldmodel->brush.entities;
if (!data)
return;
- for (entnum = 0;COM_ParseToken_Simple(&data, false) && com_token[0] == '{';entnum++)
+ for (entnum = 0;COM_ParseToken_Simple(&data, false, false) && com_token[0] == '{';entnum++)
{
type = LIGHTTYPE_MINUSX;
origin[0] = origin[1] = origin[2] = 0;
islight = false;
while (1)
{
- if (!COM_ParseToken_Simple(&data, false))
+ if (!COM_ParseToken_Simple(&data, false, false))
break; // error
if (com_token[0] == '}')
break; // end of entity
strlcpy(key, com_token, sizeof(key));
while (key[strlen(key)-1] == ' ') // remove trailing spaces
key[strlen(key)-1] = 0;
- if (!COM_ParseToken_Simple(&data, false))
+ if (!COM_ParseToken_Simple(&data, false, false))
break; // error
strlcpy(value, com_token, sizeof(value));