removed r_shadows (glquake fake shadows)
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 21 Sep 2003 22:42:57 +0000 (22:42 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 21 Sep 2003 22:42:57 +0000 (22:42 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3496 d7cf8633-e32d-0410-b094-e92efae38249

gl_models.c
gl_rmain.c
gl_rsurf.c
model_alias.c
model_brush.c
model_shared.h
model_sprite.c

index 59f6ff0..937c1d8 100644 (file)
@@ -303,68 +303,6 @@ void R_Model_Alias_Draw(entity_render_t *ent)
        }
 }
 
-void R_Model_Alias_DrawFakeShadow (entity_render_t *ent)
-{
-       int i, meshnum;
-       aliasmesh_t *mesh;
-       aliasskin_t *skin;
-       rmeshstate_t m;
-       float *v, plane[4], dist, projection[3], floororigin[3], surfnormal[3], lightdirection[3], v2[3];
-
-       if ((ent->effects & EF_ADDITIVE) || ent->alpha < 1)
-               return;
-
-       lightdirection[0] = 0.5;
-       lightdirection[1] = 0.2;
-       lightdirection[2] = -1;
-       VectorNormalizeFast(lightdirection);
-
-       VectorMA(ent->origin, 65536.0f, lightdirection, v2);
-       if (CL_TraceLine(ent->origin, v2, floororigin, surfnormal, false, NULL, SUPERCONTENTS_SOLID) == 1)
-               return;
-
-       R_Mesh_Matrix(&ent->matrix);
-
-       memset(&m, 0, sizeof(m));
-       R_Mesh_State_Texture(&m);
-
-       GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-       GL_DepthMask(false);
-       GL_DepthTest(true);
-       GL_VertexPointer(varray_vertex3f);
-       GL_Color(0, 0, 0, 0.5);
-
-       // put a light direction in the entity's coordinate space
-       Matrix4x4_Transform3x3(&ent->inversematrix, lightdirection, projection);
-       VectorNormalizeFast(projection);
-
-       // put the plane's normal in the entity's coordinate space
-       Matrix4x4_Transform3x3(&ent->inversematrix, surfnormal, plane);
-       VectorNormalizeFast(plane);
-
-       // put the plane's distance in the entity's coordinate space
-       VectorSubtract(floororigin, ent->origin, floororigin);
-       plane[3] = DotProduct(floororigin, surfnormal) + 2;
-
-       dist = -1.0f / DotProduct(projection, plane);
-       VectorScale(projection, dist, projection);
-       for (meshnum = 0, mesh = ent->model->alias.aliasdata_meshes;meshnum < ent->model->alias.aliasnum_meshes;meshnum++)
-       {
-               skin = R_FetchAliasSkin(ent, mesh);
-               if (skin->flags & ALIASSKIN_TRANSPARENT)
-                       continue;
-               R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_VERTEX, varray_vertex3f);
-               for (i = 0, v = varray_vertex3f;i < mesh->num_vertices;i++, v += 3)
-               {
-                       dist = DotProduct(v, plane) - plane[3];
-                       if (dist > 0)
-                               VectorMA(v, dist, projection, v);
-               }
-               c_alias_polys += mesh->num_triangles;
-               R_Mesh_Draw(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
-       }
-}
-
 void R_Model_Alias_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin, float lightradius)
 {
        int meshnum;
@@ -862,11 +800,6 @@ void R_Model_Zymotic_Draw(entity_render_t *ent)
        }
 }
 
