added gl_lightmaps cvar (for looking at the raw lightmaps in the map without textures)
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 18 Feb 2004 10:32:06 +0000 (10:32 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 18 Feb 2004 10:32:06 +0000 (10:32 +0000)
added r_shadow_realtime_world_lightmaps cvar (turn on/off lightmaps in r_shadow_realtime_world mode, also can be a fraction to control brightness)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3904 d7cf8633-e32d-0410-b094-e92efae38249

gl_models.c
gl_rsurf.c
glquake.h
r_light.c
r_shadow.c
r_shadow.h
todo

index f7afd47..59f3d85 100644 (file)
@@ -200,7 +200,7 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2)
                         || ((layer->flags & ALIASLAYER_NODRAW_IF_COLORMAPPED) && ent->colormap >= 0)
                         || ((layer->flags & ALIASLAYER_FOG) && !fogenabled)
                         ||  (layer->flags & ALIASLAYER_SPECULAR)
-                        || ((layer->flags & ALIASLAYER_DIFFUSE) && (r_shadow_realtime_world.integer && r_ambient.integer <= 0 && r_fullbright.integer == 0 && !(ent->effects & EF_FULLBRIGHT))))
+                        || ((layer->flags & ALIASLAYER_DIFFUSE) && (r_shadow_realtime_world.integer && r_shadow_realtime_world_lightmaps.value <= 0 && r_ambient.integer <= 0 && r_fullbright.integer == 0 && !(ent->effects & EF_FULLBRIGHT))))
                                continue;
                }
                if (!firstpass || (ent->effects & EF_ADDITIVE))
@@ -247,7 +247,7 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2)
                else
                {
                        fullbright = !(layer->flags & ALIASLAYER_DIFFUSE) || r_fullbright.integer || (ent->effects & EF_FULLBRIGHT);
-                       if (r_shadow_realtime_world.integer && !fullbright)
+                       if (r_shadow_realtime_world.integer && r_shadow_realtime_world_lightmaps.value <= 0 && !fullbright)
                        {
                                colorscale *= r_ambient.value * (2.0f / 128.0f);
                                fullbright = true;
@@ -266,6 +266,8 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2)
                        }
                        else
                                tint[0] = tint[1] = tint[2] = 1;
+                       if (r_shadow_realtime_world.integer)
+                               VectorScale(tint, r_shadow_realtime_world_lightmaps.value, tint);
                        colorscale *= ifog;
                        if (fullbright)
                                GL_Color(tint[0] * colorscale, tint[1] * colorscale, tint[2] * colorscale, ent->alpha);
index c05b879..13c97be 100644 (file)
@@ -37,6 +37,7 @@ cvar_t r_detailtextures = {CVAR_SAVE, "r_detailtextures", "1"};
 cvar_t r_surfaceworldnode = {0, "r_surfaceworldnode", "1"};
 cvar_t r_drawcollisionbrushes_polygonfactor = {0, "r_drawcollisionbrushes_polygonfactor", "-1"};
 cvar_t r_drawcollisionbrushes_polygonoffset = {0, "r_drawcollisionbrushes_polygonoffset", "0"};
+cvar_t gl_lightmaps = {0, "gl_lightmaps", "0"};
 
 static int dlightdivtable[32768];
 
@@ -976,7 +977,7 @@ static void RSurfShader_Wall_Pass_Fog(const entity_render_t *ent, const msurface
        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
 }
 
