Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
oatkiller committed Jan 30, 2020
1 parent ce922d1 commit 9a9d882
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ export function useCamera(): {
*/
const projectionMatrixAtTime = useSelector(selectors.projectionMatrix);

/**
* Use a ref to refer to the `projectionMatrixAtTime` function. The rAF loop
* accesses this and sets state during the rAF cycle. If the rAF loop
* effect read this directly from the selector, the rAF loop would need to
* be re-inited each time this function changed. The `projectionMatrixAtTime` function
* changes each frame during an animation, so the rAF loop would be causing
* itself to reinit on each frame. This would necessarily cause a drop in FPS as there
* would be a dead zone between when the rAF loop stopped and restarted itself.
* TODO prove this.
*/
const projectionMatrixAtTimeRef = useRef<typeof projectionMatrixAtTime>();

/**
Expand Down

0 comments on commit 9a9d882

Please sign in to comment.