@layoutit/polycss-react 0.2.5 → 0.2.7
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 +1 -2
- package/dist/index.cjs +813 -195
- package/dist/index.d.cts +150 -5
- package/dist/index.d.ts +150 -5
- package/dist/index.js +732 -103
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -2,8 +2,8 @@ import * as React$1 from 'react';
|
|
|
2
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
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, PolyMeshTransformInput, PolyRenderStrategiesOption, PolyRenderStrategy, PolySceneTransformInput, 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, buildPolyMeshTransform, buildPolySceneTransform, 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,
|
|
5
|
+
import { Vec3, CameraState, CameraHandle, PolyCameraProjection, PolyTextureImageSource, PolyTexturePresentation, Vec2, PolyMaterial, PolyDirectionalLight, PolyTextureLightingMode, TextureQuality, PolyTextureLeafSizing, PolyTextureImageRendering, PolyTextureBackend, PolyTextureProjection, Polygon, PolyPointLight, 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, PolyCameraProjection, PolyCameraSnapshot, PolyCameraSnapshotOptions, PolyCameraSnapshotSource, PolyDirectionalLight, PolyMaterial, PolyMeshTransformInput, PolyRenderStrategiesOption, PolyRenderStrategy, PolySceneTransformInput, PolyTextureBackend, PolyTextureImageLighting, PolyTextureImageRendering, PolyTextureImageSource, PolyTextureLeafSizing, PolyTextureLightingMode, PolyTexturePresentation, PolyTextureProjection, 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, buildPolyCameraSceneTransform, buildPolyMeshTransform, buildPolySceneTransform, buildSceneContext, cameraCullNormalGroups, cameraCullNormalGroupsFromPolygons, cameraCullNormalKey, cameraCullVisibleSignature, cameraFacingDepth, capturePolyCameraSnapshot, clampChannel, computeSceneBbox, computeShapeLighting, computeTexturePaintMetrics, conePolygons, coverPlanarPolygons, createIsometricCamera, createPolyAnimationMixer, cssDistanceToWorld, cssPositionToWorld, 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, polyCameraTargetToCss, polyCssDistanceToWorld, polyCssPositionToWorld, polygonCssSurfaceNormal, polygonFaces, polygonFacesCamera, repairMeshSeams, resolvePolyCameraAppliedPerspectiveStyle, ringPolygons, rotateVec3, seamFacetSplitPolygons, seamFacetSplitReport, seamOverlapDiagnostics, seamOverlapPolygons, seamOverlapReport, shadeColor, simplifyTriangleMeshPolygons, tetrahedronPolygons, torusPolygons, worldDirectionToCss, worldDirectionToPolyCss, worldDirectionalLightToCss, worldDirectionalLightToPolyCss, worldDistanceToCss, worldDistanceToPolyCss, worldPositionToCss, worldPositionToPolyCss } from '@layoutit/polycss-core';
|
|
7
7
|
|
|
8
8
|
interface PolyPerspectiveCameraProps {
|
|
9
9
|
zoom?: number;
|
|
@@ -63,6 +63,8 @@ interface UseCameraOptions {
|
|
|
63
63
|
rotX?: number;
|
|
64
64
|
rotY?: number;
|
|
65
65
|
distance?: number;
|
|
66
|
+
projection?: PolyCameraProjection;
|
|
67
|
+
perspectiveStyle?: string;
|
|
66
68
|
}
|
|
67
69
|
interface UseCameraResult {
|
|
68
70
|
store: SceneStore;
|
|
@@ -116,6 +118,32 @@ interface ShadowOptions {
|
|
|
116
118
|
* disable the cap entirely.
|
|
117
119
|
*/
|
|
118
120
|
maxExtend?: number;
|
|
121
|
+
/**
|
|
122
|
+
* Cast a low-resolution parametric silhouette per caster instead of its full
|
|
123
|
+
* geometry — lighter DOM + cheaper projection at the cost of an approximate
|
|
124
|
+
* outline. Casts onto every receiver through the normal pipeline. Default:
|
|
125
|
+
* `false`. (Directional + point lights; the exact path stays the default.)
|
|
126
|
+
*/
|
|
127
|
+
parametric?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Parametric-shadow detail (max silhouette points / pixel-grid resolution).
|
|
130
|
+
* Only used when `parametric` is true. Default: `16`. Override per mesh via
|
|
131
|
+
* `<PolyMesh shadowDefinition>`.
|
|
132
|
+
*/
|
|
133
|
+
definition?: number;
|
|
134
|
+
/**
|
|
135
|
+
* Parametric render style: `"vector"` (smooth contour, default) or `"pixel"`
|
|
136
|
+
* (greedy-meshed voxel blocks; `definition` becomes the grid resolution).
|
|
137
|
+
*/
|
|
138
|
+
style?: "vector" | "pixel";
|
|
139
|
+
/**
|
|
140
|
+
* Re-emit a caster's shadow while it animates (deforms) so the shadow follows
|
|
141
|
+
* the pose instead of freezing. Default `false`: a same-topology deform keeps
|
|
142
|
+
* the last shadow pose (re-emitting every frame is expensive). Best with
|
|
143
|
+
* `parametric` — a low-res silhouette is cheap to reproject. Topology changes
|
|
144
|
+
* (different polygon count) always re-emit regardless.
|
|
145
|
+
*/
|
|
146
|
+
followAnimation?: boolean;
|
|
119
147
|
}
|
|
120
148
|
|
|
121
149
|
/** Three.js-style transform props accepted by every PolyCSS component. */
|
|
@@ -164,8 +192,11 @@ interface PolyProps extends TransformProps, DOMPassthroughProps {
|
|
|
164
192
|
vertices: Vec3[];
|
|
165
193
|
color?: string;
|
|
166
194
|
texture?: string;
|
|
195
|
+
textureImageSource?: PolyTextureImageSource;
|
|
196
|
+
texturePresentation?: PolyTexturePresentation;
|
|
167
197
|
uvs?: Vec2[];
|
|
168
198
|
data?: Record<string, string | number | boolean>;
|
|
199
|
+
doubleSided?: boolean;
|
|
169
200
|
/** Shared material. When set AND the polygon's UVs form an axis-aligned
|
|
170
201
|
* rectangle, renders via `background-image` directly — no per-polygon
|
|
171
202
|
* canvas rasterization. Falls back to the atlas path otherwise. */
|
|
@@ -176,6 +207,10 @@ interface PolyProps extends TransformProps, DOMPassthroughProps {
|
|
|
176
207
|
directionalLight?: PolyDirectionalLight;
|
|
177
208
|
textureLighting?: PolyTextureLightingMode;
|
|
178
209
|
textureQuality?: TextureQuality;
|
|
210
|
+
textureLeafSizing?: PolyTextureLeafSizing;
|
|
211
|
+
textureImageRendering?: PolyTextureImageRendering;
|
|
212
|
+
textureBackend?: PolyTextureBackend;
|
|
213
|
+
textureProjection?: PolyTextureProjection;
|
|
179
214
|
debugShowBackfaces?: boolean;
|
|
180
215
|
[key: string]: unknown;
|
|
181
216
|
};
|
|
@@ -184,6 +219,14 @@ interface PolyProps extends TransformProps, DOMPassthroughProps {
|
|
|
184
219
|
/** Atlas bitmap budget and CSS sprite size. `"auto"` (default) uses a
|
|
185
220
|
* device-appropriate memory budget and desktop/mobile sprite sizing. */
|
|
186
221
|
textureQuality?: TextureQuality;
|
|
222
|
+
/** Atlas leaf CSS primitive sizing. Defaults to scene context, then canonical. */
|
|
223
|
+
textureLeafSizing?: PolyTextureLeafSizing;
|
|
224
|
+
/** Default image filtering for atlas and direct image texture leaves. */
|
|
225
|
+
textureImageRendering?: PolyTextureImageRendering;
|
|
226
|
+
/** Default texture backend request. Defaults to scene context, then "auto". */
|
|
227
|
+
textureBackend?: PolyTextureBackend;
|
|
228
|
+
/** Default texture projection request. Defaults to scene context, then "affine". */
|
|
229
|
+
textureProjection?: PolyTextureProjection;
|
|
187
230
|
/** Pre-computed shaded base color from the parent (optional override). */
|
|
188
231
|
baseColor?: string;
|
|
189
232
|
}
|
|
@@ -210,6 +253,9 @@ interface PolySceneProps extends TransformProps {
|
|
|
210
253
|
rotY?: number;
|
|
211
254
|
zoom?: number;
|
|
212
255
|
directionalLight?: PolyDirectionalLight;
|
|
256
|
+
/** Point lights (world-space positions). Direction-only per-face Lambert,
|
|
257
|
+
* baked-mode only. */
|
|
258
|
+
pointLights?: PolyPointLight[];
|
|
213
259
|
ambientLight?: PolyAmbientLight;
|
|
214
260
|
/** Textured polygon lighting mode. Defaults to "baked". */
|
|
215
261
|
textureLighting?: PolyTextureLightingMode;
|
|
@@ -218,6 +264,14 @@ interface PolySceneProps extends TransformProps {
|
|
|
218
264
|
* desktop/mobile sprite sizing. Numeric values 0.1..1 force an explicit
|
|
219
265
|
* raster scale and the 64px sprite. */
|
|
220
266
|
textureQuality?: TextureQuality;
|
|
267
|
+
/** Atlas leaf CSS primitive sizing. Defaults to canonical browser-fast sizing. */
|
|
268
|
+
textureLeafSizing?: PolyTextureLeafSizing;
|
|
269
|
+
/** Default image filtering for atlas and direct image texture leaves. */
|
|
270
|
+
textureImageRendering?: PolyTextureImageRendering;
|
|
271
|
+
/** Default texture backend request. Defaults to "auto". */
|
|
272
|
+
textureBackend?: PolyTextureBackend;
|
|
273
|
+
/** Default texture projection request. Defaults to "affine". */
|
|
274
|
+
textureProjection?: PolyTextureProjection;
|
|
221
275
|
/** Solid seam overscan. `"auto"` computes a fitted per-edge amount from the polygon plan. */
|
|
222
276
|
seamBleed?: PolySeamBleed;
|
|
223
277
|
/**
|
|
@@ -250,7 +304,7 @@ interface PolySceneProps extends TransformProps {
|
|
|
250
304
|
debugShowLabels?: boolean;
|
|
251
305
|
debugShowBackfaces?: boolean;
|
|
252
306
|
}
|
|
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;
|
|
307
|
+
declare function PolySceneInner({ polygons: polygonsProp, centerPolygons: centerPolygonsProp, perspective: _perspective, rotX: _rotX, rotY: _rotY, zoom: _zoom, directionalLight, pointLights, ambientLight, textureLighting, textureQuality, textureLeafSizing, textureImageRendering, textureBackend, textureProjection, seamBleed, strategies, autoCenter, shadow, className, style, children, position: _position, scale: _scale, rotation: _rotation, debugShowLabels: _debugShowLabels, debugShowBackfaces, }: PolySceneProps): react_jsx_runtime.JSX.Element;
|
|
254
308
|
declare const PolyScene: React$1.MemoExoticComponent<typeof PolySceneInner>;
|
|
255
309
|
|
|
256
310
|
type UseMeshOptions = LoadMeshOptions;
|
|
@@ -331,6 +385,8 @@ interface PolyMeshHandle {
|
|
|
331
385
|
* safe to call.
|
|
332
386
|
*/
|
|
333
387
|
rebakeAtlas(): void;
|
|
388
|
+
/** Resolves when this mesh's current texture generation has usable backgrounds. */
|
|
389
|
+
whenTexturesReady(): Promise<void>;
|
|
334
390
|
/**
|
|
335
391
|
* Mutate a single polygon in place and re-render the mesh. `target` is
|
|
336
392
|
* either a polygon reference (as returned by `getPolygons()`) or its index.
|
|
@@ -438,6 +494,14 @@ interface PolyMeshProps extends TransformProps, InteractionProps {
|
|
|
438
494
|
* desktop/mobile sprite sizing. Numeric values 0.1..1 force an explicit
|
|
439
495
|
* raster scale and the 64px sprite. */
|
|
440
496
|
textureQuality?: TextureQuality;
|
|
497
|
+
/** Atlas leaf CSS primitive sizing. Defaults to scene context, then canonical. */
|
|
498
|
+
textureLeafSizing?: PolyTextureLeafSizing;
|
|
499
|
+
/** Default image filtering for atlas and direct image texture leaves. */
|
|
500
|
+
textureImageRendering?: PolyTextureImageRendering;
|
|
501
|
+
/** Default texture backend request. Defaults to scene context, then "auto". */
|
|
502
|
+
textureBackend?: PolyTextureBackend;
|
|
503
|
+
/** Default texture projection request. Defaults to scene context, then "affine". */
|
|
504
|
+
textureProjection?: PolyTextureProjection;
|
|
441
505
|
/** Solid seam overscan. `"auto"` computes a fitted per-edge amount from the polygon plan. */
|
|
442
506
|
seamBleed?: PolySeamBleed;
|
|
443
507
|
/**
|
|
@@ -476,6 +540,12 @@ interface PolyMeshProps extends TransformProps, InteractionProps {
|
|
|
476
540
|
* for caster meshes — receivers handle shadow display. Defaults to `false`.
|
|
477
541
|
*/
|
|
478
542
|
receiveShadow?: boolean;
|
|
543
|
+
/**
|
|
544
|
+
* Per-mesh parametric-shadow detail, overriding the scene's
|
|
545
|
+
* `shadow.definition` for this mesh's cast/self shadow. Only used when the
|
|
546
|
+
* scene's `shadow.parametric` is true. Unset → inherit the scene definition.
|
|
547
|
+
*/
|
|
548
|
+
shadowDefinition?: number;
|
|
479
549
|
/**
|
|
480
550
|
* Apply mesh optimization (coplanar merge + interior cull) before
|
|
481
551
|
* rendering. Defaults to `true` — matches vanilla `scene.add`'s default.
|
|
@@ -580,7 +650,7 @@ declare function usePolyMaterial(options: {
|
|
|
580
650
|
* check is sound here because polygon data (vertices, color, texture) is
|
|
581
651
|
* typically created once at parse time and passed by reference.
|
|
582
652
|
*/
|
|
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;
|
|
653
|
+
declare function PolyInner({ vertices, color, texture, textureImageSource, texturePresentation, uvs, data, doubleSided, 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, textureLeafSizing: textureLeafSizingProp, textureImageRendering: textureImageRenderingProp, textureBackend: textureBackendProp, textureProjection: textureProjectionProp, baseColor: baseColorProp, ...dataAttrs }: PolyProps): react_jsx_runtime.JSX.Element | null;
|
|
584
654
|
declare const Poly: React__default.MemoExoticComponent<typeof PolyInner>;
|
|
585
655
|
|
|
586
656
|
type ShapeMeshProps = Omit<PolyMeshProps, "polygons" | "src" | "mtl">;
|
|
@@ -902,11 +972,84 @@ interface PolyRenderSurfaceLeafCounts {
|
|
|
902
972
|
atlas: number;
|
|
903
973
|
stableTriangle: number;
|
|
904
974
|
}
|
|
975
|
+
type PolyRenderLeafStrategy = keyof PolyRenderSurfaceLeafCounts;
|
|
976
|
+
interface PolyTextureReadiness {
|
|
977
|
+
ready: boolean;
|
|
978
|
+
textureLeafCount: number;
|
|
979
|
+
readyTextureLeafCount: number;
|
|
980
|
+
pendingTextureLeafCount: number;
|
|
981
|
+
atlasTextureLeafCount: number;
|
|
982
|
+
imageTextureLeafCount: number;
|
|
983
|
+
}
|
|
984
|
+
interface PolyTextureRenderStats {
|
|
985
|
+
ready: boolean;
|
|
986
|
+
leafCount: number;
|
|
987
|
+
atlasCount: number;
|
|
988
|
+
imageCount: number;
|
|
989
|
+
pendingCount: number;
|
|
990
|
+
sizingCounts: {
|
|
991
|
+
canonical: number;
|
|
992
|
+
local: number;
|
|
993
|
+
raster: number;
|
|
994
|
+
image: number;
|
|
995
|
+
unknown: number;
|
|
996
|
+
};
|
|
997
|
+
imageRenderingCounts: {
|
|
998
|
+
auto: number;
|
|
999
|
+
pixelated: number;
|
|
1000
|
+
unknown: number;
|
|
1001
|
+
};
|
|
1002
|
+
projectionCounts: {
|
|
1003
|
+
affine: number;
|
|
1004
|
+
projective: number;
|
|
1005
|
+
fallback: number;
|
|
1006
|
+
unknown: number;
|
|
1007
|
+
};
|
|
1008
|
+
minLeafWidth: number;
|
|
1009
|
+
maxLeafWidth: number;
|
|
1010
|
+
minLeafHeight: number;
|
|
1011
|
+
maxLeafHeight: number;
|
|
1012
|
+
doubleSidedCount: number;
|
|
1013
|
+
}
|
|
1014
|
+
interface PolySnapshotRenderStats {
|
|
1015
|
+
runtimeAtlasUrlCount: number;
|
|
1016
|
+
snapshotAtlasCount: number;
|
|
1017
|
+
snapshotBackgroundCount: number;
|
|
1018
|
+
selfContained: boolean;
|
|
1019
|
+
}
|
|
1020
|
+
interface PolyCameraSnapshotStats {
|
|
1021
|
+
rootFound: boolean;
|
|
1022
|
+
projection: "orthographic" | "perspective" | "unknown";
|
|
1023
|
+
perspectiveStyle: string;
|
|
1024
|
+
appliedPerspectiveStyle: string;
|
|
1025
|
+
zoom?: number;
|
|
1026
|
+
distance?: number;
|
|
1027
|
+
rotX?: number;
|
|
1028
|
+
rotY?: number;
|
|
1029
|
+
target?: [number, number, number];
|
|
1030
|
+
}
|
|
1031
|
+
interface PolyLeafInfo {
|
|
1032
|
+
element: HTMLElement;
|
|
1033
|
+
strategy: PolyRenderLeafStrategy;
|
|
1034
|
+
polygonIndex?: number;
|
|
1035
|
+
textureBackend?: string;
|
|
1036
|
+
textureReady?: boolean;
|
|
1037
|
+
textureLeafSizing?: string;
|
|
1038
|
+
textureImageRendering?: string;
|
|
1039
|
+
textureProjection?: string;
|
|
1040
|
+
textureLeafWidth?: number;
|
|
1041
|
+
textureLeafHeight?: number;
|
|
1042
|
+
doubleSided?: boolean;
|
|
1043
|
+
}
|
|
905
1044
|
interface PolyRenderStats {
|
|
906
1045
|
polygonCount: number;
|
|
907
1046
|
mountedPolygonLeafCount: number;
|
|
908
1047
|
shadowLeafCount: number;
|
|
909
1048
|
surfaceLeafCounts: PolyRenderSurfaceLeafCounts;
|
|
1049
|
+
textureReadiness: PolyTextureReadiness;
|
|
1050
|
+
textureStats: PolyTextureRenderStats;
|
|
1051
|
+
snapshotStats: PolySnapshotRenderStats;
|
|
1052
|
+
cameraStats: PolyCameraSnapshotStats;
|
|
910
1053
|
bucketCount: number;
|
|
911
1054
|
}
|
|
912
1055
|
interface PolyRenderStatsOptions {
|
|
@@ -917,6 +1060,8 @@ interface PolyRenderStatsOptions {
|
|
|
917
1060
|
*/
|
|
918
1061
|
scopeSelector?: string;
|
|
919
1062
|
}
|
|
1063
|
+
declare function queryPolyLeaves(root: ParentNode | null | undefined, optionsOrPolygonCount?: number | PolyRenderStatsOptions): PolyLeafInfo[];
|
|
1064
|
+
declare function collectPolyTextureReadiness(root: ParentNode | null | undefined, optionsOrPolygonCount?: number | PolyRenderStatsOptions): PolyTextureReadiness;
|
|
920
1065
|
declare function collectPolyRenderStats(root: ParentNode | null | undefined, optionsOrPolygonCount?: number | PolyRenderStatsOptions): PolyRenderStats;
|
|
921
1066
|
|
|
922
1067
|
interface UsePolyAnimationResult {
|
|
@@ -937,4 +1082,4 @@ interface UsePolyAnimationResult {
|
|
|
937
1082
|
}
|
|
938
1083
|
declare function usePolyAnimation(clips: PolyAnimationClip[] | undefined, controller: ParseAnimationController | undefined, root?: RefObject<PolyAnimationTarget | null> | PolyAnimationTarget | null): UsePolyAnimationResult;
|
|
939
1084
|
|
|
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 };
|
|
1085
|
+
export { type DOMPassthroughProps, type InteractionProps, Poly, PolyAxesHelper, type PolyAxesHelperProps, PolyBox, type PolyBoxProps, PolyOrthographicCamera as PolyCamera, PolyCameraContext, type PolyCameraContextValue, type PolyOrthographicCameraProps as PolyCameraProps, type PolyCameraSnapshotStats, 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, type PolyLeafInfo, 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 PolyRenderLeafStrategy, type PolyRenderStats, type PolyRenderStatsOptions, type PolyRenderSurfaceLeafCounts, PolyRing, type PolyRingProps, PolyScene, type PolySceneProps, PolySelect, type PolySelectProps, type PolySelectionApi, type PolySnapshotRenderStats, PolySphere, type PolySphereProps, PolyTetrahedron, type PolyTetrahedronProps, type PolyTextureReadiness, type PolyTextureRenderStats, 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, collectPolyTextureReadiness, findMeshUnderPoint, findPolyMeshHandle, injectPolyBaseStyles, pointInMeshElement, queryPolyLeaves, useCameraContext, usePolyAnimation, usePolyCamera, usePolyMaterial, usePolyMesh, usePolySceneContext, usePolySelect, usePolySelectionApi };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import * as React$1 from 'react';
|
|
|
2
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
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, PolyMeshTransformInput, PolyRenderStrategiesOption, PolyRenderStrategy, PolySceneTransformInput, 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, buildPolyMeshTransform, buildPolySceneTransform, 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,
|
|
5
|
+
import { Vec3, CameraState, CameraHandle, PolyCameraProjection, PolyTextureImageSource, PolyTexturePresentation, Vec2, PolyMaterial, PolyDirectionalLight, PolyTextureLightingMode, TextureQuality, PolyTextureLeafSizing, PolyTextureImageRendering, PolyTextureBackend, PolyTextureProjection, Polygon, PolyPointLight, 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, PolyCameraProjection, PolyCameraSnapshot, PolyCameraSnapshotOptions, PolyCameraSnapshotSource, PolyDirectionalLight, PolyMaterial, PolyMeshTransformInput, PolyRenderStrategiesOption, PolyRenderStrategy, PolySceneTransformInput, PolyTextureBackend, PolyTextureImageLighting, PolyTextureImageRendering, PolyTextureImageSource, PolyTextureLeafSizing, PolyTextureLightingMode, PolyTexturePresentation, PolyTextureProjection, 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, buildPolyCameraSceneTransform, buildPolyMeshTransform, buildPolySceneTransform, buildSceneContext, cameraCullNormalGroups, cameraCullNormalGroupsFromPolygons, cameraCullNormalKey, cameraCullVisibleSignature, cameraFacingDepth, capturePolyCameraSnapshot, clampChannel, computeSceneBbox, computeShapeLighting, computeTexturePaintMetrics, conePolygons, coverPlanarPolygons, createIsometricCamera, createPolyAnimationMixer, cssDistanceToWorld, cssPositionToWorld, 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, polyCameraTargetToCss, polyCssDistanceToWorld, polyCssPositionToWorld, polygonCssSurfaceNormal, polygonFaces, polygonFacesCamera, repairMeshSeams, resolvePolyCameraAppliedPerspectiveStyle, ringPolygons, rotateVec3, seamFacetSplitPolygons, seamFacetSplitReport, seamOverlapDiagnostics, seamOverlapPolygons, seamOverlapReport, shadeColor, simplifyTriangleMeshPolygons, tetrahedronPolygons, torusPolygons, worldDirectionToCss, worldDirectionToPolyCss, worldDirectionalLightToCss, worldDirectionalLightToPolyCss, worldDistanceToCss, worldDistanceToPolyCss, worldPositionToCss, worldPositionToPolyCss } from '@layoutit/polycss-core';
|
|
7
7
|
|
|
8
8
|
interface PolyPerspectiveCameraProps {
|
|
9
9
|
zoom?: number;
|
|
@@ -63,6 +63,8 @@ interface UseCameraOptions {
|
|
|
63
63
|
rotX?: number;
|
|
64
64
|
rotY?: number;
|
|
65
65
|
distance?: number;
|
|
66
|
+
projection?: PolyCameraProjection;
|
|
67
|
+
perspectiveStyle?: string;
|
|
66
68
|
}
|
|
67
69
|
interface UseCameraResult {
|
|
68
70
|
store: SceneStore;
|
|
@@ -116,6 +118,32 @@ interface ShadowOptions {
|
|
|
116
118
|
* disable the cap entirely.
|
|
117
119
|
*/
|
|
118
120
|
maxExtend?: number;
|
|
121
|
+
/**
|
|
122
|
+
* Cast a low-resolution parametric silhouette per caster instead of its full
|
|
123
|
+
* geometry — lighter DOM + cheaper projection at the cost of an approximate
|
|
124
|
+
* outline. Casts onto every receiver through the normal pipeline. Default:
|
|
125
|
+
* `false`. (Directional + point lights; the exact path stays the default.)
|
|
126
|
+
*/
|
|
127
|
+
parametric?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Parametric-shadow detail (max silhouette points / pixel-grid resolution).
|
|
130
|
+
* Only used when `parametric` is true. Default: `16`. Override per mesh via
|
|
131
|
+
* `<PolyMesh shadowDefinition>`.
|
|
132
|
+
*/
|
|
133
|
+
definition?: number;
|
|
134
|
+
/**
|
|
135
|
+
* Parametric render style: `"vector"` (smooth contour, default) or `"pixel"`
|
|
136
|
+
* (greedy-meshed voxel blocks; `definition` becomes the grid resolution).
|
|
137
|
+
*/
|
|
138
|
+
style?: "vector" | "pixel";
|
|
139
|
+
/**
|
|
140
|
+
* Re-emit a caster's shadow while it animates (deforms) so the shadow follows
|
|
141
|
+
* the pose instead of freezing. Default `false`: a same-topology deform keeps
|
|
142
|
+
* the last shadow pose (re-emitting every frame is expensive). Best with
|
|
143
|
+
* `parametric` — a low-res silhouette is cheap to reproject. Topology changes
|
|
144
|
+
* (different polygon count) always re-emit regardless.
|
|
145
|
+
*/
|
|
146
|
+
followAnimation?: boolean;
|
|
119
147
|
}
|
|
120
148
|
|
|
121
149
|
/** Three.js-style transform props accepted by every PolyCSS component. */
|
|
@@ -164,8 +192,11 @@ interface PolyProps extends TransformProps, DOMPassthroughProps {
|
|
|
164
192
|
vertices: Vec3[];
|
|
165
193
|
color?: string;
|
|
166
194
|
texture?: string;
|
|
195
|
+
textureImageSource?: PolyTextureImageSource;
|
|
196
|
+
texturePresentation?: PolyTexturePresentation;
|
|
167
197
|
uvs?: Vec2[];
|
|
168
198
|
data?: Record<string, string | number | boolean>;
|
|
199
|
+
doubleSided?: boolean;
|
|
169
200
|
/** Shared material. When set AND the polygon's UVs form an axis-aligned
|
|
170
201
|
* rectangle, renders via `background-image` directly — no per-polygon
|
|
171
202
|
* canvas rasterization. Falls back to the atlas path otherwise. */
|
|
@@ -176,6 +207,10 @@ interface PolyProps extends TransformProps, DOMPassthroughProps {
|
|
|
176
207
|
directionalLight?: PolyDirectionalLight;
|
|
177
208
|
textureLighting?: PolyTextureLightingMode;
|
|
178
209
|
textureQuality?: TextureQuality;
|
|
210
|
+
textureLeafSizing?: PolyTextureLeafSizing;
|
|
211
|
+
textureImageRendering?: PolyTextureImageRendering;
|
|
212
|
+
textureBackend?: PolyTextureBackend;
|
|
213
|
+
textureProjection?: PolyTextureProjection;
|
|
179
214
|
debugShowBackfaces?: boolean;
|
|
180
215
|
[key: string]: unknown;
|
|
181
216
|
};
|
|
@@ -184,6 +219,14 @@ interface PolyProps extends TransformProps, DOMPassthroughProps {
|
|
|
184
219
|
/** Atlas bitmap budget and CSS sprite size. `"auto"` (default) uses a
|
|
185
220
|
* device-appropriate memory budget and desktop/mobile sprite sizing. */
|
|
186
221
|
textureQuality?: TextureQuality;
|
|
222
|
+
/** Atlas leaf CSS primitive sizing. Defaults to scene context, then canonical. */
|
|
223
|
+
textureLeafSizing?: PolyTextureLeafSizing;
|
|
224
|
+
/** Default image filtering for atlas and direct image texture leaves. */
|
|
225
|
+
textureImageRendering?: PolyTextureImageRendering;
|
|
226
|
+
/** Default texture backend request. Defaults to scene context, then "auto". */
|
|
227
|
+
textureBackend?: PolyTextureBackend;
|
|
228
|
+
/** Default texture projection request. Defaults to scene context, then "affine". */
|
|
229
|
+
textureProjection?: PolyTextureProjection;
|
|
187
230
|
/** Pre-computed shaded base color from the parent (optional override). */
|
|
188
231
|
baseColor?: string;
|
|
189
232
|
}
|
|
@@ -210,6 +253,9 @@ interface PolySceneProps extends TransformProps {
|
|
|
210
253
|
rotY?: number;
|
|
211
254
|
zoom?: number;
|
|
212
255
|
directionalLight?: PolyDirectionalLight;
|
|
256
|
+
/** Point lights (world-space positions). Direction-only per-face Lambert,
|
|
257
|
+
* baked-mode only. */
|
|
258
|
+
pointLights?: PolyPointLight[];
|
|
213
259
|
ambientLight?: PolyAmbientLight;
|
|
214
260
|
/** Textured polygon lighting mode. Defaults to "baked". */
|
|
215
261
|
textureLighting?: PolyTextureLightingMode;
|
|
@@ -218,6 +264,14 @@ interface PolySceneProps extends TransformProps {
|
|
|
218
264
|
* desktop/mobile sprite sizing. Numeric values 0.1..1 force an explicit
|
|
219
265
|
* raster scale and the 64px sprite. */
|
|
220
266
|
textureQuality?: TextureQuality;
|
|
267
|
+
/** Atlas leaf CSS primitive sizing. Defaults to canonical browser-fast sizing. */
|
|
268
|
+
textureLeafSizing?: PolyTextureLeafSizing;
|
|
269
|
+
/** Default image filtering for atlas and direct image texture leaves. */
|
|
270
|
+
textureImageRendering?: PolyTextureImageRendering;
|
|
271
|
+
/** Default texture backend request. Defaults to "auto". */
|
|
272
|
+
textureBackend?: PolyTextureBackend;
|
|
273
|
+
/** Default texture projection request. Defaults to "affine". */
|
|
274
|
+
textureProjection?: PolyTextureProjection;
|
|
221
275
|
/** Solid seam overscan. `"auto"` computes a fitted per-edge amount from the polygon plan. */
|
|
222
276
|
seamBleed?: PolySeamBleed;
|
|
223
277
|
/**
|
|
@@ -250,7 +304,7 @@ interface PolySceneProps extends TransformProps {
|
|
|
250
304
|
debugShowLabels?: boolean;
|
|
251
305
|
debugShowBackfaces?: boolean;
|
|
252
306
|
}
|
|
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;
|
|
307
|
+
declare function PolySceneInner({ polygons: polygonsProp, centerPolygons: centerPolygonsProp, perspective: _perspective, rotX: _rotX, rotY: _rotY, zoom: _zoom, directionalLight, pointLights, ambientLight, textureLighting, textureQuality, textureLeafSizing, textureImageRendering, textureBackend, textureProjection, seamBleed, strategies, autoCenter, shadow, className, style, children, position: _position, scale: _scale, rotation: _rotation, debugShowLabels: _debugShowLabels, debugShowBackfaces, }: PolySceneProps): react_jsx_runtime.JSX.Element;
|
|
254
308
|
declare const PolyScene: React$1.MemoExoticComponent<typeof PolySceneInner>;
|
|
255
309
|
|
|
256
310
|
type UseMeshOptions = LoadMeshOptions;
|
|
@@ -331,6 +385,8 @@ interface PolyMeshHandle {
|
|
|
331
385
|
* safe to call.
|
|
332
386
|
*/
|
|
333
387
|
rebakeAtlas(): void;
|
|
388
|
+
/** Resolves when this mesh's current texture generation has usable backgrounds. */
|
|
389
|
+
whenTexturesReady(): Promise<void>;
|
|
334
390
|
/**
|
|
335
391
|
* Mutate a single polygon in place and re-render the mesh. `target` is
|
|
336
392
|
* either a polygon reference (as returned by `getPolygons()`) or its index.
|
|
@@ -438,6 +494,14 @@ interface PolyMeshProps extends TransformProps, InteractionProps {
|
|
|
438
494
|
* desktop/mobile sprite sizing. Numeric values 0.1..1 force an explicit
|
|
439
495
|
* raster scale and the 64px sprite. */
|
|
440
496
|
textureQuality?: TextureQuality;
|
|
497
|
+
/** Atlas leaf CSS primitive sizing. Defaults to scene context, then canonical. */
|
|
498
|
+
textureLeafSizing?: PolyTextureLeafSizing;
|
|
499
|
+
/** Default image filtering for atlas and direct image texture leaves. */
|
|
500
|
+
textureImageRendering?: PolyTextureImageRendering;
|
|
501
|
+
/** Default texture backend request. Defaults to scene context, then "auto". */
|
|
502
|
+
textureBackend?: PolyTextureBackend;
|
|
503
|
+
/** Default texture projection request. Defaults to scene context, then "affine". */
|
|
504
|
+
textureProjection?: PolyTextureProjection;
|
|
441
505
|
/** Solid seam overscan. `"auto"` computes a fitted per-edge amount from the polygon plan. */
|
|
442
506
|
seamBleed?: PolySeamBleed;
|
|
443
507
|
/**
|
|
@@ -476,6 +540,12 @@ interface PolyMeshProps extends TransformProps, InteractionProps {
|
|
|
476
540
|
* for caster meshes — receivers handle shadow display. Defaults to `false`.
|
|
477
541
|
*/
|
|
478
542
|
receiveShadow?: boolean;
|
|
543
|
+
/**
|
|
544
|
+
* Per-mesh parametric-shadow detail, overriding the scene's
|
|
545
|
+
* `shadow.definition` for this mesh's cast/self shadow. Only used when the
|
|
546
|
+
* scene's `shadow.parametric` is true. Unset → inherit the scene definition.
|
|
547
|
+
*/
|
|
548
|
+
shadowDefinition?: number;
|
|
479
549
|
/**
|
|
480
550
|
* Apply mesh optimization (coplanar merge + interior cull) before
|
|
481
551
|
* rendering. Defaults to `true` — matches vanilla `scene.add`'s default.
|
|
@@ -580,7 +650,7 @@ declare function usePolyMaterial(options: {
|
|
|
580
650
|
* check is sound here because polygon data (vertices, color, texture) is
|
|
581
651
|
* typically created once at parse time and passed by reference.
|
|
582
652
|
*/
|
|
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;
|
|
653
|
+
declare function PolyInner({ vertices, color, texture, textureImageSource, texturePresentation, uvs, data, doubleSided, 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, textureLeafSizing: textureLeafSizingProp, textureImageRendering: textureImageRenderingProp, textureBackend: textureBackendProp, textureProjection: textureProjectionProp, baseColor: baseColorProp, ...dataAttrs }: PolyProps): react_jsx_runtime.JSX.Element | null;
|
|
584
654
|
declare const Poly: React__default.MemoExoticComponent<typeof PolyInner>;
|
|
585
655
|
|
|
586
656
|
type ShapeMeshProps = Omit<PolyMeshProps, "polygons" | "src" | "mtl">;
|
|
@@ -902,11 +972,84 @@ interface PolyRenderSurfaceLeafCounts {
|
|
|
902
972
|
atlas: number;
|
|
903
973
|
stableTriangle: number;
|
|
904
974
|
}
|
|
975
|
+
type PolyRenderLeafStrategy = keyof PolyRenderSurfaceLeafCounts;
|
|
976
|
+
interface PolyTextureReadiness {
|
|
977
|
+
ready: boolean;
|
|
978
|
+
textureLeafCount: number;
|
|
979
|
+
readyTextureLeafCount: number;
|
|
980
|
+
pendingTextureLeafCount: number;
|
|
981
|
+
atlasTextureLeafCount: number;
|
|
982
|
+
imageTextureLeafCount: number;
|
|
983
|
+
}
|
|
984
|
+
interface PolyTextureRenderStats {
|
|
985
|
+
ready: boolean;
|
|
986
|
+
leafCount: number;
|
|
987
|
+
atlasCount: number;
|
|
988
|
+
imageCount: number;
|
|
989
|
+
pendingCount: number;
|
|
990
|
+
sizingCounts: {
|
|
991
|
+
canonical: number;
|
|
992
|
+
local: number;
|
|
993
|
+
raster: number;
|
|
994
|
+
image: number;
|
|
995
|
+
unknown: number;
|
|
996
|
+
};
|
|
997
|
+
imageRenderingCounts: {
|
|
998
|
+
auto: number;
|
|
999
|
+
pixelated: number;
|
|
1000
|
+
unknown: number;
|
|
1001
|
+
};
|
|
1002
|
+
projectionCounts: {
|
|
1003
|
+
affine: number;
|
|
1004
|
+
projective: number;
|
|
1005
|
+
fallback: number;
|
|
1006
|
+
unknown: number;
|
|
1007
|
+
};
|
|
1008
|
+
minLeafWidth: number;
|
|
1009
|
+
maxLeafWidth: number;
|
|
1010
|
+
minLeafHeight: number;
|
|
1011
|
+
maxLeafHeight: number;
|
|
1012
|
+
doubleSidedCount: number;
|
|
1013
|
+
}
|
|
1014
|
+
interface PolySnapshotRenderStats {
|
|
1015
|
+
runtimeAtlasUrlCount: number;
|
|
1016
|
+
snapshotAtlasCount: number;
|
|
1017
|
+
snapshotBackgroundCount: number;
|
|
1018
|
+
selfContained: boolean;
|
|
1019
|
+
}
|
|
1020
|
+
interface PolyCameraSnapshotStats {
|
|
1021
|
+
rootFound: boolean;
|
|
1022
|
+
projection: "orthographic" | "perspective" | "unknown";
|
|
1023
|
+
perspectiveStyle: string;
|
|
1024
|
+
appliedPerspectiveStyle: string;
|
|
1025
|
+
zoom?: number;
|
|
1026
|
+
distance?: number;
|
|
1027
|
+
rotX?: number;
|
|
1028
|
+
rotY?: number;
|
|
1029
|
+
target?: [number, number, number];
|
|
1030
|
+
}
|
|
1031
|
+
interface PolyLeafInfo {
|
|
1032
|
+
element: HTMLElement;
|
|
1033
|
+
strategy: PolyRenderLeafStrategy;
|
|
1034
|
+
polygonIndex?: number;
|
|
1035
|
+
textureBackend?: string;
|
|
1036
|
+
textureReady?: boolean;
|
|
1037
|
+
textureLeafSizing?: string;
|
|
1038
|
+
textureImageRendering?: string;
|
|
1039
|
+
textureProjection?: string;
|
|
1040
|
+
textureLeafWidth?: number;
|
|
1041
|
+
textureLeafHeight?: number;
|
|
1042
|
+
doubleSided?: boolean;
|
|
1043
|
+
}
|
|
905
1044
|
interface PolyRenderStats {
|
|
906
1045
|
polygonCount: number;
|
|
907
1046
|
mountedPolygonLeafCount: number;
|
|
908
1047
|
shadowLeafCount: number;
|
|
909
1048
|
surfaceLeafCounts: PolyRenderSurfaceLeafCounts;
|
|
1049
|
+
textureReadiness: PolyTextureReadiness;
|
|
1050
|
+
textureStats: PolyTextureRenderStats;
|
|
1051
|
+
snapshotStats: PolySnapshotRenderStats;
|
|
1052
|
+
cameraStats: PolyCameraSnapshotStats;
|
|
910
1053
|
bucketCount: number;
|
|
911
1054
|
}
|
|
912
1055
|
interface PolyRenderStatsOptions {
|
|
@@ -917,6 +1060,8 @@ interface PolyRenderStatsOptions {
|
|
|
917
1060
|
*/
|
|
918
1061
|
scopeSelector?: string;
|
|
919
1062
|
}
|
|
1063
|
+
declare function queryPolyLeaves(root: ParentNode | null | undefined, optionsOrPolygonCount?: number | PolyRenderStatsOptions): PolyLeafInfo[];
|
|
1064
|
+
declare function collectPolyTextureReadiness(root: ParentNode | null | undefined, optionsOrPolygonCount?: number | PolyRenderStatsOptions): PolyTextureReadiness;
|
|
920
1065
|
declare function collectPolyRenderStats(root: ParentNode | null | undefined, optionsOrPolygonCount?: number | PolyRenderStatsOptions): PolyRenderStats;
|
|
921
1066
|
|
|
922
1067
|
interface UsePolyAnimationResult {
|
|
@@ -937,4 +1082,4 @@ interface UsePolyAnimationResult {
|
|
|
937
1082
|
}
|
|
938
1083
|
declare function usePolyAnimation(clips: PolyAnimationClip[] | undefined, controller: ParseAnimationController | undefined, root?: RefObject<PolyAnimationTarget | null> | PolyAnimationTarget | null): UsePolyAnimationResult;
|
|
939
1084
|
|
|
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 };
|
|
1085
|
+
export { type DOMPassthroughProps, type InteractionProps, Poly, PolyAxesHelper, type PolyAxesHelperProps, PolyBox, type PolyBoxProps, PolyOrthographicCamera as PolyCamera, PolyCameraContext, type PolyCameraContextValue, type PolyOrthographicCameraProps as PolyCameraProps, type PolyCameraSnapshotStats, 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, type PolyLeafInfo, 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 PolyRenderLeafStrategy, type PolyRenderStats, type PolyRenderStatsOptions, type PolyRenderSurfaceLeafCounts, PolyRing, type PolyRingProps, PolyScene, type PolySceneProps, PolySelect, type PolySelectProps, type PolySelectionApi, type PolySnapshotRenderStats, PolySphere, type PolySphereProps, PolyTetrahedron, type PolyTetrahedronProps, type PolyTextureReadiness, type PolyTextureRenderStats, 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, collectPolyTextureReadiness, findMeshUnderPoint, findPolyMeshHandle, injectPolyBaseStyles, pointInMeshElement, queryPolyLeaves, useCameraContext, usePolyAnimation, usePolyCamera, usePolyMaterial, usePolyMesh, usePolySceneContext, usePolySelect, usePolySelectionApi };
|