three-low-poly 0.9.18 → 0.9.19

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.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 { ParametricGeometry } from 'three-stdlib';
15
16
  import { PerspectiveCamera } from 'three';
16
17
  import { ShaderMaterial } from 'three';
17
18
  import { Shape } from 'three';
@@ -575,14 +576,38 @@ export declare function cameraWobbleAnimation(camera: Camera, intensity: number,
575
576
  */
576
577
  export declare function cameraZoomInAnimation(camera: PerspectiveCamera, target: Vector3, startFov: number, endFov: number, duration: number, onComplete?: () => void): void;
577
578
 
578
- export declare class Candle extends Group {
579
- private candle;
580
- private flame;
581
- private candleLight;
582
- private height;
583
- private radius;
584
- constructor(height?: number, radius?: number);
585
- animateFlicker(): void;
579
+ /**
580
+ * Material indices
581
+ * 0: Stick
582
+ * 1: Flame
583
+ */
584
+ export declare class Candle extends Mesh<CandleGeometry, MeshStandardMaterial[]> {
585
+ constructor({ radiusTop, //
586
+ radiusBottom, height, flameHeight, flameRadius, segments, }?: {
587
+ radiusTop?: number | undefined;
588
+ radiusBottom?: number | undefined;
589
+ height?: number | undefined;
590
+ flameHeight?: number | undefined;
591
+ flameRadius?: number | undefined;
592
+ segments?: number | undefined;
593
+ });
594
+ }
595
+
596
+ /**
597
+ * Group indices
598
+ * 0: Stick
599
+ * 1: Flame
600
+ */
601
+ export declare class CandleGeometry extends BufferGeometry {
602
+ constructor({ radiusTop, //
603
+ radiusBottom, height, flameHeight, flameRadius, segments, }?: {
604
+ radiusTop?: number | undefined;
605
+ radiusBottom?: number | undefined;
606
+ height?: number | undefined;
607
+ flameHeight?: number | undefined;
608
+ flameRadius?: number | undefined;
609
+ segments?: number | undefined;
610
+ });
586
611
  }
587
612
 
588
613
  /**
@@ -623,12 +648,22 @@ export declare function centerInstancedMesh<T extends InstancedMesh>(mesh: T): v
623
648
  export declare function centerMesh<T extends Mesh>(mesh: T): void;
624
649
 
625
650
  /**
626
- * Centers the geometry of the given mesh at the local origin (0, 0, 0) by modifying the geometry vertices.
651
+ * Centers a Mesh at the specified target position.
652
+ */
653
+ export declare function centerMeshAtTarget<T extends Mesh>(mesh: T, target?: Vector3): void;
654
+
655
+ /**
656
+ * Centers the geometry of the Mesh at the local origin (0, 0, 0) by modifying the geometry vertices.
627
657
  * This method moves the geometry itself so that its center is at the local origin,
628
658
  * without affecting the position, rotation, or scale of the mesh.
629
659
  */
630
660
  export declare function centerMeshGeometry<T extends Mesh>(mesh: T): void;
631
661
 
662
+ /**
663
+ * Centers the geometry of a Mesh at the specified target position.
664
+ */
665
+ export declare function centerMeshGeometryAtTarget<T extends Mesh>(mesh: T, target?: Vector3): void;
666
+
632
667
  /**
633
668
  * Create a checkerboard texture
634
669
  *
@@ -1250,6 +1285,24 @@ export declare function findClosestColor(inputColor: number, dataset: number[]):
1250
1285
 
1251
1286
  export declare function findClosestColorChannelWise(inputColor: number, dataset: number[]): number | null;
1252
1287
 
1288
+ export declare class Flame extends Mesh<FlameGeometry, MeshStandardMaterial> {
1289
+ constructor({ height, radius, segmentsU, segmentsV }?: {
1290
+ height?: number | undefined;
1291
+ radius?: number | undefined;
1292
+ segmentsU?: number | undefined;
1293
+ segmentsV?: number | undefined;
1294
+ });
1295
+ }
1296
+
1297
+ export declare class FlameGeometry extends ParametricGeometry {
1298
+ constructor({ height, radius, segmentsU, segmentsV }?: {
1299
+ height?: number | undefined;
1300
+ radius?: number | undefined;
1301
+ segmentsU?: number | undefined;
1302
+ segmentsV?: number | undefined;
1303
+ });
1304
+ }
1305
+
1253
1306
  /**
1254
1307
  * Flattens vertices to a given plane defined by a target height or normal direction.
1255
1308
  */
@@ -1398,6 +1451,65 @@ export declare class LeverPanel extends Group {
1398
1451
  constructor();
1399
1452
  }
1400
1453
 
1454
+ /**
1455
+ * Create a light flicker animation that will randomly change the intensity and position of a light.
1456
+ * Effect resembles a flickering flame of candlelight.
1457
+ *
1458
+ * Example usage:
1459
+ * ```
1460
+ * // Create a candle
1461
+ * const candle = new Candle({
1462
+ * height: 1,
1463
+ * flameHeight: 0.25,
1464
+ * });
1465
+ * scene.add(candle);
1466
+ *
1467
+ * // Create a point light
1468
+ * const candleLight = new THREE.PointLight(0xffa500, 1, 5);
1469
+ * scene.add(candleLight);
1470
+ *
1471
+ * // Apply the animator to the light
1472
+ * const lightAnimation = new LightFlickerAnimation({
1473
+ * light: candleLight,
1474
+ * maxIntensity: 2.2,
1475
+ * x: candle.position.x,
1476
+ * y: candle.position.y + 1 + 0.125, // height + half flame height
1477
+ * z: candle.position.z,
1478
+ * });
1479
+ * animations.push(lightAnimation);
1480
+ *
1481
+ * // Update the light animation in the render loop
1482
+ * renderer.setAnimationLoop(() => {
1483
+ * lightAnimation.update();
1484
+ * });
1485
+ * ```
1486
+ */
1487
+ export declare class LightFlickerAnimation {
1488
+ private light?;
1489
+ minIntensity: number;
1490
+ maxIntensity: number;
1491
+ x: number;
1492
+ y: number;
1493
+ z: number;
1494
+ jitterX: number;
1495
+ jitterY: number;
1496
+ jitterZ: number;
1497
+ constructor({ light, minIntensity, maxIntensity, x, y, z, jitterX, jitterY, jitterZ, }?: Partial<LightFlickerAnimationOptions>);
1498
+ update(): void;
1499
+ }
1500
+
1501
+ export declare interface LightFlickerAnimationOptions {
1502
+ light?: Light;
1503
+ minIntensity: number;
1504
+ maxIntensity: number;
1505
+ x: number;
1506
+ y: number;
1507
+ z: number;
1508
+ jitterX: number;
1509
+ jitterY: number;
1510
+ jitterZ: number;
1511
+ }
1512
+
1401
1513
  /**
1402
1514
  * A lightning animation that can be used to simulate a lightning storm.
1403
1515
  * This effect is applied to a light source.