three-zoo 0.4.1 → 0.4.2
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/BiFovCamera.d.ts +71 -0
- package/dist/Bounds.d.ts +21 -1
- package/dist/{GeometryComparator.d.ts → GeometryHasher.d.ts} +2 -2
- package/dist/InstanceAssembler.d.ts +2 -1
- package/dist/SceneProcessor.d.ts +1 -1
- package/dist/{Enumerator.d.ts → SceneTraversal.d.ts} +2 -2
- package/dist/SkinnedMeshBaker.d.ts +2 -1
- package/dist/Sun.d.ts +61 -11
- package/dist/index.d.ts +2 -2
- package/dist/index.js +297 -201
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -0
- package/dist/index.min.js.map +1 -0
- package/package.json +12 -4
- package/dist/DoubleFOVCamera.d.ts +0 -7
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { PerspectiveCamera } from "three";
|
|
2
|
+
/**
|
|
3
|
+
* BiFovCamera - A specialized PerspectiveCamera that supports independent horizontal and vertical FOV settings
|
|
4
|
+
*
|
|
5
|
+
* This camera extends Three.js PerspectiveCamera to provide better control over the field of view,
|
|
6
|
+
* allowing separate horizontal and vertical FOV values. The camera automatically adjusts its projection
|
|
7
|
+
* matrix based on the aspect ratio to maintain proper perspective.
|
|
8
|
+
*
|
|
9
|
+
* @extends PerspectiveCamera
|
|
10
|
+
*/
|
|
11
|
+
export declare class BiFovCamera extends PerspectiveCamera {
|
|
12
|
+
private horizontalFovInternal;
|
|
13
|
+
private verticalFovInternal;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new BiFovCamera instance
|
|
16
|
+
*
|
|
17
|
+
* @param horizontalFov - Horizontal field of view in degrees (default: 90)
|
|
18
|
+
* @param verticalFov - Vertical field of view in degrees (default: 90)
|
|
19
|
+
* @param aspect - Aspect ratio (width/height) of the viewport (default: 1)
|
|
20
|
+
* @param near - Near clipping plane distance (default: 1)
|
|
21
|
+
* @param far - Far clipping plane distance (default: 1000)
|
|
22
|
+
*/
|
|
23
|
+
constructor(horizontalFov?: number, verticalFov?: number, aspect?: number, near?: number, far?: number);
|
|
24
|
+
/**
|
|
25
|
+
* Gets the horizontal field of view in degrees
|
|
26
|
+
*/
|
|
27
|
+
get horizontalFov(): number;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the vertical field of view in degrees
|
|
30
|
+
*/
|
|
31
|
+
get verticalFov(): number;
|
|
32
|
+
/**
|
|
33
|
+
* Sets the horizontal field of view in degrees
|
|
34
|
+
* @param value - The new horizontal FOV value
|
|
35
|
+
*/
|
|
36
|
+
set horizontalFov(value: number);
|
|
37
|
+
/**
|
|
38
|
+
* Sets the vertical field of view in degrees
|
|
39
|
+
* @param value - The new vertical FOV value
|
|
40
|
+
*/
|
|
41
|
+
set verticalFov(value: number);
|
|
42
|
+
/**
|
|
43
|
+
* Updates both horizontal and vertical FOV simultaneously
|
|
44
|
+
* @param horizontal - New horizontal FOV in degrees
|
|
45
|
+
* @param vertical - New vertical FOV in degrees
|
|
46
|
+
*/
|
|
47
|
+
setFov(horizontal: number, vertical: number): void;
|
|
48
|
+
/**
|
|
49
|
+
* Copies FOV settings from another BiFovCamera
|
|
50
|
+
* @param source - The camera to copy settings from
|
|
51
|
+
*/
|
|
52
|
+
copyFovSettings(source: BiFovCamera): void;
|
|
53
|
+
/**
|
|
54
|
+
* Updates the projection matrix based on current FOV settings and aspect ratio
|
|
55
|
+
* For aspect ratios >= 1 (landscape), horizontal FOV is preserved
|
|
56
|
+
* For aspect ratios < 1 (portrait), vertical FOV is preserved
|
|
57
|
+
*/
|
|
58
|
+
updateProjectionMatrix(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Returns the actual horizontal FOV after aspect ratio adjustments
|
|
61
|
+
*/
|
|
62
|
+
getEffectiveHorizontalFov(): number;
|
|
63
|
+
/**
|
|
64
|
+
* Returns the actual vertical FOV after aspect ratio adjustments
|
|
65
|
+
*/
|
|
66
|
+
getEffectiveVerticalFov(): number;
|
|
67
|
+
/**
|
|
68
|
+
* Creates a clone of this camera with the same properties
|
|
69
|
+
*/
|
|
70
|
+
clone(): this;
|
|
71
|
+
}
|
package/dist/Bounds.d.ts
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
import { Box3 } from "three";
|
|
2
2
|
export declare class Bounds extends Box3 {
|
|
3
|
-
private readonly
|
|
3
|
+
private readonly tempVector3A;
|
|
4
|
+
/**
|
|
5
|
+
* Gets the width (x-axis length) of the bounding box
|
|
6
|
+
*/
|
|
4
7
|
get width(): number;
|
|
8
|
+
/**
|
|
9
|
+
* Gets the height (y-axis length) of the bounding box
|
|
10
|
+
*/
|
|
5
11
|
get height(): number;
|
|
12
|
+
/**
|
|
13
|
+
* Gets the depth (z-axis length) of the bounding box
|
|
14
|
+
*/
|
|
6
15
|
get depth(): number;
|
|
16
|
+
/**
|
|
17
|
+
* Gets the length of the box's diagonal
|
|
18
|
+
*/
|
|
7
19
|
get diagonal(): number;
|
|
20
|
+
/**
|
|
21
|
+
* Gets the volume of the bounding box
|
|
22
|
+
*/
|
|
23
|
+
getVolume(): number;
|
|
24
|
+
/**
|
|
25
|
+
* Gets the surface area of the bounding box
|
|
26
|
+
*/
|
|
27
|
+
getSurfaceArea(): number;
|
|
8
28
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BufferGeometry } from "three";
|
|
1
|
+
import type { BufferGeometry } from "three";
|
|
2
2
|
/**
|
|
3
3
|
* Utility class for comparing and hashing BufferGeometry instances with tolerance support.
|
|
4
4
|
*/
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class GeometryHasher {
|
|
6
6
|
/**
|
|
7
7
|
* Generates a consistent hash for a BufferGeometry based on its contents and tolerance.
|
|
8
8
|
*
|
package/dist/SceneProcessor.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Material, Object3D } from "three";
|
|
1
|
+
import type { Material, Object3D } from "three";
|
|
2
2
|
type Constructor<T> = abstract new (...args: never[]) => T;
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class SceneTraversal {
|
|
4
4
|
static getObjectByName(object: Object3D, name: string): Object3D | null;
|
|
5
5
|
static getMaterialByName(object: Object3D, name: string): Material | null;
|
|
6
6
|
static enumerateObjectsByType<T>(object: Object3D, type: Constructor<T>, callback: (instance: T) => void): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AnimationClip,
|
|
1
|
+
import type { AnimationClip, Object3D, SkinnedMesh } from "three";
|
|
2
|
+
import { Mesh } from "three";
|
|
2
3
|
/**
|
|
3
4
|
* Utilities for baking poses and animations from SkinnedMesh into a regular static Mesh.
|
|
4
5
|
*/
|
package/dist/Sun.d.ts
CHANGED
|
@@ -1,21 +1,71 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Texture } from "three";
|
|
2
|
+
import { Box3, DirectionalLight } from "three";
|
|
3
|
+
/**
|
|
4
|
+
* Sun extends Three.js DirectionalLight to provide a specialized light source that simulates
|
|
5
|
+
* sunlight with advanced positioning and shadow controls.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Spherical coordinate control (distance, elevation, azimuth)
|
|
9
|
+
* - Automatic shadow map configuration based on bounding boxes
|
|
10
|
+
* - HDR environment map-based positioning
|
|
11
|
+
* - Efficient temporary vector management for calculations
|
|
12
|
+
*
|
|
13
|
+
* @extends DirectionalLight
|
|
14
|
+
*/
|
|
2
15
|
export declare class Sun extends DirectionalLight {
|
|
3
|
-
private tempVector3D0;
|
|
4
|
-
private tempVector3D1;
|
|
5
|
-
private tempVector3D2;
|
|
6
|
-
private tempVector3D3;
|
|
7
|
-
private tempVector3D4;
|
|
8
|
-
private tempVector3D5;
|
|
9
|
-
private tempVector3D6;
|
|
10
|
-
private tempVector3D7;
|
|
11
|
-
private tempBox3;
|
|
12
|
-
private tempSpherical;
|
|
16
|
+
private readonly tempVector3D0;
|
|
17
|
+
private readonly tempVector3D1;
|
|
18
|
+
private readonly tempVector3D2;
|
|
19
|
+
private readonly tempVector3D3;
|
|
20
|
+
private readonly tempVector3D4;
|
|
21
|
+
private readonly tempVector3D5;
|
|
22
|
+
private readonly tempVector3D6;
|
|
23
|
+
private readonly tempVector3D7;
|
|
24
|
+
private readonly tempBox3;
|
|
25
|
+
private readonly tempSpherical;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the distance of the sun from its target (radius in spherical coordinates)
|
|
28
|
+
* @returns The distance in world units
|
|
29
|
+
*/
|
|
13
30
|
get distance(): number;
|
|
31
|
+
/**
|
|
32
|
+
* Gets the elevation angle of the sun (phi in spherical coordinates)
|
|
33
|
+
* @returns The elevation in radians
|
|
34
|
+
*/
|
|
14
35
|
get elevation(): number;
|
|
36
|
+
/**
|
|
37
|
+
* Gets the azimuth angle of the sun (theta in spherical coordinates)
|
|
38
|
+
* @returns The azimuth in radians
|
|
39
|
+
*/
|
|
15
40
|
get azimuth(): number;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the distance of the sun from its target while maintaining current angles
|
|
43
|
+
* @param value - The new distance in world units
|
|
44
|
+
*/
|
|
16
45
|
set distance(value: number);
|
|
46
|
+
/**
|
|
47
|
+
* Sets the elevation angle of the sun while maintaining current distance and azimuth
|
|
48
|
+
* @param value - The new elevation in radians
|
|
49
|
+
*/
|
|
17
50
|
set elevation(value: number);
|
|
51
|
+
/**
|
|
52
|
+
* Sets the azimuth angle of the sun while maintaining current distance and elevation
|
|
53
|
+
* @param value - The new azimuth in radians
|
|
54
|
+
*/
|
|
18
55
|
set azimuth(value: number);
|
|
56
|
+
/**
|
|
57
|
+
* Configures the shadow camera's frustum to encompass the given bounding box
|
|
58
|
+
* This ensures that shadows are cast correctly for objects within the box
|
|
59
|
+
*
|
|
60
|
+
* @param box3 - The bounding box to configure shadows for
|
|
61
|
+
*/
|
|
19
62
|
setShadowMapFromBox3(box3: Box3): void;
|
|
63
|
+
/**
|
|
64
|
+
* Sets the sun's direction based on the brightest point in an HDR texture
|
|
65
|
+
* This is useful for matching the sun's position to an environment map
|
|
66
|
+
*
|
|
67
|
+
* @param texture - The HDR texture to analyze (must be loaded and have valid image data)
|
|
68
|
+
* @param distance - Optional distance to position the sun from its target (default: 1)
|
|
69
|
+
*/
|
|
20
70
|
setDirectionFromHDR(texture: Texture, distance?: number): void;
|
|
21
71
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
export * from "./BiFovCamera";
|
|
1
2
|
export * from "./Bounds";
|
|
2
|
-
export * from "./DoubleFOVCamera";
|
|
3
|
-
export * from "./Enumerator";
|
|
4
3
|
export * from "./InstanceAssembler";
|
|
5
4
|
export * from "./SceneProcessor";
|
|
5
|
+
export * from "./SceneTraversal";
|
|
6
6
|
export * from "./SkinnedMeshBaker";
|
|
7
7
|
export * from "./Sun";
|