13 |
14 |
20 | hover(true)}
25 | onPointerOut={() => hover(false)}
26 | material-color={hovered ? 'purple' : 'orange'}
27 | />
28 |
29 |
30 |
31 | Hover over the box, it will only render once to change colour, or when you move the camera. Look at the stats to confirm.
32 |
33 |
34 | }
--------------------------------------------------------------------------------
/src/core/canvas-in-layer/use-render.ts:
--------------------------------------------------------------------------------
1 | import { RootState } from "@react-three/fiber";
2 | import { Matrix4Tuple, PerspectiveCamera } from "three";
3 | import { UseBoundStore } from "zustand";
4 | import { MapInstance } from "../generic-map";
5 | import { syncCamera } from "../sync-camera";
6 | import { useFunction } from "../use-function";
7 | import { R3M } from "../use-r3m";
8 |
9 | export function useRender({
10 | map, origin, useThree, frameloop, r3m,
11 | } :{
12 | map: MapInstance,
13 | origin: Matrix4Tuple,
14 | useThree: UseBoundStore