enable React Compiler, add linter

This commit is contained in:
Brian Beck 2025-12-29 20:02:54 -08:00
parent f0e34caa25
commit 0c6aa3b4dd
59 changed files with 5802 additions and 1831 deletions

View file

@ -120,14 +120,14 @@ export function CamerasProvider({ children }: { children: ReactNode }) {
camera.quaternion.copy(initialViewState.quarternion);
}
}
}, [initialViewState]);
}, [camera, initialViewState]);
useEffect(() => {
if (!initialViewState.initialized || initialViewState.position) return;
if (cameraCount > 0 && cameraIndex === -1) {
setCamera(0);
}
}, [cameraCount, setCamera, cameraIndex]);
}, [cameraCount, setCamera, cameraIndex, initialViewState]);
const context: CamerasContextValue = useMemo(
() => ({

View file

@ -31,7 +31,7 @@ export const FloatingLabel = memo(function FloatingLabel({
labelRef.current.style.opacity = opacity.toString();
}
}
}, [isVisible, fadeWithDistance]);
}, [isVisible, fadeWithDistance, distanceRef]);
useFrame(() => {
if (fadeWithDistance) {

View file

@ -185,34 +185,32 @@ function InteriorMesh({ node }: { node: Mesh }) {
);
}
export const InteriorModel = memo(
({
object,
interiorFile,
}: {
object: TorqueObject;
interiorFile: string;
}) => {
const { nodes } = useInterior(interiorFile);
const debugContext = useDebug();
const debugMode = debugContext?.debugMode ?? false;
export const InteriorModel = memo(function InteriorModel({
object,
interiorFile,
}: {
object: TorqueObject;
interiorFile: string;
}) {
const { nodes } = useInterior(interiorFile);
const debugContext = useDebug();
const debugMode = debugContext?.debugMode ?? false;
return (
<group rotation={[0, -Math.PI / 2, 0]}>
{Object.entries(nodes)
.filter(([, node]: [string, any]) => node.isMesh)
.map(([name, node]: [string, any]) => (
<InteriorMesh key={name} node={node} />
))}
{debugMode ? (
<FloatingLabel>
{object._id}: {interiorFile}
</FloatingLabel>
) : null}
</group>
);
},
);
return (
<group rotation={[0, -Math.PI / 2, 0]}>
{Object.entries(nodes)
.filter(([, node]: [string, any]) => node.isMesh)
.map(([name, node]: [string, any]) => (
<InteriorMesh key={name} node={node} />
))}
{debugMode ? (
<FloatingLabel>
{object._id}: {interiorFile}
</FloatingLabel>
) : null}
</group>
);
});
function InteriorPlaceholder({
color,

View file

@ -131,7 +131,7 @@ function useExecutedMission(
controller.abort();
runtime.destroy();
};
}, [missionName, parsedMission]);
}, [missionName, missionType, parsedMission]);
return state;
}

View file

@ -66,7 +66,7 @@ function CameraMovement() {
return () => {
document.removeEventListener("click", handleClick);
};
}, [nextCamera]);
}, [gl.domElement, nextCamera]);
// Handle number keys 1-9 for camera selection
useEffect(() => {
@ -119,7 +119,7 @@ function CameraMovement() {
return () => {
canvas.removeEventListener("wheel", handleWheel);
};
}, [gl]);
}, [gl.domElement, setSpeedMultiplier]);
useFrame((state, delta) => {
const { forward, backward, left, right, up, down } = getKeys();

View file

@ -27,7 +27,7 @@ export function parseTerrainBuffer(arrayBuffer: ArrayBufferLike): TerrainFile {
};
for (let i = 0; i < SIZE * SIZE; i++) {
let height = dataView.getUint16(offset, true);
const height = dataView.getUint16(offset, true);
offset += 2;
heightMap1d[i] = height;
}
@ -49,7 +49,7 @@ export function parseTerrainBuffer(arrayBuffer: ArrayBufferLike): TerrainFile {
for (const _textureName of textureNames) {
const alphaMap = new Uint8Array(SIZE * SIZE);
for (let j = 0; j < SIZE * SIZE; j++) {
var alphaMats = dataView.getUint8(offset++);
const alphaMats = dataView.getUint8(offset++);
alphaMap[j] = alphaMats;
}
alphaMaps.push(alphaMap);