This is a very bad idea. You are trying to build the scripting system around a specific renderer implementation. This will lock all future versions of GZDoom into rendering only in this exact manner (or simulate that it is doing so).ZZYZX wrote:Something like Qt's polish/unpolish approach, if anyone here is familiar with that.So then you can override RenderBeforeThing and RenderAfterThing, and save current state in first and restore in second (to a handler field).Code: Select all
class RenderEventHandler : EventHandler native { Actor CurrentThing; // default null virtual native void RenderBeforeThing(); virtual native void RenderAfterThing(); }
And refer to the currently processed thing as CurrentThing.
The problem that I have with this currently, is that things are not processed one-by-one, they are stored as a vissprite list (and analogous structure in the GL renderer). So we can have a Before, but not After. Or it can be an "after" that is called once the vissprite is added to the list... going to test.
In fact, you already showed that if your script interface had been implemented before the current renderers, then they'd have been unable to store them in such a vissprite list without copying all the actor data (RenderAfterThing might change it). Or they'd have to wait with calling RenderAfterThing until after the entire list had been drawn, thus breaking an unknown number of mods out there that now would first have relied on RenderAfterThing being called before the next RenderBeforeThing.
Keep in mind that GPUs have gotten so fast that it is quite possible that a future GZDoom might just send all actors to the GPU every frame. Such a renderer would be forced to emulate the entire thing. Or a future GZDoom would do the visibility test in a compute shader - the CPU then would not even know which actors were visible and which weren't.