@layoutit/polycss-react 0.2.1 → 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 +16 -13
- package/dist/index.cjs +1196 -627
- package/dist/index.d.cts +89 -31
- package/dist/index.d.ts +89 -31
- package/dist/index.js +969 -390
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
-
import React__default, { ReactNode, CSSProperties, MouseEventHandler, PointerEventHandler, FocusEventHandler, KeyboardEventHandler, RefObject, MouseEvent as MouseEvent$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 * as _layoutit_polycss_core from '@layoutit/polycss-core';
|
|
4
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';
|
|
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
|
+
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,7 +12,7 @@ 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;
|
|
@@ -117,12 +118,7 @@ interface ShadowOptions {
|
|
|
117
118
|
maxExtend?: number;
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
/**
|
|
121
|
-
* Three.js-style transform props accepted by every polycss component.
|
|
122
|
-
* In Phase 3, position/scale/rotation are accepted but not yet applied —
|
|
123
|
-
* the rendered transform comes from vertices in scene-root space.
|
|
124
|
-
* Phase 4 wires these into the matrix3d composition with parent PolyMesh.
|
|
125
|
-
*/
|
|
121
|
+
/** Three.js-style transform props accepted by every PolyCSS component. */
|
|
126
122
|
interface TransformProps {
|
|
127
123
|
position?: Vec3;
|
|
128
124
|
scale?: number | Vec3;
|
|
@@ -130,7 +126,7 @@ interface TransformProps {
|
|
|
130
126
|
}
|
|
131
127
|
/**
|
|
132
128
|
* DOM event handlers, ARIA, and style props forwarded to the rendered
|
|
133
|
-
* element
|
|
129
|
+
* element by every Poly component.
|
|
134
130
|
*
|
|
135
131
|
* This is the DOM-native pitch: polygons are real DOM nodes you can
|
|
136
132
|
* target with CSS, attach event handlers to, and inspect in DevTools.
|
|
@@ -162,7 +158,7 @@ interface DOMPassthroughProps {
|
|
|
162
158
|
* Props for the `<Poly>` component — the atomic polygon primitive.
|
|
163
159
|
*
|
|
164
160
|
* Extends TransformProps + DOMPassthroughProps with the polygon's own fields.
|
|
165
|
-
* This is the canonical
|
|
161
|
+
* This is the canonical Poly component API.
|
|
166
162
|
*/
|
|
167
163
|
interface PolyProps extends TransformProps, DOMPassthroughProps {
|
|
168
164
|
vertices: Vec3[];
|
|
@@ -243,10 +239,9 @@ interface PolySceneProps extends TransformProps {
|
|
|
243
239
|
autoCenter?: boolean;
|
|
244
240
|
/**
|
|
245
241
|
* Shadow appearance for meshes with `castShadow={true}`. Works in both
|
|
246
|
-
* lighting modes
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* DOM entirely. Defaults: `{ color: "#000000", opacity: 0.25, lift: 0.05, maxExtend: 2000 }`.
|
|
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 }`.
|
|
250
245
|
*/
|
|
251
246
|
shadow?: ShadowOptions;
|
|
252
247
|
className?: string;
|
|
@@ -426,6 +421,14 @@ interface PolyMeshProps extends TransformProps, InteractionProps {
|
|
|
426
421
|
mtl?: string;
|
|
427
422
|
/** Pre-parsed polygons. Mutually exclusive with `src`. */
|
|
428
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"];
|
|
429
432
|
/** Translate so mesh's bbox center is at local origin before applying `position`. */
|
|
430
433
|
autoCenter?: boolean;
|
|
431
434
|
/** Textured polygon lighting mode. Defaults to "baked". */
|
|
@@ -437,6 +440,15 @@ interface PolyMeshProps extends TransformProps, InteractionProps {
|
|
|
437
440
|
textureQuality?: TextureQuality;
|
|
438
441
|
/** Solid seam overscan. `"auto"` computes a fitted per-edge amount from the polygon plan. */
|
|
439
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;
|
|
440
452
|
/** Per-polygon override render, or static children mounted inside the mesh wrapper. */
|
|
441
453
|
children?: ((polygon: Polygon, index: number) => ReactNode) | ReactNode;
|
|
442
454
|
/** Loading slot — rendered while `src` is being fetched/parsed. */
|
|
@@ -450,18 +462,62 @@ interface PolyMeshProps extends TransformProps, InteractionProps {
|
|
|
450
462
|
* when both are present. */
|
|
451
463
|
meshResolution?: MeshResolution;
|
|
452
464
|
/**
|
|
453
|
-
* When `true
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
* 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`.
|
|
458
469
|
*/
|
|
459
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;
|
|
460
487
|
className?: string;
|
|
461
488
|
style?: CSSProperties;
|
|
462
489
|
}
|
|
463
490
|
declare const PolyMesh: React$1.ForwardRefExoticComponent<PolyMeshProps & React$1.RefAttributes<PolyMeshHandle>>;
|
|
464
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;
|
|
515
|
+
className?: string;
|
|
516
|
+
/** Style overrides on the wrapper div (NOT on the iframe). */
|
|
517
|
+
style?: CSSProperties;
|
|
518
|
+
}
|
|
519
|
+
declare function PolyIframe({ src, width, height, position, rotation, scale, allow, sandbox, loading, referrerPolicy, title, className, style, }: PolyIframeProps): react_jsx_runtime.JSX.Element;
|
|
520
|
+
|
|
465
521
|
interface PolyGroundProps {
|
|
466
522
|
/** Side length of the ground quad in world units. Default `6`. */
|
|
467
523
|
size?: number;
|
|
@@ -469,8 +525,8 @@ interface PolyGroundProps {
|
|
|
469
525
|
z?: number;
|
|
470
526
|
/** World-space XY center. Default `[0, 0]`. */
|
|
471
527
|
center?: [number, number];
|
|
472
|
-
/** Fill color. Default `#7d848e` — medium gray, chosen so the
|
|
473
|
-
*
|
|
528
|
+
/** Fill color. Default `#7d848e` — medium gray, chosen so the default
|
|
529
|
+
* 25% black SVG shadow has visible contrast against it. */
|
|
474
530
|
color?: string;
|
|
475
531
|
className?: string;
|
|
476
532
|
}
|
|
@@ -491,7 +547,7 @@ interface UseSceneContextResult {
|
|
|
491
547
|
* normalizePolygons → mergePolygons by default → bbox compute.
|
|
492
548
|
*
|
|
493
549
|
* Returns the processed polygons + the scene-wide axis-aligned bbox. Memoized
|
|
494
|
-
* on input identity + the few options that affect output.
|
|
550
|
+
* on input identity + the few options that affect output.
|
|
495
551
|
*/
|
|
496
552
|
declare function usePolySceneContext(polygons: Polygon[], options: UseSceneContextOptions): UseSceneContextResult;
|
|
497
553
|
|
|
@@ -512,11 +568,12 @@ declare function usePolyMaterial(options: {
|
|
|
512
568
|
}): PolyMaterial;
|
|
513
569
|
|
|
514
570
|
/**
|
|
515
|
-
* Poly — renders one polygon as
|
|
571
|
+
* Poly — renders one polygon as a render-strategy DOM leaf.
|
|
516
572
|
*
|
|
517
573
|
* Public API: `{ vertices, color?, texture?, uvs?, data? }` plus DOM
|
|
518
|
-
* passthrough props.
|
|
519
|
-
* 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.
|
|
520
577
|
*
|
|
521
578
|
* Wrapped in React.memo so parent re-renders (e.g. camera rotation updating
|
|
522
579
|
* rotY state) do not re-render stable polygon children. The shallow-equality
|
|
@@ -824,10 +881,11 @@ interface PolyDirectionalLightHelperProps {
|
|
|
824
881
|
* PolyDirectionalLightHelper — small octahedron placed along the light's
|
|
825
882
|
* direction vector. Mirrors three.js's `DirectionalLightHelper`.
|
|
826
883
|
*
|
|
827
|
-
* `light.direction`
|
|
828
|
-
*
|
|
829
|
-
*
|
|
830
|
-
*
|
|
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.
|
|
831
889
|
*
|
|
832
890
|
* The octahedron is built at LOCAL origin once; the world position is
|
|
833
891
|
* applied via PolyMesh's `position` prop (a CSS transform on the wrapper).
|
|
@@ -879,4 +937,4 @@ interface UsePolyAnimationResult {
|
|
|
879
937
|
}
|
|
880
938
|
declare function usePolyAnimation(clips: PolyAnimationClip[] | undefined, controller: ParseAnimationController | undefined, root?: RefObject<PolyAnimationTarget | null> | PolyAnimationTarget | null): UsePolyAnimationResult;
|
|
881
939
|
|
|
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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
-
import React__default, { ReactNode, CSSProperties, MouseEventHandler, PointerEventHandler, FocusEventHandler, KeyboardEventHandler, RefObject, MouseEvent as MouseEvent$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 * as _layoutit_polycss_core from '@layoutit/polycss-core';
|
|
4
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';
|
|
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
|
+
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,7 +12,7 @@ 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;
|
|
@@ -117,12 +118,7 @@ interface ShadowOptions {
|
|
|
117
118
|
maxExtend?: number;
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
/**
|
|
121
|
-
* Three.js-style transform props accepted by every polycss component.
|
|
122
|
-
* In Phase 3, position/scale/rotation are accepted but not yet applied —
|
|
123
|
-
* the rendered transform comes from vertices in scene-root space.
|
|
124
|
-
* Phase 4 wires these into the matrix3d composition with parent PolyMesh.
|
|
125
|
-
*/
|
|
121
|
+
/** Three.js-style transform props accepted by every PolyCSS component. */
|
|
126
122
|
interface TransformProps {
|
|
127
123
|
position?: Vec3;
|
|
128
124
|
scale?: number | Vec3;
|
|
@@ -130,7 +126,7 @@ interface TransformProps {
|
|
|
130
126
|
}
|
|
131
127
|
/**
|
|
132
128
|
* DOM event handlers, ARIA, and style props forwarded to the rendered
|
|
133
|
-
* element
|
|
129
|
+
* element by every Poly component.
|
|
134
130
|
*
|
|
135
131
|
* This is the DOM-native pitch: polygons are real DOM nodes you can
|
|
136
132
|
* target with CSS, attach event handlers to, and inspect in DevTools.
|
|
@@ -162,7 +158,7 @@ interface DOMPassthroughProps {
|
|
|
162
158
|
* Props for the `<Poly>` component — the atomic polygon primitive.
|
|
163
159
|
*
|
|
164
160
|
* Extends TransformProps + DOMPassthroughProps with the polygon's own fields.
|
|
165
|
-
* This is the canonical
|
|
161
|
+
* This is the canonical Poly component API.
|
|
166
162
|
*/
|
|
167
163
|
interface PolyProps extends TransformProps, DOMPassthroughProps {
|
|
168
164
|
vertices: Vec3[];
|
|
@@ -243,10 +239,9 @@ interface PolySceneProps extends TransformProps {
|
|
|
243
239
|
autoCenter?: boolean;
|
|
244
240
|
/**
|
|
245
241
|
* Shadow appearance for meshes with `castShadow={true}`. Works in both
|
|
246
|
-
* lighting modes
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* DOM entirely. Defaults: `{ color: "#000000", opacity: 0.25, lift: 0.05, maxExtend: 2000 }`.
|
|
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 }`.
|
|
250
245
|
*/
|
|
251
246
|
shadow?: ShadowOptions;
|
|
252
247
|
className?: string;
|
|
@@ -426,6 +421,14 @@ interface PolyMeshProps extends TransformProps, InteractionProps {
|
|
|
426
421
|
mtl?: string;
|
|
427
422
|
/** Pre-parsed polygons. Mutually exclusive with `src`. */
|
|
428
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"];
|
|
429
432
|
/** Translate so mesh's bbox center is at local origin before applying `position`. */
|
|
430
433
|
autoCenter?: boolean;
|
|
431
434
|
/** Textured polygon lighting mode. Defaults to "baked". */
|
|
@@ -437,6 +440,15 @@ interface PolyMeshProps extends TransformProps, InteractionProps {
|
|
|
437
440
|
textureQuality?: TextureQuality;
|
|
438
441
|
/** Solid seam overscan. `"auto"` computes a fitted per-edge amount from the polygon plan. */
|
|
439
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;
|
|
440
452
|
/** Per-polygon override render, or static children mounted inside the mesh wrapper. */
|
|
441
453
|
children?: ((polygon: Polygon, index: number) => ReactNode) | ReactNode;
|
|
442
454
|
/** Loading slot — rendered while `src` is being fetched/parsed. */
|
|
@@ -450,18 +462,62 @@ interface PolyMeshProps extends TransformProps, InteractionProps {
|
|
|
450
462
|
* when both are present. */
|
|
451
463
|
meshResolution?: MeshResolution;
|
|
452
464
|
/**
|
|
453
|
-
* When `true
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
* 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`.
|
|
458
469
|
*/
|
|
459
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;
|
|
460
487
|
className?: string;
|
|
461
488
|
style?: CSSProperties;
|
|
462
489
|
}
|
|
463
490
|
declare const PolyMesh: React$1.ForwardRefExoticComponent<PolyMeshProps & React$1.RefAttributes<PolyMeshHandle>>;
|
|
464
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;
|
|
515
|
+
className?: string;
|
|
516
|
+
/** Style overrides on the wrapper div (NOT on the iframe). */
|
|
517
|
+
style?: CSSProperties;
|
|
518
|
+
}
|
|
519
|
+
declare function PolyIframe({ src, width, height, position, rotation, scale, allow, sandbox, loading, referrerPolicy, title, className, style, }: PolyIframeProps): react_jsx_runtime.JSX.Element;
|
|
520
|
+
|
|
465
521
|
interface PolyGroundProps {
|
|
466
522
|
/** Side length of the ground quad in world units. Default `6`. */
|
|
467
523
|
size?: number;
|
|
@@ -469,8 +525,8 @@ interface PolyGroundProps {
|
|
|
469
525
|
z?: number;
|
|
470
526
|
/** World-space XY center. Default `[0, 0]`. */
|
|
471
527
|
center?: [number, number];
|
|
472
|
-
/** Fill color. Default `#7d848e` — medium gray, chosen so the
|
|
473
|
-
*
|
|
528
|
+
/** Fill color. Default `#7d848e` — medium gray, chosen so the default
|
|
529
|
+
* 25% black SVG shadow has visible contrast against it. */
|
|
474
530
|
color?: string;
|
|
475
531
|
className?: string;
|
|
476
532
|
}
|
|
@@ -491,7 +547,7 @@ interface UseSceneContextResult {
|
|
|
491
547
|
* normalizePolygons → mergePolygons by default → bbox compute.
|
|
492
548
|
*
|
|
493
549
|
* Returns the processed polygons + the scene-wide axis-aligned bbox. Memoized
|
|
494
|
-
* on input identity + the few options that affect output.
|
|
550
|
+
* on input identity + the few options that affect output.
|
|
495
551
|
*/
|
|
496
552
|
declare function usePolySceneContext(polygons: Polygon[], options: UseSceneContextOptions): UseSceneContextResult;
|
|
497
553
|
|
|
@@ -512,11 +568,12 @@ declare function usePolyMaterial(options: {
|
|
|
512
568
|
}): PolyMaterial;
|
|
513
569
|
|
|
514
570
|
/**
|
|
515
|
-
* Poly — renders one polygon as
|
|
571
|
+
* Poly — renders one polygon as a render-strategy DOM leaf.
|
|
516
572
|
*
|
|
517
573
|
* Public API: `{ vertices, color?, texture?, uvs?, data? }` plus DOM
|
|
518
|
-
* passthrough props.
|
|
519
|
-
* 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.
|
|
520
577
|
*
|
|
521
578
|
* Wrapped in React.memo so parent re-renders (e.g. camera rotation updating
|
|
522
579
|
* rotY state) do not re-render stable polygon children. The shallow-equality
|
|
@@ -824,10 +881,11 @@ interface PolyDirectionalLightHelperProps {
|
|
|
824
881
|
* PolyDirectionalLightHelper — small octahedron placed along the light's
|
|
825
882
|
* direction vector. Mirrors three.js's `DirectionalLightHelper`.
|
|
826
883
|
*
|
|
827
|
-
* `light.direction`
|
|
828
|
-
*
|
|
829
|
-
*
|
|
830
|
-
*
|
|
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.
|
|
831
889
|
*
|
|
832
890
|
* The octahedron is built at LOCAL origin once; the world position is
|
|
833
891
|
* applied via PolyMesh's `position` prop (a CSS transform on the wrapper).
|
|
@@ -879,4 +937,4 @@ interface UsePolyAnimationResult {
|
|
|
879
937
|
}
|
|
880
938
|
declare function usePolyAnimation(clips: PolyAnimationClip[] | undefined, controller: ParseAnimationController | undefined, root?: RefObject<PolyAnimationTarget | null> | PolyAnimationTarget | null): UsePolyAnimationResult;
|
|
881
939
|
|
|
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 };
|
|
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 };
|