-void R_Model_Zymotic_DrawFakeShadow(entity_render_t *ent)
-{
-       // FIXME
-}
-
 void R_Model_Zymotic_DrawLight(entity_render_t *ent, vec3_t relativelightorigin, float lightradius2, float lightdistbias, float lightsubtract, float *lightcolor)
 {
        // FIXME
index c30c0a9..73e7766 100644 (file)
@@ -54,7 +54,6 @@ unsigned short d_lightstylevalue[256];
 
 cvar_t r_drawentities = {0, "r_drawentities","1"};
 cvar_t r_drawviewmodel = {0, "r_drawviewmodel","1"};
-cvar_t r_shadows = {CVAR_SAVE, "r_shadows", "0"};
 cvar_t r_shadow_staticworldlights = {0, "r_shadow_staticworldlights", "1"};
 cvar_t r_speeds = {0, "r_speeds","0"};
 cvar_t r_fullbright = {0, "r_fullbright","0"};
@@ -248,7 +247,6 @@ void GL_Main_Init(void)
        Cmd_AddCommand("timerefresh", R_TimeRefresh_f);
        Cvar_RegisterVariable(&r_drawentities);
        Cvar_RegisterVariable(&r_drawviewmodel);
-       Cvar_RegisterVariable(&r_shadows);
        Cvar_RegisterVariable(&r_shadow_staticworldlights);
        Cvar_RegisterVariable(&r_speeds);
        Cvar_RegisterVariable(&r_fullbrights);
@@ -509,25 +507,6 @@ void R_DrawModels(void)
        }
 }
 
-void R_DrawFakeShadows(void)
-{
-       int i;
-       entity_render_t *ent;
-
-       ent = &cl_entities[0].render;
-       if (ent->model && ent->model->DrawFakeShadow)
-               ent->model->DrawFakeShadow(ent);
-
-       if (!r_drawentities.integer)
-               return;
-       for (i = 0;i < r_refdef.numentities;i++)
-       {
-               ent = r_refdef.entities[i];
-               if ((ent->flags & RENDER_SHADOW) && ent->model && ent->model->DrawFakeShadow)
-                       ent->model->DrawFakeShadow(ent);
-       }
-}
-
 #include "r_shadow.h"
 
 int shadowframecount = 0;
@@ -923,12 +902,6 @@ void R_RenderView (void)
        R_DrawModels();
        R_TimeReport("models");
 
-       if (r_shadows.integer == 1 && !r_shadow_realtime_world.integer)
-       {
-               R_DrawFakeShadows();
-               R_TimeReport("fakeshadow");
-       }
-
        if (r_shadow_realtime_world.integer || r_shadow_realtime_dlight.integer)
        {
                R_ShadowVolumeLighting(false);
index b0b286a..c5ed09e 100644 (file)
@@ -30,7 +30,6 @@ static float floatblocklights[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*3]; // LordHav
 static qbyte templight[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*4];
 
 cvar_t r_ambient = {0, "r_ambient", "0"};
-cvar_t r_vertexsurfaces = {0, "r_vertexsurfaces", "0"};
 cvar_t r_dlightmap = {CVAR_SAVE, "r_dlightmap", "1"};
 cvar_t r_drawportals = {0, "r_drawportals", "0"};
 cvar_t r_testvis = {0, "r_testvis", "0"};
@@ -1357,21 +1356,6 @@ static void RSurfShader_Wall_Lightmap(const entity_render_t *ent, const texture_
                if (fogenabled)
                        RSurfShader_OpaqueWall_Pass_Fog(ent, texture, surfchain);
        }
-       else if (r_vertexsurfaces.integer)
-       {
-               // opaque vertex shaded from lightmap
-               for (chain = surfchain;(surf = *chain) != NULL;chain++)
-                       if (surf->visframe == r_framecount)
-                               RSurfShader_Wall_Pass_BaseVertex(ent, surf, texture, texture->rendertype, texture->currentalpha);
-               if (texture->skin.glow)
-                       for (chain = surfchain;(surf = *chain) != NULL;chain++)
-                               if (surf->visframe == r_framecount)
-                                       RSurfShader_Wall_Pass_Glow(ent, surf, texture, texture->rendertype, texture->currentalpha);
-               if (fogenabled)
-                       for (chain = surfchain;(surf = *chain) != NULL;chain++)
-                               if (surf->visframe == r_framecount)
-                                       RSurfShader_Wall_Pass_Fog(ent, surf, texture, texture->rendertype, texture->currentalpha);
-       }
        else
        {
                // opaque lightmapped
@@ -1502,7 +1486,7 @@ void R_PrepareSurfaces(entity_render_t *ent)
                        {
                                c_faces++;
                                surf->visframe = r_framecount;
-                               if (surf->cached_dlight && surf->lightmaptexture != NULL && !r_vertexsurfaces.integer)
+                               if (surf->cached_dlight && surf->lightmaptexture != NULL)
                                        R_BuildLightMap(ent, surf);
                        }
                }
@@ -2078,12 +2062,6 @@ void R_Q3BSP_Draw(entity_render_t *ent)
        }
 }
 
