Object3D.onAfterRender and Object3d.onBeforeRender is correctly called upon by WebGLRenderer but not by SVGRenderer.
What's your use case?
I'd like a way to be notified in an animation when an object pops into view. This functionality is given by onAfterRender when using a WebGLRenderer. However, it would also be nice to have it in SVGRenderer which I use when webgl is not available (e.g. in jsdom).
After Object3D.onAfterRender and Object3d.onBeforeRender was added to the CSS renderers, I've had a look at the source code of SVGRenderer. Unlike the other renderers, SVGRenderer does not render the scene object by object. Instead, it uses Projector to produce an array of renderable elements (THREE.RenderableSprite, THREE.RenderableLine and THREE.RenderableFace). The problem is that the order of elements is not the same as the order of objects. Meaning it's not possible to trigger Object3D.onAfterRender and Object3d.onBeforeRender like in the other renderers.
Well, it is possible to call Object3d.onBeforeRender for all renderable objects, then perform the rendering of all renderable elements and finally call Object3D.onAfterRender for all objects. However, the timing when the callbacks are executed is now different compared to other renderers.
An other side effect: Because of the usage of Projector, transforming objects in Object3d.onBeforeRender won't affect the position of the final rendering anymore. Hence, I don't think it's possible to properly support both callbacks.
Unlike the other renderers,
SVGRendererdoes not render the scene object by object. Instead, it usesProjectorto produce an array of renderable elements (THREE.RenderableSprite,THREE.RenderableLineandTHREE.RenderableFace).
True! Forgot about that.... I'm inclined to go with Won't fix on this one...
I'm inclined to go with Won't fix on this one.
I vote for doing this since I can't see a way to properly implement this feature request.