Is there an intended way to render a view (on a separate canvas) manually (eg not via render loop) while a 2nd view (canvas) is rendered continuously?
I got something up and running, but it’s quite hacky and involves stopping and starting the render loop, calling _renderViews()
and registering and unregistering the views for every rendered frame. I’m hoping there is a simpler (maybe more obvious?) way to to this.
To show what I mean I created this playground
The interesting part happens in renderFrame
:
const renderFrame = (frame) => {
// Why is play & pause needed for goToFrame to work properly?????
animGroup.play();
animGroup.pause();
animGroup.goToFrame(frame)
engine.registerView(newCanvas1, camera2);
engine.registerView(newCanvas2, camera);
engine.stopRenderLoop();
engine.runRenderLoop(() => {
scene.render();
});
engine.unRegisterView(canvas);
engine._renderViews();
setTimeout(() => {
engine.unRegisterView(newCanvas1);
engine.unRegisterView(newCanvas2);
}, 0);
}```
Does it need to be this hard? Am I missing something?