three-low-poly 0.9.14 → 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 +11 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +471 -36
- package/dist/index.es.js +1190 -958
- package/dist/index.es.js.map +1 -1
- package/dist/index.iife.js +11 -11
- package/dist/index.iife.js.map +1 -1
- package/dist/index.umd.js +11 -11
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,13 @@ import { Color } from 'three';
|
|
|
5
5
|
import { DataTexture } from 'three';
|
|
6
6
|
import { Group } from 'three';
|
|
7
7
|
import { InstancedMesh } from 'three';
|
|
8
|
+
import { Light } from 'three';
|
|
8
9
|
import { Material } from 'three';
|
|
9
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';
|
|
10
15
|
import { PerspectiveCamera } from 'three';
|
|
11
16
|
import { ShaderMaterial } from 'three';
|
|
12
17
|
import { Shape } from 'three';
|
|
@@ -21,10 +26,10 @@ import { Vector3 } from 'three';
|
|
|
21
26
|
* @param {Object} options - Options for noise modification.
|
|
22
27
|
* @param {number} [options.time=0.0] - The time value for the noise function.
|
|
23
28
|
* @param {number} [options.intensity=1.0] - The intensity of the displacement.
|
|
24
|
-
* @param {Vector3} [options.
|
|
29
|
+
* @param {Vector3} [options.axis=new Vector3(1, 1, 1)] - The axis of displacement.
|
|
25
30
|
* @param {number} [options.scale=10.0] - The scale of the noise effect.
|
|
26
31
|
*/
|
|
27
|
-
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;
|
|
28
33
|
|
|
29
34
|
/**
|
|
30
35
|
* Utility function to add water-like vertex displacement to an existing Three.js material.
|
|
@@ -139,13 +144,132 @@ export declare class AtmosphericSkybox extends Mesh {
|
|
|
139
144
|
sunPosition(theta: number, phi: number): void;
|
|
140
145
|
}
|
|
141
146
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
+
};
|
|
149
273
|
|
|
150
274
|
export declare class BifurcatedStaircaseGeometry extends BufferGeometry {
|
|
151
275
|
constructor(stepWidth?: number, stepHeight?: number, stepDepth?: number, numStepsCentral?: number, numStepsBranch?: number, branchAngle?: number);
|
|
@@ -253,6 +377,20 @@ export declare class BurstShape extends Shape {
|
|
|
253
377
|
constructor(sides?: number, innerRadius?: number, outerRadius?: number);
|
|
254
378
|
}
|
|
255
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
|
+
|
|
256
394
|
export declare class Candle extends Group {
|
|
257
395
|
private candle;
|
|
258
396
|
private flame;
|
|
@@ -418,6 +556,59 @@ export declare const createLogarithmicCurvePoints: (start: Vector2, end: Vector2
|
|
|
418
556
|
*/
|
|
419
557
|
export declare const createParabolicCurvePoints: (start: Vector2, end: Vector2, a: number, b: number, c: number, segments?: number) => Vector2[];
|
|
420
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
|
+
|
|
421
612
|
/**
|
|
422
613
|
* Function to create quadratic Bezier curve points
|
|
423
614
|
*
|
|
@@ -474,6 +665,45 @@ export declare const cubicEaseInOut: (t: number) => number;
|
|
|
474
665
|
|
|
475
666
|
export declare const cubicEaseOut: (t: number) => number;
|
|
476
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
|
+
|
|
477
707
|
export declare const dampedCurve: (t: number, damping?: number) => number;
|
|
478
708
|
|
|
479
709
|
export declare class DaySkybox extends Mesh {
|
|
@@ -515,7 +745,13 @@ export declare interface DaySkyUniforms {
|
|
|
515
745
|
bottomColor: Uniform<Color>;
|
|
516
746
|
}
|
|
517
747
|
|
|
518
|
-
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 {
|
|
519
755
|
constructor();
|
|
520
756
|
}
|
|
521
757
|
|
|
@@ -524,7 +760,9 @@ export declare class DioramaGeometry extends BufferGeometry {
|
|
|
524
760
|
}
|
|
525
761
|
|
|
526
762
|
/**
|
|
527
|
-
*
|
|
763
|
+
* Movement or orientation in a specific direction.
|
|
764
|
+
*
|
|
765
|
+
* Example usages:
|
|
528
766
|
*
|
|
529
767
|
* Moving an Object Along a Direction
|
|
530
768
|
* ```
|
|
@@ -542,22 +780,6 @@ export declare class DioramaGeometry extends BufferGeometry {
|
|
|
542
780
|
* object.position.copy(targetPosition.clone().add(snapDirection.clone().multiplyScalar(10)));
|
|
543
781
|
* ```
|
|
544
782
|
*
|
|
545
|
-
* Rotating or Orienting an Object
|
|
546
|
-
* ```
|
|
547
|
-
* const targetDirection = Direction.XY; // Diagonal upward
|
|
548
|
-
* object.lookAt(object.position.clone().add(targetDirection));
|
|
549
|
-
* ```
|
|
550
|
-
*
|
|
551
|
-
* Procedural Geometry
|
|
552
|
-
* ```
|
|
553
|
-
* const vertex = new Vector3(0, 0, 0);
|
|
554
|
-
* const direction = Direction.XZ; // Diagonal direction on XZ plane
|
|
555
|
-
*
|
|
556
|
-
* const offset = direction.clone().multiplyScalar(5);
|
|
557
|
-
* vertex.add(offset); // Move vertex in direction
|
|
558
|
-
* geometry.vertices.push(vertex);
|
|
559
|
-
* ```
|
|
560
|
-
*
|
|
561
783
|
* Animating Along a Direction
|
|
562
784
|
* ```
|
|
563
785
|
* const distance = 10; // Total distance to travel
|
|
@@ -610,13 +832,6 @@ export declare const Direction: {
|
|
|
610
832
|
RIGHT: Vector3;
|
|
611
833
|
FORWARD: Vector3;
|
|
612
834
|
BACKWARD: Vector3;
|
|
613
|
-
X: Vector3;
|
|
614
|
-
Y: Vector3;
|
|
615
|
-
Z: Vector3;
|
|
616
|
-
XY: Vector3;
|
|
617
|
-
XZ: Vector3;
|
|
618
|
-
YZ: Vector3;
|
|
619
|
-
XYZ: Vector3;
|
|
620
835
|
};
|
|
621
836
|
|
|
622
837
|
/**
|
|
@@ -679,6 +894,45 @@ export declare class EllipticLeafGeometry extends BufferGeometry {
|
|
|
679
894
|
constructor(size?: number);
|
|
680
895
|
}
|
|
681
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
|
+
|
|
682
936
|
export declare class ErlenmeyerFlask extends Mesh {
|
|
683
937
|
constructor({ flaskRadius, //
|
|
684
938
|
neckRadius, height, neckHeight, radialSegments, }?: {
|
|
@@ -759,6 +1013,16 @@ export declare class Flask extends Group {
|
|
|
759
1013
|
*/
|
|
760
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;
|
|
761
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
|
+
|
|
762
1026
|
/**
|
|
763
1027
|
* The camera flies through a sequence of points, ideal for showcasing specific elements in the scene.
|
|
764
1028
|
*
|
|
@@ -865,6 +1129,41 @@ export declare class LeverPanel extends Group {
|
|
|
865
1129
|
constructor();
|
|
866
1130
|
}
|
|
867
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
|
+
|
|
868
1167
|
export declare const linear: (t: number) => number;
|
|
869
1168
|
|
|
870
1169
|
export declare const logarithmic: (t: number) => number;
|
|
@@ -1036,10 +1335,35 @@ export declare const noiseBrush: <T extends BufferGeometry>(geometry: T, positio
|
|
|
1036
1335
|
declare interface NoiseDisplacementOptions {
|
|
1037
1336
|
time?: number;
|
|
1038
1337
|
intensity?: number;
|
|
1039
|
-
|
|
1338
|
+
axis?: Vector3;
|
|
1040
1339
|
scale?: number;
|
|
1041
1340
|
}
|
|
1042
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
|
+
|
|
1043
1367
|
export declare class ObeliskHeadstone extends Mesh {
|
|
1044
1368
|
constructor({ totalHeight, baseWidth }?: ObeliskHeadstoneOptions);
|
|
1045
1369
|
}
|
|
@@ -1065,6 +1389,40 @@ declare interface ObeliskHeadstoneOptions {
|
|
|
1065
1389
|
*/
|
|
1066
1390
|
export declare function orbitAnimation(camera: Camera, target: Vector3, radius: number, duration: number, onComplete?: () => void): void;
|
|
1067
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
|
+
|
|
1068
1426
|
export declare const parabolicCurve: (t: number, a?: number, b?: number, c?: number) => number;
|
|
1069
1427
|
|
|
1070
1428
|
export declare const ParametricCurve: {
|
|
@@ -1100,6 +1458,40 @@ export declare const ParametricCurveUtils: {
|
|
|
1100
1458
|
*/
|
|
1101
1459
|
export declare function pendulumAnimation(camera: Camera, center: Vector3, radius: number, duration: number, oscillations: number, onComplete?: () => void): void;
|
|
1102
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
|
+
|
|
1103
1495
|
export declare const quadraticCurve: (t: number, p0: number, p1: number, p2: number) => number;
|
|
1104
1496
|
|
|
1105
1497
|
export declare const quadraticEaseIn: (t: number) => number;
|
|
@@ -1142,7 +1534,7 @@ export declare function randomFloat(min?: number, max?: number): number;
|
|
|
1142
1534
|
*/
|
|
1143
1535
|
export declare function randomInteger(min?: number, max?: number): number;
|
|
1144
1536
|
|
|
1145
|
-
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;
|
|
1146
1538
|
|
|
1147
1539
|
export declare class Rock extends Mesh {
|
|
1148
1540
|
constructor(radius?: number, widthSegments?: number, heightSegments?: number);
|
|
@@ -1198,6 +1590,30 @@ declare interface RowOfBooksOptions<T extends Material = Material> {
|
|
|
1198
1590
|
scaleZMax?: number;
|
|
1199
1591
|
}
|
|
1200
1592
|
|
|
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;
|
|
1604
|
+
|
|
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
|
+
|
|
1201
1617
|
export declare const sigmoidCurve: (t: number, a?: number) => number;
|
|
1202
1618
|
|
|
1203
1619
|
export declare const sineEaseIn: (t: number) => number;
|
|
@@ -1226,6 +1642,23 @@ export declare const sphericalToCartesian: (radius: number, theta: number, phi:
|
|
|
1226
1642
|
z: number;
|
|
1227
1643
|
};
|
|
1228
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
|
+
|
|
1229
1662
|
/**
|
|
1230
1663
|
* Creates spikes or depressions centered on the target position, pushing vertices away or pulling them towards the center.
|
|
1231
1664
|
*/
|
|
@@ -1266,6 +1699,8 @@ export declare class StaircaseGeometry extends BufferGeometry {
|
|
|
1266
1699
|
}
|
|
1267
1700
|
|
|
1268
1701
|
export declare class Stand extends Mesh {
|
|
1702
|
+
geometry: StandGeometry;
|
|
1703
|
+
material: MeshStandardMaterial;
|
|
1269
1704
|
constructor({ radius, //
|
|
1270
1705
|
height, count, thickness, radialSegments, }?: {
|
|
1271
1706
|
radius?: number | undefined;
|