Skip to content

Commit

Permalink
add optional render hook
Browse files Browse the repository at this point in the history
  • Loading branch information
spearwolf committed Nov 17, 2023
1 parent 3e0ee76 commit 9049973
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/twopoint5d/src/stage/Stage2D.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,15 @@ export class Stage2D {
renderer.autoClear = this.autoClear;

let isRendered = false;
const renderFrame = () => {

const renderFrame = (renderHook?: () => void) => {
if (!isRendered) {
isRendered = true;
renderer.render(scene, camera);
if (renderHook) {
renderHook();
} else {
renderer.render(scene, camera);
}
}
};

Expand Down

0 comments on commit 9049973

Please sign in to comment.