From 92db391e7c469443568bc50aaacc1c67c28a2007 Mon Sep 17 00:00:00 2001 From: Ragnvald Maartmann-Moe IV Date: Sun, 1 Sep 2002 23:45:22 +0000 Subject: [PATCH] Optimize model rendering a hair. WildCode spotted that minimum shade was only being applied to the view model (why do we set it up for other stuff if it's not going to be used?). While looking at that, I noticed we could do the divide by 200 in model setup. --- libs/models/model.c | 6 +++--- libs/video/renderer/gl/gl_mod_alias.c | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libs/models/model.c b/libs/models/model.c index f41570c5c..74f60a12d 100644 --- a/libs/models/model.c +++ b/libs/models/model.c @@ -201,11 +201,11 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator) } if (strequal (mod->name, "progs/player.mdl")) { - mod->min_light = 8; + mod->min_light = 0.04; } else if (strnequal (mod->name, "progs/v_", 8)) { - mod->min_light = 24; + mod->min_light = 0.12; } else { - mod->min_light = 0; + mod->min_light = 0.0; } // call the apropriate loader diff --git a/libs/video/renderer/gl/gl_mod_alias.c b/libs/video/renderer/gl/gl_mod_alias.c index cfa33070d..a23b3e9dc 100644 --- a/libs/video/renderer/gl/gl_mod_alias.c +++ b/libs/video/renderer/gl/gl_mod_alias.c @@ -522,7 +522,6 @@ R_DrawAliasModel (entity_t *e) radius = model->radius; if (e->scale != 1.0) radius *= e->scale; - if (R_CullSphere (e->origin, radius)) return; @@ -561,8 +560,8 @@ R_DrawAliasModel (entity_t *e) } // always give the gun some light shade = max (shadecolor[0], max (shadecolor[1], shadecolor[2])); - minshade = model->min_light / 200.0; - if (e == r_view_model && shade < minshade) { + minshade = model->min_light; + if (shade < minshade) { shadecolor[0] += minshade - shade; shadecolor[1] += minshade - shade; shadecolor[2] += minshade - shade;