add better error debug labels, rebuild

This commit is contained in:
Brian Beck 2025-11-30 17:42:59 -08:00
parent e600bc3418
commit 8147a1c418
13 changed files with 52 additions and 18 deletions

View file

@ -59,18 +59,31 @@ export function ShapeTexture({
return <primitive object={customMaterial} attach="material" />;
}
export function ShapePlaceholder({ color }: { color: string }) {
export function ShapePlaceholder({
color,
label,
}: {
color: string;
label?: string;
}) {
return (
<mesh>
<boxGeometry args={[10, 10, 10]} />
<meshStandardMaterial color={color} wireframe />
{label ? <FloatingLabel color={color}>{label}</FloatingLabel> : null}
</mesh>
);
}
export function DebugPlaceholder({ color }: { color: string }) {
export function DebugPlaceholder({
color,
label,
}: {
color: string;
label?: string;
}) {
const { debugMode } = useDebug();
return debugMode ? <ShapePlaceholder color={color} /> : null;
return debugMode ? <ShapePlaceholder color={color} label={label} /> : null;
}
export const ShapeModel = memo(function ShapeModel() {

View file

@ -71,18 +71,25 @@ export const InteriorModel = memo(
},
);
function InteriorPlaceholder({ color }: { color: string }) {
function InteriorPlaceholder({
color,
label,
}: {
color: string;
label?: string;
}) {
return (
<mesh>
<boxGeometry args={[10, 10, 10]} />
<meshStandardMaterial color={color} wireframe />
{label ? <FloatingLabel color={color}>{label}</FloatingLabel> : null}
</mesh>
);
}
function DebugInteriorPlaceholder() {
function DebugInteriorPlaceholder({ label }: { label?: string }) {
const { debugMode } = useDebug();
return debugMode ? <InteriorPlaceholder color="red" /> : null;
return debugMode ? <InteriorPlaceholder color="red" label={label} /> : null;
}
export const InteriorInstance = memo(function InteriorInstance({
@ -97,7 +104,9 @@ export const InteriorInstance = memo(function InteriorInstance({
return (
<group position={position} quaternion={q} scale={scale}>
<ErrorBoundary fallback={<DebugInteriorPlaceholder />}>
<ErrorBoundary
fallback={<DebugInteriorPlaceholder label={interiorFile} />}
>
<Suspense fallback={<InteriorPlaceholder color="orange" />}>
<InteriorModel interiorFile={interiorFile} />
</Suspense>

View file

@ -79,7 +79,9 @@ export function Item({ object }: { object: TorqueObject }) {
<ShapeInfoProvider shapeName={shapeName} type="Item">
<group position={position} quaternion={q} scale={scale}>
{shapeName ? (
<ErrorBoundary fallback={<DebugPlaceholder color="red" />}>
<ErrorBoundary
fallback={<DebugPlaceholder color="red" label={shapeName} />}
>
<Suspense fallback={<ShapePlaceholder color="pink" />}>
<ShapeModel />
{label ? (

View file

@ -58,7 +58,9 @@ export function StaticShape({ object }: { object: TorqueObject }) {
<ShapeInfoProvider shapeName={shapeName} type="StaticShape">
<group position={position} quaternion={q} scale={scale}>
{shapeName ? (
<ErrorBoundary fallback={<DebugPlaceholder color="red" />}>
<ErrorBoundary
fallback={<DebugPlaceholder color="red" label={shapeName} />}
>
<Suspense fallback={<ShapePlaceholder color="yellow" />}>
<ShapeModel />
</Suspense>

View file

@ -19,7 +19,9 @@ export function TSStatic({ object }: { object: TorqueObject }) {
return (
<ShapeInfoProvider shapeName={shapeName} type="TSStatic">
<group position={position} quaternion={q} scale={scale}>
<ErrorBoundary fallback={<DebugPlaceholder color="red" />}>
<ErrorBoundary
fallback={<DebugPlaceholder color="red" label={shapeName} />}
>
<Suspense fallback={<ShapePlaceholder color="yellow" />}>
<ShapeModel />
</Suspense>

View file

@ -57,7 +57,9 @@ export function Turret({ object }: { object: TorqueObject }) {
<ShapeInfoProvider shapeName={shapeName} type="Turret">
<group position={position} quaternion={q} scale={scale}>
{shapeName ? (
<ErrorBoundary fallback={<DebugPlaceholder color="red" />}>
<ErrorBoundary
fallback={<DebugPlaceholder color="red" label={shapeName} />}
>
<Suspense fallback={<ShapePlaceholder color="yellow" />}>
<ShapeModel />
</Suspense>
@ -68,7 +70,11 @@ export function Turret({ object }: { object: TorqueObject }) {
<ShapeInfoProvider shapeName={barrelShapeName} type="Turret">
<group position={[0, 1.5, 0]}>
{barrelShapeName ? (
<ErrorBoundary fallback={<DebugPlaceholder color="red" />}>
<ErrorBoundary
fallback={
<DebugPlaceholder color="red" label={barrelShapeName} />
}
>
<Suspense fallback={<ShapePlaceholder color="yellow" />}>
<ShapeModel />
</Suspense>