-/*
-void R_Q3BSP_DrawFakeShadow(entity_render_t *ent)
-{
-}
-*/
-
 void R_Q3BSP_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin, float lightradius)
 {
        int i;
@@ -2168,7 +2146,6 @@ void GL_Surf_Init(void)
                dlightdivtable[i] = 4194304 / (i << 7);
 
        Cvar_RegisterVariable(&r_ambient);
-       Cvar_RegisterVariable(&r_vertexsurfaces);
        Cvar_RegisterVariable(&r_dlightmap);
        Cvar_RegisterVariable(&r_drawportals);
        Cvar_RegisterVariable(&r_testvis);
index 1c5ee14..c43a37d 100644 (file)
@@ -267,7 +267,6 @@ void Mod_BuildAliasSkinsFromSkinFiles(aliasskin_t *skin, skinfile_t *skinfile, c
 #define BOUNDI(VALUE,MIN,MAX) if (VALUE < MIN || VALUE >= MAX) Host_Error("model %s has an invalid ##VALUE (%d exceeds %d - %d)\n", loadmodel->name, VALUE, MIN, MAX);
 #define BOUNDF(VALUE,MIN,MAX) if (VALUE < MIN || VALUE >= MAX) Host_Error("model %s has an invalid ##VALUE (%f exceeds %f - %f)\n", loadmodel->name, VALUE, MIN, MAX);
 extern void R_Model_Alias_Draw(entity_render_t *ent);
-extern void R_Model_Alias_DrawFakeShadow(entity_render_t *ent);
 extern void R_Model_Alias_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin, float lightradius);
 extern void R_Model_Alias_DrawLight(entity_render_t *ent, vec3_t relativelightorigin, vec3_t relativeeyeorigin, float lightradius, float *lightcolor, const matrix4x4_t *matrix_modeltofilter, const matrix4x4_t *matrix_modeltoattenuationxyz, const matrix4x4_t *matrix_modeltoattenuationz);
 void Mod_IDP0_Load(model_t *mod, void *buffer)
@@ -304,7 +303,6 @@ void Mod_IDP0_Load(model_t *mod, void *buffer)
        loadmodel->alias.aliastype = ALIASTYPE_ALIAS;
        loadmodel->DrawSky = NULL;
        loadmodel->Draw = R_Model_Alias_Draw;
-       loadmodel->DrawFakeShadow = R_Model_Alias_DrawFakeShadow;
        loadmodel->DrawShadowVolume = R_Model_Alias_DrawShadowVolume;
        loadmodel->DrawLight = R_Model_Alias_DrawLight;
 
@@ -607,7 +605,6 @@ void Mod_IDP2_Load(model_t *mod, void *buffer)
        loadmodel->alias.aliastype = ALIASTYPE_ALIAS;
        loadmodel->DrawSky = NULL;
        loadmodel->Draw = R_Model_Alias_Draw;
-       loadmodel->DrawFakeShadow = R_Model_Alias_DrawFakeShadow;
        loadmodel->DrawShadowVolume = R_Model_Alias_DrawShadowVolume;
        loadmodel->DrawLight = R_Model_Alias_DrawLight;
 
@@ -828,7 +825,6 @@ void Mod_IDP3_Load(model_t *mod, void *buffer)
        loadmodel->alias.aliastype = ALIASTYPE_ALIAS;
        loadmodel->DrawSky = NULL;
        loadmodel->Draw = R_Model_Alias_Draw;
-       loadmodel->DrawFakeShadow = R_Model_Alias_DrawFakeShadow;
        loadmodel->DrawShadowVolume = R_Model_Alias_DrawShadowVolume;
        loadmodel->DrawLight = R_Model_Alias_DrawLight;
        loadmodel->flags = 0;
@@ -926,7 +922,6 @@ void Mod_IDP3_Load(model_t *mod, void *buffer)
 
 extern void R_Model_Zymotic_DrawSky(entity_render_t *ent);
 extern void R_Model_Zymotic_Draw(entity_render_t *ent);
-extern void R_Model_Zymotic_DrawFakeShadow(entity_render_t *ent);
 extern void R_Model_Zymotic_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin, float lightradius);
 extern void R_Model_Zymotic_DrawLight(entity_render_t *ent, vec3_t relativelightorigin, vec3_t relativeeyeorigin, float lightradius, float *lightcolor, const matrix4x4_t *matrix_modeltofilter, const matrix4x4_t *matrix_modeltoattenuationxyz, const matrix4x4_t *matrix_modeltoattenuationz);
 void Mod_ZYMOTICMODEL_Load(model_t *mod, void *buffer)
