mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-04-22 04:45:34 +00:00
enable React Compiler, add linter
This commit is contained in:
parent
f0e34caa25
commit
0c6aa3b4dd
59 changed files with 5802 additions and 1831 deletions
|
|
@ -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(
|
||||
() => ({
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export const FloatingLabel = memo(function FloatingLabel({
|
|||
labelRef.current.style.opacity = opacity.toString();
|
||||
}
|
||||
}
|
||||
}, [isVisible, fadeWithDistance]);
|
||||
}, [isVisible, fadeWithDistance, distanceRef]);
|
||||
|
||||
useFrame(() => {
|
||||
if (fadeWithDistance) {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ function useExecutedMission(
|
|||
controller.abort();
|
||||
runtime.destroy();
|
||||
};
|
||||
}, [missionName, parsedMission]);
|
||||
}, [missionName, missionType, parsedMission]);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue