-
Notifications
You must be signed in to change notification settings - Fork 0
/
fix_particles_in_fog.patch
36 lines (32 loc) · 1.09 KB
/
fix_particles_in_fog.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
diff --git a/src/engine/renderparticles.cpp b/src/engine/renderparticles.cpp
index 357525d..e68d59b 100644
--- a/src/engine/renderparticles.cpp
+++ b/src/engine/renderparticles.cpp
@@ -1081,6 +1081,14 @@ static partrenderer *parts[] =
&flares // must be done last!
};
+int partsorder[sizeof(parts)/sizeof(parts[0])];
+
+void orderparts() {
+ int j = 0, n = sizeof(parts)/sizeof(parts[0]);
+ loopi(n) if(!(parts[i]->type&PT_LERP)) partsorder[j++] = i;
+ loopi(n) if(parts[i]->type&PT_LERP) partsorder[j++] = i;
+}
+
void finddepthfxranges()
{
depthfxmin = vec(1e16f, 1e16f, 1e16f);
@@ -1121,6 +1129,7 @@ void initparticles()
parts[i]->init(parts[i]->type&PT_FEW ? min(fewparticles, maxparticles) : maxparticles);
parts[i]->preload();
}
+ orderparts();
}
void clearparticles()
@@ -1176,7 +1185,7 @@ void renderparticles(bool mainpass)
loopi(sizeof(parts)/sizeof(parts[0]))
{
- partrenderer *p = parts[i];
+ partrenderer *p = parts[partsorder[i]];
if(glaring && !(p->type&PT_GLARE)) continue;
if(!p->haswork()) continue;