From: Mario Date: Fri, 29 May 2020 11:43:38 +0000 (+1000) Subject: Simplify spawnpoint distance culling (particles aren't affected by entity alpha)... X-Git-Tag: xonotic-v0.8.5~1009 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=53d9e7f50579c44c9d97e7da3b35449e9a447807;p=xonotic%2Fxonotic-data.pk3dir.git Simplify spawnpoint distance culling (particles aren't affected by entity alpha), improves performance slightly --- diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 90bf6fb91..06d89929a 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -70,7 +70,6 @@ bool autocvar_cl_spawn_event_particles; bool autocvar_cl_spawn_event_sound = 1; // float autocvar_cl_spawn_point_model; bool autocvar_cl_spawn_point_particles; -float autocvar_cl_spawn_point_dist_min = 800; float autocvar_cl_spawn_point_dist_max = 1200; bool autocvar_cl_spawnzoom = 1; float autocvar_cl_spawnzoom_speed = 1; diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 39201fd72..9f95530d1 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -674,7 +674,7 @@ NET_HANDLE(ENT_CLIENT_ACCURACY, bool isnew) void Spawn_Draw(entity this) { - if(this.alpha <= 0) + if(!this.alpha) return; __pointparticles(this.cnt, this.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1)); @@ -682,25 +682,15 @@ void Spawn_Draw(entity this) void Spawn_PreDraw(entity this) { - float alph; - vector org = getpropertyvec(VF_ORIGIN); - if(this.fade_start) + bool dodraw = true; + if(autocvar_cl_spawn_point_dist_max) { - if(vdist(org - this.origin, >, this.fade_end)) - alph = 0; // save on some processing - else if(vdist(org - this.origin, <, this.fade_start)) - alph = 1; // more processing saved - else - alph = bound(0, (this.fade_end - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.fade_end - this.fade_start), 1); + vector org = getpropertyvec(VF_ORIGIN); + dodraw = vdist(org - this.origin, <, autocvar_cl_spawn_point_dist_max); } - else - alph = 1; //printf("%v <-> %v\n", view_origin, this.origin + 0.5 * (this.mins + this.maxs)); - this.alpha = alph; - if(alph <= 0) - this.drawmask = 0; - else - this.drawmask = MASK_NORMAL; + this.alpha = dodraw; + this.drawmask = (dodraw) ? MASK_NORMAL : 0; } NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new) @@ -745,8 +735,6 @@ NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new) this.draw = Spawn_Draw; if (is_new) IL_PUSH(g_drawables, this); setpredraw(this, Spawn_PreDraw); - this.fade_start = autocvar_cl_spawn_point_dist_min; - this.fade_end = autocvar_cl_spawn_point_dist_max; } //} diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 389da6f74..089d86802 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -67,8 +67,7 @@ seta cl_spawn_event_particles 1 "pointparticles effect whenever a player spawns" seta cl_spawn_event_sound 1 "sound effect whenever a player spawns" //seta cl_spawn_point_model 0 "place a model at all spawn points" // still needs a model seta cl_spawn_point_particles 1 "pointparticles effect at all spawn points" // managed by effects-.cfg files -seta cl_spawn_point_dist_min 800 -seta cl_spawn_point_dist_max 1200 +seta cl_spawn_point_dist_max 1200 "maximum distance from which spawnpoint particles will be visible" freelook 1 sensitivity 6