three.js
three.js copied to clipboard
ArcballControls is using .clone() unnecessarily
The three.js convention is to create single instances and reuse them.
Are there any that happen every frame?
Every time the mouse moves.
If the library is consistent in avoiding that pattern, then you don't have to worry about it.
There is still more to be done here...
There is still more to be done here... anyone interested?
I've looked into this issue multiple times but I'm afraid it can only be solved by rewriting major parts of the class. The problem is that certain methods like calculateRotationAxis() or getCursorNDC() return new objects. And the calling code relies on this pattern and assumes to get new objects. Besides, many intermediate objects are not placed in the module scope but are properties of ArcballControls. Every time I have tried to refactor all of this, things started to break. Besides, ArcballControls has by far the biggest code base of all control classes. That makes this task even more time consuming.
I'm not sure its worth to invest a lot of time in this class unless a user reports performance issues.
Every time I have tried to refactor all of this, things started to break.
This is red flag, then. The OP is not responding, and in addition, four devs have demonstrated little interest in pursuing it further.
If this code is not going to be maintained, it should be hosted elsewhere by someone willing to take responsibility for it.