@layoutit/polycss-react 0.0.1 → 0.2.1
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/README.md +148 -123
- package/dist/index.cjs +4012 -1204
- package/dist/index.d.cts +242 -29
- package/dist/index.d.ts +242 -29
- package/dist/index.js +3994 -1126
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import React__default, { ReactNode, CSSProperties, MouseEventHandler, PointerEventHandler, FocusEventHandler, KeyboardEventHandler, RefObject, MouseEvent as MouseEvent$1 } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { Vec3, CameraState, CameraHandle, Vec2, PolyMaterial, PolyDirectionalLight, PolyTextureLightingMode, Polygon, PolyAmbientLight, LoadMeshOptions, PolyAnimationTarget, PolyAnimationMixer, PolyAnimationClip, PolyAnimationAction, ParseAnimationController } from '@layoutit/polycss-core';
|
|
5
|
-
export { ArrowPolygonsOptions, AutoRotateConfig, AutoRotateOption, AxesHelperOptions, BASE_TILE, CameraHandle, CameraState, CameraStyleInput, CoverPlanarPolygonsOptions, CullInteriorOptions, DEFAULT_CAMERA_STATE, DEFAULT_PROJECTION, GltfParseOptions, LoadMeshOptions, LoopMode, LoopOnce, LoopPingPong, LoopRepeat, MtlParseResult, NormalizeResult, ObjParseOptions, OctahedronPolygonsOptions, ParseAnimationClip, ParseAnimationController, ParseResult, ParsedColor, PolyAmbientLight, PolyAnimationAction, PolyAnimationClip, PolyAnimationMixer, PolyAnimationTarget, PolyDirectionalLight, PolyMaterial, PolyTextureLightingMode, Polygon, PolygonFace, RingPolygonsOptions, SceneBbox, SceneContext, SceneContextBuildArgs, SceneContextBuildResult, SolidTextureSampleOptions, TexturePaintMetrics, TexturePaintMetricsOptions, TextureTriangle, Vec2, Vec3, VoxParseOptions, arrowPolygons, axesHelperPolygons, bakeSolidTextureSampledPolygons, bakeSolidTextureSamples, buildSceneContext, clampChannel, computeSceneBbox, computeShapeLighting, computeTexturePaintMetrics, coverPlanarPolygons, createIsometricCamera, createPolyAnimationMixer, cullInteriorPolygons, formatColor, inverseRotateVec3, loadMesh, mergePolygons, normalizeInvertMultiplier, normalizePolygons, octahedronPolygons, parseColor, parseGltf, parseHexColor, parseMtl, parseObj, parsePureColor, parseRgbColor, parseVox, polygonFaces, ringPolygons, rotateVec3, shadeColor } from '@layoutit/polycss-core';
|
|
4
|
+
import { Vec3, CameraState, CameraHandle, Vec2, PolyMaterial, PolyDirectionalLight, PolyTextureLightingMode, TextureQuality, Polygon, PolyAmbientLight, PolySeamBleed, PolyRenderStrategiesOption, LoadMeshOptions, ParseResult, MeshResolution, BoxPolygonsOptions, ConePolygonsOptions, CylinderPolygonsOptions, DodecahedronPolygonsOptions, IcosahedronPolygonsOptions, OctahedronPolygonsOptions, PlanePolygonsOptions, RingPolygonsOptions, SpherePolygonsOptions, TetrahedronPolygonsOptions, TorusPolygonsOptions, PolyAnimationTarget, PolyAnimationMixer, PolyAnimationClip, PolyAnimationAction, ParseAnimationController } from '@layoutit/polycss-core';
|
|
5
|
+
export { ArrowPolygonsOptions, AutoRotateConfig, AutoRotateOption, AxesHelperOptions, BASE_TILE, BoxFace, BoxFaceOptions, BoxPolygonsOptions, CAMERA_BACKFACE_CULL_EPS, CameraCullNormalGroup, CameraCullRotation, CameraHandle, CameraState, CameraStyleInput, ConePolygonsOptions, CoverPlanarPolygonsOptions, CullInteriorOptions, CylinderPolygonsOptions, DEFAULT_CAMERA_STATE, DEFAULT_PROJECTION, DEFAULT_SEAM_FACET_SPLIT_OPTIONS, DEFAULT_SEAM_OVERLAP_OPTIONS, DodecahedronPolygonsOptions, GltfParseOptions, IcosahedronPolygonsOptions, LoadMeshOptions, LoopMode, LoopOnce, LoopPingPong, LoopRepeat, MeshResolution, MtlParseResult, NormalizeResult, ObjParseOptions, OctahedronPolygonsOptions, OptimizeAnimatedMeshPolygonsOptions, OptimizeMeshPolygonsOptions, ParseAnimationClip, ParseAnimationController, ParseResult, ParsedColor, PlanePolygonsOptions, PolyAmbientLight, PolyAnimationAction, PolyAnimationClip, PolyAnimationMixer, PolyAnimationTarget, PolyDirectionalLight, PolyMaterial, PolyRenderStrategiesOption, PolyRenderStrategy, PolyTextureLightingMode, Polygon, PolygonFace, RingPolygonsOptions, SceneBbox, SceneContext, SceneContextBuildArgs, SceneContextBuildResult, SeamFacetSplitCandidate, SeamFacetSplitCandidateReason, SeamFacetSplitOptions, SeamFacetSplitReport, SeamOverlapCandidate, SeamOverlapCandidateKind, SeamOverlapDiagnostics, SeamOverlapOptions, SolidTextureSampleOptions, TetrahedronPolygonsOptions, TexturePaintMetrics, TexturePaintMetricsOptions, TextureTriangle, TorusPolygonsOptions, VOXEL_CAMERA_CULL_AXIS_EPS, VOXEL_CAMERA_CULL_NORMAL_LIMIT, Vec2, Vec3, VoxParseOptions, arrowPolygons, axesHelperPolygons, bakeSolidTextureSampledPolygons, bakeSolidTextureSamples, boxPolygons, buildSceneContext, cameraCullNormalGroups, cameraCullNormalGroupsFromPolygons, cameraCullNormalKey, cameraCullVisibleSignature, cameraFacingDepth, clampChannel, computeSceneBbox, computeShapeLighting, computeTexturePaintMetrics, conePolygons, coverPlanarPolygons, createIsometricCamera, createPolyAnimationMixer, cullInteriorPolygons, cylinderPolygons, dodecahedronPolygons, formatColor, icosahedronPolygons, inverseRotateVec3, isAxisAlignedSurfaceNormal, isVoxelCameraCullableNormalGroups, loadMesh, mergePolygons, normalFacesCamera, normalizeInvertMultiplier, normalizePolygons, octahedronPolygons, optimizeAnimatedMeshPolygons, optimizeMeshPolygons, parseColor, parseGltf, parseHexColor, parseMtl, parseObj, parsePureColor, parseRgbColor, parseVox, planePolygons, polygonCssSurfaceNormal, polygonFaces, polygonFacesCamera, repairMeshSeams, ringPolygons, rotateVec3, seamFacetSplitPolygons, seamFacetSplitReport, seamOverlapDiagnostics, seamOverlapPolygons, seamOverlapReport, shadeColor, tetrahedronPolygons, torusPolygons } from '@layoutit/polycss-core';
|
|
6
6
|
|
|
7
7
|
interface PolyPerspectiveCameraProps {
|
|
8
8
|
zoom?: number;
|
|
@@ -18,7 +18,7 @@ interface PolyPerspectiveCameraProps {
|
|
|
18
18
|
style?: React.CSSProperties;
|
|
19
19
|
}
|
|
20
20
|
declare function PolyPerspectiveCameraInner({ zoom, target, rotX, rotY, distance, perspective, children, className, style, }: PolyPerspectiveCameraProps): react_jsx_runtime.JSX.Element;
|
|
21
|
-
declare const PolyPerspectiveCamera:
|
|
21
|
+
declare const PolyPerspectiveCamera: React$1.MemoExoticComponent<typeof PolyPerspectiveCameraInner>;
|
|
22
22
|
|
|
23
23
|
interface PolyOrthographicCameraProps {
|
|
24
24
|
zoom?: number;
|
|
@@ -32,10 +32,17 @@ interface PolyOrthographicCameraProps {
|
|
|
32
32
|
style?: React.CSSProperties;
|
|
33
33
|
}
|
|
34
34
|
declare function PolyOrthographicCameraInner({ zoom, target, rotX, rotY, distance, children, className, style, }: PolyOrthographicCameraProps): react_jsx_runtime.JSX.Element;
|
|
35
|
-
declare const PolyOrthographicCamera:
|
|
35
|
+
declare const PolyOrthographicCamera: React$1.MemoExoticComponent<typeof PolyOrthographicCameraInner>;
|
|
36
36
|
|
|
37
37
|
interface SceneStoreState {
|
|
38
38
|
cameraState: CameraState;
|
|
39
|
+
/**
|
|
40
|
+
* Bbox-center of all auto-centerable meshes in world coords. Kept separate
|
|
41
|
+
* from `target` so user pan (written to `target` by controls) survives mesh
|
|
42
|
+
* add/remove without fighting the auto-managed centering offset.
|
|
43
|
+
* [0, 0, 0] when autoCenter is off or there are no centerable meshes.
|
|
44
|
+
*/
|
|
45
|
+
autoCenterOffset: Vec3;
|
|
39
46
|
}
|
|
40
47
|
interface SceneStore {
|
|
41
48
|
getState(): SceneStoreState;
|
|
@@ -45,6 +52,8 @@ interface SceneStore {
|
|
|
45
52
|
updateCameraFromRef(handle: CameraHandle): boolean;
|
|
46
53
|
/** Force notify all subscribers (e.g. after prop-driven camera change). */
|
|
47
54
|
notifyAll(): void;
|
|
55
|
+
/** Update the autoCenterOffset (world coords bbox center). */
|
|
56
|
+
setAutoCenterOffset(offset: Vec3): void;
|
|
48
57
|
}
|
|
49
58
|
|
|
50
59
|
interface UseCameraOptions {
|
|
@@ -92,10 +101,21 @@ interface PolyCameraContextValue {
|
|
|
92
101
|
*/
|
|
93
102
|
applyTransformDirect: () => void;
|
|
94
103
|
}
|
|
95
|
-
declare const PolyCameraContext:
|
|
104
|
+
declare const PolyCameraContext: React$1.Context<PolyCameraContextValue | null>;
|
|
96
105
|
declare function useCameraContext(): PolyCameraContextValue;
|
|
97
106
|
|
|
98
|
-
|
|
107
|
+
interface ShadowOptions {
|
|
108
|
+
color?: string;
|
|
109
|
+
opacity?: number;
|
|
110
|
+
lift?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Maximum CSS pixels the shadow may extend beyond the mesh's
|
|
113
|
+
* footprint. Caps the SVG backing store at low light elevations to
|
|
114
|
+
* prevent repaint flicker. Default: `2000`. Pass `Infinity` to
|
|
115
|
+
* disable the cap entirely.
|
|
116
|
+
*/
|
|
117
|
+
maxExtend?: number;
|
|
118
|
+
}
|
|
99
119
|
|
|
100
120
|
/**
|
|
101
121
|
* Three.js-style transform props accepted by every polycss component.
|
|
@@ -159,14 +179,15 @@ interface PolyProps extends TransformProps, DOMPassthroughProps {
|
|
|
159
179
|
layerElevation?: number;
|
|
160
180
|
directionalLight?: PolyDirectionalLight;
|
|
161
181
|
textureLighting?: PolyTextureLightingMode;
|
|
162
|
-
|
|
182
|
+
textureQuality?: TextureQuality;
|
|
163
183
|
debugShowBackfaces?: boolean;
|
|
164
184
|
[key: string]: unknown;
|
|
165
185
|
};
|
|
166
186
|
/** Textured polygon lighting mode. Defaults to scene context, then "baked". */
|
|
167
187
|
textureLighting?: PolyTextureLightingMode;
|
|
168
|
-
/**
|
|
169
|
-
|
|
188
|
+
/** Atlas bitmap budget and CSS sprite size. `"auto"` (default) uses a
|
|
189
|
+
* device-appropriate memory budget and desktop/mobile sprite sizing. */
|
|
190
|
+
textureQuality?: TextureQuality;
|
|
170
191
|
/** Pre-computed shaded base color from the parent (optional override). */
|
|
171
192
|
baseColor?: string;
|
|
172
193
|
}
|
|
@@ -196,8 +217,20 @@ interface PolySceneProps extends TransformProps {
|
|
|
196
217
|
ambientLight?: PolyAmbientLight;
|
|
197
218
|
/** Textured polygon lighting mode. Defaults to "baked". */
|
|
198
219
|
textureLighting?: PolyTextureLightingMode;
|
|
199
|
-
/**
|
|
200
|
-
|
|
220
|
+
/** Atlas bitmap budget and CSS sprite size. `"auto"` (default) uses a
|
|
221
|
+
* device-appropriate memory budget (~4 MB mobile / ~16 MB desktop) and
|
|
222
|
+
* desktop/mobile sprite sizing. Numeric values 0.1..1 force an explicit
|
|
223
|
+
* raster scale and the 64px sprite. */
|
|
224
|
+
textureQuality?: TextureQuality;
|
|
225
|
+
/** Solid seam overscan. `"auto"` computes a fitted per-edge amount from the polygon plan. */
|
|
226
|
+
seamBleed?: PolySeamBleed;
|
|
227
|
+
/**
|
|
228
|
+
* Render strategy overrides. Use `{ disable: ["u"] }` to force solid
|
|
229
|
+
* triangles through the atlas path (`<s>`), or `{ disable: ["b", "i", "u"] }`
|
|
230
|
+
* to force every polygon through the atlas. Mirrors the same option on
|
|
231
|
+
* `renderPolygonsWithTextureAtlas` in `@layoutit/polycss`.
|
|
232
|
+
*/
|
|
233
|
+
strategies?: PolyRenderStrategiesOption;
|
|
201
234
|
/**
|
|
202
235
|
* When `true`, rotation pivots around the mesh's bbox center instead of
|
|
203
236
|
* world (0,0,0). Polygon data is not mutated — the scene element's
|
|
@@ -208,18 +241,27 @@ interface PolySceneProps extends TransformProps {
|
|
|
208
241
|
* origin is at a corner / feet / arbitrary point.
|
|
209
242
|
*/
|
|
210
243
|
autoCenter?: boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Shadow appearance for meshes with `castShadow={true}`. Works in both
|
|
246
|
+
* lighting modes — dynamic mode projects via CSS vars so shadows
|
|
247
|
+
* follow a moving light, baked mode CPU-bakes the projection into
|
|
248
|
+
* each leaf's inline `matrix3d` and drops back-facing polys from the
|
|
249
|
+
* DOM entirely. Defaults: `{ color: "#000000", opacity: 0.25, lift: 0.05, maxExtend: 2000 }`.
|
|
250
|
+
*/
|
|
251
|
+
shadow?: ShadowOptions;
|
|
211
252
|
className?: string;
|
|
212
253
|
style?: CSSProperties;
|
|
213
254
|
children?: ReactNode;
|
|
214
255
|
debugShowLabels?: boolean;
|
|
215
256
|
debugShowBackfaces?: boolean;
|
|
216
257
|
}
|
|
217
|
-
declare function PolySceneInner({ polygons: polygonsProp, centerPolygons: centerPolygonsProp, perspective: _perspective, rotX: _rotX, rotY: _rotY, zoom: _zoom, directionalLight, ambientLight, textureLighting,
|
|
218
|
-
declare const PolyScene:
|
|
258
|
+
declare function PolySceneInner({ polygons: polygonsProp, centerPolygons: centerPolygonsProp, perspective: _perspective, rotX: _rotX, rotY: _rotY, zoom: _zoom, directionalLight, ambientLight, textureLighting, textureQuality, seamBleed, strategies, autoCenter, shadow, className, style, children, position: _position, scale: _scale, rotation: _rotation, debugShowLabels: _debugShowLabels, debugShowBackfaces, }: PolySceneProps): react_jsx_runtime.JSX.Element;
|
|
259
|
+
declare const PolyScene: React$1.MemoExoticComponent<typeof PolySceneInner>;
|
|
219
260
|
|
|
220
261
|
type UseMeshOptions = LoadMeshOptions;
|
|
221
262
|
interface UseMeshResult {
|
|
222
263
|
polygons: Polygon[];
|
|
264
|
+
voxelSource: ParseResult["voxelSource"];
|
|
223
265
|
loading: boolean;
|
|
224
266
|
error: Error | null;
|
|
225
267
|
warnings: string[];
|
|
@@ -231,7 +273,7 @@ declare function usePolyMesh(src: string, options?: UseMeshOptions): UseMeshResu
|
|
|
231
273
|
/**
|
|
232
274
|
* Pointer event API for <PolyMesh>. Mirrors @react-three/fiber's mesh
|
|
233
275
|
* event surface (handler names + payload shape) so devs migrating from
|
|
234
|
-
* three.js use the same mental model.
|
|
276
|
+
* three.js use the same mental model. PolyCSS is DOM-native so we get
|
|
235
277
|
* native pointer events for free — no raycaster, no canvas event
|
|
236
278
|
* synthesis.
|
|
237
279
|
*
|
|
@@ -266,6 +308,12 @@ interface PolyMeshHandle {
|
|
|
266
308
|
getScale(): number | Vec3 | undefined;
|
|
267
309
|
/** Polygons currently being rendered (post-autoCenter). */
|
|
268
310
|
getPolygons(): Polygon[];
|
|
311
|
+
/**
|
|
312
|
+
* Replace the mesh polygons imperatively. Animated solid-triangle meshes use
|
|
313
|
+
* a stable DOM update path that mutates mounted leaves directly; unsupported
|
|
314
|
+
* topology falls back to the normal framework render path.
|
|
315
|
+
*/
|
|
316
|
+
setPolygons(polygons: Polygon[]): void;
|
|
269
317
|
/**
|
|
270
318
|
* Snapshot the current `rotation` prop as the new "baked rotation" and
|
|
271
319
|
* trigger an atlas re-rasterization with the directional light
|
|
@@ -288,6 +336,15 @@ interface PolyMeshHandle {
|
|
|
288
336
|
* safe to call.
|
|
289
337
|
*/
|
|
290
338
|
rebakeAtlas(): void;
|
|
339
|
+
/**
|
|
340
|
+
* Mutate a single polygon in place and re-render the mesh. `target` is
|
|
341
|
+
* either a polygon reference (as returned by `getPolygons()`) or its index.
|
|
342
|
+
* `partial` fields are merged onto the polygon via `Object.assign`. Skips
|
|
343
|
+
* the merge pass — cheaper than a full prop change for targeted edits like
|
|
344
|
+
* color picker updates from an inspector UI. Silently no-ops when `target`
|
|
345
|
+
* is not found or the index is out of range.
|
|
346
|
+
*/
|
|
347
|
+
updatePolygon(target: Polygon | number, partial: Partial<Polygon>): void;
|
|
291
348
|
}
|
|
292
349
|
/**
|
|
293
350
|
* Pointer event payload delivered to <PolyMesh> handlers. Mirrors r3f's
|
|
@@ -373,20 +430,51 @@ interface PolyMeshProps extends TransformProps, InteractionProps {
|
|
|
373
430
|
autoCenter?: boolean;
|
|
374
431
|
/** Textured polygon lighting mode. Defaults to "baked". */
|
|
375
432
|
textureLighting?: PolyTextureLightingMode;
|
|
376
|
-
/**
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
433
|
+
/** Atlas bitmap budget and CSS sprite size. `"auto"` (default) uses a
|
|
434
|
+
* device-appropriate memory budget (~4 MB mobile / ~16 MB desktop) and
|
|
435
|
+
* desktop/mobile sprite sizing. Numeric values 0.1..1 force an explicit
|
|
436
|
+
* raster scale and the 64px sprite. */
|
|
437
|
+
textureQuality?: TextureQuality;
|
|
438
|
+
/** Solid seam overscan. `"auto"` computes a fitted per-edge amount from the polygon plan. */
|
|
439
|
+
seamBleed?: PolySeamBleed;
|
|
440
|
+
/** Per-polygon override render, or static children mounted inside the mesh wrapper. */
|
|
441
|
+
children?: ((polygon: Polygon, index: number) => ReactNode) | ReactNode;
|
|
380
442
|
/** Loading slot — rendered while `src` is being fetched/parsed. */
|
|
381
443
|
fallback?: ReactNode;
|
|
382
444
|
/** Error slot — rendered if parse fails. Receives the Error. */
|
|
383
445
|
errorFallback?: (error: Error) => ReactNode;
|
|
384
446
|
/** Parser options forwarded to parseObj/parseGltf. */
|
|
385
447
|
parseOptions?: UseMeshOptions;
|
|
448
|
+
/** Mesh optimization intent. Defaults to "lossy"; set "lossless" to keep
|
|
449
|
+
* authored surface fidelity. Top-level prop wins over `parseOptions.meshResolution`
|
|
450
|
+
* when both are present. */
|
|
451
|
+
meshResolution?: MeshResolution;
|
|
452
|
+
/**
|
|
453
|
+
* When `true` and the scene is in dynamic lighting mode, emits a flat
|
|
454
|
+
* shadow leaf (`<q class="polycss-shadow">`) sibling for each polygon.
|
|
455
|
+
* The shadow is projected onto the ground plane along the CSS-space light
|
|
456
|
+
* direction via `--shadow-proj` (a CSS var on the scene root). Zero JS in
|
|
457
|
+
* the render loop — projection is pure `calc()`. Defaults to `false`.
|
|
458
|
+
*/
|
|
459
|
+
castShadow?: boolean;
|
|
386
460
|
className?: string;
|
|
387
461
|
style?: CSSProperties;
|
|
388
462
|
}
|
|
389
|
-
declare const PolyMesh:
|
|
463
|
+
declare const PolyMesh: React$1.ForwardRefExoticComponent<PolyMeshProps & React$1.RefAttributes<PolyMeshHandle>>;
|
|
464
|
+
|
|
465
|
+
interface PolyGroundProps {
|
|
466
|
+
/** Side length of the ground quad in world units. Default `6`. */
|
|
467
|
+
size?: number;
|
|
468
|
+
/** World-space Z (floor height). Default `0`. */
|
|
469
|
+
z?: number;
|
|
470
|
+
/** World-space XY center. Default `[0, 0]`. */
|
|
471
|
+
center?: [number, number];
|
|
472
|
+
/** Fill color. Default `#7d848e` — medium gray, chosen so the 25% black
|
|
473
|
+
* `<q>` shadow leaves on top have visible contrast against it. */
|
|
474
|
+
color?: string;
|
|
475
|
+
className?: string;
|
|
476
|
+
}
|
|
477
|
+
declare function PolyGround({ size, z, center, color, className, }: PolyGroundProps): react_jsx_runtime.JSX.Element;
|
|
390
478
|
|
|
391
479
|
interface UseSceneContextOptions {
|
|
392
480
|
directionalLight?: PolyDirectionalLight;
|
|
@@ -399,7 +487,7 @@ interface UseSceneContextResult {
|
|
|
399
487
|
};
|
|
400
488
|
}
|
|
401
489
|
/**
|
|
402
|
-
* React hook that runs the
|
|
490
|
+
* React hook that runs the PolyCSS scene-context pipeline:
|
|
403
491
|
* normalizePolygons → mergePolygons by default → bbox compute.
|
|
404
492
|
*
|
|
405
493
|
* Returns the processed polygons + the scene-wide axis-aligned bbox. Memoized
|
|
@@ -435,8 +523,110 @@ declare function usePolyMaterial(options: {
|
|
|
435
523
|
* check is sound here because polygon data (vertices, color, texture) is
|
|
436
524
|
* typically created once at parse time and passed by reference.
|
|
437
525
|
*/
|
|
438
|
-
declare function PolyInner({ vertices, color, texture, uvs, data, material, position, scale, rotation, className, style: styleProp, id, onClick, onDoubleClick, onMouseEnter, onMouseLeave, onMouseMove, onPointerDown, onPointerUp, onPointerEnter, onPointerLeave, onFocus, onBlur, onKeyDown, tabIndex, role, "aria-label": ariaLabel, "aria-hidden": ariaHidden, pointerEvents: pointerEventsProp, context, textureLighting: textureLightingProp,
|
|
439
|
-
declare const Poly:
|
|
526
|
+
declare function PolyInner({ vertices, color, texture, uvs, data, material, position, scale, rotation, className, style: styleProp, id, onClick, onDoubleClick, onMouseEnter, onMouseLeave, onMouseMove, onPointerDown, onPointerUp, onPointerEnter, onPointerLeave, onFocus, onBlur, onKeyDown, tabIndex, role, "aria-label": ariaLabel, "aria-hidden": ariaHidden, pointerEvents: pointerEventsProp, context, textureLighting: textureLightingProp, textureQuality: textureQualityProp, baseColor: baseColorProp, ...dataAttrs }: PolyProps): react_jsx_runtime.JSX.Element | null;
|
|
527
|
+
declare const Poly: React__default.MemoExoticComponent<typeof PolyInner>;
|
|
528
|
+
|
|
529
|
+
type ShapeMeshProps = Omit<PolyMeshProps, "polygons" | "src" | "mtl">;
|
|
530
|
+
interface PolyBoxProps extends ShapeMeshProps, BoxPolygonsOptions {
|
|
531
|
+
}
|
|
532
|
+
declare function PolyBox({ size, center, min, max, color, texture, material, uvs, data, faces, ...meshProps }: PolyBoxProps): react_jsx_runtime.JSX.Element;
|
|
533
|
+
interface PolyPlaneProps extends ShapeMeshProps, PlanePolygonsOptions {
|
|
534
|
+
}
|
|
535
|
+
declare function PolyPlane({ axis, size, offset, along, color, ...meshProps }: PolyPlaneProps): react_jsx_runtime.JSX.Element;
|
|
536
|
+
interface PolyRingProps extends ShapeMeshProps, RingPolygonsOptions {
|
|
537
|
+
}
|
|
538
|
+
declare function PolyRing({ axis, radius, halfThickness, segments, color, ...meshProps }: PolyRingProps): react_jsx_runtime.JSX.Element;
|
|
539
|
+
interface PolyOctahedronProps extends ShapeMeshProps, OctahedronPolygonsOptions {
|
|
540
|
+
}
|
|
541
|
+
declare function PolyOctahedron({ center, size, color, ...meshProps }: PolyOctahedronProps): react_jsx_runtime.JSX.Element;
|
|
542
|
+
interface PolyTetrahedronProps extends ShapeMeshProps, TetrahedronPolygonsOptions {
|
|
543
|
+
}
|
|
544
|
+
declare function PolyTetrahedron({ size, color, ...meshProps }: PolyTetrahedronProps): react_jsx_runtime.JSX.Element;
|
|
545
|
+
interface PolyIcosahedronProps extends ShapeMeshProps, IcosahedronPolygonsOptions {
|
|
546
|
+
}
|
|
547
|
+
declare function PolyIcosahedron({ size, color, ...meshProps }: PolyIcosahedronProps): react_jsx_runtime.JSX.Element;
|
|
548
|
+
interface PolyDodecahedronProps extends ShapeMeshProps, DodecahedronPolygonsOptions {
|
|
549
|
+
}
|
|
550
|
+
declare function PolyDodecahedron({ size, color, ...meshProps }: PolyDodecahedronProps): react_jsx_runtime.JSX.Element;
|
|
551
|
+
interface PolySphereProps extends ShapeMeshProps, SpherePolygonsOptions {
|
|
552
|
+
}
|
|
553
|
+
declare function PolySphere({ radius, subdivisions, color, ...meshProps }: PolySphereProps): react_jsx_runtime.JSX.Element;
|
|
554
|
+
interface PolyCylinderProps extends ShapeMeshProps, CylinderPolygonsOptions {
|
|
555
|
+
}
|
|
556
|
+
declare function PolyCylinder({ radius, radiusTop, height, radialSegments, color, ...meshProps }: PolyCylinderProps): react_jsx_runtime.JSX.Element;
|
|
557
|
+
interface PolyConeProps extends ShapeMeshProps, ConePolygonsOptions {
|
|
558
|
+
}
|
|
559
|
+
declare function PolyCone({ radius, height, radialSegments, color, ...meshProps }: PolyConeProps): react_jsx_runtime.JSX.Element;
|
|
560
|
+
interface PolyTorusProps extends ShapeMeshProps, TorusPolygonsOptions {
|
|
561
|
+
}
|
|
562
|
+
declare function PolyTorus({ radius, tube, radialSegments, tubularSegments, color, ...meshProps }: PolyTorusProps): react_jsx_runtime.JSX.Element;
|
|
563
|
+
|
|
564
|
+
interface PolyFirstPersonControlsOptions {
|
|
565
|
+
/** Master switch. When `false`, all sub-controls are inert. Default: `true`. */
|
|
566
|
+
enabled?: boolean;
|
|
567
|
+
/** Pointer-lock mouselook (rotX = pitch, rotY = yaw). Default: `true`. */
|
|
568
|
+
lookEnabled?: boolean;
|
|
569
|
+
/** WASD / arrow-key planar movement on world XY. Default: `true`. */
|
|
570
|
+
moveEnabled?: boolean;
|
|
571
|
+
/** Space-bar parametric jump arc on world Z. Default: `true`. */
|
|
572
|
+
jumpEnabled?: boolean;
|
|
573
|
+
/** Ctrl crouch (lowers eye height while held). Default: `true`. */
|
|
574
|
+
crouchEnabled?: boolean;
|
|
575
|
+
/** Mouselook sensitivity in degrees per pixel. Default: `0.15`. */
|
|
576
|
+
lookSensitivity?: number;
|
|
577
|
+
/** Invert vertical mouselook. Default: `false`. */
|
|
578
|
+
invertY?: boolean;
|
|
579
|
+
/** Movement speed in world units per second. Default: `5`. */
|
|
580
|
+
moveSpeed?: number;
|
|
581
|
+
/** Initial vertical velocity for a jump, world units per second. Default: `7`. */
|
|
582
|
+
jumpVelocity?: number;
|
|
583
|
+
/** Gravity acceleration in world units per second squared. Default: `18`. */
|
|
584
|
+
gravity?: number;
|
|
585
|
+
/** Standing eye height above the ground plane. Default: `1.7`. */
|
|
586
|
+
eyeHeight?: number;
|
|
587
|
+
/** Eye height while crouching. Default: `1`. */
|
|
588
|
+
crouchHeight?: number;
|
|
589
|
+
/** World Z of the ground plane the player walks on. Default: `0`. */
|
|
590
|
+
groundZ?: number;
|
|
591
|
+
/** Min pitch (rotX) angle in degrees. Default: `5`. */
|
|
592
|
+
minPitch?: number;
|
|
593
|
+
/** Max pitch (rotX) angle in degrees. Default: `175`. */
|
|
594
|
+
maxPitch?: number;
|
|
595
|
+
}
|
|
596
|
+
interface PolyFirstPersonControlsHandle {
|
|
597
|
+
update(partial: PolyFirstPersonControlsOptions): void;
|
|
598
|
+
resume(): void;
|
|
599
|
+
pause(): void;
|
|
600
|
+
destroy(): void;
|
|
601
|
+
/** Request pointer-lock now. Call from a user gesture (click). */
|
|
602
|
+
lock(): void;
|
|
603
|
+
/** Release pointer-lock. */
|
|
604
|
+
unlock(): void;
|
|
605
|
+
/** Whether pointer-lock is currently held. */
|
|
606
|
+
isLocked(): boolean;
|
|
607
|
+
/**
|
|
608
|
+
* The camera's WORLD position (the eye). Snapshot — mutate via WASD /
|
|
609
|
+
* jump / crouch, or by calling `setOrigin`.
|
|
610
|
+
*/
|
|
611
|
+
getOrigin(): [number, number, number];
|
|
612
|
+
/**
|
|
613
|
+
* Move the camera origin to a specific world position. Re-derives the
|
|
614
|
+
* scene's target so the perspective viewer follows.
|
|
615
|
+
*/
|
|
616
|
+
setOrigin(origin: [number, number, number]): void;
|
|
617
|
+
addEventListener(type: "change" | "start" | "end", listener: () => void): void;
|
|
618
|
+
removeEventListener(type: "change" | "start" | "end", listener: () => void): void;
|
|
619
|
+
hasEventListener(type: "change" | "start" | "end", listener: () => void): boolean;
|
|
620
|
+
}
|
|
621
|
+
interface PolyFirstPersonControlsProps extends PolyFirstPersonControlsOptions {
|
|
622
|
+
/** Called on every camera state change (mouselook, WASD, jump, crouch). */
|
|
623
|
+
onChange?: () => void;
|
|
624
|
+
/** Called when pointer-lock is acquired (interaction starts). */
|
|
625
|
+
onInteractionStart?: () => void;
|
|
626
|
+
/** Called when pointer-lock is released (interaction ends). */
|
|
627
|
+
onInteractionEnd?: () => void;
|
|
628
|
+
}
|
|
629
|
+
declare const PolyFirstPersonControls: React$1.ForwardRefExoticComponent<PolyFirstPersonControlsProps & React$1.RefAttributes<PolyFirstPersonControlsHandle>>;
|
|
440
630
|
|
|
441
631
|
interface PolyControlsAnimateOptions {
|
|
442
632
|
/** Degrees per 60Hz-equivalent frame. Default 0.3 (≈ 18 deg/sec). */
|
|
@@ -485,14 +675,14 @@ interface SharedControlsProps {
|
|
|
485
675
|
onInteractionEnd?: (camera: PolyControlsCamera) => void;
|
|
486
676
|
}
|
|
487
677
|
|
|
488
|
-
interface PolyOrbitControlsProps extends SharedControlsProps {
|
|
489
|
-
}
|
|
490
|
-
declare function PolyOrbitControls({ drag, wheel, dolly, invert, minZoom, maxZoom, minDistance, maxDistance, animate, onChange, onInteractionStart, onInteractionEnd, }: PolyOrbitControlsProps): null;
|
|
491
|
-
|
|
492
678
|
interface PolyMapControlsProps extends SharedControlsProps {
|
|
493
679
|
}
|
|
494
680
|
declare function PolyMapControls({ drag, wheel, dolly, invert, minZoom, maxZoom, minDistance, maxDistance, animate, onChange, onInteractionStart, onInteractionEnd, }: PolyMapControlsProps): null;
|
|
495
681
|
|
|
682
|
+
interface PolyOrbitControlsProps extends SharedControlsProps {
|
|
683
|
+
}
|
|
684
|
+
declare function PolyOrbitControls({ drag, wheel, dolly, invert, minZoom, maxZoom, minDistance, maxDistance, animate, onChange, onInteractionStart, onInteractionEnd, }: PolyOrbitControlsProps): null;
|
|
685
|
+
|
|
496
686
|
/** Optional ref-or-direct binding to a target mesh. */
|
|
497
687
|
type PolyTransformControlsObject = PolyMeshHandle | RefObject<PolyMeshHandle | null> | null;
|
|
498
688
|
interface PolyTransformControlsObjectChangeEvent {
|
|
@@ -648,6 +838,29 @@ declare function PolyDirectionalLightHelper({ light, target, distance, size, col
|
|
|
648
838
|
|
|
649
839
|
declare function injectPolyBaseStyles(doc?: Document): void;
|
|
650
840
|
|
|
841
|
+
interface PolyRenderSurfaceLeafCounts {
|
|
842
|
+
quad: number;
|
|
843
|
+
clippedSolid: number;
|
|
844
|
+
atlas: number;
|
|
845
|
+
stableTriangle: number;
|
|
846
|
+
}
|
|
847
|
+
interface PolyRenderStats {
|
|
848
|
+
polygonCount: number;
|
|
849
|
+
mountedPolygonLeafCount: number;
|
|
850
|
+
shadowLeafCount: number;
|
|
851
|
+
surfaceLeafCounts: PolyRenderSurfaceLeafCounts;
|
|
852
|
+
bucketCount: number;
|
|
853
|
+
}
|
|
854
|
+
interface PolyRenderStatsOptions {
|
|
855
|
+
polygonCount?: number;
|
|
856
|
+
/**
|
|
857
|
+
* Optional subtree selector for diagnostics that only want model leaves and
|
|
858
|
+
* not helpers/floors/gizmos sharing the same scene root.
|
|
859
|
+
*/
|
|
860
|
+
scopeSelector?: string;
|
|
861
|
+
}
|
|
862
|
+
declare function collectPolyRenderStats(root: ParentNode | null | undefined, optionsOrPolygonCount?: number | PolyRenderStatsOptions): PolyRenderStats;
|
|
863
|
+
|
|
651
864
|
interface UsePolyAnimationResult {
|
|
652
865
|
/** Attach to a `PolyAnimationTarget`-compatible handle when not using `root`. */
|
|
653
866
|
ref: RefObject<PolyAnimationTarget | null>;
|
|
@@ -666,4 +879,4 @@ interface UsePolyAnimationResult {
|
|
|
666
879
|
}
|
|
667
880
|
declare function usePolyAnimation(clips: PolyAnimationClip[] | undefined, controller: ParseAnimationController | undefined, root?: RefObject<PolyAnimationTarget | null> | PolyAnimationTarget | null): UsePolyAnimationResult;
|
|
668
881
|
|
|
669
|
-
export { type DOMPassthroughProps, type InteractionProps, Poly, PolyAxesHelper, type PolyAxesHelperProps,
|
|
882
|
+
export { type DOMPassthroughProps, type InteractionProps, Poly, PolyAxesHelper, type PolyAxesHelperProps, PolyBox, type PolyBoxProps, PolyOrthographicCamera as PolyCamera, PolyCameraContext, type PolyCameraContextValue, type PolyOrthographicCameraProps as PolyCameraProps, PolyCone, type PolyConeProps, type PolyControlsAnimateOptions, type PolyControlsCamera, PolyCylinder, type PolyCylinderProps, PolyDirectionalLightHelper, type PolyDirectionalLightHelperProps, PolyDodecahedron, type PolyDodecahedronProps, type PolyEventHandler, PolyFirstPersonControls, type PolyFirstPersonControlsHandle, type PolyFirstPersonControlsOptions, type PolyFirstPersonControlsProps, PolyGround, type PolyGroundProps, PolyIcosahedron, type PolyIcosahedronProps, PolyMapControls, type PolyControlsCamera as PolyMapControlsCamera, type PolyMapControlsProps, PolyMesh, type PolyMeshHandle, type PolyMeshProps, type PolyMouseEvent, PolyOctahedron, type PolyOctahedronProps, PolyOrbitControls, type PolyControlsCamera as PolyOrbitControlsCamera, type PolyOrbitControlsProps, PolyOrthographicCamera, type PolyOrthographicCameraProps, PolyPerspectiveCamera, type PolyPerspectiveCameraProps, PolyPlane, type PolyPlaneProps, type PolyPointerEvent, type PolyProps, type PolyRenderStats, type PolyRenderStatsOptions, type PolyRenderSurfaceLeafCounts, PolyRing, type PolyRingProps, PolyScene, type PolySceneProps, PolySelect, type PolySelectProps, type PolySelectionApi, PolySphere, type PolySphereProps, PolyTetrahedron, type PolyTetrahedronProps, PolyTorus, type PolyTorusProps, PolyTransformControls, type PolyTransformControlsObject, type PolyTransformControlsObjectChangeEvent, type PolyTransformControlsProps, type PolyWheelEvent, type SharedControlsProps, type TransformProps, type UseCameraOptions, type UseCameraResult, type UseMeshOptions, type UseMeshResult, type UsePolyAnimationResult, type UseSceneContextOptions, type UseSceneContextResult, collectPolyRenderStats, findMeshUnderPoint, findPolyMeshHandle, injectPolyBaseStyles, pointInMeshElement, useCameraContext, usePolyAnimation, usePolyCamera, usePolyMaterial, usePolyMesh, usePolySceneContext, usePolySelect, usePolySelectionApi };
|