three-stdlib icon indicating copy to clipboard operation
three-stdlib copied to clipboard

Replace three `Timer` with postprocessing `Timer`

Open krispya opened this issue 2 years ago • 4 comments

We recently added the three Timer class by Mugen. After this @vanruesc made us aware that he has a modified version inside of pmndrs/postprocessing that can be found here. I'm thinking we should use the same Timer class as pmndrs/postprocessing so that a shared timer is possible between pmndrs libraries.

Notable differences are using getters instead of get functions, reset properly resets the whole timer, autoReset manages the timer with page visibility without constructor side effects and the rAF timestamp can be passed into update (though this optimization was added to the three Timer recently).

The only downside I see is when the three Timer gets merged its API will likely be different from ours. However, I think if we do extend what looks like a better Timer design it can influence the final API and allow us to experiment with new ideas.

krispya avatar Dec 31 '22 18:12 krispya

FYI: I forgot to include the above-mentioned Timer changes in the latest pp release. Will update it first thing tomorrow.

vanruesc avatar Jan 01 '23 00:01 vanruesc

The Timer class is now up-to-date in [email protected].

vanruesc avatar Jan 01 '23 19:01 vanruesc

@vanruesc How do you feel about including your Timer class in three-stdlib and centrally maintaining it here? We can use the same class in R3F and possibly sync clocks with postprocessing.

krispya avatar Jan 13 '23 18:01 krispya

Feel free to include it in three-stdlib :+1:

Adding three-stdlib as a dependency in pmndrs/postprocessing for a single class that will eventually be replaced seems overkill to me. I hope the Timer gets included in three soon, even if the API ends up being different.

vanruesc avatar Jan 13 '23 19:01 vanruesc