-static void RSurfShader_OpaqueWall_Pass_BaseTripleTexCombine(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
+static void RSurfShader_OpaqueWall_Pass_BaseCombine_TextureLightmapDetailGlow(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
 {
        const msurface_t *surf;
        rmeshstate_t m;
@@ -990,7 +991,15 @@ static void RSurfShader_OpaqueWall_Pass_BaseTripleTexCombine(const entity_render
        m.texrgbscale[1] = 2;
        m.tex[2] = R_GetTexture(texture->skin.detail);
        m.texrgbscale[2] = 2;
-       GL_Color(1, 1, 1, 1);
+       if (texture->skin.glow)
+       {
+               m.tex[3] = R_GetTexture(texture->skin.glow);
+               m.texcombinergb[3] = GL_ADD;
+       }
+       if (r_shadow_realtime_world.integer)
+               GL_Color(r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, 1);
+       else
+               GL_Color(1, 1, 1, 1);
 
        while((surf = *surfchain++) != NULL)
        {
@@ -1006,13 +1015,14 @@ static void RSurfShader_OpaqueWall_Pass_BaseTripleTexCombine(const entity_render
                        m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
                        m.pointer_texcoord[1] = surf->mesh.data_texcoordlightmap2f;
                        m.pointer_texcoord[2] = surf->mesh.data_texcoorddetail2f;
+                       m.pointer_texcoord[3] = surf->mesh.data_texcoordtexture2f;
                        R_Mesh_State_Texture(&m);
                        R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
                }
        }
 }
 
-static void RSurfShader_OpaqueWall_Pass_BaseDoubleTexCombine(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
+static void RSurfShader_OpaqueWall_Pass_BaseCombine_TextureLightmapDetail(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
 {
        const msurface_t *surf;
        rmeshstate_t m;
@@ -1024,7 +1034,49 @@ static void RSurfShader_OpaqueWall_Pass_BaseDoubleTexCombine(const entity_render
        m.tex[0] = R_GetTexture(texture->skin.base);
        m.tex[1] = R_GetTexture((**surfchain).lightmaptexture);
        m.texrgbscale[1] = 2;
-       GL_Color(1, 1, 1, 1);
+       m.tex[2] = R_GetTexture(texture->skin.detail);
+       m.texrgbscale[2] = 2;
+       if (r_shadow_realtime_world.integer)
+               GL_Color(r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, 1);
+       else
+               GL_Color(1, 1, 1, 1);
+
+       while((surf = *surfchain++) != NULL)
+       {
+               if (surf->visframe == r_framecount)
+               {
+                       lightmaptexturenum = R_GetTexture(surf->lightmaptexture);
+                       //if (m.tex[1] != lightmaptexturenum)
+                       //{
+                               m.tex[1] = lightmaptexturenum;
+                       //      R_Mesh_State_Texture(&m);
+                       //}
+                       GL_VertexPointer(surf->mesh.data_vertex3f);
+                       m.pointer_texcoord[0] = surf->mesh.data_texcoordtexture2f;
+                       m.pointer_texcoord[1] = surf->mesh.data_texcoordlightmap2f;
+                       m.pointer_texcoord[2] = surf->mesh.data_texcoorddetail2f;
+                       R_Mesh_State_Texture(&m);
+                       R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+               }
+       }
+}
+
+static void RSurfShader_OpaqueWall_Pass_BaseCombine_TextureLightmap(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
+{
+       const msurface_t *surf;
+       rmeshstate_t m;
+       int lightmaptexturenum;
+       memset(&m, 0, sizeof(m));
+       GL_BlendFunc(GL_ONE, GL_ZERO);
+       GL_DepthMask(true);
+       GL_DepthTest(true);
+       m.tex[0] = R_GetTexture(texture->skin.base);
+       m.tex[1] = R_GetTexture((**surfchain).lightmaptexture);
+       m.texrgbscale[1] = 2;
+       if (r_shadow_realtime_world.integer)
+               GL_Color(r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, 1);
+       else
+               GL_Color(1, 1, 1, 1);
        while((surf = *surfchain++) != NULL)
        {
                if (surf->visframe == r_framecount)
@@ -1053,7 +1105,10 @@ static void RSurfShader_OpaqueWall_Pass_BaseTexture(const entity_render_t *ent,
        GL_DepthTest(true);
        GL_BlendFunc(GL_ONE, GL_ZERO);
        m.tex[0] = R_GetTexture(texture->skin.base);
-       GL_Color(1, 1, 1, 1);
+       if (r_shadow_realtime_world.integer)
+               GL_Color(r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, 1);
+       else
+               GL_Color(1, 1, 1, 1);
        while((surf = *surfchain++) != NULL)
        {
                if (surf->visframe == r_framecount)
@@ -1164,6 +1219,7 @@ static void RSurfShader_OpaqueWall_Pass_Glow(const entity_render_t *ent, const t
        }
 }
 
+/*
 static void RSurfShader_OpaqueWall_Pass_OpaqueGlow(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
 {
        const msurface_t *surf;
@@ -1187,6 +1243,39 @@ static void RSurfShader_OpaqueWall_Pass_OpaqueGlow(const entity_render_t *ent, c
                }
        }
 }
+*/
+
+static void RSurfShader_OpaqueWall_Pass_BaseLightmapOnly(const entity_render_t *ent, const texture_t *texture, msurface_t **surfchain)
+{
+       const msurface_t *surf;
+       rmeshstate_t m;
+       int lightmaptexturenum;
+       memset(&m, 0, sizeof(m));
+       GL_BlendFunc(GL_ONE, GL_ZERO);
+       GL_DepthMask(true);
+       GL_DepthTest(true);
+       m.tex[0] = R_GetTexture((**surfchain).lightmaptexture);
+       if (r_shadow_realtime_world.integer)
+               GL_Color(r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, 1);
+       else
+               GL_Color(1, 1, 1, 1);
+       while((surf = *surfchain++) != NULL)
+       {
+               if (surf->visframe == r_framecount)
+               {
+                       lightmaptexturenum = R_GetTexture(surf->lightmaptexture);
+                       //if (m.tex[0] != lightmaptexturenum)
+                       //{
+                               m.tex[0] = lightmaptexturenum;
+                       //      R_Mesh_State_Texture(&m);
+                       //}
+                       GL_VertexPointer(surf->mesh.data_vertex3f);
+                       m.pointer_texcoord[0] = surf->mesh.data_texcoordlightmap2f;
+                       R_Mesh_State_Texture(&m);
+                       R_Mesh_Draw(surf->mesh.num_vertices, surf->mesh.num_triangles, surf->mesh.data_element3i);
+               }
+       }
+}
 
 static void RSurfShader_Wall_Vertex_Callback(const void *calldata1, int calldata2)
 {
@@ -1243,45 +1332,60 @@ static void RSurfShader_Wall_Lightmap(const entity_render_t *ent, const texture_
                if (fogenabled)
                        RSurfShader_OpaqueWall_Pass_Fog(ent, texture, surfchain);
        }
-       else if (r_shadow_realtime_world.integer)
+       /*
+       // opaque base lighting
+       else if (r_shadow_realtime_world.integer && r_shadow_realtime_world_lightmaps.value <= 0)
+       {
+               if (r_ambient.value > 0)
+               {
+               }
+               else
+                       RSurfShader_OpaqueWall_Pass_OpaqueGlow(ent, texture, surfchain);
+               if (fogenabled)
+                       RSurfShader_OpaqueWall_Pass_Fog(ent, texture, surfchain);
+       }
+       */
+       // opaque lightmapped
+       else if (r_textureunits.integer >= 4 && gl_combine.integer && r_detailtextures.integer && !gl_lightmaps.integer)
        {
-               // opaque base lighting
-               RSurfShader_OpaqueWall_Pass_OpaqueGlow(ent, texture, surfchain);
+               RSurfShader_OpaqueWall_Pass_BaseCombine_TextureLightmapDetailGlow(ent, texture, surfchain);
+               if (fogenabled)
+                       RSurfShader_OpaqueWall_Pass_Fog(ent, texture, surfchain);
+       }
+       else if (r_textureunits.integer >= 3 && gl_combine.integer && r_detailtextures.integer && !gl_lightmaps.integer)
+       {
+               RSurfShader_OpaqueWall_Pass_BaseCombine_TextureLightmapDetail(ent, texture, surfchain);
+               if (texture->skin.glow)
+                       RSurfShader_OpaqueWall_Pass_Glow(ent, texture, surfchain);
+               if (fogenabled)
+                       RSurfShader_OpaqueWall_Pass_Fog(ent, texture, surfchain);
+       }
+       else if (r_textureunits.integer >= 2 && gl_combine.integer && !gl_lightmaps.integer)
+       {
+               RSurfShader_OpaqueWall_Pass_BaseCombine_TextureLightmap(ent, texture, surfchain);
+               if (r_detailtextures.integer)
+                       RSurfShader_OpaqueWall_Pass_BaseDetail(ent, texture, surfchain);
+               if (texture->skin.glow)
+                       RSurfShader_OpaqueWall_Pass_Glow(ent, texture, surfchain);
+               if (fogenabled)
+                       RSurfShader_OpaqueWall_Pass_Fog(ent, texture, surfchain);
+       }
+       else if (!gl_lightmaps.integer)
+       {
+               RSurfShader_OpaqueWall_Pass_BaseTexture(ent, texture, surfchain);
+               RSurfShader_OpaqueWall_Pass_BaseLightmap(ent, texture, surfchain);
+               if (r_detailtextures.integer)
+                       RSurfShader_OpaqueWall_Pass_BaseDetail(ent, texture, surfchain);
+               if (texture->skin.glow)
+                       RSurfShader_OpaqueWall_Pass_Glow(ent, texture, surfchain);
                if (fogenabled)
                        RSurfShader_OpaqueWall_Pass_Fog(ent, texture, surfchain);
        }
        else
        {
-               // opaque lightmapped
-               if (r_textureunits.integer >= 3 && gl_combine.integer && r_detailtextures.integer)
-               {
-                       RSurfShader_OpaqueWall_Pass_BaseTripleTexCombine(ent, texture, surfchain);
-                       if (texture->skin.glow)
-                               RSurfShader_OpaqueWall_Pass_Glow(ent, texture, surfchain);
-                       if (fogenabled)
-                               RSurfShader_OpaqueWall_Pass_Fog(ent, texture, surfchain);
-               }
-               else if (r_textureunits.integer >= 2 && gl_combine.integer)
-               {
-                       RSurfShader_OpaqueWall_Pass_BaseDoubleTexCombine(ent, texture, surfchain);
-                       if (r_detailtextures.integer)
-                               RSurfShader_OpaqueWall_Pass_BaseDetail(ent, texture, surfchain);
-                       if (texture->skin.glow)
-                               RSurfShader_OpaqueWall_Pass_Glow(ent, texture, surfchain);
-                       if (fogenabled)
-                               RSurfShader_OpaqueWall_Pass_Fog(ent, texture, surfchain);
-               }
-               else
-               {
-                       RSurfShader_OpaqueWall_Pass_BaseTexture(ent, texture, surfchain);
-                       RSurfShader_OpaqueWall_Pass_BaseLightmap(ent, texture, surfchain);
-                       if (r_detailtextures.integer)
-                               RSurfShader_OpaqueWall_Pass_BaseDetail(ent, texture, surfchain);
-                       if (texture->skin.glow)
-                               RSurfShader_OpaqueWall_Pass_Glow(ent, texture, surfchain);
-                       if (fogenabled)
-                               RSurfShader_OpaqueWall_Pass_Fog(ent, texture, surfchain);
-               }
+               RSurfShader_OpaqueWall_Pass_BaseLightmapOnly(ent, texture, surfchain);
+               if (fogenabled)
+                       RSurfShader_OpaqueWall_Pass_Fog(ent, texture, surfchain);
        }
 }
 
@@ -1890,7 +1994,7 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_Lightmap(entity_render_t *ent, q3mface_t *
        rmeshstate_t m;
        memset(&m, 0, sizeof(m));
        GL_BlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
-       GL_DepthMask(true);
+       GL_DepthMask(false);
        GL_DepthTest(true);
        m.tex[0] = R_GetTexture(face->lightmaptexture);
        m.pointer_texcoord[0] = face->data_texcoordlightmap2f;
@@ -1900,12 +2004,30 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_Lightmap(entity_render_t *ent, q3mface_t *
        R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
 }
 
+void R_Q3BSP_DrawFace_OpaqueWall_Pass_LightmapOnly(entity_render_t *ent, q3mface_t *face)
+{
+       rmeshstate_t m;
+       memset(&m, 0, sizeof(m));
+       GL_BlendFunc(GL_ONE, GL_ZERO);
+       GL_DepthMask(true);
+       GL_DepthTest(true);
+       m.tex[0] = R_GetTexture(face->lightmaptexture);
+       m.pointer_texcoord[0] = face->data_texcoordlightmap2f;
+       if (r_shadow_realtime_world.integer)
+               GL_Color(r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, 1);
+       else
+               GL_Color(1, 1, 1, 1);
+       R_Mesh_State_Texture(&m);
+       GL_VertexPointer(face->data_vertex3f);
+       R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+}
+
 void R_Q3BSP_DrawFace_OpaqueWall_Pass_Glow(entity_render_t *ent, q3mface_t *face)
 {
        rmeshstate_t m;
        memset(&m, 0, sizeof(m));
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
-       GL_DepthMask(true);
+       GL_DepthMask(false);
        GL_DepthTest(true);
        if (face->texture->skin.glow)
        {
@@ -1922,6 +2044,8 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_Glow(entity_render_t *ent, q3mface_t *face
 
 void R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureVertex(entity_render_t *ent, q3mface_t *face)
 {
+       int i;
+       float mul;
        rmeshstate_t m;
        memset(&m, 0, sizeof(m));
        GL_BlendFunc(GL_ONE, GL_ZERO);
@@ -1929,14 +2053,49 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureVertex(entity_render_t *ent, q3mfac
        GL_DepthTest(true);
        m.tex[0] = R_GetTexture(face->texture->skin.base);
        m.pointer_texcoord[0] = face->data_texcoordtexture2f;
-       if (gl_combine.integer)
+       mul = 2.0f;
+       if (r_shadow_realtime_world.integer && r_shadow_realtime_world_lightmaps.value != 1)
+               mul *= r_shadow_realtime_world_lightmaps.value;
+       if (mul == 2 && gl_combine.integer)
        {
                m.texrgbscale[0] = 2;
                GL_ColorPointer(face->data_color4f);
        }
+       else if (mul == 1)
+               GL_ColorPointer(face->data_color4f);
+       else
+       {
+               for (i = 0;i < face->num_vertices;i++)
+               {
+                       varray_color4f[i*4+0] = face->data_color4f[i*4+0] * mul;
+                       varray_color4f[i*4+1] = face->data_color4f[i*4+1] * mul;
+                       varray_color4f[i*4+2] = face->data_color4f[i*4+2] * mul;
+                       varray_color4f[i*4+3] = face->data_color4f[i*4+3];
+               }
+               GL_ColorPointer(varray_color4f);
+       }
+       R_Mesh_State_Texture(&m);
+       GL_VertexPointer(face->data_vertex3f);
+       R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
+}
+
+void R_Q3BSP_DrawFace_OpaqueWall_Pass_VertexOnly(entity_render_t *ent, q3mface_t *face)
+{
+       int i;
+       float mul;
+       rmeshstate_t m;
+       memset(&m, 0, sizeof(m));
+       GL_BlendFunc(GL_ONE, GL_ZERO);
+       GL_DepthMask(true);
+       GL_DepthTest(true);
+       R_Mesh_State_Texture(&m);
+       mul = 2.0f;
+       if (r_shadow_realtime_world.integer && r_shadow_realtime_world_lightmaps.value != 1)
+               mul *= r_shadow_realtime_world_lightmaps.value;
+       if (mul == 1)
+               GL_ColorPointer(face->data_color4f);
        else
        {
-               int i;
                for (i = 0;i < face->num_vertices;i++)
                {
                        varray_color4f[i*4+0] = face->data_color4f[i*4+0] * 2.0f;
@@ -1946,7 +2105,6 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureVertex(entity_render_t *ent, q3mfac
                }
                GL_ColorPointer(varray_color4f);
        }
-       R_Mesh_State_Texture(&m);
        GL_VertexPointer(face->data_vertex3f);
        R_Mesh_Draw(face->num_vertices, face->num_triangles, face->data_element3i);
 }
@@ -2050,7 +2208,7 @@ void R_Q3BSP_DrawFace(entity_render_t *ent, q3mface_t *face)
                return;
        }
        R_Mesh_Matrix(&ent->matrix);
-       if (r_shadow_realtime_world.integer)
+       if (r_shadow_realtime_world.integer && r_shadow_realtime_world_lightmaps.value <= 0)
                R_Q3BSP_DrawFace_OpaqueWall_Pass_OpaqueGlow(ent, face);
        else if ((ent->effects & EF_FULLBRIGHT) || r_fullbright.integer)
        {
@@ -2060,21 +2218,31 @@ void R_Q3BSP_DrawFace(entity_render_t *ent, q3mface_t *face)
        }
        else if (face->lightmaptexture)
        {
-               if (r_textureunits.integer >= 2 && gl_combine.integer)
-                       R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureLightmapCombine(ent, face);
+               if (gl_lightmaps.integer)
+                       R_Q3BSP_DrawFace_OpaqueWall_Pass_LightmapOnly(ent, face);
                else
                {
-                       R_Q3BSP_DrawFace_OpaqueWall_Pass_Texture(ent, face);
-                       R_Q3BSP_DrawFace_OpaqueWall_Pass_Lightmap(ent, face);
+                       if (r_textureunits.integer >= 2 && gl_combine.integer)
+                               R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureLightmapCombine(ent, face);
+                       else
+                       {
+                               R_Q3BSP_DrawFace_OpaqueWall_Pass_Texture(ent, face);
+                               R_Q3BSP_DrawFace_OpaqueWall_Pass_Lightmap(ent, face);
+                       }
+                       if (face->texture->skin.glow)
+                               R_Q3BSP_DrawFace_OpaqueWall_Pass_Glow(ent, face);
                }
-               if (face->texture->skin.glow)
-                       R_Q3BSP_DrawFace_OpaqueWall_Pass_Glow(ent, face);
        }
        else
        {
-               R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureVertex(ent, face);
-               if (face->texture->skin.glow)
-                       R_Q3BSP_DrawFace_OpaqueWall_Pass_Glow(ent, face);
+               if (gl_lightmaps.integer)
+                       R_Q3BSP_DrawFace_OpaqueWall_Pass_VertexOnly(ent, face);
+               else
+               {
+                       R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureVertex(ent, face);
+                       if (face->texture->skin.glow)
+                               R_Q3BSP_DrawFace_OpaqueWall_Pass_Glow(ent, face);
+               }
        }
        if (r_ambient.value)
                R_Q3BSP_DrawFace_OpaqueWall_Pass_AddTextureAmbient(ent, face);
@@ -2290,6 +2458,7 @@ void GL_Surf_Init(void)
        Cvar_RegisterVariable(&r_surfaceworldnode);
        Cvar_RegisterVariable(&r_drawcollisionbrushes_polygonfactor);
        Cvar_RegisterVariable(&r_drawcollisionbrushes_polygonoffset);
+       Cvar_RegisterVariable(&gl_lightmaps);
 
        R_RegisterModule("GL_Surf", gl_surf_start, gl_surf_shutdown, gl_surf_newmap);
 }
index d871480..3dabde6 100644 (file)
--- a/glquake.h
+++ b/glquake.h
@@ -124,6 +124,7 @@ extern int gl_support_anisotropy;
 #define GL_TEXTURE_MAX_ANISOTROPY_EXT          0x84FE
 #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT      0x84FF
 
+#define GL_ADD                                 0x0104
 #define GL_DECAL                               0x2101
 #define GL_MODULATE                            0x2100
 
index ca6817c..364e456 100644 (file)
--- a/r_light.c
+++ b/r_light.c
@@ -380,7 +380,7 @@ int R_LightModel(float *ambient4f, float *diffusecolor, float *diffusenormal, co
                VectorSet(ambient4f, 1, 1, 1);
                maxnearlights = 0;
        }
-       else if (r_shadow_realtime_world.integer)
+       else if (r_shadow_realtime_world.integer && r_shadow_realtime_world_lightmaps.value <= 0)
                maxnearlights = 0;
        else
        {
@@ -590,7 +590,7 @@ void R_UpdateEntLights(entity_render_t *ent)
        int i;
        const mlight_t *sl;
        vec3_t v;
-       if (r_shadow_realtime_world.integer)
+       if (r_shadow_realtime_world.integer && r_shadow_realtime_world_lightmaps.value <= 0)
                return;
        VectorSubtract(ent->origin, ent->entlightsorigin, v);
        if (ent->entlightsframe != (r_framecount - 1) || (realtime > ent->entlightstime && DotProduct(v,v) >= 1.0f))
index 11e62aa..e92bafc 100644 (file)
@@ -147,6 +147,7 @@ rtexture_t *r_shadow_blankbumptexture;
 rtexture_t *r_shadow_blankglosstexture;
 rtexture_t *r_shadow_blankwhitetexture;
 
+cvar_t r_shadow_realtime_world_lightmaps = {0, "r_shadow_realtime_world_lightmaps", "0"};
 cvar_t r_shadow_lightattenuationpower = {0, "r_shadow_lightattenuationpower", "0.5"};
 cvar_t r_shadow_lightattenuationscale = {0, "r_shadow_lightattenuationscale", "1"};
 cvar_t r_shadow_lightintensityscale = {0, "r_shadow_lightintensityscale", "1"};
@@ -243,6 +244,7 @@ void R_Shadow_Help_f(void)
 "r_shadow_lightintensityscale : scale rendering brightness of all lights\n"
 "r_shadow_realtime_world : use realtime world light rendering\n"
 "r_shadow_realtime_dlight : use high quality dlight rendering\n"
+"r_shadow_realtime_world_lightmaps : use lightmaps in addition to rtlights\n"
 "r_shadow_visiblevolumes : useful for performance testing; bright = slow!\n"
 "r_shadow_gloss 0/1/2 : no gloss, gloss textures only, force gloss\n"
 "r_shadow_glossintensity : brightness of textured gloss\n"
@@ -270,6 +272,7 @@ void R_Shadow_Init(void)
        Cvar_RegisterVariable(&r_shadow_lightattenuationscale);
        Cvar_RegisterVariable(&r_shadow_lightintensityscale);
        Cvar_RegisterVariable(&r_shadow_realtime_world);
+       Cvar_RegisterVariable(&r_shadow_realtime_world_lightmaps);
        Cvar_RegisterVariable(&r_shadow_realtime_dlight);
        Cvar_RegisterVariable(&r_shadow_visiblevolumes);
        Cvar_RegisterVariable(&r_shadow_gloss);
index 78ff414..7a2da06 100644 (file)
@@ -5,6 +5,7 @@
 extern cvar_t r_shadow_lightattenuationscale;
 extern cvar_t r_shadow_lightintensityscale;
 extern cvar_t r_shadow_realtime_world;
+extern cvar_t r_shadow_realtime_world_lightmaps;
 extern cvar_t r_shadow_realtime_dlight;
 extern cvar_t r_shadow_visiblevolumes;
 extern cvar_t r_shadow_gloss;
diff --git a/todo b/todo
index 6f19157..0850de8 100644 (file)
--- a/todo
+++ b/todo
 -n darkplaces: server is starting before the "port" cvar is set by commandline and scripts? (yummyluv)
 -n darkplaces: typing ip in join game menu should show 'trying' and 'no response' after a while, or 'no network' if networking is not initialized (yummyluv)
 -n dpmod: make grapple off-hand (joe hill)
+0 darkplaces: add r_shadow_realtime_world_lightmaps cvar to control lightmap brightness (Mitchell)
+0 darkplaces: add gl_lightmaps cvar to disable texturing except lightmaps for testing (Vic)
+0 hmap2: release hmap2 (Vic, Supajoe)
+4 darkplaces: add capability for qc entities to act as bones in a model, and send them as compressed origins in the parent entity's updates, with perhaps a limit of 16 bones, this would allow some simple serverside ragdoll (Mitchell)
+4 darkplaces: add .psk/.psa (ut2003/ut2004) model support (Mitchell)
+d darkplaces: worked around Intel precision bug with view blends (they were not covering one line of the screen, due to being so huge that it had precision problems, on ATI and NVIDIA) (Sajt)
+0 darkplaces: release darkplaces build
+0 darkplaces: fix loadsky;r_restart;r_restart crash, again (sajt)
+0 darkplaces: add Mem_AllocNoClear function, and use it where possible, if developer is on it should clear with random garbage
+0 darkplaces: make Mem_Free function clear memory only if developer is on
+d darkplaces: fix video modes menu as you can select 2048x1536 and then go right to get 0x0 (Sajt)
+2 darkplaces: change menu qc key input to using string key names instead of numbers (the bind alias names should be able to do this) (Mercury, Black, Vermeulen)
+d darkplaces: add 66.28.32.64 to master server list (Willis)
 d darkplaces: update darkplaces readme
 0 darkplaces: add a cvar to indicate that MOVETYPE_WALK works on non-clients (tell FrikaC)
 d darkplaces: make r_fullbrights affect model skins, not just map textures