@almadar/shell-web 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AvlGlyph-PIXU6QH5.js +5 -0
- package/dist/AvlStateMachine-CKGMECMG.js +8 -0
- package/dist/{AvlTransitionDetail-63SD6GZF.js → AvlTransitionDetail-QZX6G5KJ.js} +4 -5
- package/dist/AvlTransitionExplainer-26WLEIC6.js +11 -0
- package/dist/BehaviorView-JLZ4PKWY.js +10 -0
- package/dist/{FileTree-BCFnBEuQ.d.ts → FileTree-B3GDAjaQ.d.ts} +131 -4
- package/dist/{FlowCanvas-AUMTWMNG.js → FlowCanvas-RPII4V24.js} +10 -13
- package/dist/{FlowCanvas-3JRMNJLV.css → FlowCanvas-VWUPMBKB.css} +189 -191
- package/dist/{GameAudioProvider-ceM_n0ey.d.ts → GameAudioProvider-D7wo5ryN.d.ts} +1 -1
- package/dist/{KernelEngineContext-CcxGYtlr.d.ts → KernelEngineContext-CPeWQMAz.d.ts} +15 -2
- package/dist/ModuleCard-NJD6JQGD.js +6 -0
- package/dist/{OrbInspector-QCPEPUPH.js → OrbInspector-OWWKPOBF.js} +10 -13
- package/dist/{OrbInspector-MHLJ6OEE.css → OrbInspector-VMTMZHNQ.css} +189 -191
- package/dist/{Select-B-iDdnvE.d.ts → Select-C2Uq6t86.d.ts} +1 -1
- package/dist/{UISlotRenderer-KVFO6J7R.css → UISlotRenderer-BIS6KT7T.css} +189 -191
- package/dist/{UISlotRenderer-C7WWOK43.js → UISlotRenderer-PY7FIJXN.js} +10 -13
- package/dist/avl/index.css +189 -191
- package/dist/avl/index.d.ts +19 -7
- package/dist/avl/index.js +157 -26
- package/dist/{chunk-TUPZWTRE.js → chunk-2WGR4TDJ.js} +464 -35
- package/dist/{chunk-SP5CDJ6K.js → chunk-4YJ53G7S.js} +3 -3
- package/dist/{chunk-HH5KSMH5.js → chunk-7N6ZPHQ5.js} +1 -1
- package/dist/{chunk-CPLN6NBQ.js → chunk-AGVSO4WY.js} +2 -3
- package/dist/{chunk-UXLE3IPR.js → chunk-FAKU5F62.js} +205 -4
- package/dist/{chunk-TXAUOLWZ.js → chunk-M74BCDBQ.js} +1 -1
- package/dist/{chunk-LHP2TK7O.js → chunk-MS4K3K2R.js} +2908 -4574
- package/dist/{chunk-K4MOPSEL.js → chunk-OWNG4JZI.js} +3 -4
- package/dist/{chunk-AB3X7QTE.js → chunk-PRLHKBXG.js} +1 -2
- package/dist/{chunk-X3DMMX27.js → chunk-VHC2M26B.js} +1 -1
- package/dist/{chunk-E6KA4J6N.js → chunk-VUIACGDU.js} +3 -4
- package/dist/{chunk-ROICKAU7.js → chunk-YYIHRIDH.js} +1 -1
- package/dist/{chunk-3VZ36ZKO.js → chunk-ZDRDJKYB.js} +5 -2
- package/dist/components/index.css +189 -191
- package/dist/components/index.d.ts +417 -173
- package/dist/components/index.js +14 -17
- package/dist/core.d.ts +3 -3
- package/dist/{fx-CmQjnHmT.d.ts → fx-Br8zjvu9.d.ts} +6 -6
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -2
- package/dist/{kernel-client-TZKGHJRY.js → kernel-client-JW6OH5FX.js} +24 -3
- package/dist/{kernel-wire-wNdAPfhJ.d.ts → kernel-wire-DGAySGhX.d.ts} +7 -0
- package/dist/lib/index.d.ts +2 -3
- package/dist/lib/index.js +2 -3
- package/dist/providers/index.css +189 -191
- package/dist/providers/index.d.ts +6 -8
- package/dist/providers/index.js +10 -14
- package/dist/runtime/index.css +189 -191
- package/dist/runtime/index.d.ts +6 -1
- package/dist/runtime/index.js +10 -13
- package/dist/test-support.js +2 -2
- package/dist/{paintDispatch-CuJLsr9Y.d.ts → verificationRegistry-oopV1J1n.d.ts} +127 -15
- package/package.json +8 -36
- package/dist/AvlGlyph-EPJKFEO3.js +0 -6
- package/dist/AvlStateMachine-RKZIKNGC.js +0 -9
- package/dist/AvlTransitionExplainer-ZBTLOM3T.js +0 -12
- package/dist/BehaviorView-YS5G4GNB.js +0 -11
- package/dist/Canvas3DHost-BkZQB5l2.d.ts +0 -552
- package/dist/ModuleCard-QHDGK5XK.js +0 -7
- package/dist/avl-3d-context-BycmO6tG.d.ts +0 -201
- package/dist/avl-schema-parser-CtJxJ9KU.d.ts +0 -132
- package/dist/avl-zoom-state-CKMVuBFg.d.ts +0 -17
- package/dist/chunk-4T3P43NS.js +0 -1133
- package/dist/chunk-DZBQA2OW.js +0 -176
- package/dist/chunk-EOWMARUB.js +0 -16
- package/dist/chunk-GFXCPUMX.js +0 -1334
- package/dist/chunk-ILZ7ORX7.js +0 -432
- package/dist/three/index.css +0 -503
- package/dist/three/index.d.ts +0 -1185
- package/dist/three/index.js +0 -3908
- package/dist/verificationRegistry-CVrcxG1s.d.ts +0 -122
package/dist/three/index.d.ts
DELETED
|
@@ -1,1185 +0,0 @@
|
|
|
1
|
-
import { C as CanvasPointLightConfig } from '../Canvas3DHost-BkZQB5l2.js';
|
|
2
|
-
import { IsometricTile, IsometricUnit, IsometricFeature } from '../components/index.js';
|
|
3
|
-
export { c as Canvas3DHost, d as Canvas3DHostHandle, e as Canvas3DHostProps, c as GameCanvas3D, U as UnitAnimationState } from '../Canvas3DHost-BkZQB5l2.js';
|
|
4
|
-
import React__default, { Component, ReactNode, ErrorInfo } from 'react';
|
|
5
|
-
import * as THREE from 'three';
|
|
6
|
-
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
|
|
7
|
-
import { JsonObject, EventEmit, OrbitalSchema } from '@almadar/core';
|
|
8
|
-
import { ZoomLevel } from '../avl/index.js';
|
|
9
|
-
import { b as Avl3DModelOverrides } from '../avl-3d-context-BycmO6tG.js';
|
|
10
|
-
export { d as AVL_3D_COLORS, A as Avl3DConfig, a as Avl3DContext, C as CAMERA_POSITIONS, P as Position3D, e as arcCurve3D, f as fibonacciSpherePositions, g as goldenSpiralPositions, o as orbitRingPositions, s as selfLoopCurve3D, t as treeLayout3D, u as useAvl3DConfig } from '../avl-3d-context-BycmO6tG.js';
|
|
11
|
-
import { ApplicationLevelData, OrbitalLevelData, TraitLevelData, TransitionLevelData } from '../avl/index.js';
|
|
12
|
-
import '../paintDispatch-CuJLsr9Y.js';
|
|
13
|
-
import '../fx-CmQjnHmT.js';
|
|
14
|
-
import 'lucide-react';
|
|
15
|
-
import '../EventBusProvider-BFFHfN4O.js';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Scene3D
|
|
19
|
-
*
|
|
20
|
-
* Three.js scene wrapper component for React Three Fiber.
|
|
21
|
-
* Manages the scene environment, fog, and background.
|
|
22
|
-
*
|
|
23
|
-
* @packageDocumentation
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
interface Scene3DProps {
|
|
27
|
-
/** Background color or URL */
|
|
28
|
-
background?: string;
|
|
29
|
-
/** Fog configuration */
|
|
30
|
-
fog?: {
|
|
31
|
-
color: string;
|
|
32
|
-
near: number;
|
|
33
|
-
far: number;
|
|
34
|
-
};
|
|
35
|
-
/** Children to render in scene */
|
|
36
|
-
children?: React__default.ReactNode;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Scene3D Component
|
|
40
|
-
*
|
|
41
|
-
* Manages Three.js scene settings like background and fog.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```tsx
|
|
45
|
-
* <Canvas>
|
|
46
|
-
* <Scene3D background="#1a1a2e" fog={{ color: '#1a1a2e', near: 10, far: 50 }}>
|
|
47
|
-
* <GameObjects />
|
|
48
|
-
* </Scene3D>
|
|
49
|
-
* </Canvas>
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
declare function Scene3D({ background, fog, children }: Scene3DProps): React__default.JSX.Element;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Camera3D
|
|
56
|
-
*
|
|
57
|
-
* Three.js camera component with orbit controls.
|
|
58
|
-
* Supports isometric, perspective, and top-down camera modes.
|
|
59
|
-
*
|
|
60
|
-
* @packageDocumentation
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
type CameraMode$1 = 'isometric' | 'perspective' | 'top-down';
|
|
64
|
-
interface Camera3DProps {
|
|
65
|
-
/** Camera mode */
|
|
66
|
-
mode?: CameraMode$1;
|
|
67
|
-
/** Initial camera position */
|
|
68
|
-
position?: [number, number, number];
|
|
69
|
-
/** Target to look at */
|
|
70
|
-
target?: [number, number, number];
|
|
71
|
-
/** Zoom level */
|
|
72
|
-
zoom?: number;
|
|
73
|
-
/** Field of view (perspective mode only) */
|
|
74
|
-
fov?: number;
|
|
75
|
-
/** Enable orbit controls */
|
|
76
|
-
enableOrbit?: boolean;
|
|
77
|
-
/** Minimum zoom distance */
|
|
78
|
-
minDistance?: number;
|
|
79
|
-
/** Maximum zoom distance */
|
|
80
|
-
maxDistance?: number;
|
|
81
|
-
/** Called when camera changes */
|
|
82
|
-
onChange?: (camera: THREE.Camera) => void;
|
|
83
|
-
}
|
|
84
|
-
interface Camera3DHandle {
|
|
85
|
-
/** Get current camera */
|
|
86
|
-
getCamera: () => THREE.Camera;
|
|
87
|
-
/** Set camera position */
|
|
88
|
-
setPosition: (x: number, y: number, z: number) => void;
|
|
89
|
-
/** Look at target */
|
|
90
|
-
lookAt: (x: number, y: number, z: number) => void;
|
|
91
|
-
/** Reset to initial position */
|
|
92
|
-
reset: () => void;
|
|
93
|
-
/** Get current view bounds */
|
|
94
|
-
getViewBounds: () => {
|
|
95
|
-
min: THREE.Vector3;
|
|
96
|
-
max: THREE.Vector3;
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Camera3D Component
|
|
101
|
-
*
|
|
102
|
-
* Configurable camera with orbit controls and multiple modes.
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```tsx
|
|
106
|
-
* <Canvas>
|
|
107
|
-
* <Camera3D mode="isometric" position={[10, 10, 10]} target={[0, 0, 0]} />
|
|
108
|
-
* </Canvas>
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
declare const Camera3D: React__default.ForwardRefExoticComponent<Camera3DProps & React__default.RefAttributes<Camera3DHandle>>;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Lighting3D
|
|
115
|
-
*
|
|
116
|
-
* Default lighting setup for 3D game scenes.
|
|
117
|
-
* Includes ambient, directional, and optional point lights.
|
|
118
|
-
*
|
|
119
|
-
* @packageDocumentation
|
|
120
|
-
*/
|
|
121
|
-
|
|
122
|
-
interface Lighting3DProps {
|
|
123
|
-
/** Ambient light intensity */
|
|
124
|
-
ambientIntensity?: number;
|
|
125
|
-
/** Ambient light color */
|
|
126
|
-
ambientColor?: string;
|
|
127
|
-
/** Directional light intensity */
|
|
128
|
-
directionalIntensity?: number;
|
|
129
|
-
/** Directional light color */
|
|
130
|
-
directionalColor?: string;
|
|
131
|
-
/** Directional light position */
|
|
132
|
-
directionalPosition?: [number, number, number];
|
|
133
|
-
/** Hemisphere (sky/ground) light intensity */
|
|
134
|
-
hemisphereIntensity?: number;
|
|
135
|
-
/** Hemisphere sky color */
|
|
136
|
-
hemisphereColor?: string;
|
|
137
|
-
/** Hemisphere ground color */
|
|
138
|
-
hemisphereGroundColor?: string;
|
|
139
|
-
/** Additional point lights, authored as data */
|
|
140
|
-
points?: CanvasPointLightConfig[];
|
|
141
|
-
/** Enable shadows */
|
|
142
|
-
shadows?: boolean;
|
|
143
|
-
/** Shadow map size */
|
|
144
|
-
shadowMapSize?: number;
|
|
145
|
-
/** Shadow camera size (orthographic half-extent) */
|
|
146
|
-
shadowCameraSize?: number;
|
|
147
|
-
/** Shadow depth bias — reduces shadow acne */
|
|
148
|
-
shadowBias?: number;
|
|
149
|
-
/** Shadow normal bias — reduces acne on angled faces (undefined = three.js default 0) */
|
|
150
|
-
shadowNormalBias?: number;
|
|
151
|
-
/** Shadow camera near plane */
|
|
152
|
-
shadowCameraNear?: number;
|
|
153
|
-
/** Shadow camera far plane */
|
|
154
|
-
shadowCameraFar?: number;
|
|
155
|
-
/** Show helper for directional light */
|
|
156
|
-
showHelpers?: boolean;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Lighting3D Component
|
|
160
|
-
*
|
|
161
|
-
* Pre-configured lighting setup for game scenes.
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* ```tsx
|
|
165
|
-
* <Canvas>
|
|
166
|
-
* <Lighting3D
|
|
167
|
-
* ambientIntensity={0.6}
|
|
168
|
-
* directionalIntensity={1.0}
|
|
169
|
-
* shadows={true}
|
|
170
|
-
* />
|
|
171
|
-
* </Canvas>
|
|
172
|
-
* ```
|
|
173
|
-
*/
|
|
174
|
-
declare function Lighting3D({ ambientIntensity, ambientColor, directionalIntensity, directionalColor, directionalPosition, hemisphereIntensity, hemisphereColor, hemisphereGroundColor, points, shadows, shadowMapSize, shadowCameraSize, shadowBias, shadowNormalBias, shadowCameraNear, shadowCameraFar, showHelpers, }: Lighting3DProps): React__default.JSX.Element;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Canvas3DLoadingState
|
|
178
|
-
*
|
|
179
|
-
* Loading state component for 3D canvas with progress indicator.
|
|
180
|
-
* Displays asset loading progress and estimated time remaining.
|
|
181
|
-
*
|
|
182
|
-
* @packageDocumentation
|
|
183
|
-
*/
|
|
184
|
-
|
|
185
|
-
interface Canvas3DLoadingStateProps {
|
|
186
|
-
/** Current loading progress (0-100) */
|
|
187
|
-
progress?: number;
|
|
188
|
-
/** Number of assets loaded */
|
|
189
|
-
loaded?: number;
|
|
190
|
-
/** Total assets to load */
|
|
191
|
-
total?: number;
|
|
192
|
-
/** Loading message */
|
|
193
|
-
message?: string;
|
|
194
|
-
/** Secondary details message */
|
|
195
|
-
details?: string;
|
|
196
|
-
/** Whether to show spinner */
|
|
197
|
-
showSpinner?: boolean;
|
|
198
|
-
/** Custom className */
|
|
199
|
-
className?: string;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Canvas3DLoadingState Component
|
|
203
|
-
*
|
|
204
|
-
* Displays loading progress for 3D assets.
|
|
205
|
-
*
|
|
206
|
-
* @example
|
|
207
|
-
* ```tsx
|
|
208
|
-
* <Canvas3DLoadingState
|
|
209
|
-
* progress={65}
|
|
210
|
-
* loaded={13}
|
|
211
|
-
* total={20}
|
|
212
|
-
* message="Loading 3D models..."
|
|
213
|
-
* details="character-knight.glb"
|
|
214
|
-
* />
|
|
215
|
-
* ```
|
|
216
|
-
*/
|
|
217
|
-
declare function Canvas3DLoadingState({ progress, loaded, total, message: messageProp, details, showSpinner, className, }: Canvas3DLoadingStateProps): React__default.JSX.Element;
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Canvas3DErrorBoundary
|
|
221
|
-
*
|
|
222
|
-
* Error boundary for 3D canvas components.
|
|
223
|
-
* Catches Three.js and React Three Fiber errors gracefully.
|
|
224
|
-
*
|
|
225
|
-
* @packageDocumentation
|
|
226
|
-
*/
|
|
227
|
-
|
|
228
|
-
interface Canvas3DErrorBoundaryProps {
|
|
229
|
-
/** Child components */
|
|
230
|
-
children: ReactNode;
|
|
231
|
-
/** Custom fallback component */
|
|
232
|
-
fallback?: ReactNode;
|
|
233
|
-
/** Error callback */
|
|
234
|
-
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
235
|
-
/** Reset callback */
|
|
236
|
-
onReset?: () => void;
|
|
237
|
-
}
|
|
238
|
-
interface Canvas3DErrorBoundaryState {
|
|
239
|
-
/** Whether an error has occurred */
|
|
240
|
-
hasError: boolean;
|
|
241
|
-
/** The error that occurred */
|
|
242
|
-
error: Error | null;
|
|
243
|
-
/** Error info from React */
|
|
244
|
-
errorInfo: ErrorInfo | null;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Canvas3DErrorBoundary Component
|
|
248
|
-
*
|
|
249
|
-
* Catches errors in 3D canvas and displays a user-friendly fallback.
|
|
250
|
-
*
|
|
251
|
-
* @example
|
|
252
|
-
* ```tsx
|
|
253
|
-
* <Canvas3DErrorBoundary
|
|
254
|
-
* onError={(error) => console.error('3D Error:', error)}
|
|
255
|
-
* onReset={() => console.log('Resetting...')}
|
|
256
|
-
* >
|
|
257
|
-
* <GameCanvas3D {...props} />
|
|
258
|
-
* </Canvas3DErrorBoundary>
|
|
259
|
-
* ```
|
|
260
|
-
*/
|
|
261
|
-
declare class Canvas3DErrorBoundary extends Component<Canvas3DErrorBoundaryProps, Canvas3DErrorBoundaryState> {
|
|
262
|
-
constructor(props: Canvas3DErrorBoundaryProps);
|
|
263
|
-
static getDerivedStateFromError(error: Error): Canvas3DErrorBoundaryState;
|
|
264
|
-
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
265
|
-
handleReset: () => void;
|
|
266
|
-
render(): ReactNode;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* ModelLoader Component
|
|
271
|
-
*
|
|
272
|
-
* React Three Fiber component for loading and displaying GLB/GLTF models from URLs.
|
|
273
|
-
* Handles loading states and errors without requiring React Suspense.
|
|
274
|
-
*
|
|
275
|
-
* @packageDocumentation
|
|
276
|
-
*/
|
|
277
|
-
|
|
278
|
-
interface ModelLoaderProps {
|
|
279
|
-
/** URL to the GLB/GLTF model */
|
|
280
|
-
url: string;
|
|
281
|
-
/** Position [x, y, z] */
|
|
282
|
-
position?: [number, number, number];
|
|
283
|
-
/** Scale - either a single number or [x, y, z] */
|
|
284
|
-
scale?: number | [number, number, number];
|
|
285
|
-
/** Rotation in degrees [x, y, z] */
|
|
286
|
-
rotation?: [number, number, number];
|
|
287
|
-
/** Whether the model is selected */
|
|
288
|
-
isSelected?: boolean;
|
|
289
|
-
/** Whether the model is hovered */
|
|
290
|
-
isHovered?: boolean;
|
|
291
|
-
/** Click handler */
|
|
292
|
-
onClick?: () => void;
|
|
293
|
-
/** Hover handler */
|
|
294
|
-
onHover?: (hovered: boolean) => void;
|
|
295
|
-
/** Fallback geometry type */
|
|
296
|
-
fallbackGeometry?: 'box' | 'sphere' | 'cylinder' | 'none';
|
|
297
|
-
/**
|
|
298
|
-
* Named GLB animation clip to play (e.g. "idle", "walk") — the LOLO state machine
|
|
299
|
-
* drives this from the unit's `animation` field. Matched case-insensitively; an
|
|
300
|
-
* unknown or absent name leaves the model static (bind pose).
|
|
301
|
-
*/
|
|
302
|
-
animation?: string;
|
|
303
|
-
/** Multiply the model's material colors by this CSS color (per-instance; e.g. team tint). */
|
|
304
|
-
tint?: string;
|
|
305
|
-
/** Enable shadows */
|
|
306
|
-
castShadow?: boolean;
|
|
307
|
-
/** Receive shadows */
|
|
308
|
-
receiveShadow?: boolean;
|
|
309
|
-
/**
|
|
310
|
-
* Base path for shared resources (textures, materials).
|
|
311
|
-
* If not provided, auto-detected from the URL by looking for a `/3d/` segment.
|
|
312
|
-
* E.g. "https://host/3d/" so that "Textures/colormap.png" resolves correctly.
|
|
313
|
-
*/
|
|
314
|
-
resourceBasePath?: string;
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* ModelLoader component for rendering GLB models in React Three Fiber
|
|
318
|
-
*/
|
|
319
|
-
declare function ModelLoader({ url, position, scale, rotation, isSelected, isHovered, onClick, onHover, fallbackGeometry, castShadow, receiveShadow, resourceBasePath, animation, tint, }: ModelLoaderProps): React__default.JSX.Element;
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* AssetLoader
|
|
323
|
-
*
|
|
324
|
-
* Three.js asset loading manager for 3D models and textures.
|
|
325
|
-
* Supports GLB/GLTF (primary), OBJ (fallback), and texture loading.
|
|
326
|
-
* Implements caching for performance.
|
|
327
|
-
*
|
|
328
|
-
* @packageDocumentation
|
|
329
|
-
*/
|
|
330
|
-
|
|
331
|
-
interface LoadedModel {
|
|
332
|
-
scene: THREE.Group;
|
|
333
|
-
animations: THREE.AnimationClip[];
|
|
334
|
-
}
|
|
335
|
-
declare class AssetLoader {
|
|
336
|
-
private objLoader;
|
|
337
|
-
private textureLoader;
|
|
338
|
-
private modelCache;
|
|
339
|
-
private textureCache;
|
|
340
|
-
private loadingPromises;
|
|
341
|
-
constructor();
|
|
342
|
-
/**
|
|
343
|
-
* Load a GLB/GLTF model
|
|
344
|
-
* @param url - URL to the .glb or .gltf file
|
|
345
|
-
* @returns Promise with loaded model scene and animations
|
|
346
|
-
*/
|
|
347
|
-
loadModel(url: string): Promise<LoadedModel>;
|
|
348
|
-
/**
|
|
349
|
-
* Load an OBJ model (fallback for non-GLB assets)
|
|
350
|
-
* @param url - URL to the .obj file
|
|
351
|
-
* @returns Promise with loaded object group
|
|
352
|
-
*/
|
|
353
|
-
loadOBJ(url: string): Promise<THREE.Group>;
|
|
354
|
-
/**
|
|
355
|
-
* Load a texture
|
|
356
|
-
* @param url - URL to the texture image
|
|
357
|
-
* @returns Promise with loaded texture
|
|
358
|
-
*/
|
|
359
|
-
loadTexture(url: string): Promise<THREE.Texture>;
|
|
360
|
-
/**
|
|
361
|
-
* Preload multiple assets
|
|
362
|
-
* @param urls - Array of asset URLs to preload
|
|
363
|
-
* @returns Promise that resolves when all assets are loaded
|
|
364
|
-
*/
|
|
365
|
-
preload(urls: string[]): Promise<void>;
|
|
366
|
-
/**
|
|
367
|
-
* Check if a model is cached
|
|
368
|
-
* @param url - Model URL
|
|
369
|
-
*/
|
|
370
|
-
hasModel(url: string): boolean;
|
|
371
|
-
/**
|
|
372
|
-
* Check if a texture is cached
|
|
373
|
-
* @param url - Texture URL
|
|
374
|
-
*/
|
|
375
|
-
hasTexture(url: string): boolean;
|
|
376
|
-
/**
|
|
377
|
-
* Get cached model (throws if not cached)
|
|
378
|
-
* @param url - Model URL
|
|
379
|
-
*/
|
|
380
|
-
getModel(url: string): LoadedModel;
|
|
381
|
-
/**
|
|
382
|
-
* Get cached texture (throws if not cached)
|
|
383
|
-
* @param url - Texture URL
|
|
384
|
-
*/
|
|
385
|
-
getTexture(url: string): THREE.Texture;
|
|
386
|
-
/**
|
|
387
|
-
* Clear all caches
|
|
388
|
-
*/
|
|
389
|
-
clearCache(): void;
|
|
390
|
-
/**
|
|
391
|
-
* Get cache statistics
|
|
392
|
-
*/
|
|
393
|
-
getStats(): {
|
|
394
|
-
models: number;
|
|
395
|
-
textures: number;
|
|
396
|
-
loading: number;
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
declare const assetLoader: AssetLoader;
|
|
400
|
-
|
|
401
|
-
type CameraMode = 'isometric' | 'perspective' | 'top-down';
|
|
402
|
-
interface UseThreeOptions {
|
|
403
|
-
/** Camera mode for viewing the scene */
|
|
404
|
-
cameraMode?: CameraMode;
|
|
405
|
-
/** Initial camera position [x, y, z] */
|
|
406
|
-
cameraPosition?: [number, number, number];
|
|
407
|
-
/** Background color */
|
|
408
|
-
backgroundColor?: string;
|
|
409
|
-
/** Enable shadows */
|
|
410
|
-
shadows?: boolean;
|
|
411
|
-
/** Enable grid helper */
|
|
412
|
-
showGrid?: boolean;
|
|
413
|
-
/** Grid size */
|
|
414
|
-
gridSize?: number;
|
|
415
|
-
/** Asset loader instance */
|
|
416
|
-
assetLoader?: AssetLoader;
|
|
417
|
-
}
|
|
418
|
-
interface UseThreeReturn {
|
|
419
|
-
/** Canvas element reference (for React Three Fiber) */
|
|
420
|
-
canvasRef: React.RefObject<HTMLCanvasElement | null>;
|
|
421
|
-
/** Three.js renderer */
|
|
422
|
-
renderer: THREE.WebGLRenderer | null;
|
|
423
|
-
/** Three.js scene */
|
|
424
|
-
scene: THREE.Scene | null;
|
|
425
|
-
/** Three.js camera */
|
|
426
|
-
camera: THREE.Camera | null;
|
|
427
|
-
/** Orbit controls */
|
|
428
|
-
controls: OrbitControls | null;
|
|
429
|
-
/** Is scene ready */
|
|
430
|
-
isReady: boolean;
|
|
431
|
-
/** Canvas dimensions */
|
|
432
|
-
dimensions: {
|
|
433
|
-
width: number;
|
|
434
|
-
height: number;
|
|
435
|
-
};
|
|
436
|
-
/** Set camera position */
|
|
437
|
-
setCameraPosition: (x: number, y: number, z: number) => void;
|
|
438
|
-
/** Look at a specific point */
|
|
439
|
-
lookAt: (x: number, y: number, z: number) => void;
|
|
440
|
-
/** Reset camera to initial position */
|
|
441
|
-
resetCamera: () => void;
|
|
442
|
-
/** Fit view to bounds */
|
|
443
|
-
fitView: (bounds: {
|
|
444
|
-
minX: number;
|
|
445
|
-
maxX: number;
|
|
446
|
-
minZ: number;
|
|
447
|
-
maxZ: number;
|
|
448
|
-
}) => void;
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* Hook for managing a Three.js scene
|
|
452
|
-
* This is a lower-level hook used by GameCanvas3D
|
|
453
|
-
*/
|
|
454
|
-
declare function useThree(options?: UseThreeOptions): UseThreeReturn;
|
|
455
|
-
|
|
456
|
-
interface UseAssetLoaderOptions {
|
|
457
|
-
/** URLs to preload on mount */
|
|
458
|
-
preloadUrls?: string[];
|
|
459
|
-
/** Asset loader instance (uses singleton if not provided) */
|
|
460
|
-
loader?: AssetLoader;
|
|
461
|
-
}
|
|
462
|
-
interface AssetLoadingState {
|
|
463
|
-
/** Whether assets are currently loading */
|
|
464
|
-
isLoading: boolean;
|
|
465
|
-
/** Loading progress (0-100) */
|
|
466
|
-
progress: number;
|
|
467
|
-
/** Number of loaded assets */
|
|
468
|
-
loaded: number;
|
|
469
|
-
/** Total assets to load */
|
|
470
|
-
total: number;
|
|
471
|
-
/** Any loading errors */
|
|
472
|
-
errors: string[];
|
|
473
|
-
}
|
|
474
|
-
interface UseAssetLoaderReturn extends AssetLoadingState {
|
|
475
|
-
/** Load a single model */
|
|
476
|
-
loadModel: (url: string) => Promise<LoadedModel>;
|
|
477
|
-
/** Load a single OBJ model */
|
|
478
|
-
loadOBJ: (url: string) => Promise<THREE.Group>;
|
|
479
|
-
/** Load a single texture */
|
|
480
|
-
loadTexture: (url: string) => Promise<THREE.Texture>;
|
|
481
|
-
/** Preload multiple assets */
|
|
482
|
-
preload: (urls: string[]) => Promise<void>;
|
|
483
|
-
/** Check if model is cached */
|
|
484
|
-
hasModel: (url: string) => boolean;
|
|
485
|
-
/** Check if texture is cached */
|
|
486
|
-
hasTexture: (url: string) => boolean;
|
|
487
|
-
/** Get cached model */
|
|
488
|
-
getModel: (url: string) => LoadedModel | undefined;
|
|
489
|
-
/** Get cached texture */
|
|
490
|
-
getTexture: (url: string) => THREE.Texture | undefined;
|
|
491
|
-
/** Clear all caches */
|
|
492
|
-
clearCache: () => void;
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* Hook for managing 3D asset loading in React components
|
|
496
|
-
*
|
|
497
|
-
* @example
|
|
498
|
-
* ```tsx
|
|
499
|
-
* const { loadModel, isLoading, progress } = useAssetLoader({
|
|
500
|
-
* preloadUrls: ['/assets/model.glb']
|
|
501
|
-
* });
|
|
502
|
-
*
|
|
503
|
-
* useEffect(() => {
|
|
504
|
-
* loadModel('/assets/character.glb').then((model) => {
|
|
505
|
-
* scene.add(model.scene);
|
|
506
|
-
* });
|
|
507
|
-
* }, []);
|
|
508
|
-
* ```
|
|
509
|
-
*/
|
|
510
|
-
declare function useAssetLoader(options?: UseAssetLoaderOptions): UseAssetLoaderReturn;
|
|
511
|
-
|
|
512
|
-
type NodeType = 'tile' | 'unit' | 'feature' | 'highlight' | 'effect';
|
|
513
|
-
interface SceneGraphNode {
|
|
514
|
-
/** Unique node identifier */
|
|
515
|
-
id: string;
|
|
516
|
-
/** Node type classification */
|
|
517
|
-
type: NodeType;
|
|
518
|
-
/** Three.js object */
|
|
519
|
-
mesh: THREE.Object3D;
|
|
520
|
-
/** World position */
|
|
521
|
-
position: {
|
|
522
|
-
x: number;
|
|
523
|
-
y: number;
|
|
524
|
-
z: number;
|
|
525
|
-
};
|
|
526
|
-
/** Grid position */
|
|
527
|
-
gridPosition: {
|
|
528
|
-
x: number;
|
|
529
|
-
z: number;
|
|
530
|
-
};
|
|
531
|
-
/** Optional metadata */
|
|
532
|
-
metadata?: JsonObject;
|
|
533
|
-
}
|
|
534
|
-
interface UseSceneGraphReturn {
|
|
535
|
-
/** Reference to the nodes map */
|
|
536
|
-
nodesRef: React.MutableRefObject<Map<string, SceneGraphNode>>;
|
|
537
|
-
/** Add a node to the scene */
|
|
538
|
-
addNode: (node: SceneGraphNode) => void;
|
|
539
|
-
/** Remove a node from the scene */
|
|
540
|
-
removeNode: (id: string) => void;
|
|
541
|
-
/** Get a node by ID */
|
|
542
|
-
getNode: (id: string) => SceneGraphNode | undefined;
|
|
543
|
-
/** Update node position */
|
|
544
|
-
updateNodePosition: (id: string, x: number, y: number, z: number) => void;
|
|
545
|
-
/** Update node grid position */
|
|
546
|
-
updateNodeGridPosition: (id: string, gridX: number, gridZ: number) => void;
|
|
547
|
-
/** Get node at grid position */
|
|
548
|
-
getNodeAtGrid: (x: number, z: number, type?: NodeType) => SceneGraphNode | undefined;
|
|
549
|
-
/** Get all nodes of a specific type */
|
|
550
|
-
getNodesByType: (type: NodeType) => SceneGraphNode[];
|
|
551
|
-
/** Get all nodes within a bounding box */
|
|
552
|
-
getNodesInBounds: (minX: number, maxX: number, minZ: number, maxZ: number) => SceneGraphNode[];
|
|
553
|
-
/** Clear all nodes */
|
|
554
|
-
clearNodes: () => void;
|
|
555
|
-
/** Count nodes by type */
|
|
556
|
-
countNodes: (type?: NodeType) => number;
|
|
557
|
-
}
|
|
558
|
-
/**
|
|
559
|
-
* Hook for managing the 3D scene graph
|
|
560
|
-
*
|
|
561
|
-
* @example
|
|
562
|
-
* ```tsx
|
|
563
|
-
* const { addNode, removeNode, getNodeAtGrid } = useSceneGraph();
|
|
564
|
-
*
|
|
565
|
-
* // Add a tile
|
|
566
|
-
* addNode({
|
|
567
|
-
* id: 'tile-0-0',
|
|
568
|
-
* type: 'tile',
|
|
569
|
-
* mesh: tileMesh,
|
|
570
|
-
* position: { x: 0, y: 0, z: 0 },
|
|
571
|
-
* gridPosition: { x: 0, z: 0 }
|
|
572
|
-
* });
|
|
573
|
-
* ```
|
|
574
|
-
*/
|
|
575
|
-
declare function useSceneGraph(): UseSceneGraphReturn;
|
|
576
|
-
|
|
577
|
-
interface RaycastHit {
|
|
578
|
-
/** Intersected object */
|
|
579
|
-
object: THREE.Object3D;
|
|
580
|
-
/** Intersection point */
|
|
581
|
-
point: THREE.Vector3;
|
|
582
|
-
/** Distance from camera */
|
|
583
|
-
distance: number;
|
|
584
|
-
/** UV coordinates (if available) */
|
|
585
|
-
uv?: THREE.Vector2;
|
|
586
|
-
/** Face normal */
|
|
587
|
-
face?: THREE.Face;
|
|
588
|
-
/** Face index */
|
|
589
|
-
faceIndex?: number;
|
|
590
|
-
/** Instance ID (for instanced meshes) */
|
|
591
|
-
instanceId?: number;
|
|
592
|
-
}
|
|
593
|
-
interface GridHit {
|
|
594
|
-
/** Grid X coordinate */
|
|
595
|
-
gridX: number;
|
|
596
|
-
/** Grid Z coordinate */
|
|
597
|
-
gridZ: number;
|
|
598
|
-
/** World position */
|
|
599
|
-
worldPosition: THREE.Vector3;
|
|
600
|
-
/** Intersected object type */
|
|
601
|
-
objectType?: 'tile' | 'unit' | 'feature';
|
|
602
|
-
/** Object ID if available */
|
|
603
|
-
objectId?: string;
|
|
604
|
-
}
|
|
605
|
-
interface UseRaycasterOptions {
|
|
606
|
-
/** Camera reference */
|
|
607
|
-
camera: THREE.Camera | null;
|
|
608
|
-
/** Canvas element for coordinate conversion */
|
|
609
|
-
canvas: HTMLCanvasElement | null;
|
|
610
|
-
/** Grid cell size */
|
|
611
|
-
cellSize?: number;
|
|
612
|
-
/** Grid offset X */
|
|
613
|
-
offsetX?: number;
|
|
614
|
-
/** Grid offset Z */
|
|
615
|
-
offsetZ?: number;
|
|
616
|
-
}
|
|
617
|
-
interface UseRaycasterReturn {
|
|
618
|
-
/** Raycaster instance */
|
|
619
|
-
raycaster: React.MutableRefObject<THREE.Raycaster>;
|
|
620
|
-
/** Mouse vector instance */
|
|
621
|
-
mouse: React.MutableRefObject<THREE.Vector2>;
|
|
622
|
-
/** Get intersection at client coordinates */
|
|
623
|
-
getIntersection: (clientX: number, clientY: number, objects: THREE.Object3D[]) => RaycastHit | null;
|
|
624
|
-
/** Get all intersections at client coordinates */
|
|
625
|
-
getAllIntersections: (clientX: number, clientY: number, objects: THREE.Object3D[]) => RaycastHit[];
|
|
626
|
-
/** Get grid coordinates at client position */
|
|
627
|
-
getGridCoordinates: (clientX: number, clientY: number) => {
|
|
628
|
-
x: number;
|
|
629
|
-
z: number;
|
|
630
|
-
} | null;
|
|
631
|
-
/** Get tile at client position from scene */
|
|
632
|
-
getTileAtPosition: (clientX: number, clientY: number, scene: THREE.Scene) => GridHit | null;
|
|
633
|
-
/** Convert client coordinates to normalized device coordinates */
|
|
634
|
-
clientToNDC: (clientX: number, clientY: number) => {
|
|
635
|
-
x: number;
|
|
636
|
-
y: number;
|
|
637
|
-
};
|
|
638
|
-
/** Check if point is within canvas bounds */
|
|
639
|
-
isWithinCanvas: (clientX: number, clientY: number) => boolean;
|
|
640
|
-
}
|
|
641
|
-
/**
|
|
642
|
-
* Hook for 3D raycasting operations
|
|
643
|
-
*
|
|
644
|
-
* @example
|
|
645
|
-
* ```tsx
|
|
646
|
-
* const { getIntersection, getGridCoordinates } = useRaycaster({
|
|
647
|
-
* camera,
|
|
648
|
-
* canvas: canvasRef.current
|
|
649
|
-
* });
|
|
650
|
-
*
|
|
651
|
-
* const handleClick = (e: MouseEvent) => {
|
|
652
|
-
* const hit = getIntersection(e.clientX, e.clientY, tileMeshes);
|
|
653
|
-
* if (hit) {
|
|
654
|
-
* const grid = getGridCoordinates(e.clientX, e.clientY);
|
|
655
|
-
* console.log('Clicked grid:', grid);
|
|
656
|
-
* }
|
|
657
|
-
* };
|
|
658
|
-
* ```
|
|
659
|
-
*/
|
|
660
|
-
declare function useRaycaster(options: UseRaycasterOptions): UseRaycasterReturn;
|
|
661
|
-
|
|
662
|
-
interface GameCanvas3DEventConfig {
|
|
663
|
-
/** Event name for tile clicks. `tileId` is optional — the neutral draw-host emits
|
|
664
|
-
* only the scene coordinate `{ x, z }` (the FSM keys off the cell, not an id). */
|
|
665
|
-
tileClickEvent?: EventEmit<{
|
|
666
|
-
x: number;
|
|
667
|
-
z: number;
|
|
668
|
-
tileId?: string;
|
|
669
|
-
type?: string;
|
|
670
|
-
terrain?: string;
|
|
671
|
-
elevation?: number;
|
|
672
|
-
}>;
|
|
673
|
-
/** Event name for unit clicks */
|
|
674
|
-
unitClickEvent?: EventEmit<{
|
|
675
|
-
unitId: string;
|
|
676
|
-
x: number;
|
|
677
|
-
z: number;
|
|
678
|
-
unitType?: string;
|
|
679
|
-
name?: string;
|
|
680
|
-
team?: string;
|
|
681
|
-
faction?: string;
|
|
682
|
-
health?: number;
|
|
683
|
-
maxHealth?: number;
|
|
684
|
-
}>;
|
|
685
|
-
/** Event name for feature clicks */
|
|
686
|
-
featureClickEvent?: EventEmit<{
|
|
687
|
-
featureId: string;
|
|
688
|
-
x: number;
|
|
689
|
-
z: number;
|
|
690
|
-
type?: string;
|
|
691
|
-
elevation?: number;
|
|
692
|
-
}>;
|
|
693
|
-
/** Event name for canvas clicks */
|
|
694
|
-
canvasClickEvent?: EventEmit<{
|
|
695
|
-
clientX: number;
|
|
696
|
-
clientY: number;
|
|
697
|
-
button: number;
|
|
698
|
-
}>;
|
|
699
|
-
/** Event name for tile hover */
|
|
700
|
-
tileHoverEvent?: EventEmit<{
|
|
701
|
-
tileId: string;
|
|
702
|
-
x: number;
|
|
703
|
-
z: number;
|
|
704
|
-
type?: string;
|
|
705
|
-
}>;
|
|
706
|
-
/** Event name for tile leave */
|
|
707
|
-
tileLeaveEvent?: EventEmit<Record<string, never>>;
|
|
708
|
-
/** Event name for unit animation changes */
|
|
709
|
-
unitAnimationEvent?: EventEmit<{
|
|
710
|
-
unitId: string;
|
|
711
|
-
state: string;
|
|
712
|
-
timestamp: number;
|
|
713
|
-
}>;
|
|
714
|
-
/** Event name for camera changes */
|
|
715
|
-
cameraChangeEvent?: EventEmit<{
|
|
716
|
-
position: {
|
|
717
|
-
x: number;
|
|
718
|
-
y: number;
|
|
719
|
-
z: number;
|
|
720
|
-
};
|
|
721
|
-
timestamp: number;
|
|
722
|
-
}>;
|
|
723
|
-
}
|
|
724
|
-
/** Minimal mouse event interface — satisfied by both React.MouseEvent and ThreeEvent<MouseEvent> */
|
|
725
|
-
interface MinimalMouseEvent {
|
|
726
|
-
clientX: number;
|
|
727
|
-
clientY: number;
|
|
728
|
-
button: number;
|
|
729
|
-
}
|
|
730
|
-
interface UseGameCanvas3DEventsOptions extends GameCanvas3DEventConfig {
|
|
731
|
-
/** Callback for tile clicks (direct) */
|
|
732
|
-
onTileClick?: (tile: IsometricTile, event: MinimalMouseEvent) => void;
|
|
733
|
-
/** Callback for unit clicks (direct) */
|
|
734
|
-
onUnitClick?: (unit: IsometricUnit, event: MinimalMouseEvent) => void;
|
|
735
|
-
/** Callback for feature clicks (direct) */
|
|
736
|
-
onFeatureClick?: (feature: IsometricFeature, event: MinimalMouseEvent) => void;
|
|
737
|
-
/** Callback for canvas clicks (direct) */
|
|
738
|
-
onCanvasClick?: (event: MinimalMouseEvent) => void;
|
|
739
|
-
/** Callback for tile hover (direct) */
|
|
740
|
-
onTileHover?: (tile: IsometricTile | null, event: MinimalMouseEvent) => void;
|
|
741
|
-
/** Callback for unit animation changes (direct) */
|
|
742
|
-
onUnitAnimation?: (unitId: string, state: string) => void;
|
|
743
|
-
}
|
|
744
|
-
interface UseGameCanvas3DEventsReturn {
|
|
745
|
-
/** Handle tile click - emits event and calls callback */
|
|
746
|
-
handleTileClick: (tile: IsometricTile, event: MinimalMouseEvent) => void;
|
|
747
|
-
/** Handle unit click - emits event and calls callback */
|
|
748
|
-
handleUnitClick: (unit: IsometricUnit, event: MinimalMouseEvent) => void;
|
|
749
|
-
/** Handle feature click - emits event and calls callback */
|
|
750
|
-
handleFeatureClick: (feature: IsometricFeature, event: MinimalMouseEvent) => void;
|
|
751
|
-
/** Handle canvas click - emits event and calls callback */
|
|
752
|
-
handleCanvasClick: (event: MinimalMouseEvent) => void;
|
|
753
|
-
/** Handle tile hover - emits event and calls callback */
|
|
754
|
-
handleTileHover: (tile: IsometricTile | null, event: MinimalMouseEvent) => void;
|
|
755
|
-
/** Handle unit animation - emits event and calls callback */
|
|
756
|
-
handleUnitAnimation: (unitId: string, state: string) => void;
|
|
757
|
-
/** Handle camera change - emits event */
|
|
758
|
-
handleCameraChange: (position: {
|
|
759
|
-
x: number;
|
|
760
|
-
y: number;
|
|
761
|
-
z: number;
|
|
762
|
-
}) => void;
|
|
763
|
-
}
|
|
764
|
-
/**
|
|
765
|
-
* Hook for integrating GameCanvas3D with the event bus
|
|
766
|
-
*
|
|
767
|
-
* Supports both declarative event props (tileClickEvent) and
|
|
768
|
-
* direct callback props (onTileClick).
|
|
769
|
-
*
|
|
770
|
-
* @example
|
|
771
|
-
* ```tsx
|
|
772
|
-
* const events = useGameCanvas3DEvents({
|
|
773
|
-
* tileClickEvent: 'TILE_SELECTED',
|
|
774
|
-
* unitClickEvent: 'UNIT_SELECTED',
|
|
775
|
-
* onTileClick: (tile) => console.log('Tile:', tile)
|
|
776
|
-
* });
|
|
777
|
-
*
|
|
778
|
-
* // In component:
|
|
779
|
-
* <TileRenderer onTileClick={events.handleTileClick} />
|
|
780
|
-
* ```
|
|
781
|
-
*/
|
|
782
|
-
declare function useGameCanvas3DEvents(options: UseGameCanvas3DEventsOptions): UseGameCanvas3DEventsReturn;
|
|
783
|
-
|
|
784
|
-
/**
|
|
785
|
-
* Grid 3D Utilities
|
|
786
|
-
*
|
|
787
|
-
* Utility functions for 3D grid coordinate transformations,
|
|
788
|
-
* raycasting, and spatial calculations for GameCanvas3D.
|
|
789
|
-
*
|
|
790
|
-
* @packageDocumentation
|
|
791
|
-
*/
|
|
792
|
-
|
|
793
|
-
interface Grid3DConfig {
|
|
794
|
-
/** Size of each grid cell */
|
|
795
|
-
cellSize: number;
|
|
796
|
-
/** Grid offset X */
|
|
797
|
-
offsetX?: number;
|
|
798
|
-
/** Grid offset Z */
|
|
799
|
-
offsetZ?: number;
|
|
800
|
-
/** Grid Y height (elevation) */
|
|
801
|
-
elevation?: number;
|
|
802
|
-
}
|
|
803
|
-
interface GridCoordinate {
|
|
804
|
-
x: number;
|
|
805
|
-
y: number;
|
|
806
|
-
z: number;
|
|
807
|
-
}
|
|
808
|
-
/**
|
|
809
|
-
* Convert grid coordinates to world position
|
|
810
|
-
* @param gridX - Grid X coordinate
|
|
811
|
-
* @param gridZ - Grid Z coordinate
|
|
812
|
-
* @param config - Grid configuration
|
|
813
|
-
* @returns World position vector
|
|
814
|
-
*/
|
|
815
|
-
declare function gridToWorld(gridX: number, gridZ: number, config?: Grid3DConfig): THREE.Vector3;
|
|
816
|
-
/**
|
|
817
|
-
* Convert world position to grid coordinates
|
|
818
|
-
* @param worldX - World X position
|
|
819
|
-
* @param worldZ - World Z position
|
|
820
|
-
* @param config - Grid configuration
|
|
821
|
-
* @returns Grid coordinates
|
|
822
|
-
*/
|
|
823
|
-
declare function worldToGrid(worldX: number, worldZ: number, config?: Grid3DConfig): {
|
|
824
|
-
x: number;
|
|
825
|
-
z: number;
|
|
826
|
-
};
|
|
827
|
-
/**
|
|
828
|
-
* Raycast from camera through mouse position to find grid intersection
|
|
829
|
-
* @param camera - Three.js camera
|
|
830
|
-
* @param mouseX - Mouse X position (normalized -1 to 1)
|
|
831
|
-
* @param mouseY - Mouse Y position (normalized -1 to 1)
|
|
832
|
-
* @param planeY - Y height of the intersection plane (default: 0)
|
|
833
|
-
* @returns Intersection point or null
|
|
834
|
-
*/
|
|
835
|
-
declare function raycastToPlane(camera: THREE.Camera, mouseX: number, mouseY: number, planeY?: number): THREE.Vector3 | null;
|
|
836
|
-
/**
|
|
837
|
-
* Raycast from camera through mouse position against a set of objects
|
|
838
|
-
* @param camera - Three.js camera
|
|
839
|
-
* @param mouseX - Mouse X position (normalized -1 to 1)
|
|
840
|
-
* @param mouseY - Mouse Y position (normalized -1 to 1)
|
|
841
|
-
* @param objects - Array of objects to test
|
|
842
|
-
* @returns First intersection or null
|
|
843
|
-
*/
|
|
844
|
-
declare function raycastToObjects(camera: THREE.Camera, mouseX: number, mouseY: number, objects: THREE.Object3D[]): THREE.Intersection | null;
|
|
845
|
-
/**
|
|
846
|
-
* Calculate distance between two grid coordinates
|
|
847
|
-
* @param a - First grid coordinate
|
|
848
|
-
* @param b - Second grid coordinate
|
|
849
|
-
* @returns Distance in grid units
|
|
850
|
-
*/
|
|
851
|
-
declare function gridDistance(a: {
|
|
852
|
-
x: number;
|
|
853
|
-
z: number;
|
|
854
|
-
}, b: {
|
|
855
|
-
x: number;
|
|
856
|
-
z: number;
|
|
857
|
-
}): number;
|
|
858
|
-
/**
|
|
859
|
-
* Calculate Manhattan distance between two grid coordinates
|
|
860
|
-
* @param a - First grid coordinate
|
|
861
|
-
* @param b - Second grid coordinate
|
|
862
|
-
* @returns Manhattan distance
|
|
863
|
-
*/
|
|
864
|
-
declare function gridManhattanDistance(a: {
|
|
865
|
-
x: number;
|
|
866
|
-
z: number;
|
|
867
|
-
}, b: {
|
|
868
|
-
x: number;
|
|
869
|
-
z: number;
|
|
870
|
-
}): number;
|
|
871
|
-
/**
|
|
872
|
-
* Get neighboring grid cells
|
|
873
|
-
* @param x - Center X coordinate
|
|
874
|
-
* @param z - Center Z coordinate
|
|
875
|
-
* @param includeDiagonal - Whether to include diagonal neighbors
|
|
876
|
-
* @returns Array of neighbor coordinates
|
|
877
|
-
*/
|
|
878
|
-
declare function getNeighbors(x: number, z: number, includeDiagonal?: boolean): {
|
|
879
|
-
x: number;
|
|
880
|
-
z: number;
|
|
881
|
-
}[];
|
|
882
|
-
/**
|
|
883
|
-
* Check if a grid coordinate is within bounds
|
|
884
|
-
* @param x - X coordinate
|
|
885
|
-
* @param z - Z coordinate
|
|
886
|
-
* @param bounds - Bounds object
|
|
887
|
-
* @returns Whether the coordinate is within bounds
|
|
888
|
-
*/
|
|
889
|
-
declare function isInBounds(x: number, z: number, bounds: {
|
|
890
|
-
minX: number;
|
|
891
|
-
maxX: number;
|
|
892
|
-
minZ: number;
|
|
893
|
-
maxZ: number;
|
|
894
|
-
}): boolean;
|
|
895
|
-
/**
|
|
896
|
-
* Get all grid cells within a circular radius
|
|
897
|
-
* @param centerX - Center X coordinate
|
|
898
|
-
* @param centerZ - Center Z coordinate
|
|
899
|
-
* @param radius - Radius in grid units
|
|
900
|
-
* @returns Array of coordinates within radius
|
|
901
|
-
*/
|
|
902
|
-
declare function getCellsInRadius(centerX: number, centerZ: number, radius: number): {
|
|
903
|
-
x: number;
|
|
904
|
-
z: number;
|
|
905
|
-
}[];
|
|
906
|
-
/**
|
|
907
|
-
* Create a highlight mesh for grid cells
|
|
908
|
-
* @param color - Highlight color
|
|
909
|
-
* @param opacity - Opacity (0-1)
|
|
910
|
-
* @returns Mesh that can be positioned at grid cells
|
|
911
|
-
*/
|
|
912
|
-
declare function createGridHighlight(color?: number, opacity?: number): THREE.Mesh;
|
|
913
|
-
/**
|
|
914
|
-
* Normalize mouse coordinates to NDC (-1 to 1)
|
|
915
|
-
* @param clientX - Mouse client X
|
|
916
|
-
* @param clientY - Mouse client Y
|
|
917
|
-
* @param element - Canvas element
|
|
918
|
-
* @returns Normalized coordinates
|
|
919
|
-
*/
|
|
920
|
-
declare function normalizeMouseCoordinates(clientX: number, clientY: number, element: HTMLElement): {
|
|
921
|
-
x: number;
|
|
922
|
-
y: number;
|
|
923
|
-
};
|
|
924
|
-
|
|
925
|
-
/**
|
|
926
|
-
* Culling Utilities
|
|
927
|
-
*
|
|
928
|
-
* Frustum culling and LOD (Level of Detail) management for 3D scene optimization.
|
|
929
|
-
*
|
|
930
|
-
* @packageDocumentation
|
|
931
|
-
*/
|
|
932
|
-
|
|
933
|
-
interface CullingOptions {
|
|
934
|
-
/** Camera frustum for culling */
|
|
935
|
-
camera: THREE.Camera;
|
|
936
|
-
/** Optional padding around frustum */
|
|
937
|
-
padding?: number;
|
|
938
|
-
}
|
|
939
|
-
interface LODLevel {
|
|
940
|
-
/** Distance threshold for this LOD level */
|
|
941
|
-
distance: number;
|
|
942
|
-
/** Geometry or mesh for this level */
|
|
943
|
-
geometry?: THREE.BufferGeometry;
|
|
944
|
-
/** Scale multiplier for this level */
|
|
945
|
-
scale?: number;
|
|
946
|
-
/** Whether to use simplified material */
|
|
947
|
-
simpleMaterial?: boolean;
|
|
948
|
-
}
|
|
949
|
-
interface LODConfig {
|
|
950
|
-
/** LOD levels from closest to farthest */
|
|
951
|
-
levels: LODLevel[];
|
|
952
|
-
/** Transition smoothness (0-1) */
|
|
953
|
-
transitionSmoothness?: number;
|
|
954
|
-
}
|
|
955
|
-
/**
|
|
956
|
-
* Frustum culling check for a position
|
|
957
|
-
* @param position - World position to check
|
|
958
|
-
* @param camera - Camera to check against
|
|
959
|
-
* @param padding - Optional padding in world units
|
|
960
|
-
* @returns Whether the position is within the frustum
|
|
961
|
-
*/
|
|
962
|
-
declare function isInFrustum(position: THREE.Vector3, camera: THREE.Camera, padding?: number): boolean;
|
|
963
|
-
/**
|
|
964
|
-
* Filter an array of positions to only those within the frustum
|
|
965
|
-
* @param positions - Array of world positions
|
|
966
|
-
* @param camera - Camera to check against
|
|
967
|
-
* @param padding - Optional padding in world units
|
|
968
|
-
* @returns Array of positions within frustum
|
|
969
|
-
*/
|
|
970
|
-
declare function filterByFrustum(positions: THREE.Vector3[], camera: THREE.Camera, padding?: number): THREE.Vector3[];
|
|
971
|
-
/**
|
|
972
|
-
* Get indices of visible items from an array
|
|
973
|
-
* @param positions - Array of world positions
|
|
974
|
-
* @param camera - Camera to check against
|
|
975
|
-
* @param padding - Optional padding in world units
|
|
976
|
-
* @returns Set of visible indices
|
|
977
|
-
*/
|
|
978
|
-
declare function getVisibleIndices(positions: THREE.Vector3[], camera: THREE.Camera, padding?: number): Set<number>;
|
|
979
|
-
/**
|
|
980
|
-
* Calculate LOD level based on distance from camera
|
|
981
|
-
* @param position - Object position
|
|
982
|
-
* @param camera - Camera position
|
|
983
|
-
* @param lodLevels - Array of distance thresholds (sorted closest to farthest)
|
|
984
|
-
* @returns Index of the LOD level to use
|
|
985
|
-
*/
|
|
986
|
-
declare function calculateLODLevel(position: THREE.Vector3, camera: THREE.Camera, lodLevels: number[]): number;
|
|
987
|
-
/**
|
|
988
|
-
* Create a distance-based LOD system for an instanced mesh
|
|
989
|
-
* @param instancedMesh - The instanced mesh to manage
|
|
990
|
-
* @param positions - Array of instance positions
|
|
991
|
-
* @param camera - Camera to calculate distances from
|
|
992
|
-
* @param lodDistances - Distance thresholds for LOD levels
|
|
993
|
-
* @returns Array of LOD indices for each instance
|
|
994
|
-
*/
|
|
995
|
-
declare function updateInstanceLOD(instancedMesh: THREE.InstancedMesh, positions: THREE.Vector3[], camera: THREE.Camera, lodDistances: number[]): Uint8Array;
|
|
996
|
-
/**
|
|
997
|
-
* Create visibility data for instanced mesh culling
|
|
998
|
-
* Updates the instance matrix to hide/show instances
|
|
999
|
-
* @param instancedMesh - The instanced mesh
|
|
1000
|
-
* @param positions - Array of instance positions
|
|
1001
|
-
* @param visibleIndices - Set of visible indices
|
|
1002
|
-
* @returns Updated count of visible instances
|
|
1003
|
-
*/
|
|
1004
|
-
declare function cullInstancedMesh(instancedMesh: THREE.InstancedMesh, positions: THREE.Vector3[], visibleIndices: Set<number>): number;
|
|
1005
|
-
/**
|
|
1006
|
-
* Spatial hash grid for efficient object queries
|
|
1007
|
-
*/
|
|
1008
|
-
declare class SpatialHashGrid {
|
|
1009
|
-
private cellSize;
|
|
1010
|
-
private cells;
|
|
1011
|
-
private objectPositions;
|
|
1012
|
-
constructor(cellSize?: number);
|
|
1013
|
-
/**
|
|
1014
|
-
* Get cell key for a position
|
|
1015
|
-
*/
|
|
1016
|
-
private getCellKey;
|
|
1017
|
-
/**
|
|
1018
|
-
* Insert an object into the grid
|
|
1019
|
-
*/
|
|
1020
|
-
insert(id: string, position: THREE.Vector3): void;
|
|
1021
|
-
/**
|
|
1022
|
-
* Remove an object from the grid
|
|
1023
|
-
*/
|
|
1024
|
-
remove(id: string): void;
|
|
1025
|
-
/**
|
|
1026
|
-
* Update an object's position
|
|
1027
|
-
*/
|
|
1028
|
-
update(id: string, newPosition: THREE.Vector3): void;
|
|
1029
|
-
/**
|
|
1030
|
-
* Query objects within a radius of a position
|
|
1031
|
-
*/
|
|
1032
|
-
queryRadius(center: THREE.Vector3, radius: number): string[];
|
|
1033
|
-
/**
|
|
1034
|
-
* Query objects within a bounding box
|
|
1035
|
-
*/
|
|
1036
|
-
queryBox(minX: number, maxX: number, minZ: number, maxZ: number): string[];
|
|
1037
|
-
/**
|
|
1038
|
-
* Clear all objects from the grid
|
|
1039
|
-
*/
|
|
1040
|
-
clear(): void;
|
|
1041
|
-
/**
|
|
1042
|
-
* Get statistics about the grid
|
|
1043
|
-
*/
|
|
1044
|
-
getStats(): {
|
|
1045
|
-
objects: number;
|
|
1046
|
-
cells: number;
|
|
1047
|
-
};
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
/**
|
|
1051
|
-
* Avl3DViewer - Interactive 3D Orbital Visualization
|
|
1052
|
-
*
|
|
1053
|
-
* The host organism that owns the R3F Canvas and delegates to 3D scene
|
|
1054
|
-
* renderers at each zoom level. The 3D equivalent of AvlCosmicZoom.
|
|
1055
|
-
*
|
|
1056
|
-
* Reuses avl-schema-parser.ts and avl-zoom-state.ts directly.
|
|
1057
|
-
*
|
|
1058
|
-
* @packageDocumentation
|
|
1059
|
-
*/
|
|
1060
|
-
|
|
1061
|
-
interface Avl3DViewerProps {
|
|
1062
|
-
/** The orbital schema (parsed object or JSON string) */
|
|
1063
|
-
schema: OrbitalSchema | string;
|
|
1064
|
-
/** CSS class for the outer container */
|
|
1065
|
-
className?: string;
|
|
1066
|
-
/** Enable animations (default: true) */
|
|
1067
|
-
animated?: boolean;
|
|
1068
|
-
/** Pre-select an orbital on mount */
|
|
1069
|
-
initialOrbital?: string;
|
|
1070
|
-
/** Pre-select a trait on mount */
|
|
1071
|
-
initialTrait?: string;
|
|
1072
|
-
/** Callback when zoom level changes */
|
|
1073
|
-
onZoomChange?: (level: ZoomLevel, context: {
|
|
1074
|
-
orbital?: string;
|
|
1075
|
-
trait?: string;
|
|
1076
|
-
}) => void;
|
|
1077
|
-
/** Container width */
|
|
1078
|
-
width?: number | string;
|
|
1079
|
-
/** Container height */
|
|
1080
|
-
height?: number | string;
|
|
1081
|
-
/** Enable postprocessing effects (bloom, DOF, vignette). Default: true */
|
|
1082
|
-
effects?: boolean;
|
|
1083
|
-
/** Custom 3D model URLs to replace default primitive geometry */
|
|
1084
|
-
modelOverrides?: Avl3DModelOverrides;
|
|
1085
|
-
}
|
|
1086
|
-
declare const Avl3DViewer: React__default.FC<Avl3DViewerProps>;
|
|
1087
|
-
|
|
1088
|
-
/**
|
|
1089
|
-
* Avl3DApplicationScene - Galaxy view of all orbitals.
|
|
1090
|
-
*
|
|
1091
|
-
* Positions orbitals on a golden-ratio spiral and renders cross-orbital
|
|
1092
|
-
* event wires between them. The 3D equivalent of AvlApplicationScene.
|
|
1093
|
-
*
|
|
1094
|
-
* @packageDocumentation
|
|
1095
|
-
*/
|
|
1096
|
-
|
|
1097
|
-
interface Avl3DApplicationSceneProps {
|
|
1098
|
-
/** Parsed application-level data */
|
|
1099
|
-
data: ApplicationLevelData;
|
|
1100
|
-
/** Click handler for an orbital */
|
|
1101
|
-
onOrbitalClick?: (orbitalName: string) => void;
|
|
1102
|
-
/** Primary color */
|
|
1103
|
-
color?: string;
|
|
1104
|
-
}
|
|
1105
|
-
declare const Avl3DApplicationScene: React__default.FC<Avl3DApplicationSceneProps>;
|
|
1106
|
-
|
|
1107
|
-
/**
|
|
1108
|
-
* Avl3DOrbitalScene - Solar system view of a single orbital.
|
|
1109
|
-
*
|
|
1110
|
-
* Renders entity core at center, trait orbit rings, and page portals.
|
|
1111
|
-
* The 3D equivalent of AvlOrbitalScene.
|
|
1112
|
-
*
|
|
1113
|
-
* @packageDocumentation
|
|
1114
|
-
*/
|
|
1115
|
-
|
|
1116
|
-
interface Avl3DOrbitalSceneProps {
|
|
1117
|
-
/** Parsed orbital-level data */
|
|
1118
|
-
data: OrbitalLevelData;
|
|
1119
|
-
/** Click handler for a trait */
|
|
1120
|
-
onTraitClick?: (traitName: string) => void;
|
|
1121
|
-
/** Currently highlighted trait */
|
|
1122
|
-
highlightedTrait?: string | null;
|
|
1123
|
-
/** Highlight change handler */
|
|
1124
|
-
onTraitHighlight?: (traitName: string | null) => void;
|
|
1125
|
-
/** Primary color */
|
|
1126
|
-
color?: string;
|
|
1127
|
-
}
|
|
1128
|
-
declare const Avl3DOrbitalScene: React__default.FC<Avl3DOrbitalSceneProps>;
|
|
1129
|
-
|
|
1130
|
-
/**
|
|
1131
|
-
* Avl3DTraitScene - 3D state machine view for a single trait.
|
|
1132
|
-
*
|
|
1133
|
-
* Positions states on a fibonacci sphere and renders transition arcs
|
|
1134
|
-
* between them. The 3D equivalent of AvlTraitScene.
|
|
1135
|
-
*
|
|
1136
|
-
* @packageDocumentation
|
|
1137
|
-
*/
|
|
1138
|
-
|
|
1139
|
-
interface Avl3DTraitSceneProps {
|
|
1140
|
-
/** Parsed trait-level data */
|
|
1141
|
-
data: TraitLevelData;
|
|
1142
|
-
/** Click handler for a transition */
|
|
1143
|
-
onTransitionClick?: (transitionIndex: number) => void;
|
|
1144
|
-
/** Primary color */
|
|
1145
|
-
color?: string;
|
|
1146
|
-
}
|
|
1147
|
-
declare const Avl3DTraitScene: React__default.FC<Avl3DTraitSceneProps>;
|
|
1148
|
-
|
|
1149
|
-
/**
|
|
1150
|
-
* Avl3DTransitionScene - 3D expression tree and effect chain view.
|
|
1151
|
-
*
|
|
1152
|
-
* Renders a detailed view of a single transition with its guard
|
|
1153
|
-
* expression tree and effect chain. The 3D equivalent of AvlTransitionScene.
|
|
1154
|
-
*
|
|
1155
|
-
* @packageDocumentation
|
|
1156
|
-
*/
|
|
1157
|
-
|
|
1158
|
-
interface Avl3DTransitionSceneProps {
|
|
1159
|
-
/** Parsed transition-level data */
|
|
1160
|
-
data: TransitionLevelData;
|
|
1161
|
-
/** Primary color */
|
|
1162
|
-
color?: string;
|
|
1163
|
-
}
|
|
1164
|
-
declare const Avl3DTransitionScene: React__default.FC<Avl3DTransitionSceneProps>;
|
|
1165
|
-
|
|
1166
|
-
/**
|
|
1167
|
-
* Avl3DEffects - Postprocessing effects and ambient visuals for AVL 3D.
|
|
1168
|
-
*
|
|
1169
|
-
* Two layers:
|
|
1170
|
-
* 1. Ambient visuals (sparkles, starfield) - always rendered via drei
|
|
1171
|
-
* 2. Postprocessing (bloom, DOF, vignette) - rendered via @react-three/postprocessing
|
|
1172
|
-
*
|
|
1173
|
-
* @packageDocumentation
|
|
1174
|
-
*/
|
|
1175
|
-
|
|
1176
|
-
interface Avl3DEffectsProps {
|
|
1177
|
-
/** Current zoom level (effects vary by level) */
|
|
1178
|
-
level: ZoomLevel;
|
|
1179
|
-
/** Enable/disable all effects */
|
|
1180
|
-
enabled?: boolean;
|
|
1181
|
-
}
|
|
1182
|
-
declare const Avl3DEffects: React__default.FC<Avl3DEffectsProps>;
|
|
1183
|
-
|
|
1184
|
-
export { AssetLoader, Avl3DApplicationScene, Avl3DEffects, Avl3DModelOverrides, Avl3DOrbitalScene, Avl3DTraitScene, Avl3DTransitionScene, Avl3DViewer, Camera3D, Canvas3DErrorBoundary, Canvas3DLoadingState, Lighting3D, ModelLoader, Scene3D, SpatialHashGrid, assetLoader, calculateLODLevel, createGridHighlight, cullInstancedMesh, filterByFrustum, getCellsInRadius, getNeighbors, getVisibleIndices, gridDistance, gridManhattanDistance, gridToWorld, isInBounds, isInFrustum, normalizeMouseCoordinates, raycastToObjects, raycastToPlane, updateInstanceLOD, useAssetLoader, useGameCanvas3DEvents, useRaycaster, useSceneGraph, useThree, worldToGrid };
|
|
1185
|
-
export type { AssetLoadingState, Avl3DApplicationSceneProps, Avl3DEffectsProps, Avl3DOrbitalSceneProps, Avl3DTraitSceneProps, Avl3DTransitionSceneProps, Avl3DViewerProps, Camera3DHandle, Camera3DProps, CameraMode$1 as CameraMode, Canvas3DErrorBoundaryProps, Canvas3DErrorBoundaryState, Canvas3DLoadingStateProps, CullingOptions, GameCanvas3DEventConfig, Grid3DConfig, GridCoordinate, GridHit, LODConfig, LODLevel, Lighting3DProps, LoadedModel, ModelLoaderProps, NodeType, RaycastHit, Scene3DProps, SceneGraphNode, UseAssetLoaderOptions, UseAssetLoaderReturn, UseGameCanvas3DEventsOptions, UseGameCanvas3DEventsReturn, UseRaycasterOptions, UseRaycasterReturn, UseSceneGraphReturn, UseThreeOptions, UseThreeReturn };
|