@@ -945,7 +940,6 @@ void Mod_ZYMOTICMODEL_Load(model_t *mod, void *buffer)
        loadmodel->alias.aliastype = ALIASTYPE_ZYM;
        loadmodel->DrawSky = NULL;
        loadmodel->Draw = R_Model_Zymotic_Draw;
-       loadmodel->DrawFakeShadow = NULL;//R_Model_Zymotic_DrawFakeShadow;
        loadmodel->DrawShadowVolume = NULL;//R_Model_Zymotic_DrawShadowVolume;
        loadmodel->DrawLight = NULL;//R_Model_Zymotic_DrawLight;
 
index 1fb281e..92ae090 100644 (file)
@@ -2752,7 +2752,6 @@ void Mod_Q1BSP_Load(model_t *mod, void *buffer)
                // this gets altered below if sky is used
                mod->DrawSky = NULL;
                mod->Draw = R_Model_Brush_Draw;
-               mod->DrawFakeShadow = NULL;
                mod->DrawShadowVolume = R_Model_Brush_DrawShadowVolume;
                mod->DrawLight = R_Model_Brush_DrawLight;
                mod->brushq1.pvstexturechains = Mem_Alloc(originalloadmodel->mempool, mod->brushq1.numtextures * sizeof(msurface_t **));
@@ -4446,7 +4445,6 @@ static int Mod_Q3BSP_NativeContentsFromSuperContents(model_t *model, int superco
 
 //extern void R_Q3BSP_DrawSky(struct entity_render_s *ent);
 extern void R_Q3BSP_Draw(struct entity_render_s *ent);
-//extern void R_Q3BSP_DrawFakeShadow(struct entity_render_s *ent);
 extern void R_Q3BSP_DrawShadowVolume(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius);
 extern void R_Q3BSP_DrawLight(struct entity_render_s *ent, vec3_t relativelightorigin, vec3_t relativeeyeorigin, float lightradius, float *lightcolor, const matrix4x4_t *matrix_modeltofilter, const matrix4x4_t *matrix_modeltoattenuationxyz, const matrix4x4_t *matrix_modeltoattenuationz);
 void Mod_Q3BSP_Load(model_t *mod, void *buffer)
@@ -4481,7 +4479,6 @@ void Mod_Q3BSP_Load(model_t *mod, void *buffer)
        mod->brush.TraceBox = Mod_Q3BSP_TraceBox;
        //mod->DrawSky = R_Q3BSP_DrawSky;
        mod->Draw = R_Q3BSP_Draw;
-       //mod->DrawFakeShadow = R_Q3BSP_DrawFakeShadow;
        mod->DrawShadowVolume = R_Q3BSP_DrawShadowVolume;
        mod->DrawLight = R_Q3BSP_DrawLight;
 
index 5802d2c..e87a913 100644 (file)
@@ -515,8 +515,6 @@ typedef struct model_s
        void(*DrawSky)(struct entity_render_s *ent);
        // draw the model using lightmap/dlight shading
        void(*Draw)(struct entity_render_s *ent);
-       // draw a fake shadow for the model
-       void(*DrawFakeShadow)(struct entity_render_s *ent);
        // draw a shadow volume for the model based on light source
        void(*DrawShadowVolume)(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius);
        // draw the lighting on a model (through stencil)
index 043f9fd..06d1ce8 100644 (file)
@@ -243,7 +243,6 @@ void Mod_IDSP_Load(model_t *mod, void *buffer)
 
        loadmodel->DrawSky = NULL;
        loadmodel->Draw = R_Model_Sprite_Draw;
-       loadmodel->DrawFakeShadow = NULL;
        loadmodel->DrawShadowVolume = NULL;
        loadmodel->DrawLight = NULL;