firtoz/react-three-renderer-example

Performance when using TrackballControls

alfonsomunozpomer opened this issue · 0 comments

Hi,

First of all congratulations on pulling off such a great project!

I was having a look at https://github.com/toxicFork/react-three-renderer-example/blob/master/src/examples/WebGLCameraExample/index.js and in my tests, the line controls.addEventListener(change, () => { introduces a noticeable performance hit. My guess is that setState makes the scene be rendered twice: once by this.controls.update(); inside _onAnimate and then again by the render method.

What’s to lose if we comment out the controls.addEventListener(change, () => { method, besides the camera position in the state (which from what I can tell is only used when the view is initially rendered)?