float texcoord2f[3][2];
float vertex3f[3][3];
float color4f[3][4];
+ float plane[4]; // backface culling
// how long this decal has lived so far (the actual fade begins at cl_decals_time)
float lived;
// if >= 0 this indicates the decal should follow an animated triangle
decal->texcoord2f[1][1] = t1[1];
decal->texcoord2f[2][0] = t2[0];
decal->texcoord2f[2][1] = t2[1];
+ TriangleNormal(v0, v1, v2, decal->plane);
+ VectorNormalize(decal->plane);
+ decal->plane[3] = DotProduct(v0, decal->plane);
}
extern cvar_t cl_decals_bias;
if (surfacevisible && !surfacevisible[decal->surfaceindex])
continue;
+ // skip backfaces
+ if (decal->triangleindex < 0 && DotProduct(r_refdef.view.origin, decal->plane) < decal->plane[3])
+ continue;
+
// update color values for fading decals
if (decal->lived >= cl_decals_time.value)
alpha = 1 - faderate * (decal->lived - cl_decals_time.value);