pmndrs / pmndrs/three-stdlib

Replace three `Timer` with postprocessing `Timer`

Open
#218 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
858
Forks
144
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the referenced pmndrs/postprocessing src/utils/Timer.ts and compare it with the three Timer implementations and their call sites. Confirm the API differences and replace the existing timers with the postprocessing design, updating uses as needed so a shared timer is possible without breaking behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, three.js
Domain
computer-graphics, tooling
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.