three-low-poly 0.9.19 → 0.9.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +10 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +150 -21
- package/dist/index.es.js +2542 -1691
- package/dist/index.es.js.map +1 -1
- package/dist/index.iife.js +10 -10
- package/dist/index.iife.js.map +1 -1
- package/dist/index.umd.js +10 -10
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/uv-grid.jpg +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { MeshLambertMaterial } from 'three';
|
|
|
12
12
|
import { MeshPhongMaterial } from 'three';
|
|
13
13
|
import { MeshPhysicalMaterial } from 'three';
|
|
14
14
|
import { MeshStandardMaterial } from 'three';
|
|
15
|
+
import { Object3D } from 'three';
|
|
15
16
|
import { ParametricGeometry } from 'three-stdlib';
|
|
16
17
|
import { PerspectiveCamera } from 'three';
|
|
17
18
|
import { ShaderMaterial } from 'three';
|
|
@@ -46,6 +47,37 @@ export declare function addWaterDisplacement<T extends Material>(material: T, {
|
|
|
46
47
|
waveAmplitude?: number | undefined;
|
|
47
48
|
}): void;
|
|
48
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Align a BufferGeometry to a surface by adjusting its vertices.
|
|
52
|
+
*/
|
|
53
|
+
export declare function alignBufferGeometryToSurface(geometry: BufferGeometry, targetPositionY: number): void;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Align a specific instance in an InstancedMesh to a surface.
|
|
57
|
+
*/
|
|
58
|
+
export declare function alignInstancedMeshIndexToSurface(instancedMesh: InstancedMesh, targetPosition: Vector3, instanceIndex: number, offset?: Vector3): void;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Align an InstancedMesh to a surface.
|
|
62
|
+
*/
|
|
63
|
+
export declare function alignInstancedMeshToSurface(instancedMesh: InstancedMesh, targetPosition: Vector3, offset?: Vector3): void;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Align an Object3D to a surface by adjusting its position.
|
|
67
|
+
*/
|
|
68
|
+
export declare function alignObjectToSurface(object: Object3D, targetPosition: Vector3, offset?: Vector3): void;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Aligns an array of Object3D objects (or subclasses) to a specified side
|
|
72
|
+
* (left, right, top, bottom, front, or back) based on their world-space bounding boxes.
|
|
73
|
+
*/
|
|
74
|
+
export declare function alignToEdge<T extends Object3D>(objects: T[], side: BoxSide): void;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Aligns an array of `Object3D` objects along a specified direction with optional spacing.
|
|
78
|
+
*/
|
|
79
|
+
export declare function alignToRow<T extends Object3D>(objects: T[], direction?: Vector3, spacing?: number): void;
|
|
80
|
+
|
|
49
81
|
/**
|
|
50
82
|
* Generates spherical curve profile points, for use with geometry.
|
|
51
83
|
* Enables connective geometry via holes at the top and bottom of the sphere.
|
|
@@ -391,6 +423,15 @@ export declare class BookshelfGeometry extends BufferGeometry {
|
|
|
391
423
|
});
|
|
392
424
|
}
|
|
393
425
|
|
|
426
|
+
export declare enum BoxSide {
|
|
427
|
+
LEFT = "left",
|
|
428
|
+
RIGHT = "right",
|
|
429
|
+
TOP = "top",
|
|
430
|
+
BOTTOM = "bottom",
|
|
431
|
+
FRONT = "front",
|
|
432
|
+
BACK = "back"
|
|
433
|
+
}
|
|
434
|
+
|
|
394
435
|
export declare class BubblingEffect extends InstancedMesh {
|
|
395
436
|
private bubblePositions;
|
|
396
437
|
private velocities;
|
|
@@ -635,34 +676,41 @@ export declare const cartesianToSpherical: (x: number, y: number, z: number) =>
|
|
|
635
676
|
phi: number;
|
|
636
677
|
};
|
|
637
678
|
|
|
638
|
-
export declare
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* Centers the given mesh at the origin (0, 0, 0) of the scene by adjusting its position.
|
|
646
|
-
* The mesh is moved so that its bounding box center is placed at the origin.
|
|
647
|
-
*/
|
|
648
|
-
export declare function centerMesh<T extends Mesh>(mesh: T): void;
|
|
679
|
+
export declare const Center: {
|
|
680
|
+
object: typeof centerObject;
|
|
681
|
+
objectGeometry: typeof centerObjectGeometry;
|
|
682
|
+
meshGeometry: typeof centerMeshGeometry;
|
|
683
|
+
};
|
|
649
684
|
|
|
650
685
|
/**
|
|
651
|
-
* Centers a Mesh
|
|
686
|
+
* Centers the geometry of a `Mesh` relative to a target position with an optional offset.
|
|
687
|
+
*
|
|
688
|
+
* This function calculates the bounding box center of the `Mesh` geometry and adjusts its
|
|
689
|
+
* position by translating the geometry such that it is centered at the specified target
|
|
690
|
+
* position, with an optional offset applied. The function modifies the geometry directly,
|
|
691
|
+
* leaving the `Mesh`'s transformation properties (`position`, `rotation`, `scale`) unchanged.
|
|
652
692
|
*/
|
|
653
|
-
export declare function
|
|
693
|
+
export declare function centerMeshGeometry<T extends Mesh>(mesh: T, target?: Vector3, offset?: Vector3): void;
|
|
654
694
|
|
|
655
695
|
/**
|
|
656
|
-
* Centers
|
|
657
|
-
*
|
|
658
|
-
*
|
|
696
|
+
* Centers an `Object3D` relative to a specified target position with an optional offset.
|
|
697
|
+
*
|
|
698
|
+
* This function calculates the bounding box center of the given `Object3D` and adjusts
|
|
699
|
+
* its position so that it is centered at the specified target position, with an optional
|
|
700
|
+
* offset applied. The centering respects the object's current transformation, including
|
|
701
|
+
* its scale and rotation.
|
|
659
702
|
*/
|
|
660
|
-
export declare function
|
|
703
|
+
export declare function centerObject<T extends Object3D>(object: T, target?: Vector3, offset?: Vector3): void;
|
|
661
704
|
|
|
662
705
|
/**
|
|
663
|
-
* Centers the geometry of
|
|
706
|
+
* Centers the geometry of an `Object3D` relative to a target position with an optional offset.
|
|
707
|
+
*
|
|
708
|
+
* This function calculates the bounding box center of the given `Object3D` and adjusts its
|
|
709
|
+
* geometry's position by translating it such that the geometry is centered at the specified
|
|
710
|
+
* target position, with an optional offset applied. Unlike modifying the `position` property,
|
|
711
|
+
* this function directly translates the geometry within the object's local space.
|
|
664
712
|
*/
|
|
665
|
-
export declare function
|
|
713
|
+
export declare function centerObjectGeometry<T extends Object3D>(object: T, target?: Vector3, offset?: Vector3): void;
|
|
666
714
|
|
|
667
715
|
/**
|
|
668
716
|
* Create a checkerboard texture
|
|
@@ -687,8 +735,9 @@ export declare const ColorPalette: {
|
|
|
687
735
|
CHERRY_RED: number;
|
|
688
736
|
CRIMSON: number;
|
|
689
737
|
ALIZARIN_CRIMSON: number;
|
|
690
|
-
RUST: number;
|
|
691
738
|
DARK_RED: number;
|
|
739
|
+
RUST: number;
|
|
740
|
+
CORAL_ORANGE: number;
|
|
692
741
|
TANGERINE: number;
|
|
693
742
|
ORANGE_PEEL: number;
|
|
694
743
|
CADMIUM_ORANGE: number;
|
|
@@ -708,6 +757,7 @@ export declare const ColorPalette: {
|
|
|
708
757
|
MINT_GREEN: number;
|
|
709
758
|
AQUAMARINE: number;
|
|
710
759
|
PHTHALO_BLUE: number;
|
|
760
|
+
AETHER_BLUE: number;
|
|
711
761
|
SKY_BLUE: number;
|
|
712
762
|
CERULEAN_BLUE: number;
|
|
713
763
|
AZURE: number;
|
|
@@ -808,6 +858,25 @@ export declare const createDampedCurvePoints: (start: Vector2, end: Vector2, dam
|
|
|
808
858
|
*/
|
|
809
859
|
export declare const createExponentialCurvePoints: (start: Vector2, end: Vector2, base: number, factor: number, segments?: number) => Vector2[];
|
|
810
860
|
|
|
861
|
+
/**
|
|
862
|
+
* Hexagonal tile pattern factory.
|
|
863
|
+
*
|
|
864
|
+
* Example usage:
|
|
865
|
+
* ```ts
|
|
866
|
+
* const hexTile = createHexagonalTile({
|
|
867
|
+
* width: 10,
|
|
868
|
+
* depth: 10,
|
|
869
|
+
* height: 0.01,
|
|
870
|
+
* radius: 0.1,
|
|
871
|
+
* gap: 0.01,
|
|
872
|
+
* material: new THREE.MeshStandardMaterial({ color: ColorPalette.White }),
|
|
873
|
+
* });
|
|
874
|
+
*
|
|
875
|
+
* scene.add(hexTile);
|
|
876
|
+
* ```
|
|
877
|
+
*/
|
|
878
|
+
export declare function createHexagonalTile(options: HexagonalTileOptions): InstancedMesh;
|
|
879
|
+
|
|
811
880
|
/**
|
|
812
881
|
* Function to create logarithmic curve points
|
|
813
882
|
*
|
|
@@ -1051,8 +1120,41 @@ export declare class DeskGeometry extends BufferGeometry {
|
|
|
1051
1120
|
constructor();
|
|
1052
1121
|
}
|
|
1053
1122
|
|
|
1123
|
+
/**
|
|
1124
|
+
* A diorama with a floor and walls.
|
|
1125
|
+
*
|
|
1126
|
+
* Material indices:
|
|
1127
|
+
* 0: Interior walls
|
|
1128
|
+
* 1: Floor
|
|
1129
|
+
* 2: Exterior walls
|
|
1130
|
+
*/
|
|
1131
|
+
export declare class Diorama extends Mesh<DioramaGeometry, MeshStandardMaterial[]> {
|
|
1132
|
+
constructor({ width, height, depth, wallThickness, interiorColor, floorColor, exteriorColor, }?: {
|
|
1133
|
+
width?: number | undefined;
|
|
1134
|
+
height?: number | undefined;
|
|
1135
|
+
depth?: number | undefined;
|
|
1136
|
+
wallThickness?: number | undefined;
|
|
1137
|
+
interiorColor?: number | undefined;
|
|
1138
|
+
floorColor?: number | undefined;
|
|
1139
|
+
exteriorColor?: number | undefined;
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* Geometry for a diorama with a floor and walls.
|
|
1145
|
+
*
|
|
1146
|
+
* Group indices:
|
|
1147
|
+
* 0: Interior walls
|
|
1148
|
+
* 1: Floor
|
|
1149
|
+
* 2: Exterior walls
|
|
1150
|
+
*/
|
|
1054
1151
|
export declare class DioramaGeometry extends BufferGeometry {
|
|
1055
|
-
constructor(width
|
|
1152
|
+
constructor({ width, height, depth, wallThickness }?: {
|
|
1153
|
+
width?: number | undefined;
|
|
1154
|
+
height?: number | undefined;
|
|
1155
|
+
depth?: number | undefined;
|
|
1156
|
+
wallThickness?: number | undefined;
|
|
1157
|
+
});
|
|
1056
1158
|
}
|
|
1057
1159
|
|
|
1058
1160
|
/**
|
|
@@ -1285,6 +1387,17 @@ export declare function findClosestColor(inputColor: number, dataset: number[]):
|
|
|
1285
1387
|
|
|
1286
1388
|
export declare function findClosestColorChannelWise(inputColor: number, dataset: number[]): number | null;
|
|
1287
1389
|
|
|
1390
|
+
/**
|
|
1391
|
+
* Get the closest point on a mesh to a specified point.
|
|
1392
|
+
*
|
|
1393
|
+
* Example usage:
|
|
1394
|
+
* ```ts
|
|
1395
|
+
* const point = new Vector3(5, 2, 1); // The point to check against the mesh
|
|
1396
|
+
* const closestPoint = getClosestPointOnMesh(point, targetMesh);
|
|
1397
|
+
* ```
|
|
1398
|
+
*/
|
|
1399
|
+
export declare function findClosestPoint(point: Vector3, mesh: Mesh): Vector3;
|
|
1400
|
+
|
|
1288
1401
|
export declare class Flame extends Mesh<FlameGeometry, MeshStandardMaterial> {
|
|
1289
1402
|
constructor({ height, radius, segmentsU, segmentsV }?: {
|
|
1290
1403
|
height?: number | undefined;
|
|
@@ -1344,6 +1457,15 @@ export declare class HeartShape extends Shape {
|
|
|
1344
1457
|
constructor(size?: number, width?: number, height?: number, tipDepth?: number);
|
|
1345
1458
|
}
|
|
1346
1459
|
|
|
1460
|
+
export declare interface HexagonalTileOptions {
|
|
1461
|
+
width: number;
|
|
1462
|
+
depth: number;
|
|
1463
|
+
height: number;
|
|
1464
|
+
radius: number;
|
|
1465
|
+
gap: number;
|
|
1466
|
+
material?: Material;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1347
1469
|
export declare function hexToHsl(hex: number): [number, number, number];
|
|
1348
1470
|
|
|
1349
1471
|
/**
|
|
@@ -1851,6 +1973,13 @@ export declare interface PanelOptions {
|
|
|
1851
1973
|
|
|
1852
1974
|
export declare const parabolicCurve: (t: number, a?: number, b?: number, c?: number) => number;
|
|
1853
1975
|
|
|
1976
|
+
/**
|
|
1977
|
+
* Prismatic parallelogram, with horizontal skew (offset in X for the slant).
|
|
1978
|
+
*/
|
|
1979
|
+
export declare class ParallelogramBoxGeometry extends BufferGeometry {
|
|
1980
|
+
constructor(width?: number, height?: number, depth?: number, angle?: number);
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1854
1983
|
export declare const ParametricCurve: {
|
|
1855
1984
|
CUBIC: (t: number, p0: number, p1: number, p2: number, p3: number) => number;
|
|
1856
1985
|
DAMPED: (t: number, damping?: number) => number;
|