three-low-poly 0.9.13 → 0.9.15
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 +12 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +611 -53
- package/dist/index.es.js +1895 -1496
- package/dist/index.es.js.map +1 -1
- package/dist/index.iife.js +12 -12
- package/dist/index.iife.js.map +1 -1
- package/dist/index.umd.js +12 -12
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { BoxGeometry } from 'three';
|
|
2
2
|
import { BufferGeometry } from 'three';
|
|
3
|
+
import { Camera } from 'three';
|
|
3
4
|
import { Color } from 'three';
|
|
4
5
|
import { DataTexture } from 'three';
|
|
5
6
|
import { Group } from 'three';
|
|
6
7
|
import { InstancedMesh } from 'three';
|
|
8
|
+
import { Light } from 'three';
|
|
7
9
|
import { Material } from 'three';
|
|
8
10
|
import { Mesh } from 'three';
|
|
11
|
+
import { MeshLambertMaterial } from 'three';
|
|
12
|
+
import { MeshPhongMaterial } from 'three';
|
|
13
|
+
import { MeshPhysicalMaterial } from 'three';
|
|
14
|
+
import { MeshStandardMaterial } from 'three';
|
|
15
|
+
import { PerspectiveCamera } from 'three';
|
|
9
16
|
import { ShaderMaterial } from 'three';
|
|
10
17
|
import { Shape } from 'three';
|
|
11
18
|
import { SphereGeometry } from 'three';
|
|
@@ -19,10 +26,10 @@ import { Vector3 } from 'three';
|
|
|
19
26
|
* @param {Object} options - Options for noise modification.
|
|
20
27
|
* @param {number} [options.time=0.0] - The time value for the noise function.
|
|
21
28
|
* @param {number} [options.intensity=1.0] - The intensity of the displacement.
|
|
22
|
-
* @param {Vector3} [options.
|
|
29
|
+
* @param {Vector3} [options.axis=new Vector3(1, 1, 1)] - The axis of displacement.
|
|
23
30
|
* @param {number} [options.scale=10.0] - The scale of the noise effect.
|
|
24
31
|
*/
|
|
25
|
-
export declare function addNoiseDisplacement<T extends Material>(material: T, { time, intensity,
|
|
32
|
+
export declare function addNoiseDisplacement<T extends Material>(material: T, { time, intensity, axis, scale }?: NoiseDisplacementOptions): void;
|
|
26
33
|
|
|
27
34
|
/**
|
|
28
35
|
* Utility function to add water-like vertex displacement to an existing Three.js material.
|
|
@@ -137,13 +144,132 @@ export declare class AtmosphericSkybox extends Mesh {
|
|
|
137
144
|
sunPosition(theta: number, phi: number): void;
|
|
138
145
|
}
|
|
139
146
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Geometric and mathematical role of the vectors as axes in 3D space.
|
|
149
|
+
*
|
|
150
|
+
* Example usages:
|
|
151
|
+
*
|
|
152
|
+
* Defining a geometry's up vector:
|
|
153
|
+
* ```
|
|
154
|
+
* const upVector = Axis.Z; // Set the Z-axis as the "up" direction
|
|
155
|
+
* object.up.copy(upVector);
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* Rotating or Orienting an Object
|
|
159
|
+
* ```
|
|
160
|
+
* const axis = Axis.XY; // Diagonal upward
|
|
161
|
+
* object.lookAt(object.position.clone().add(axis));
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* Rotate around axis:
|
|
165
|
+
* ```
|
|
166
|
+
* const angle = Math.PI / 4; // 45-degree rotation
|
|
167
|
+
* const rotationAxis = Axis.Y; // Rotate around the Y-axis
|
|
168
|
+
*
|
|
169
|
+
* object.rotateOnAxis(rotationAxis, angle);
|
|
170
|
+
* ```
|
|
171
|
+
*
|
|
172
|
+
* Scaling along an axis:
|
|
173
|
+
* ```
|
|
174
|
+
* const scalingAxis = Axis.XZ; // Scale equally along X and Z
|
|
175
|
+
* const scaleFactor = 2;
|
|
176
|
+
*
|
|
177
|
+
* object.scale.multiply(scalingAxis.clone().multiplyScalar(scaleFactor));
|
|
178
|
+
* ```
|
|
179
|
+
*
|
|
180
|
+
* Aligning a Camera
|
|
181
|
+
* ```
|
|
182
|
+
* const cameraAxis = Axis.XZ; // Align the camera diagonally on the XZ plane
|
|
183
|
+
*
|
|
184
|
+
* camera.lookAt(camera.position.clone().add(cameraAxis));
|
|
185
|
+
* ```
|
|
186
|
+
*
|
|
187
|
+
* Directional lighting
|
|
188
|
+
* ```
|
|
189
|
+
* const lightDirection = Axis.YZ; // Diagonal light along Y and Z axes
|
|
190
|
+
* directionalLight.position.copy(lightDirection.clone().multiplyScalar(10));
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* Aligning an Object
|
|
194
|
+
* ```
|
|
195
|
+
* const axis = Axis.X; // Align object to the X-axis
|
|
196
|
+
* object.lookAt(object.position.clone().add(axis));
|
|
197
|
+
* ```
|
|
198
|
+
*
|
|
199
|
+
* Spawning objects along an axis
|
|
200
|
+
* ```
|
|
201
|
+
* const spawnAxis = Axis.XZ; // Arrange objects diagonally on XZ
|
|
202
|
+
* const count = 10;
|
|
203
|
+
* const spacing = 5;
|
|
204
|
+
*
|
|
205
|
+
* for (let i = 0; i < count; i++) {
|
|
206
|
+
* const position = spawnAxis.clone().multiplyScalar(i * spacing);
|
|
207
|
+
* const newObject = object.clone();
|
|
208
|
+
* newObject.position.copy(position);
|
|
209
|
+
* scene.add(newObject);
|
|
210
|
+
* }
|
|
211
|
+
* ```
|
|
212
|
+
*
|
|
213
|
+
* Vector projections
|
|
214
|
+
* ```
|
|
215
|
+
* const vector = new Vector3(3, 5, 7);
|
|
216
|
+
* const projectionAxis = Axis.Z; // Project the vector onto the Z-axis
|
|
217
|
+
*
|
|
218
|
+
* const projection = vector.clone().projectOnVector(projectionAxis);
|
|
219
|
+
* ```
|
|
220
|
+
*
|
|
221
|
+
* Plane definitions
|
|
222
|
+
* ```
|
|
223
|
+
* const normal = Axis.Y; // Y-axis is the normal for a horizontal plane
|
|
224
|
+
* const distanceFromOrigin = 5;
|
|
225
|
+
*
|
|
226
|
+
* const plane = new THREE.Plane(normal, distanceFromOrigin);
|
|
227
|
+
* ```
|
|
228
|
+
*
|
|
229
|
+
* Plane intersections
|
|
230
|
+
* ```
|
|
231
|
+
* const planeNormal = Axis.Y; // Define a plane normal (horizontal plane)
|
|
232
|
+
* const plane = new THREE.Plane(planeNormal);
|
|
233
|
+
*
|
|
234
|
+
* const rayDirection = Axis.Z; // Ray pointing along Z-axis
|
|
235
|
+
* const rayOrigin = new Vector3(0, 5, 0);
|
|
236
|
+
* const ray = new THREE.Ray(rayOrigin, rayDirection);
|
|
237
|
+
*
|
|
238
|
+
* // Find intersection point
|
|
239
|
+
* const intersectionPoint = new Vector3();
|
|
240
|
+
* plane.intersectLine(new THREE.Line3(rayOrigin, rayOrigin.clone().add(rayDirection)), intersectionPoint);
|
|
241
|
+
* ```
|
|
242
|
+
*
|
|
243
|
+
* Defining bounds
|
|
244
|
+
* ```
|
|
245
|
+
* const boundsAxis = Axis.XY; // Restrict an object’s movement within XY bounds
|
|
246
|
+
* const maxBounds = 10;
|
|
247
|
+
*
|
|
248
|
+
* object.position.clamp(
|
|
249
|
+
* new Vector3(-maxBounds, -maxBounds, -Infinity),
|
|
250
|
+
* new Vector3(maxBounds, maxBounds, Infinity)
|
|
251
|
+
* );
|
|
252
|
+
* ```
|
|
253
|
+
*
|
|
254
|
+
* Procedural Geometry
|
|
255
|
+
* ```
|
|
256
|
+
* const vertex = new Vector3(0, 0, 0);
|
|
257
|
+
* const axis = Axis.XZ; // Diagonal axis on XZ plane
|
|
258
|
+
*
|
|
259
|
+
* const offset = axis.clone().multiplyScalar(5);
|
|
260
|
+
* vertex.add(offset); // Move vertex in axis
|
|
261
|
+
* geometry.vertices.push(vertex);
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
264
|
+
export declare const Axis: {
|
|
265
|
+
X: Vector3;
|
|
266
|
+
Y: Vector3;
|
|
267
|
+
Z: Vector3;
|
|
268
|
+
XY: Vector3;
|
|
269
|
+
XZ: Vector3;
|
|
270
|
+
YZ: Vector3;
|
|
271
|
+
XYZ: Vector3;
|
|
272
|
+
};
|
|
147
273
|
|
|
148
274
|
export declare class BifurcatedStaircaseGeometry extends BufferGeometry {
|
|
149
275
|
constructor(stepWidth?: number, stepHeight?: number, stepDepth?: number, numStepsCentral?: number, numStepsBranch?: number, branchAngle?: number);
|
|
@@ -212,23 +338,31 @@ export declare class Bottle extends Group {
|
|
|
212
338
|
constructor();
|
|
213
339
|
}
|
|
214
340
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
private
|
|
221
|
-
|
|
222
|
-
constructor();
|
|
341
|
+
export declare class BubblingEffect extends InstancedMesh {
|
|
342
|
+
private bubblePositions;
|
|
343
|
+
private velocities;
|
|
344
|
+
private width;
|
|
345
|
+
private height;
|
|
346
|
+
private depth;
|
|
347
|
+
constructor(options?: BubblingEffectOptions);
|
|
223
348
|
/**
|
|
224
|
-
* Updates
|
|
225
|
-
* to the bottom if they reach the top.
|
|
349
|
+
* Updates the position of a specific bubble instance in the InstancedMesh.
|
|
226
350
|
*/
|
|
227
|
-
private
|
|
351
|
+
private updateInstanceMatrix;
|
|
228
352
|
/**
|
|
229
|
-
*
|
|
353
|
+
* Updates bubble positions, moving them upward and resetting them
|
|
354
|
+
* to the bottom if they reach the top.
|
|
230
355
|
*/
|
|
231
|
-
|
|
356
|
+
update(): void;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export declare interface BubblingEffectOptions {
|
|
360
|
+
geometry?: BufferGeometry;
|
|
361
|
+
material?: Material;
|
|
362
|
+
count?: number;
|
|
363
|
+
height?: number;
|
|
364
|
+
width?: number;
|
|
365
|
+
depth?: number;
|
|
232
366
|
}
|
|
233
367
|
|
|
234
368
|
export declare class BunsenBurner extends Group {
|
|
@@ -243,6 +377,20 @@ export declare class BurstShape extends Shape {
|
|
|
243
377
|
constructor(sides?: number, innerRadius?: number, outerRadius?: number);
|
|
244
378
|
}
|
|
245
379
|
|
|
380
|
+
/**
|
|
381
|
+
* Compute normal based on the quad’s vertices (using the cross product of two edges).
|
|
382
|
+
*/
|
|
383
|
+
export declare function calculateNormal(p1: [number, number, number], p2: [number, number, number], p3: [number, number, number]): [number, number, number];
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Finding Bounds for a List of UVs
|
|
387
|
+
* calculate the min and max values dynamically.
|
|
388
|
+
*/
|
|
389
|
+
export declare function calculateUVBounds(uvs: [number, number][]): {
|
|
390
|
+
minBounds: [number, number];
|
|
391
|
+
maxBounds: [number, number];
|
|
392
|
+
};
|
|
393
|
+
|
|
246
394
|
export declare class Candle extends Group {
|
|
247
395
|
private candle;
|
|
248
396
|
private flame;
|
|
@@ -408,6 +556,59 @@ export declare const createLogarithmicCurvePoints: (start: Vector2, end: Vector2
|
|
|
408
556
|
*/
|
|
409
557
|
export declare const createParabolicCurvePoints: (start: Vector2, end: Vector2, a: number, b: number, c: number, segments?: number) => Vector2[];
|
|
410
558
|
|
|
559
|
+
/**
|
|
560
|
+
* Generates vertices for two triangles based upon a quad.
|
|
561
|
+
*
|
|
562
|
+
* Example usages:
|
|
563
|
+
*
|
|
564
|
+
* Create a face of a box:
|
|
565
|
+
* ```
|
|
566
|
+
* const frontQuad = createQuad(
|
|
567
|
+
* [-1, -1, 1], // Bottom-left
|
|
568
|
+
* [ 1, -1, 1], // Bottom-right
|
|
569
|
+
* [-1, 1, 1], // Top-left
|
|
570
|
+
* [ 1, 1, 1], // Top-right
|
|
571
|
+
* [ 0, 0, 1] // Normal (facing forward)
|
|
572
|
+
* );
|
|
573
|
+
* ```
|
|
574
|
+
*
|
|
575
|
+
* Assembling a box:
|
|
576
|
+
* ```
|
|
577
|
+
* const vertices = [
|
|
578
|
+
* ...createQuad([-1, -1, 1], [1, -1, 1], [-1, 1, 1], [1, 1, 1], [0, 0, 1]), // Front face
|
|
579
|
+
* ...createQuad([1, -1, -1], [-1, -1, -1], [1, 1, -1], [-1, 1, -1], [0, 0, -1]), // Back face
|
|
580
|
+
* ...createQuad([-1, 1, 1], [1, 1, 1], [-1, 1, -1], [1, 1, -1], [0, 1, 0]), // Top face
|
|
581
|
+
* ...createQuad([-1, -1, -1], [1, -1, -1], [-1, -1, 1], [1, -1, 1], [0, -1, 0]), // Bottom face
|
|
582
|
+
* ...createQuad([-1, -1, -1], [-1, -1, 1], [-1, 1, -1], [-1, 1, 1], [-1, 0, 0]), // Left face
|
|
583
|
+
* ...createQuad([1, -1, 1], [1, -1, -1], [1, 1, 1], [1, 1, -1], [1, 0, 0]), // Right face
|
|
584
|
+
* ];
|
|
585
|
+
* ```
|
|
586
|
+
*
|
|
587
|
+
* Generating Buffer Geometry:
|
|
588
|
+
* ```
|
|
589
|
+
* const positions = [];
|
|
590
|
+
* const normals = [];
|
|
591
|
+
* const uvs = [];
|
|
592
|
+
*
|
|
593
|
+
* for (const vertex of vertices) {
|
|
594
|
+
* positions.push(...vertex.pos);
|
|
595
|
+
* normals.push(...vertex.norm);
|
|
596
|
+
* uvs.push(...vertex.uv);
|
|
597
|
+
* }
|
|
598
|
+
*
|
|
599
|
+
* const geometry = new THREE.BufferGeometry();
|
|
600
|
+
* geometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array(positions), 3));
|
|
601
|
+
* geometry.setAttribute('normal', new THREE.BufferAttribute(new Float32Array(normals), 3));
|
|
602
|
+
* geometry.setAttribute('uv', new THREE.BufferAttribute(new Float32Array(uvs), 2));
|
|
603
|
+
* ```
|
|
604
|
+
*/
|
|
605
|
+
export declare function createQuad(p1: [number, number, number], //
|
|
606
|
+
p2: [number, number, number], p3: [number, number, number], p4: [number, number, number], normal?: [number, number, number], uv1?: [number, number], uv2?: [number, number], uv3?: [number, number], uv4?: [number, number]): {
|
|
607
|
+
pos: [number, number, number];
|
|
608
|
+
norm: [number, number, number];
|
|
609
|
+
uv: [number, number];
|
|
610
|
+
}[];
|
|
611
|
+
|
|
411
612
|
/**
|
|
412
613
|
* Function to create quadratic Bezier curve points
|
|
413
614
|
*
|
|
@@ -464,6 +665,45 @@ export declare const cubicEaseInOut: (t: number) => number;
|
|
|
464
665
|
|
|
465
666
|
export declare const cubicEaseOut: (t: number) => number;
|
|
466
667
|
|
|
668
|
+
/**
|
|
669
|
+
* Cubic UV Mapping
|
|
670
|
+
* Applies a texture by projecting UVs along each face of a cube.
|
|
671
|
+
*
|
|
672
|
+
* Example usage:
|
|
673
|
+
* ```
|
|
674
|
+
* const cubeVertices = [
|
|
675
|
+
* [-1, -1, 1],
|
|
676
|
+
* [1, -1, 1],
|
|
677
|
+
* [-1, 1, 1],
|
|
678
|
+
* [1, 1, 1],
|
|
679
|
+
* ];
|
|
680
|
+
*
|
|
681
|
+
* const cubeUVs = cubicUVMappingBatch(cubeVertices);
|
|
682
|
+
* ```
|
|
683
|
+
*/
|
|
684
|
+
export declare function cubicUVMapping(vertex: [number, number, number]): [number, number];
|
|
685
|
+
|
|
686
|
+
export declare function cubicUVMappingBatch(vertices: [number, number, number][]): [number, number][];
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Cylindrical UV Mapping
|
|
690
|
+
* Projects UV coordinates onto the surface as though the texture is
|
|
691
|
+
* wrapped around the cylinder's height and circumference.
|
|
692
|
+
*
|
|
693
|
+
* Example usage:
|
|
694
|
+
* ```
|
|
695
|
+
* const cylinderVertices = [
|
|
696
|
+
* [1, 0, 0], // Vertex on the "equator"
|
|
697
|
+
* [0, 1, 0], // Vertex on the top
|
|
698
|
+
* [0, -1, 1], // Vertex on the bottom
|
|
699
|
+
* [-1, 0, 0], // Opposite side of the equator
|
|
700
|
+
* ];
|
|
701
|
+
*
|
|
702
|
+
* const cylinderUVs = cylindricalUVMapping(cylinderVertices);
|
|
703
|
+
* ```
|
|
704
|
+
*/
|
|
705
|
+
export declare function cylindricalUVMapping(vertices: [number, number, number][]): [number, number][];
|
|
706
|
+
|
|
467
707
|
export declare const dampedCurve: (t: number, damping?: number) => number;
|
|
468
708
|
|
|
469
709
|
export declare class DaySkybox extends Mesh {
|
|
@@ -505,7 +745,13 @@ export declare interface DaySkyUniforms {
|
|
|
505
745
|
bottomColor: Uniform<Color>;
|
|
506
746
|
}
|
|
507
747
|
|
|
508
|
-
export declare class Desk extends
|
|
748
|
+
export declare class Desk extends Mesh {
|
|
749
|
+
geometry: DeskGeometry;
|
|
750
|
+
material: MeshStandardMaterial[];
|
|
751
|
+
constructor();
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
export declare class DeskGeometry extends BufferGeometry {
|
|
509
755
|
constructor();
|
|
510
756
|
}
|
|
511
757
|
|
|
@@ -514,7 +760,9 @@ export declare class DioramaGeometry extends BufferGeometry {
|
|
|
514
760
|
}
|
|
515
761
|
|
|
516
762
|
/**
|
|
517
|
-
*
|
|
763
|
+
* Movement or orientation in a specific direction.
|
|
764
|
+
*
|
|
765
|
+
* Example usages:
|
|
518
766
|
*
|
|
519
767
|
* Moving an Object Along a Direction
|
|
520
768
|
* ```
|
|
@@ -532,22 +780,6 @@ export declare class DioramaGeometry extends BufferGeometry {
|
|
|
532
780
|
* object.position.copy(targetPosition.clone().add(snapDirection.clone().multiplyScalar(10)));
|
|
533
781
|
* ```
|
|
534
782
|
*
|
|
535
|
-
* Rotating or Orienting an Object
|
|
536
|
-
* ```
|
|
537
|
-
* const targetDirection = Direction.XY; // Diagonal upward
|
|
538
|
-
* object.lookAt(object.position.clone().add(targetDirection));
|
|
539
|
-
* ```
|
|
540
|
-
*
|
|
541
|
-
* Procedural Geometry
|
|
542
|
-
* ```
|
|
543
|
-
* const vertex = new Vector3(0, 0, 0);
|
|
544
|
-
* const direction = Direction.XZ; // Diagonal direction on XZ plane
|
|
545
|
-
*
|
|
546
|
-
* const offset = direction.clone().multiplyScalar(5);
|
|
547
|
-
* vertex.add(offset); // Move vertex in direction
|
|
548
|
-
* geometry.vertices.push(vertex);
|
|
549
|
-
* ```
|
|
550
|
-
*
|
|
551
783
|
* Animating Along a Direction
|
|
552
784
|
* ```
|
|
553
785
|
* const distance = 10; // Total distance to travel
|
|
@@ -600,13 +832,6 @@ export declare const Direction: {
|
|
|
600
832
|
RIGHT: Vector3;
|
|
601
833
|
FORWARD: Vector3;
|
|
602
834
|
BACKWARD: Vector3;
|
|
603
|
-
X: Vector3;
|
|
604
|
-
Y: Vector3;
|
|
605
|
-
Z: Vector3;
|
|
606
|
-
XY: Vector3;
|
|
607
|
-
XZ: Vector3;
|
|
608
|
-
YZ: Vector3;
|
|
609
|
-
XYZ: Vector3;
|
|
610
835
|
};
|
|
611
836
|
|
|
612
837
|
/**
|
|
@@ -614,6 +839,18 @@ export declare const Direction: {
|
|
|
614
839
|
*/
|
|
615
840
|
export declare const displacementBrush: <T extends BufferGeometry>(geometry: T, position: Vector3, radius: number, strength: number, direction?: Vector3, falloffFn?: (distance: number, radius: number) => number) => void;
|
|
616
841
|
|
|
842
|
+
/**
|
|
843
|
+
* Dolly backward
|
|
844
|
+
*
|
|
845
|
+
* Example:
|
|
846
|
+
* ```
|
|
847
|
+
* dollyAnimation(camera, 5, 3000, () => {
|
|
848
|
+
* console.log("Dolly animation complete");
|
|
849
|
+
* });
|
|
850
|
+
* ```
|
|
851
|
+
*/
|
|
852
|
+
export declare function dollyAnimation(camera: Camera, distance: number, duration: number, onComplete?: () => void): void;
|
|
853
|
+
|
|
617
854
|
/**
|
|
618
855
|
* Easing functions for interpolating values over time.
|
|
619
856
|
*/
|
|
@@ -653,6 +890,49 @@ export declare class ElectricPanel extends Group {
|
|
|
653
890
|
constructor();
|
|
654
891
|
}
|
|
655
892
|
|
|
893
|
+
export declare class EllipticLeafGeometry extends BufferGeometry {
|
|
894
|
+
constructor(size?: number);
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* Emissive pulse effect, designed for flickering lights.
|
|
899
|
+
* The emissive intensity of the material will oscillate between `minIntensity` and `maxIntensity`.
|
|
900
|
+
*
|
|
901
|
+
* Use with materials that have emissive properties.
|
|
902
|
+
*
|
|
903
|
+
* Oscillation time = 2π / speed
|
|
904
|
+
* - Low speed values (e.g., 0.5) will result in a slow pulse
|
|
905
|
+
* - High speed values (e.g., 10) will result in a rapid flicker
|
|
906
|
+
*
|
|
907
|
+
* Requires `update()` frame handler with `clock.getElapsedTime()` for animation.
|
|
908
|
+
*/
|
|
909
|
+
export declare class EmissivePulseEffect {
|
|
910
|
+
speed: number;
|
|
911
|
+
maxIntensity: number;
|
|
912
|
+
minIntensity: number;
|
|
913
|
+
material: MeshStandardMaterial | MeshPhysicalMaterial | MeshLambertMaterial | MeshPhongMaterial;
|
|
914
|
+
constructor(options: EmissivePulseEffectOptions);
|
|
915
|
+
/**
|
|
916
|
+
* Update the emissive intensity of the material.
|
|
917
|
+
*
|
|
918
|
+
* Use Three.Clock getElapsedTime()
|
|
919
|
+
*
|
|
920
|
+
* Example:
|
|
921
|
+
* ```
|
|
922
|
+
* const clock = new THREE.Clock();
|
|
923
|
+
* effect.update(clock.getElapsedTime());
|
|
924
|
+
* ```
|
|
925
|
+
*/
|
|
926
|
+
update(elapsedTime?: number): void;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
export declare interface EmissivePulseEffectOptions {
|
|
930
|
+
speed?: number;
|
|
931
|
+
maxIntensity?: number;
|
|
932
|
+
minIntensity?: number;
|
|
933
|
+
material: MeshStandardMaterial | MeshPhysicalMaterial | MeshLambertMaterial | MeshPhongMaterial;
|
|
934
|
+
}
|
|
935
|
+
|
|
656
936
|
export declare class ErlenmeyerFlask extends Mesh {
|
|
657
937
|
constructor({ flaskRadius, //
|
|
658
938
|
neckRadius, height, neckHeight, radialSegments, }?: {
|
|
@@ -733,6 +1013,37 @@ export declare class Flask extends Group {
|
|
|
733
1013
|
*/
|
|
734
1014
|
export declare const flattenBrush: <T extends BufferGeometry>(geometry: T, position: Vector3, radius: number, targetHeight: number, strength: number, direction?: Vector3, falloffFn?: (distance: number, radius: number) => number) => void;
|
|
735
1015
|
|
|
1016
|
+
export declare class FlorenceFlask extends Mesh {
|
|
1017
|
+
geometry: FlorenceFlaskGeometry;
|
|
1018
|
+
material: MeshPhysicalMaterial;
|
|
1019
|
+
constructor();
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
export declare class FlorenceFlaskGeometry extends BufferGeometry {
|
|
1023
|
+
constructor();
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* The camera flies through a sequence of points, ideal for showcasing specific elements in the scene.
|
|
1028
|
+
*
|
|
1029
|
+
* Example:
|
|
1030
|
+
* ```
|
|
1031
|
+
* flythroughAnimation(
|
|
1032
|
+
* camera,
|
|
1033
|
+
* [
|
|
1034
|
+
* new THREE.Vector3(0, 5, 5),
|
|
1035
|
+
* new THREE.Vector3(0, 5, -25.5),
|
|
1036
|
+
* new THREE.Vector3(-20.5, 5, 0),
|
|
1037
|
+
* ],
|
|
1038
|
+
* 6000,
|
|
1039
|
+
* () => {
|
|
1040
|
+
* console.log("Flythrough animation complete");
|
|
1041
|
+
* }
|
|
1042
|
+
* );
|
|
1043
|
+
* ```
|
|
1044
|
+
*/
|
|
1045
|
+
export declare function flythroughAnimation(camera: Camera, waypoints: Vector3[], duration: number, onComplete?: () => void): void;
|
|
1046
|
+
|
|
736
1047
|
export declare const gaussian: (t: number) => number;
|
|
737
1048
|
|
|
738
1049
|
export declare class Gear extends Mesh {
|
|
@@ -795,10 +1106,64 @@ export declare class Lantern extends Group {
|
|
|
795
1106
|
constructor(height?: number, baseWidth?: number);
|
|
796
1107
|
}
|
|
797
1108
|
|
|
1109
|
+
export declare class LeafEffect extends InstancedMesh {
|
|
1110
|
+
private dummyMatrix;
|
|
1111
|
+
private velocities;
|
|
1112
|
+
private width;
|
|
1113
|
+
private height;
|
|
1114
|
+
private depth;
|
|
1115
|
+
constructor(options?: LeafEffectOptions);
|
|
1116
|
+
update(): void;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
export declare interface LeafEffectOptions {
|
|
1120
|
+
geometry?: BufferGeometry;
|
|
1121
|
+
material?: Material;
|
|
1122
|
+
count?: number;
|
|
1123
|
+
width?: number;
|
|
1124
|
+
height?: number;
|
|
1125
|
+
depth?: number;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
798
1128
|
export declare class LeverPanel extends Group {
|
|
799
1129
|
constructor();
|
|
800
1130
|
}
|
|
801
1131
|
|
|
1132
|
+
/**
|
|
1133
|
+
* A lightning effect that can be used to simulate a lightning storm.
|
|
1134
|
+
* This effect is applied to a light source.
|
|
1135
|
+
*
|
|
1136
|
+
* Example usage:
|
|
1137
|
+
* ```
|
|
1138
|
+
* const lightning = new THREE.DirectionalLight(0xffffff, 0);
|
|
1139
|
+
* scene.add(lightning);
|
|
1140
|
+
* lightning.position.set(5, 10, -5);
|
|
1141
|
+
*
|
|
1142
|
+
* setRandomInterval(() => {
|
|
1143
|
+
* lightningEffect.triggerLightning();
|
|
1144
|
+
* }, 250, 1250);
|
|
1145
|
+
* ```
|
|
1146
|
+
*/
|
|
1147
|
+
export declare class LightningEffect {
|
|
1148
|
+
private light?;
|
|
1149
|
+
minIntensity: number;
|
|
1150
|
+
maxIntensity: number;
|
|
1151
|
+
minDuration: number;
|
|
1152
|
+
maxDuration: number;
|
|
1153
|
+
constructor({ light, //
|
|
1154
|
+
minIntensity, maxIntensity, minDuration, maxDuration, }?: LightningEffectOptions);
|
|
1155
|
+
triggerLightning(): void;
|
|
1156
|
+
update(): void;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
declare interface LightningEffectOptions {
|
|
1160
|
+
light?: Light;
|
|
1161
|
+
minIntensity?: number;
|
|
1162
|
+
maxIntensity?: number;
|
|
1163
|
+
minDuration?: number;
|
|
1164
|
+
maxDuration?: number;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
802
1167
|
export declare const linear: (t: number) => number;
|
|
803
1168
|
|
|
804
1169
|
export declare const logarithmic: (t: number) => number;
|
|
@@ -970,10 +1335,35 @@ export declare const noiseBrush: <T extends BufferGeometry>(geometry: T, positio
|
|
|
970
1335
|
declare interface NoiseDisplacementOptions {
|
|
971
1336
|
time?: number;
|
|
972
1337
|
intensity?: number;
|
|
973
|
-
|
|
1338
|
+
axis?: Vector3;
|
|
974
1339
|
scale?: number;
|
|
975
1340
|
}
|
|
976
1341
|
|
|
1342
|
+
/**
|
|
1343
|
+
* Generic Normalization Function
|
|
1344
|
+
* This function will normalize 2D UV coordinates based on given bounds.
|
|
1345
|
+
*
|
|
1346
|
+
* Full pipeline:
|
|
1347
|
+
* - Compute UVs
|
|
1348
|
+
* - Calculate bounds
|
|
1349
|
+
* - Normalize UVs
|
|
1350
|
+
*
|
|
1351
|
+
* Example usage:
|
|
1352
|
+
* ```
|
|
1353
|
+
* const planarMapping = (vertex: [number, number, number]) => [vertex[0], vertex[1]];
|
|
1354
|
+
* const uvs = vertices.map(mappingFunction);
|
|
1355
|
+
* const { minBounds, maxBounds } = calculateUVBounds(uvs);
|
|
1356
|
+
* const normalizedUVs = normalizeUVBatch(uvs, minBounds, maxBounds);
|
|
1357
|
+
* ```
|
|
1358
|
+
*/
|
|
1359
|
+
export declare function normalizeUV(uv: [number, number], minU: number, maxU: number, minV: number, maxV: number): [number, number];
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* Batch Normalization for Multiple UVs
|
|
1363
|
+
* If you have multiple UVs, normalize them all based on the overall min/max bounds.
|
|
1364
|
+
*/
|
|
1365
|
+
export declare function normalizeUVBatch(uvs: [number, number][], minBounds: [number, number], maxBounds: [number, number]): [number, number][];
|
|
1366
|
+
|
|
977
1367
|
export declare class ObeliskHeadstone extends Mesh {
|
|
978
1368
|
constructor({ totalHeight, baseWidth }?: ObeliskHeadstoneOptions);
|
|
979
1369
|
}
|
|
@@ -987,6 +1377,52 @@ declare interface ObeliskHeadstoneOptions {
|
|
|
987
1377
|
totalHeight?: number;
|
|
988
1378
|
}
|
|
989
1379
|
|
|
1380
|
+
/**
|
|
1381
|
+
* Orbit around a target
|
|
1382
|
+
*
|
|
1383
|
+
* Example:
|
|
1384
|
+
* ```
|
|
1385
|
+
* orbitAnimation(camera, new THREE.Vector3(0, 0, 0), 10, 5000, () => {
|
|
1386
|
+
* console.log("Orbit animation complete");
|
|
1387
|
+
* });
|
|
1388
|
+
* ```
|
|
1389
|
+
*/
|
|
1390
|
+
export declare function orbitAnimation(camera: Camera, target: Vector3, radius: number, duration: number, onComplete?: () => void): void;
|
|
1391
|
+
|
|
1392
|
+
/**
|
|
1393
|
+
* Prefab for a panel.
|
|
1394
|
+
* Designed to be used as a control panel for switches, lights, levels, dials, and gauges.
|
|
1395
|
+
*/
|
|
1396
|
+
export declare class Panel extends Mesh {
|
|
1397
|
+
geometry: BoxGeometry;
|
|
1398
|
+
material: MeshStandardMaterial;
|
|
1399
|
+
constructor({ width, height, depth }?: PanelOptions);
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
/**
|
|
1403
|
+
* Prefab for a panel light.
|
|
1404
|
+
* Designed to appear as a LED light
|
|
1405
|
+
*/
|
|
1406
|
+
export declare class PanelLight extends Mesh {
|
|
1407
|
+
geometry: SphereGeometry;
|
|
1408
|
+
material: MeshStandardMaterial;
|
|
1409
|
+
constructor({ radius, //
|
|
1410
|
+
color, emissive, emissiveIntensity, }?: PanelLightOptions);
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
export declare interface PanelLightOptions {
|
|
1414
|
+
radius?: number;
|
|
1415
|
+
color?: number;
|
|
1416
|
+
emissive?: number;
|
|
1417
|
+
emissiveIntensity?: number;
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
export declare interface PanelOptions {
|
|
1421
|
+
width?: number;
|
|
1422
|
+
height?: number;
|
|
1423
|
+
depth?: number;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
990
1426
|
export declare const parabolicCurve: (t: number, a?: number, b?: number, c?: number) => number;
|
|
991
1427
|
|
|
992
1428
|
export declare const ParametricCurve: {
|
|
@@ -1010,6 +1446,52 @@ export declare const ParametricCurveUtils: {
|
|
|
1010
1446
|
createSigmoidCurvePoints: (start: Vector2, end: Vector2, a: number, segments?: number) => Vector2[];
|
|
1011
1447
|
};
|
|
1012
1448
|
|
|
1449
|
+
/**
|
|
1450
|
+
* The camera swings back and forth like a pendulum.
|
|
1451
|
+
*
|
|
1452
|
+
* Example:
|
|
1453
|
+
* ```
|
|
1454
|
+
* pendulumAnimation(camera, new THREE.Vector3(0, 5, 5), 0.5, 9000, 3, () => {
|
|
1455
|
+
* console.log("Pendulum animation complete");
|
|
1456
|
+
* });
|
|
1457
|
+
* ```
|
|
1458
|
+
*/
|
|
1459
|
+
export declare function pendulumAnimation(camera: Camera, center: Vector3, radius: number, duration: number, oscillations: number, onComplete?: () => void): void;
|
|
1460
|
+
|
|
1461
|
+
/**
|
|
1462
|
+
* Planar UV Mapping
|
|
1463
|
+
* Projects UVs onto the geometry from a single direction (like shining a projector onto a surface).
|
|
1464
|
+
*
|
|
1465
|
+
* Example:
|
|
1466
|
+
* ```
|
|
1467
|
+
* const vertices = [
|
|
1468
|
+
* [-1, -1, 1],
|
|
1469
|
+
* [1, -1, 1],
|
|
1470
|
+
* [-1, 1, 1],
|
|
1471
|
+
* [1, 1, 1],
|
|
1472
|
+
* ];
|
|
1473
|
+
*
|
|
1474
|
+
* const uvs = planarUVMapping(vertices, 'z'); // Project onto the Z-axis
|
|
1475
|
+
*/
|
|
1476
|
+
export declare function planarUVMapping(vertices: [number, number, number][], axis: 'x' | 'y' | 'z'): [number, number][];
|
|
1477
|
+
|
|
1478
|
+
/**
|
|
1479
|
+
* Polar UV Mapping
|
|
1480
|
+
* Map textures onto circular or radial geometries, such as discs or dome-like structures.
|
|
1481
|
+
* Maps the radial distance from the center of the geometry to the v coordinate
|
|
1482
|
+
* and the angular position to the u coordinate.
|
|
1483
|
+
*
|
|
1484
|
+
* const discVertices = [
|
|
1485
|
+
* [1, 0, 0], // Vertex at (1, 0, 0)
|
|
1486
|
+
* [0, 0, 1], // Vertex at (0, 0, 1)
|
|
1487
|
+
* [-1, 0, 0], // Vertex at (-1, 0, 0)
|
|
1488
|
+
* [0, 0, -1], // Vertex at (0, 0, -1)
|
|
1489
|
+
* ];
|
|
1490
|
+
*
|
|
1491
|
+
* const polarUVs = polarUVMapping(discVertices);
|
|
1492
|
+
*/
|
|
1493
|
+
export declare function polarUVMapping(vertices: [number, number, number][]): [number, number][];
|
|
1494
|
+
|
|
1013
1495
|
export declare const quadraticCurve: (t: number, p0: number, p1: number, p2: number) => number;
|
|
1014
1496
|
|
|
1015
1497
|
export declare const quadraticEaseIn: (t: number) => number;
|
|
@@ -1052,7 +1534,7 @@ export declare function randomFloat(min?: number, max?: number): number;
|
|
|
1052
1534
|
*/
|
|
1053
1535
|
export declare function randomInteger(min?: number, max?: number): number;
|
|
1054
1536
|
|
|
1055
|
-
export declare function randomTransformVertices<T extends BufferGeometry>(geometry: T,
|
|
1537
|
+
export declare function randomTransformVertices<T extends BufferGeometry>(geometry: T, axis?: Vector3, minScale?: number, maxScale?: number): T;
|
|
1056
1538
|
|
|
1057
1539
|
export declare class Rock extends Mesh {
|
|
1058
1540
|
constructor(radius?: number, widthSegments?: number, heightSegments?: number);
|
|
@@ -1108,11 +1590,31 @@ declare interface RowOfBooksOptions<T extends Material = Material> {
|
|
|
1108
1590
|
scaleZMax?: number;
|
|
1109
1591
|
}
|
|
1110
1592
|
|
|
1111
|
-
|
|
1593
|
+
/**
|
|
1594
|
+
* Set a random interval that will call the callback function with a random delay between minDelay and maxDelay.
|
|
1595
|
+
*
|
|
1596
|
+
* Example usage:
|
|
1597
|
+
* ```
|
|
1598
|
+
* const clearRandomInterval = setRandomInterval(() => {
|
|
1599
|
+
* console.log('Random interval executed!');
|
|
1600
|
+
* }, 500, 1500); // Random delay between 500ms and 1500ms
|
|
1601
|
+
* ```
|
|
1602
|
+
*/
|
|
1603
|
+
export declare function setRandomInterval(callback: () => void, minDelay: number, maxDelay: number): () => void;
|
|
1112
1604
|
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1605
|
+
/**
|
|
1606
|
+
* Set a random timeout that will call the callback function with a random delay between minDelay and maxDelay.
|
|
1607
|
+
*
|
|
1608
|
+
* Example usage:
|
|
1609
|
+
* ```
|
|
1610
|
+
* setRandomTimeout(() => {
|
|
1611
|
+
* console.log(`Callback ${i} executed!`);
|
|
1612
|
+
* }, 100, 500); // Random timeout between 100ms and 500ms
|
|
1613
|
+
* ```
|
|
1614
|
+
*/
|
|
1615
|
+
export declare function setRandomTimeout(callback: () => void, minDelay: number, maxDelay: number): NodeJS.Timeout;
|
|
1616
|
+
|
|
1617
|
+
export declare const sigmoidCurve: (t: number, a?: number) => number;
|
|
1116
1618
|
|
|
1117
1619
|
export declare const sineEaseIn: (t: number) => number;
|
|
1118
1620
|
|
|
@@ -1140,11 +1642,40 @@ export declare const sphericalToCartesian: (radius: number, theta: number, phi:
|
|
|
1140
1642
|
z: number;
|
|
1141
1643
|
};
|
|
1142
1644
|
|
|
1645
|
+
/**
|
|
1646
|
+
* Spherical UV Mapping
|
|
1647
|
+
* Wraps UVs around the geometry as if the texture were projected from a globe.
|
|
1648
|
+
*
|
|
1649
|
+
* Example usage:
|
|
1650
|
+
* ```
|
|
1651
|
+
* const sphereVertices = [
|
|
1652
|
+
* [1, 0, 0],
|
|
1653
|
+
* [0, 1, 0],
|
|
1654
|
+
* [0, 0, 1],
|
|
1655
|
+
* ];
|
|
1656
|
+
*
|
|
1657
|
+
* const sphereUVs = sphericalUVMapping(sphereVertices);
|
|
1658
|
+
* ```
|
|
1659
|
+
*/
|
|
1660
|
+
export declare function sphericalUVMapping(vertices: [number, number, number][]): [number, number][];
|
|
1661
|
+
|
|
1143
1662
|
/**
|
|
1144
1663
|
* Creates spikes or depressions centered on the target position, pushing vertices away or pulling them towards the center.
|
|
1145
1664
|
*/
|
|
1146
1665
|
export declare const spikeBrush: <T extends BufferGeometry>(geometry: T, position: Vector3, radius: number, strength: number, inward?: boolean, falloffFn?: (distance: number, radius: number) => number) => void;
|
|
1147
1666
|
|
|
1667
|
+
/**
|
|
1668
|
+
* The camera spirals upward, perfect for revealing a large scene or structure.
|
|
1669
|
+
*
|
|
1670
|
+
* Example:
|
|
1671
|
+
* ```
|
|
1672
|
+
* spiralAscensionAnimation(camera, new THREE.Vector3(0, 0, 0), 10, 300, 7, 12000, () => {
|
|
1673
|
+
* console.log("Spiral ascension animation complete");
|
|
1674
|
+
* });
|
|
1675
|
+
* ```
|
|
1676
|
+
*/
|
|
1677
|
+
export declare function spiralAscensionAnimation(camera: Camera, center: Vector3, radius: number, height: number, revolutions: number, duration: number, onComplete?: () => void): void;
|
|
1678
|
+
|
|
1148
1679
|
export declare class SpiralStaircaseGeometry extends BufferGeometry {
|
|
1149
1680
|
constructor(stepWidth?: number, stepDepth?: number, stepHeight?: number, numSteps?: number, radius?: number, angleIncrement?: number);
|
|
1150
1681
|
}
|
|
@@ -1168,6 +1699,8 @@ export declare class StaircaseGeometry extends BufferGeometry {
|
|
|
1168
1699
|
}
|
|
1169
1700
|
|
|
1170
1701
|
export declare class Stand extends Mesh {
|
|
1702
|
+
geometry: StandGeometry;
|
|
1703
|
+
material: MeshStandardMaterial;
|
|
1171
1704
|
constructor({ radius, //
|
|
1172
1705
|
height, count, thickness, radialSegments, }?: {
|
|
1173
1706
|
radius?: number | undefined;
|
|
@@ -1296,6 +1829,18 @@ export declare class WineBottleGeometry extends BufferGeometry {
|
|
|
1296
1829
|
});
|
|
1297
1830
|
}
|
|
1298
1831
|
|
|
1832
|
+
/**
|
|
1833
|
+
* Add a slight random wobble for intensity or realism (e.g., during an explosion).
|
|
1834
|
+
*
|
|
1835
|
+
* Example:
|
|
1836
|
+
* ```
|
|
1837
|
+
* wobbleAnimation(camera, 0.5, 1000, () => {
|
|
1838
|
+
* console.log("Wobble animation complete");
|
|
1839
|
+
* });
|
|
1840
|
+
* ```
|
|
1841
|
+
*/
|
|
1842
|
+
export declare function wobbleAnimation(camera: Camera, intensity: number, duration: number, onComplete?: () => void): void;
|
|
1843
|
+
|
|
1299
1844
|
export declare class WroughtIronBar extends Mesh {
|
|
1300
1845
|
constructor({ barHeight, //
|
|
1301
1846
|
barRadius, spikeHeight, spikeRadius, spikeScaleZ, radialSegments, }?: {
|
|
@@ -1357,4 +1902,17 @@ export declare class WroughtIronFenceGeometry extends BufferGeometry {
|
|
|
1357
1902
|
});
|
|
1358
1903
|
}
|
|
1359
1904
|
|
|
1905
|
+
/**
|
|
1906
|
+
* The camera smoothly zooms in toward a target, focusing attention on a specific point,
|
|
1907
|
+
* and resets to its original FOV after completion.
|
|
1908
|
+
*
|
|
1909
|
+
* Example:
|
|
1910
|
+
* ```
|
|
1911
|
+
* zoomInAnimation(camera, new THREE.Vector3(0, 0, 0), 120, 75, 2000, () => {
|
|
1912
|
+
* console.log("Zoom in animation complete");
|
|
1913
|
+
* });
|
|
1914
|
+
* ```
|
|
1915
|
+
*/
|
|
1916
|
+
export declare function zoomInAnimation(camera: PerspectiveCamera, target: Vector3, startFov: number, endFov: number, duration: number, onComplete?: () => void): void;
|
|
1917
|
+
|
|
1360
1918
|
export { }
|