From 41785bd3bbe0b7bd19e7ddea8cc2f126b6b88b66 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 16 Jul 2016 01:33:50 +1000 Subject: [PATCH] Don't draw rain when the func_rain brush is too far away (partial fix for large open rainy map performance) --- defaultXonotic.cfg | 2 ++ qcsrc/common/triggers/func/rainsnow.qc | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index ebc41c612..30ed7c988 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1297,6 +1297,8 @@ r_fakelight 1 r_water_hideplayer 1 // hide your own feet/player model in refraction views, this way you don't see half of your body under water r_water_refractdistort 0.019 +set cl_rainsnow_maxdrawdist 2048 + // strength sound settings set sv_strengthsound_antispam_time 0.1 "minimum distance of strength sounds" set sv_strengthsound_antispam_refire_threshold 0.04 "apply minimum distance only if refire of the gun is smaller than this" diff --git a/qcsrc/common/triggers/func/rainsnow.qc b/qcsrc/common/triggers/func/rainsnow.qc index dc569f69a..265d45e0a 100644 --- a/qcsrc/common/triggers/func/rainsnow.qc +++ b/qcsrc/common/triggers/func/rainsnow.qc @@ -92,14 +92,24 @@ spawnfunc(func_snow) Net_LinkEntity(this, false, 0, rainsnow_SendEntity); } #elif defined(CSQC) +float autocvar_cl_rainsnow_maxdrawdist = 2048; + void Draw_Rain(entity this) { - te_particlerain(this.origin + this.mins, this.origin + this.maxs, this.velocity, floor(this.count * drawframetime + random()), this.glow_color); + vector maxdist = '1 1 0' * autocvar_cl_rainsnow_maxdrawdist; + maxdist.z = 5; + if(boxesoverlap(vec2(view_origin) - maxdist, vec2(view_origin) + maxdist, vec2(this.absmin) - '0 0 5', vec2(this.absmax) + '0 0 5')) + //if(autocvar_cl_rainsnow_maxdrawdist <= 0 || vdist(vec2(this.origin) - vec2(this.absmin + this.absmax * 0.5), <=, autocvar_cl_rainsnow_maxdrawdist)) + te_particlerain(this.origin + this.mins, this.origin + this.maxs, this.velocity, floor(this.count * drawframetime + random()), this.glow_color); } void Draw_Snow(entity this) { - te_particlesnow(this.origin + this.mins, this.origin + this.maxs, this.velocity, floor(this.count * drawframetime + random()), this.glow_color); + vector maxdist = '1 1 0' * autocvar_cl_rainsnow_maxdrawdist; + maxdist.z = 5; + if(boxesoverlap(vec2(view_origin) - maxdist, vec2(view_origin) + maxdist, vec2(this.absmin) - '0 0 5', vec2(this.absmax) + '0 0 5')) + //if(autocvar_cl_rainsnow_maxdrawdist <= 0 || vdist(vec2(this.origin) - vec2(this.absmin + this.absmax * 0.5), <=, autocvar_cl_rainsnow_maxdrawdist)) + te_particlesnow(this.origin + this.mins, this.origin + this.maxs, this.velocity, floor(this.count * drawframetime + random()), this.glow_color); } NET_HANDLE(ENT_CLIENT_RAINSNOW, bool isnew) -- 2.39.2