Skip to content

Commit 5dd58a6

Browse files
committed
Merge branch 'feat-blocks-auto-render' of https://github.com/playcanvas/react into feat-blocks-auto-render
2 parents 283ff02 + b431387 commit 5dd58a6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/blocks/src/splat-viewer/hooks/use-render-on-camera-change.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ const nearlyEquals = (a: Float32Array, b: Float32Array, epsilon = 1e-4): boolean
99
return true;
1010
};
1111

12+
/**
13+
* A custom React hook that triggers rendering when the camera's transform or projection matrix changes.
14+
*
15+
* @param {Entity | null} entity - The PlayCanvas entity representing the camera. If null, the hook does nothing.
16+
* @returns {void} This hook does not return a value but updates the rendering state of the application.
17+
*/
1218
export const useRenderOnCameraChange = (entity: Entity | null) => {
1319
const app = useApp();
1420
const prevWorld = useRef<Float32Array>(new Float32Array(16));

0 commit comments

Comments
 (0)