@layoutit/polycss-react 0.2.0 → 0.2.2
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 +149 -121
- package/dist/index.cjs +3389 -1849
- package/dist/index.d.cts +182 -52
- package/dist/index.d.ts +182 -52
- package/dist/index.js +3343 -1740
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import React__default, { ReactNode, CSSProperties, MouseEventHandler, PointerEventHandler, FocusEventHandler, KeyboardEventHandler, IframeHTMLAttributes, RefObject, MouseEvent as MouseEvent$1 } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import
|
|
5
|
-
|
|
4
|
+
import * as _layoutit_polycss_core from '@layoutit/polycss-core';
|
|
5
|
+
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';
|
|
6
|
+
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, OptimizeMeshParseResultOptions, OptimizeMeshPolygonsOptions, ParseAnimationClip, ParseAnimationController, ParseResult, ParseStlColor, ParseStlSolid, ParseStlTopology, 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, SimplifyTriangleMeshPolygonsOptions, SolidTextureSampleOptions, StlParseOptions, 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, optimizeMeshParseResult, optimizeMeshPolygons, parseColor, parseGltf, parseHexColor, parseMtl, parseObj, parsePureColor, parseRgbColor, parseStl, parseVox, planePolygons, polygonCssSurfaceNormal, polygonFaces, polygonFacesCamera, repairMeshSeams, ringPolygons, rotateVec3, seamFacetSplitPolygons, seamFacetSplitReport, seamOverlapDiagnostics, seamOverlapPolygons, seamOverlapReport, shadeColor, simplifyTriangleMeshPolygons, tetrahedronPolygons, torusPolygons } from '@layoutit/polycss-core';
|
|
6
7
|
|
|
7
8
|
interface PolyPerspectiveCameraProps {
|
|
8
9
|
zoom?: number;
|
|
@@ -11,14 +12,14 @@ interface PolyPerspectiveCameraProps {
|
|
|
11
12
|
rotY?: number;
|
|
12
13
|
/** Camera pull-back in CSS pixels (dolly). Default 0. */
|
|
13
14
|
distance?: number;
|
|
14
|
-
/** CSS perspective distance in pixels. Defaults to
|
|
15
|
+
/** CSS perspective distance in pixels. Defaults to 32000. */
|
|
15
16
|
perspective?: number;
|
|
16
17
|
children?: ReactNode;
|
|
17
18
|
className?: string;
|
|
18
19
|
style?: React.CSSProperties;
|
|
19
20
|
}
|
|
20
21
|
declare function PolyPerspectiveCameraInner({ zoom, target, rotX, rotY, distance, perspective, children, className, style, }: PolyPerspectiveCameraProps): react_jsx_runtime.JSX.Element;
|
|
21
|
-
declare const PolyPerspectiveCamera:
|
|
22
|
+
declare const PolyPerspectiveCamera: React$1.MemoExoticComponent<typeof PolyPerspectiveCameraInner>;
|
|
22
23
|
|
|
23
24
|
interface PolyOrthographicCameraProps {
|
|
24
25
|
zoom?: number;
|
|
@@ -32,7 +33,7 @@ interface PolyOrthographicCameraProps {
|
|
|
32
33
|
style?: React.CSSProperties;
|
|
33
34
|
}
|
|
34
35
|
declare function PolyOrthographicCameraInner({ zoom, target, rotX, rotY, distance, children, className, style, }: PolyOrthographicCameraProps): react_jsx_runtime.JSX.Element;
|
|
35
|
-
declare const PolyOrthographicCamera:
|
|
36
|
+
declare const PolyOrthographicCamera: React$1.MemoExoticComponent<typeof PolyOrthographicCameraInner>;
|
|
36
37
|
|
|
37
38
|
interface SceneStoreState {
|
|
38
39
|
cameraState: CameraState;
|
|
@@ -101,31 +102,23 @@ interface PolyCameraContextValue {
|
|
|
101
102
|
*/
|
|
102
103
|
applyTransformDirect: () => void;
|
|
103
104
|
}
|
|
104
|
-
declare const PolyCameraContext:
|
|
105
|
+
declare const PolyCameraContext: React$1.Context<PolyCameraContextValue | null>;
|
|
105
106
|
declare function useCameraContext(): PolyCameraContextValue;
|
|
106
107
|
|
|
107
108
|
interface ShadowOptions {
|
|
108
109
|
color?: string;
|
|
109
110
|
opacity?: number;
|
|
110
111
|
lift?: number;
|
|
112
|
+
/**
|
|
113
|
+
* Maximum CSS pixels the shadow may extend beyond the mesh's
|
|
114
|
+
* footprint. Caps the SVG backing store at low light elevations to
|
|
115
|
+
* prevent repaint flicker. Default: `2000`. Pass `Infinity` to
|
|
116
|
+
* disable the cap entirely.
|
|
117
|
+
*/
|
|
118
|
+
maxExtend?: number;
|
|
111
119
|
}
|
|
112
120
|
|
|
113
|
-
/**
|
|
114
|
-
type PolyRenderStrategy = "b" | "i" | "u";
|
|
115
|
-
interface PolyRenderStrategiesOption {
|
|
116
|
-
/** Strategies to skip; polygons that would normally use them fall through
|
|
117
|
-
* the chain (b → i → s, u → i → s, i → s). `<s>` is the universal
|
|
118
|
-
* fallback and cannot be disabled — textured polys have no other path. */
|
|
119
|
-
disable?: readonly PolyRenderStrategy[];
|
|
120
|
-
}
|
|
121
|
-
type TextureQuality = number | "auto";
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Three.js-style transform props accepted by every polycss component.
|
|
125
|
-
* In Phase 3, position/scale/rotation are accepted but not yet applied —
|
|
126
|
-
* the rendered transform comes from vertices in scene-root space.
|
|
127
|
-
* Phase 4 wires these into the matrix3d composition with parent PolyMesh.
|
|
128
|
-
*/
|
|
121
|
+
/** Three.js-style transform props accepted by every PolyCSS component. */
|
|
129
122
|
interface TransformProps {
|
|
130
123
|
position?: Vec3;
|
|
131
124
|
scale?: number | Vec3;
|
|
@@ -133,7 +126,7 @@ interface TransformProps {
|
|
|
133
126
|
}
|
|
134
127
|
/**
|
|
135
128
|
* DOM event handlers, ARIA, and style props forwarded to the rendered
|
|
136
|
-
* element
|
|
129
|
+
* element by every Poly component.
|
|
137
130
|
*
|
|
138
131
|
* This is the DOM-native pitch: polygons are real DOM nodes you can
|
|
139
132
|
* target with CSS, attach event handlers to, and inspect in DevTools.
|
|
@@ -165,7 +158,7 @@ interface DOMPassthroughProps {
|
|
|
165
158
|
* Props for the `<Poly>` component — the atomic polygon primitive.
|
|
166
159
|
*
|
|
167
160
|
* Extends TransformProps + DOMPassthroughProps with the polygon's own fields.
|
|
168
|
-
* This is the canonical
|
|
161
|
+
* This is the canonical Poly component API.
|
|
169
162
|
*/
|
|
170
163
|
interface PolyProps extends TransformProps, DOMPassthroughProps {
|
|
171
164
|
vertices: Vec3[];
|
|
@@ -225,6 +218,8 @@ interface PolySceneProps extends TransformProps {
|
|
|
225
218
|
* desktop/mobile sprite sizing. Numeric values 0.1..1 force an explicit
|
|
226
219
|
* raster scale and the 64px sprite. */
|
|
227
220
|
textureQuality?: TextureQuality;
|
|
221
|
+
/** Solid seam overscan. `"auto"` computes a fitted per-edge amount from the polygon plan. */
|
|
222
|
+
seamBleed?: PolySeamBleed;
|
|
228
223
|
/**
|
|
229
224
|
* Render strategy overrides. Use `{ disable: ["u"] }` to force solid
|
|
230
225
|
* triangles through the atlas path (`<s>`), or `{ disable: ["b", "i", "u"] }`
|
|
@@ -243,9 +238,10 @@ interface PolySceneProps extends TransformProps {
|
|
|
243
238
|
*/
|
|
244
239
|
autoCenter?: boolean;
|
|
245
240
|
/**
|
|
246
|
-
* Shadow appearance for meshes with `castShadow={true}`.
|
|
247
|
-
*
|
|
248
|
-
*
|
|
241
|
+
* Shadow appearance for meshes with `castShadow={true}`. Works in both
|
|
242
|
+
* lighting modes. Shadows emit as SVG paths and reproject when light,
|
|
243
|
+
* ground, or mesh geometry changes. Defaults:
|
|
244
|
+
* `{ color: "#000000", opacity: 0.25, lift: 0.05, maxExtend: 2000 }`.
|
|
249
245
|
*/
|
|
250
246
|
shadow?: ShadowOptions;
|
|
251
247
|
className?: string;
|
|
@@ -254,12 +250,13 @@ interface PolySceneProps extends TransformProps {
|
|
|
254
250
|
debugShowLabels?: boolean;
|
|
255
251
|
debugShowBackfaces?: boolean;
|
|
256
252
|
}
|
|
257
|
-
declare function PolySceneInner({ polygons: polygonsProp, centerPolygons: centerPolygonsProp, perspective: _perspective, rotX: _rotX, rotY: _rotY, zoom: _zoom, directionalLight, ambientLight, textureLighting, textureQuality, strategies, autoCenter, shadow, className, style, children, position: _position, scale: _scale, rotation: _rotation, debugShowLabels: _debugShowLabels, debugShowBackfaces, }: PolySceneProps): react_jsx_runtime.JSX.Element;
|
|
258
|
-
declare const PolyScene:
|
|
253
|
+
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;
|
|
254
|
+
declare const PolyScene: React$1.MemoExoticComponent<typeof PolySceneInner>;
|
|
259
255
|
|
|
260
256
|
type UseMeshOptions = LoadMeshOptions;
|
|
261
257
|
interface UseMeshResult {
|
|
262
258
|
polygons: Polygon[];
|
|
259
|
+
voxelSource: ParseResult["voxelSource"];
|
|
263
260
|
loading: boolean;
|
|
264
261
|
error: Error | null;
|
|
265
262
|
warnings: string[];
|
|
@@ -271,7 +268,7 @@ declare function usePolyMesh(src: string, options?: UseMeshOptions): UseMeshResu
|
|
|
271
268
|
/**
|
|
272
269
|
* Pointer event API for <PolyMesh>. Mirrors @react-three/fiber's mesh
|
|
273
270
|
* event surface (handler names + payload shape) so devs migrating from
|
|
274
|
-
* three.js use the same mental model.
|
|
271
|
+
* three.js use the same mental model. PolyCSS is DOM-native so we get
|
|
275
272
|
* native pointer events for free — no raycaster, no canvas event
|
|
276
273
|
* synthesis.
|
|
277
274
|
*
|
|
@@ -306,6 +303,12 @@ interface PolyMeshHandle {
|
|
|
306
303
|
getScale(): number | Vec3 | undefined;
|
|
307
304
|
/** Polygons currently being rendered (post-autoCenter). */
|
|
308
305
|
getPolygons(): Polygon[];
|
|
306
|
+
/**
|
|
307
|
+
* Replace the mesh polygons imperatively. Animated solid-triangle meshes use
|
|
308
|
+
* a stable DOM update path that mutates mounted leaves directly; unsupported
|
|
309
|
+
* topology falls back to the normal framework render path.
|
|
310
|
+
*/
|
|
311
|
+
setPolygons(polygons: Polygon[]): void;
|
|
309
312
|
/**
|
|
310
313
|
* Snapshot the current `rotation` prop as the new "baked rotation" and
|
|
311
314
|
* trigger an atlas re-rasterization with the directional light
|
|
@@ -418,6 +421,14 @@ interface PolyMeshProps extends TransformProps, InteractionProps {
|
|
|
418
421
|
mtl?: string;
|
|
419
422
|
/** Pre-parsed polygons. Mutually exclusive with `src`. */
|
|
420
423
|
polygons?: Polygon[];
|
|
424
|
+
/** Optional `parseResult.voxelSource` companion for `.vox` meshes. When
|
|
425
|
+
* set alongside `polygons`, the direct voxel renderer fast path activates
|
|
426
|
+
* — emitting one `<b>` per visible voxel quad inside `.polycss-voxel-face`
|
|
427
|
+
* wrappers (matches vanilla's `scene.add(parseResult)` behaviour).
|
|
428
|
+
* Callers fetching via core's `loadMesh()` pass `parseResult.voxelSource`
|
|
429
|
+
* here so the fast path engages; callers fetching via PolyMesh's `src`
|
|
430
|
+
* prop get the same data wired through `useMesh` automatically. */
|
|
431
|
+
voxelSource?: _layoutit_polycss_core.ParseResult["voxelSource"];
|
|
421
432
|
/** Translate so mesh's bbox center is at local origin before applying `position`. */
|
|
422
433
|
autoCenter?: boolean;
|
|
423
434
|
/** Textured polygon lighting mode. Defaults to "baked". */
|
|
@@ -427,6 +438,17 @@ interface PolyMeshProps extends TransformProps, InteractionProps {
|
|
|
427
438
|
* desktop/mobile sprite sizing. Numeric values 0.1..1 force an explicit
|
|
428
439
|
* raster scale and the 64px sprite. */
|
|
429
440
|
textureQuality?: TextureQuality;
|
|
441
|
+
/** Solid seam overscan. `"auto"` computes a fitted per-edge amount from the polygon plan. */
|
|
442
|
+
seamBleed?: PolySeamBleed;
|
|
443
|
+
/**
|
|
444
|
+
* Hold the whole previous frame (geometry + texture) until the next atlas is
|
|
445
|
+
* decoded, then swap atomically — so a geometry edit never shows geometry
|
|
446
|
+
* before its texture. Best when edits arrive as discrete commits (no
|
|
447
|
+
* continuous drag). Defaults to false (bitmap streams in over live geometry).
|
|
448
|
+
*/
|
|
449
|
+
atomicAtlas?: boolean;
|
|
450
|
+
/** Fires when the displayed atlas frame swaps to a ready one (atomic mode). */
|
|
451
|
+
onFrameReady?: () => void;
|
|
430
452
|
/** Per-polygon override render, or static children mounted inside the mesh wrapper. */
|
|
431
453
|
children?: ((polygon: Polygon, index: number) => ReactNode) | ReactNode;
|
|
432
454
|
/** Loading slot — rendered while `src` is being fetched/parsed. */
|
|
@@ -435,18 +457,66 @@ interface PolyMeshProps extends TransformProps, InteractionProps {
|
|
|
435
457
|
errorFallback?: (error: Error) => ReactNode;
|
|
436
458
|
/** Parser options forwarded to parseObj/parseGltf. */
|
|
437
459
|
parseOptions?: UseMeshOptions;
|
|
460
|
+
/** Mesh optimization intent. Defaults to "lossy"; set "lossless" to keep
|
|
461
|
+
* authored surface fidelity. Top-level prop wins over `parseOptions.meshResolution`
|
|
462
|
+
* when both are present. */
|
|
463
|
+
meshResolution?: MeshResolution;
|
|
438
464
|
/**
|
|
439
|
-
* When `true
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
* the render loop — projection is pure `calc()`. Defaults to `false`.
|
|
465
|
+
* When `true`, emits a per-mesh SVG shadow path in both lighting modes.
|
|
466
|
+
* Each casting polygon projects onto the scene ground plane along the
|
|
467
|
+
* directional light; overlapping outlines are merged into one silhouette.
|
|
468
|
+
* Defaults to `false`.
|
|
444
469
|
*/
|
|
445
470
|
castShadow?: boolean;
|
|
471
|
+
/**
|
|
472
|
+
* When `true`, this mesh acts as a shadow receiver. The scene's caster
|
|
473
|
+
* meshes (those with `castShadow=true`) project per-coplanar-face SVG
|
|
474
|
+
* shadows onto each visible surface of this mesh, matching Three.js's
|
|
475
|
+
* `mesh.receiveShadow` semantics. Disables the ground-shadow fallback
|
|
476
|
+
* for caster meshes — receivers handle shadow display. Defaults to `false`.
|
|
477
|
+
*/
|
|
478
|
+
receiveShadow?: boolean;
|
|
479
|
+
/**
|
|
480
|
+
* Apply mesh optimization (coplanar merge + interior cull) before
|
|
481
|
+
* rendering. Defaults to `true` — matches vanilla `scene.add`'s default.
|
|
482
|
+
* Set `false` for helper meshes (axes, light markers) whose geometry
|
|
483
|
+
* shouldn't be merged, or when the imperative `updatePolygon` API needs
|
|
484
|
+
* polygon refs to survive across updates.
|
|
485
|
+
*/
|
|
486
|
+
merge?: boolean;
|
|
487
|
+
className?: string;
|
|
488
|
+
style?: CSSProperties;
|
|
489
|
+
}
|
|
490
|
+
declare const PolyMesh: React$1.ForwardRefExoticComponent<PolyMeshProps & React$1.RefAttributes<PolyMeshHandle>>;
|
|
491
|
+
|
|
492
|
+
interface PolyIframeProps {
|
|
493
|
+
/** Iframe URL — forwarded to the underlying <iframe>'s `src` attribute. */
|
|
494
|
+
src: string;
|
|
495
|
+
/** Width in world units (multiplied by BASE_TILE for CSS px). */
|
|
496
|
+
width: number;
|
|
497
|
+
/** Height in world units (multiplied by BASE_TILE for CSS px). */
|
|
498
|
+
height: number;
|
|
499
|
+
/** World-units position (+X right, +Y forward, +Z up). */
|
|
500
|
+
position?: Vec3;
|
|
501
|
+
/** World Euler XYZ in degrees. */
|
|
502
|
+
rotation?: Vec3;
|
|
503
|
+
/** Uniform scale (number) or per-axis Vec3. */
|
|
504
|
+
scale?: number | Vec3;
|
|
505
|
+
/** Forwarded to the underlying <iframe>'s `allow`. */
|
|
506
|
+
allow?: string;
|
|
507
|
+
/** Forwarded to the underlying <iframe>'s `sandbox`. */
|
|
508
|
+
sandbox?: string;
|
|
509
|
+
/** Forwarded to the underlying <iframe>'s `loading`. */
|
|
510
|
+
loading?: IframeHTMLAttributes<HTMLIFrameElement>["loading"];
|
|
511
|
+
/** Forwarded to the underlying <iframe>'s `referrerpolicy`. */
|
|
512
|
+
referrerPolicy?: IframeHTMLAttributes<HTMLIFrameElement>["referrerPolicy"];
|
|
513
|
+
/** Forwarded to the underlying <iframe>'s `title` (a11y label). */
|
|
514
|
+
title?: string;
|
|
446
515
|
className?: string;
|
|
516
|
+
/** Style overrides on the wrapper div (NOT on the iframe). */
|
|
447
517
|
style?: CSSProperties;
|
|
448
518
|
}
|
|
449
|
-
declare
|
|
519
|
+
declare function PolyIframe({ src, width, height, position, rotation, scale, allow, sandbox, loading, referrerPolicy, title, className, style, }: PolyIframeProps): react_jsx_runtime.JSX.Element;
|
|
450
520
|
|
|
451
521
|
interface PolyGroundProps {
|
|
452
522
|
/** Side length of the ground quad in world units. Default `6`. */
|
|
@@ -455,8 +525,8 @@ interface PolyGroundProps {
|
|
|
455
525
|
z?: number;
|
|
456
526
|
/** World-space XY center. Default `[0, 0]`. */
|
|
457
527
|
center?: [number, number];
|
|
458
|
-
/** Fill color. Default `#7d848e` — medium gray, chosen so the
|
|
459
|
-
*
|
|
528
|
+
/** Fill color. Default `#7d848e` — medium gray, chosen so the default
|
|
529
|
+
* 25% black SVG shadow has visible contrast against it. */
|
|
460
530
|
color?: string;
|
|
461
531
|
className?: string;
|
|
462
532
|
}
|
|
@@ -473,11 +543,11 @@ interface UseSceneContextResult {
|
|
|
473
543
|
};
|
|
474
544
|
}
|
|
475
545
|
/**
|
|
476
|
-
* React hook that runs the
|
|
546
|
+
* React hook that runs the PolyCSS scene-context pipeline:
|
|
477
547
|
* normalizePolygons → mergePolygons by default → bbox compute.
|
|
478
548
|
*
|
|
479
549
|
* Returns the processed polygons + the scene-wide axis-aligned bbox. Memoized
|
|
480
|
-
* on input identity + the few options that affect output.
|
|
550
|
+
* on input identity + the few options that affect output.
|
|
481
551
|
*/
|
|
482
552
|
declare function usePolySceneContext(polygons: Polygon[], options: UseSceneContextOptions): UseSceneContextResult;
|
|
483
553
|
|
|
@@ -498,11 +568,12 @@ declare function usePolyMaterial(options: {
|
|
|
498
568
|
}): PolyMaterial;
|
|
499
569
|
|
|
500
570
|
/**
|
|
501
|
-
* Poly — renders one polygon as
|
|
571
|
+
* Poly — renders one polygon as a render-strategy DOM leaf.
|
|
502
572
|
*
|
|
503
573
|
* Public API: `{ vertices, color?, texture?, uvs?, data? }` plus DOM
|
|
504
|
-
* passthrough props.
|
|
505
|
-
* faces
|
|
574
|
+
* passthrough props. Solid faces use the cheapest supported solid strategy;
|
|
575
|
+
* textured faces use the atlas path. `<Poly>` never emits SVG in the normal
|
|
576
|
+
* render path.
|
|
506
577
|
*
|
|
507
578
|
* Wrapped in React.memo so parent re-renders (e.g. camera rotation updating
|
|
508
579
|
* rotY state) do not re-render stable polygon children. The shallow-equality
|
|
@@ -510,7 +581,42 @@ declare function usePolyMaterial(options: {
|
|
|
510
581
|
* typically created once at parse time and passed by reference.
|
|
511
582
|
*/
|
|
512
583
|
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;
|
|
513
|
-
declare const Poly:
|
|
584
|
+
declare const Poly: React__default.MemoExoticComponent<typeof PolyInner>;
|
|
585
|
+
|
|
586
|
+
type ShapeMeshProps = Omit<PolyMeshProps, "polygons" | "src" | "mtl">;
|
|
587
|
+
interface PolyBoxProps extends ShapeMeshProps, BoxPolygonsOptions {
|
|
588
|
+
}
|
|
589
|
+
declare function PolyBox({ size, center, min, max, color, texture, material, uvs, data, faces, ...meshProps }: PolyBoxProps): react_jsx_runtime.JSX.Element;
|
|
590
|
+
interface PolyPlaneProps extends ShapeMeshProps, PlanePolygonsOptions {
|
|
591
|
+
}
|
|
592
|
+
declare function PolyPlane({ axis, size, offset, along, color, ...meshProps }: PolyPlaneProps): react_jsx_runtime.JSX.Element;
|
|
593
|
+
interface PolyRingProps extends ShapeMeshProps, RingPolygonsOptions {
|
|
594
|
+
}
|
|
595
|
+
declare function PolyRing({ axis, radius, halfThickness, segments, color, ...meshProps }: PolyRingProps): react_jsx_runtime.JSX.Element;
|
|
596
|
+
interface PolyOctahedronProps extends ShapeMeshProps, OctahedronPolygonsOptions {
|
|
597
|
+
}
|
|
598
|
+
declare function PolyOctahedron({ center, size, color, ...meshProps }: PolyOctahedronProps): react_jsx_runtime.JSX.Element;
|
|
599
|
+
interface PolyTetrahedronProps extends ShapeMeshProps, TetrahedronPolygonsOptions {
|
|
600
|
+
}
|
|
601
|
+
declare function PolyTetrahedron({ size, color, ...meshProps }: PolyTetrahedronProps): react_jsx_runtime.JSX.Element;
|
|
602
|
+
interface PolyIcosahedronProps extends ShapeMeshProps, IcosahedronPolygonsOptions {
|
|
603
|
+
}
|
|
604
|
+
declare function PolyIcosahedron({ size, color, ...meshProps }: PolyIcosahedronProps): react_jsx_runtime.JSX.Element;
|
|
605
|
+
interface PolyDodecahedronProps extends ShapeMeshProps, DodecahedronPolygonsOptions {
|
|
606
|
+
}
|
|
607
|
+
declare function PolyDodecahedron({ size, color, ...meshProps }: PolyDodecahedronProps): react_jsx_runtime.JSX.Element;
|
|
608
|
+
interface PolySphereProps extends ShapeMeshProps, SpherePolygonsOptions {
|
|
609
|
+
}
|
|
610
|
+
declare function PolySphere({ radius, subdivisions, color, ...meshProps }: PolySphereProps): react_jsx_runtime.JSX.Element;
|
|
611
|
+
interface PolyCylinderProps extends ShapeMeshProps, CylinderPolygonsOptions {
|
|
612
|
+
}
|
|
613
|
+
declare function PolyCylinder({ radius, radiusTop, height, radialSegments, color, ...meshProps }: PolyCylinderProps): react_jsx_runtime.JSX.Element;
|
|
614
|
+
interface PolyConeProps extends ShapeMeshProps, ConePolygonsOptions {
|
|
615
|
+
}
|
|
616
|
+
declare function PolyCone({ radius, height, radialSegments, color, ...meshProps }: PolyConeProps): react_jsx_runtime.JSX.Element;
|
|
617
|
+
interface PolyTorusProps extends ShapeMeshProps, TorusPolygonsOptions {
|
|
618
|
+
}
|
|
619
|
+
declare function PolyTorus({ radius, tube, radialSegments, tubularSegments, color, ...meshProps }: PolyTorusProps): react_jsx_runtime.JSX.Element;
|
|
514
620
|
|
|
515
621
|
interface PolyFirstPersonControlsOptions {
|
|
516
622
|
/** Master switch. When `false`, all sub-controls are inert. Default: `true`. */
|
|
@@ -577,7 +683,7 @@ interface PolyFirstPersonControlsProps extends PolyFirstPersonControlsOptions {
|
|
|
577
683
|
/** Called when pointer-lock is released (interaction ends). */
|
|
578
684
|
onInteractionEnd?: () => void;
|
|
579
685
|
}
|
|
580
|
-
declare const PolyFirstPersonControls:
|
|
686
|
+
declare const PolyFirstPersonControls: React$1.ForwardRefExoticComponent<PolyFirstPersonControlsProps & React$1.RefAttributes<PolyFirstPersonControlsHandle>>;
|
|
581
687
|
|
|
582
688
|
interface PolyControlsAnimateOptions {
|
|
583
689
|
/** Degrees per 60Hz-equivalent frame. Default 0.3 (≈ 18 deg/sec). */
|
|
@@ -775,10 +881,11 @@ interface PolyDirectionalLightHelperProps {
|
|
|
775
881
|
* PolyDirectionalLightHelper — small octahedron placed along the light's
|
|
776
882
|
* direction vector. Mirrors three.js's `DirectionalLightHelper`.
|
|
777
883
|
*
|
|
778
|
-
* `light.direction`
|
|
779
|
-
*
|
|
780
|
-
*
|
|
781
|
-
*
|
|
884
|
+
* Post-parity: both `light.direction` and `target` are in WORLD coords
|
|
885
|
+
* (`+X right, +Y forward, +Z up`), and `<PolyMesh>`'s `position` prop is
|
|
886
|
+
* also world units (the renderer applies the world→CSS axis swap +
|
|
887
|
+
* ×BASE_TILE internally). The helper just adds `dir × distance` to
|
|
888
|
+
* `target` and passes the result through.
|
|
782
889
|
*
|
|
783
890
|
* The octahedron is built at LOCAL origin once; the world position is
|
|
784
891
|
* applied via PolyMesh's `position` prop (a CSS transform on the wrapper).
|
|
@@ -789,6 +896,29 @@ declare function PolyDirectionalLightHelper({ light, target, distance, size, col
|
|
|
789
896
|
|
|
790
897
|
declare function injectPolyBaseStyles(doc?: Document): void;
|
|
791
898
|
|
|
899
|
+
interface PolyRenderSurfaceLeafCounts {
|
|
900
|
+
quad: number;
|
|
901
|
+
clippedSolid: number;
|
|
902
|
+
atlas: number;
|
|
903
|
+
stableTriangle: number;
|
|
904
|
+
}
|
|
905
|
+
interface PolyRenderStats {
|
|
906
|
+
polygonCount: number;
|
|
907
|
+
mountedPolygonLeafCount: number;
|
|
908
|
+
shadowLeafCount: number;
|
|
909
|
+
surfaceLeafCounts: PolyRenderSurfaceLeafCounts;
|
|
910
|
+
bucketCount: number;
|
|
911
|
+
}
|
|
912
|
+
interface PolyRenderStatsOptions {
|
|
913
|
+
polygonCount?: number;
|
|
914
|
+
/**
|
|
915
|
+
* Optional subtree selector for diagnostics that only want model leaves and
|
|
916
|
+
* not helpers/floors/gizmos sharing the same scene root.
|
|
917
|
+
*/
|
|
918
|
+
scopeSelector?: string;
|
|
919
|
+
}
|
|
920
|
+
declare function collectPolyRenderStats(root: ParentNode | null | undefined, optionsOrPolygonCount?: number | PolyRenderStatsOptions): PolyRenderStats;
|
|
921
|
+
|
|
792
922
|
interface UsePolyAnimationResult {
|
|
793
923
|
/** Attach to a `PolyAnimationTarget`-compatible handle when not using `root`. */
|
|
794
924
|
ref: RefObject<PolyAnimationTarget | null>;
|
|
@@ -807,4 +937,4 @@ interface UsePolyAnimationResult {
|
|
|
807
937
|
}
|
|
808
938
|
declare function usePolyAnimation(clips: PolyAnimationClip[] | undefined, controller: ParseAnimationController | undefined, root?: RefObject<PolyAnimationTarget | null> | PolyAnimationTarget | null): UsePolyAnimationResult;
|
|
809
939
|
|
|
810
|
-
export { type DOMPassthroughProps, type InteractionProps, Poly, PolyAxesHelper, type PolyAxesHelperProps,
|
|
940
|
+
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, PolyIframe, type PolyIframeProps, 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 };
|