It used to crash because after recursing into R_MirrorPoint(), which
calls tr.CropRenderSize(), about MAX_RENDER_CROPS times,
CropRenderSize() wrote behind the end of tr.renderCrops[] and damaged
a pointer.
Even if it didn't crash because of that, endlessly recursing is a bad
idea, so it's limited now. The limit can be configued with the new
r_maxMirrorRecursion CVar, but the hard limit is MAX_RENDER_CROPS-3 = 5
Another problem was that mirrors and other subviews render into
a texture, specifically globalImages->scratchImage ("_scratch"), so
it could happen that it got written to several times before being used.
Now there are 8 scratch images (+ the original "_scratch" which is also
used by gamecode) that the subview code cycles through to minimize the
chance of overwriting something that's still in use.
The previous commit didn't fix the issue for the pistol and only was a
workaround anyway. So I reverted that and fixed the issue properly.
The underlying issue is that the particle's material sets the
texture matrix (with "translate" or "scale" or whatever), and the soft
particle rendering code (and shader) didn't take the texture matrix
into account.
Now it does, in a similar way as the interaction shader code.
Fixes https://github.com/dhewm/dhewm3-sdk/issues/36
turned out the whole problem with soft particles what that the vertex
shader used vertex.attrib[8] instead of vertex.texcoord (and with
nvidia drivers those are equivalent)
I integrated the shader source into the c++ code so I don't have to
ship glprogs/soft_particles.vfp
can be enabled/disabled with the r_useStencilOpSeparate for comparisons
(like Z-Fail, this doesn't really seem to make a difference on my main
machine, neither on my RPi4)
Partly based on Pat Raynor's Code:
2933cb5545/neo/renderer/draw_stencilshadow.cpp
Don't include the lazy precompiled.h everywhere, only what's
required for the compilation unit.
platform.h needs to be included instead to provide all essential
defines and types.
All includes use the relative path to the neo or the game
specific root.
Move all idlib related includes from idlib/Lib.h to precompiled.h.
precompiled.h still exists for the MFC stuff in tools/.
Add some missing header guards.