feat: add the map
This commit is contained in:
+3
-2
@@ -31,6 +31,7 @@ Scene objects are **never** singleton classes. Managers are **never** React comp
|
||||
- Scene components live in `src/world/` and `src/components/3d/`
|
||||
- UI overlays live in `src/components/ui/`
|
||||
- Managers live in `src/stateManager/`
|
||||
- Debug tooling lives in `src/debug/`
|
||||
- Hooks live in `src/hooks/`
|
||||
- Static data lives in `src/data/`
|
||||
- Shaders live in `src/shaders/`
|
||||
@@ -54,9 +55,9 @@ import { useGameState } from "@/hooks/useGameState";
|
||||
### Debug
|
||||
|
||||
- Debug panel activates with `?debug` in URL
|
||||
- All debug logic goes through `Debug.getInstance()` from `src/utils/Debug.ts`
|
||||
- All debug logic goes through `Debug.getInstance()` from `src/debug/Debug.ts`
|
||||
- Never scatter `if (isDev)` blocks across files
|
||||
- `r3f-perf` is lazy-loaded only in debug mode via `src/components/3d/DebugPerf.tsx`
|
||||
- `r3f-perf` is lazy-loaded only in debug mode via `src/debug/DebugPerf.tsx`
|
||||
|
||||
## Managers (4 max)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ http://localhost:5173?debug
|
||||
## Debug singleton
|
||||
|
||||
```ts
|
||||
// src/utils/Debug.ts
|
||||
// src/debug/Debug.ts
|
||||
import GUI from "lil-gui";
|
||||
|
||||
export class Debug {
|
||||
@@ -56,14 +56,15 @@ if (debug.active) {
|
||||
r3f-perf is loaded only in debug mode to avoid dependency issues in production:
|
||||
|
||||
```tsx
|
||||
// src/components/3d/DebugPerf.tsx
|
||||
// src/debug/DebugPerf.tsx
|
||||
import { Suspense, lazy } from "react";
|
||||
import { Debug } from "@/debug/Debug";
|
||||
|
||||
const Perf = lazy(() => import("r3f-perf").then((m) => ({ default: m.Perf })));
|
||||
|
||||
export function DebugPerf() {
|
||||
const debug = new URLSearchParams(window.location.search).has("debug");
|
||||
if (!debug) return null;
|
||||
const debug = Debug.getInstance();
|
||||
if (!debug.active) return null;
|
||||
|
||||
return (
|
||||
<Suspense fallback={null}>
|
||||
|
||||
Reference in New Issue
Block a user