three-zoo 0.5.5 → 0.5.6
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/DualFovCamera.d.ts +33 -72
- package/dist/SceneTraversal.d.ts +48 -65
- package/dist/SkinnedMeshBaker.d.ts +7 -8
- package/dist/StandardToBasicConverter.d.ts +11 -33
- package/dist/StandardToLambertConverter.d.ts +10 -28
- package/dist/Sun.d.ts +12 -35
- package/dist/index.js +179 -281
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
package/dist/DualFovCamera.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { Box3, SkinnedMesh } from "three";
|
|
2
2
|
import { PerspectiveCamera, Vector3 } from "three";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* Extends Three.js PerspectiveCamera to allow separate control over horizontal
|
|
6
|
-
* and vertical fields of view.
|
|
4
|
+
* Camera with independent horizontal and vertical FOV settings.
|
|
7
5
|
*/
|
|
8
6
|
export declare class DualFovCamera extends PerspectiveCamera {
|
|
9
7
|
/** Internal storage for horizontal field of view in degrees */
|
|
@@ -11,130 +9,93 @@ export declare class DualFovCamera extends PerspectiveCamera {
|
|
|
11
9
|
/** Internal storage for vertical field of view in degrees */
|
|
12
10
|
private verticalFovInternal;
|
|
13
11
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param near - Near clipping plane distance.
|
|
20
|
-
* @param far - Far clipping plane distance.
|
|
12
|
+
* @param horizontalFov - Horizontal FOV in degrees (clamped 1-179°)
|
|
13
|
+
* @param verticalFov - Vertical FOV in degrees (clamped 1-179°)
|
|
14
|
+
* @param aspect - Aspect ratio (width/height)
|
|
15
|
+
* @param near - Near clipping plane distance
|
|
16
|
+
* @param far - Far clipping plane distance
|
|
21
17
|
*/
|
|
22
18
|
constructor(horizontalFov?: number, verticalFov?: number, aspect?: number, near?: number, far?: number);
|
|
23
19
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @returns The horizontal FOV value
|
|
20
|
+
* @returns Horizontal FOV in degrees
|
|
27
21
|
*/
|
|
28
22
|
get horizontalFov(): number;
|
|
29
23
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @returns The vertical FOV value
|
|
24
|
+
* @returns Vertical FOV in degrees
|
|
33
25
|
*/
|
|
34
26
|
get verticalFov(): number;
|
|
35
27
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* @param value - The horizontal FOV value in degrees. Clamped between 1° and 179°.
|
|
28
|
+
* @param value - Horizontal FOV in degrees (clamped 1-179°)
|
|
39
29
|
*/
|
|
40
30
|
set horizontalFov(value: number);
|
|
41
31
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* @param value - The vertical FOV value in degrees. Clamped between 1° and 179°.
|
|
32
|
+
* @param value - Vertical FOV in degrees (clamped 1-179°)
|
|
45
33
|
*/
|
|
46
34
|
set verticalFov(value: number);
|
|
47
35
|
/**
|
|
48
|
-
* Sets both
|
|
36
|
+
* Sets both FOV values.
|
|
49
37
|
*
|
|
50
|
-
* @param horizontal - Horizontal FOV in degrees
|
|
51
|
-
* @param vertical - Vertical FOV in degrees
|
|
38
|
+
* @param horizontal - Horizontal FOV in degrees (clamped 1-179°)
|
|
39
|
+
* @param vertical - Vertical FOV in degrees (clamped 1-179°)
|
|
52
40
|
*/
|
|
53
41
|
setFov(horizontal: number, vertical: number): void;
|
|
54
42
|
/**
|
|
55
|
-
* Copies
|
|
43
|
+
* Copies FOV settings from another DualFovCamera.
|
|
56
44
|
*
|
|
57
|
-
* @param source -
|
|
45
|
+
* @param source - Source camera to copy from
|
|
58
46
|
*/
|
|
59
47
|
copyFovSettings(source: DualFovCamera): void;
|
|
60
48
|
/**
|
|
61
|
-
* Updates
|
|
62
|
-
*
|
|
63
|
-
* The behavior differs based on orientation:
|
|
64
|
-
* - **Landscape mode (aspect > 1)**: Preserves horizontal FOV, calculates vertical FOV
|
|
65
|
-
* - **Portrait mode (aspect ≤ 1)**: Preserves vertical FOV, calculates horizontal FOV
|
|
49
|
+
* Updates projection matrix based on FOV and aspect ratio.
|
|
66
50
|
*
|
|
67
|
-
*
|
|
51
|
+
* Landscape (aspect > 1): preserves horizontal FOV.
|
|
52
|
+
* Portrait (aspect ≤ 1): preserves vertical FOV.
|
|
68
53
|
*
|
|
69
54
|
* @override
|
|
70
55
|
*/
|
|
71
56
|
updateProjectionMatrix(): void;
|
|
72
57
|
/**
|
|
73
|
-
* Gets
|
|
74
|
-
*
|
|
75
|
-
* In landscape mode, returns the set horizontal FOV.
|
|
76
|
-
* In portrait mode, calculates the horizontal FOV from vertical FOV and aspect ratio.
|
|
58
|
+
* Gets actual horizontal FOV after aspect ratio adjustments.
|
|
77
59
|
*
|
|
78
|
-
* @returns
|
|
60
|
+
* @returns Horizontal FOV in degrees
|
|
79
61
|
*/
|
|
80
62
|
getActualHorizontalFov(): number;
|
|
81
63
|
/**
|
|
82
|
-
* Gets
|
|
64
|
+
* Gets actual vertical FOV after aspect ratio adjustments.
|
|
83
65
|
*
|
|
84
|
-
*
|
|
85
|
-
* In landscape mode, calculates the vertical FOV from horizontal FOV and aspect ratio.
|
|
86
|
-
*
|
|
87
|
-
* @returns The vertical FOV in degrees
|
|
66
|
+
* @returns Vertical FOV in degrees
|
|
88
67
|
*/
|
|
89
68
|
getActualVerticalFov(): number;
|
|
90
69
|
/**
|
|
91
|
-
* Adjusts
|
|
92
|
-
*
|
|
93
|
-
* Calculates the required vertical FOV to ensure all provided vertices
|
|
94
|
-
* are visible within the vertical bounds of the camera's frustum.
|
|
70
|
+
* Adjusts vertical FOV to fit points within camera view.
|
|
95
71
|
*
|
|
96
72
|
* @param vertices - Array of 3D points in world coordinates
|
|
97
73
|
*/
|
|
98
74
|
fitVerticalFovToPoints(vertices: Vector3[]): void;
|
|
99
75
|
/**
|
|
100
|
-
* Adjusts
|
|
76
|
+
* Adjusts vertical FOV to fit bounding box within camera view.
|
|
101
77
|
*
|
|
102
|
-
*
|
|
103
|
-
* is visible within the vertical bounds of the camera's frustum.
|
|
104
|
-
*
|
|
105
|
-
* @param box - The 3D bounding box in world coordinates
|
|
78
|
+
* @param box - 3D bounding box in world coordinates
|
|
106
79
|
*/
|
|
107
80
|
fitVerticalFovToBox(box: Box3): void;
|
|
108
81
|
/**
|
|
109
|
-
* Adjusts
|
|
110
|
-
*
|
|
111
|
-
* Updates the mesh's skeleton, applies bone transformations to vertices,
|
|
112
|
-
* and calculates the required vertical FOV to fit the deformed mesh
|
|
113
|
-
* within the vertical bounds of the camera's frustum.
|
|
82
|
+
* Adjusts vertical FOV to fit skinned mesh within camera view.
|
|
83
|
+
* Updates skeleton and applies bone transformations.
|
|
114
84
|
*
|
|
115
|
-
* @param skinnedMesh -
|
|
85
|
+
* @param skinnedMesh - Skinned mesh with active skeleton
|
|
116
86
|
*/
|
|
117
87
|
fitVerticalFovToMesh(skinnedMesh: SkinnedMesh): void;
|
|
118
88
|
/**
|
|
119
|
-
* Points
|
|
89
|
+
* Points camera to look at skinned mesh center of mass.
|
|
90
|
+
* Uses iterative clustering to find main vertex concentration.
|
|
120
91
|
*
|
|
121
|
-
*
|
|
122
|
-
* calculates the center of mass using a clustering algorithm, and orients the camera
|
|
123
|
-
* to look at that point.
|
|
124
|
-
*
|
|
125
|
-
* The center of mass calculation uses iterative clustering to find the
|
|
126
|
-
* main concentration of vertices.
|
|
127
|
-
*
|
|
128
|
-
* @param skinnedMesh - The skinned mesh with active skeleton
|
|
92
|
+
* @param skinnedMesh - Skinned mesh with active skeleton
|
|
129
93
|
*/
|
|
130
94
|
lookAtMeshCenterOfMass(skinnedMesh: SkinnedMesh): void;
|
|
131
95
|
/**
|
|
132
|
-
* Creates a copy of this
|
|
133
|
-
*
|
|
134
|
-
* The cloned camera has identical FOV settings, position, rotation,
|
|
135
|
-
* and all other camera properties.
|
|
96
|
+
* Creates a copy of this camera with identical settings.
|
|
136
97
|
*
|
|
137
|
-
* @returns
|
|
98
|
+
* @returns New DualFovCamera instance
|
|
138
99
|
* @override
|
|
139
100
|
*/
|
|
140
101
|
clone(): this;
|
package/dist/SceneTraversal.d.ts
CHANGED
|
@@ -1,104 +1,87 @@
|
|
|
1
1
|
import type { Material, Object3D } from "three";
|
|
2
2
|
import { Mesh } from "three";
|
|
3
3
|
/**
|
|
4
|
-
* Constructor type for
|
|
5
|
-
*
|
|
6
|
-
* Represents a constructor function that creates instances of type T.
|
|
7
|
-
* Used for runtime type checking when filtering objects by constructor type.
|
|
4
|
+
* Constructor type for runtime type checking.
|
|
8
5
|
*
|
|
9
6
|
* @template T - The type that the constructor creates
|
|
10
7
|
*/
|
|
11
8
|
export type Constructor<T> = abstract new (...args: never[]) => T;
|
|
12
9
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* Provides static methods for traversing Three.js scene hierarchies,
|
|
16
|
-
* searching for objects or materials, and performing batch operations.
|
|
10
|
+
* Static methods for traversing Three.js scene hierarchies.
|
|
17
11
|
*
|
|
18
|
-
* All methods
|
|
19
|
-
* root object and recursively processing all children.
|
|
12
|
+
* All methods use depth-first traversal.
|
|
20
13
|
*/
|
|
21
14
|
export declare class SceneTraversal {
|
|
22
15
|
/**
|
|
23
|
-
* Finds
|
|
24
|
-
*
|
|
25
|
-
* Performs depth-first search through the scene graph starting from the
|
|
26
|
-
* root object. Returns the first object whose name property matches
|
|
27
|
-
* the search string.
|
|
16
|
+
* Finds first object with exact name match.
|
|
28
17
|
*
|
|
29
|
-
* @param object -
|
|
30
|
-
* @param name -
|
|
31
|
-
* @returns
|
|
18
|
+
* @param object - Root object to start from
|
|
19
|
+
* @param name - Name to search for (case-sensitive)
|
|
20
|
+
* @returns First matching object or null
|
|
32
21
|
*/
|
|
33
22
|
static getObjectByName(object: Object3D, name: string): Object3D | null;
|
|
34
23
|
/**
|
|
35
|
-
* Finds
|
|
24
|
+
* Finds first material with exact name match from mesh objects.
|
|
36
25
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @param object - The root Object3D to start searching from
|
|
42
|
-
* @param name - The exact material name to search for (case-sensitive)
|
|
43
|
-
* @returns The first matching Material, or null if no match is found
|
|
26
|
+
* @param object - Root object to start from
|
|
27
|
+
* @param name - Material name to search for (case-sensitive)
|
|
28
|
+
* @returns First matching material or null
|
|
44
29
|
*/
|
|
45
30
|
static getMaterialByName(object: Object3D, name: string): Material | null;
|
|
46
31
|
/**
|
|
47
|
-
*
|
|
32
|
+
* Executes callback for all objects of specified type.
|
|
48
33
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
34
|
+
* @template T - Type of objects to process
|
|
35
|
+
* @param object - Root object to start from
|
|
36
|
+
* @param type - Constructor to filter by
|
|
37
|
+
* @param callback - Function to execute for each matching object
|
|
38
|
+
*/
|
|
39
|
+
static enumerateObjectsByType<T extends Object3D>(object: Object3D, type: Constructor<T>, callback: (instance: T) => void): void;
|
|
40
|
+
/**
|
|
41
|
+
* Executes callback for all materials of specified type from mesh objects.
|
|
51
42
|
*
|
|
52
|
-
* @template T -
|
|
53
|
-
* @param object -
|
|
54
|
-
* @param type -
|
|
55
|
-
* @param callback - Function to execute for each matching
|
|
43
|
+
* @template T - Type of materials to process
|
|
44
|
+
* @param object - Root object to start from
|
|
45
|
+
* @param type - Constructor to filter by
|
|
46
|
+
* @param callback - Function to execute for each matching material
|
|
56
47
|
*/
|
|
57
|
-
static
|
|
48
|
+
static enumerateMaterialsByType<T extends Material>(object: Object3D, type: Constructor<T>, callback: (material: T) => void): void;
|
|
58
49
|
/**
|
|
59
|
-
*
|
|
50
|
+
* Executes callback for all objects in hierarchy.
|
|
60
51
|
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
|
|
52
|
+
* @param object - Root object to start from
|
|
53
|
+
* @param callback - Function to execute for each object
|
|
54
|
+
*/
|
|
55
|
+
static enumerateObjects(object: Object3D, callback: (object: Object3D) => void): void;
|
|
56
|
+
/**
|
|
57
|
+
* Executes callback for all materials from mesh objects.
|
|
64
58
|
*
|
|
65
|
-
* @param object -
|
|
66
|
-
* @param callback - Function to execute for each material
|
|
59
|
+
* @param object - Root object to start from
|
|
60
|
+
* @param callback - Function to execute for each material
|
|
67
61
|
*/
|
|
68
62
|
static enumerateMaterials(object: Object3D, callback: (material: Material) => void): void;
|
|
69
63
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* Performs depth-first search and collects all objects that either match
|
|
73
|
-
* a regular expression pattern (applied to object names) or satisfy
|
|
74
|
-
* a predicate function.
|
|
64
|
+
* Returns all objects matching filter criteria.
|
|
75
65
|
*
|
|
76
|
-
* @param object -
|
|
77
|
-
* @param filter -
|
|
78
|
-
* @returns Array of
|
|
66
|
+
* @param object - Root object to start from
|
|
67
|
+
* @param filter - RegExp for object names or predicate function
|
|
68
|
+
* @returns Array of matching objects
|
|
79
69
|
*/
|
|
80
70
|
static filterObjects(object: Object3D, filter: RegExp | ((object: Object3D) => boolean)): Object3D[];
|
|
81
71
|
/**
|
|
82
|
-
*
|
|
72
|
+
* Returns all materials matching filter criteria from mesh objects.
|
|
83
73
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* @param object - The root Object3D to start searching from
|
|
89
|
-
* @param name - Regular expression pattern to test against material names
|
|
90
|
-
* @returns Array of all matching Material instances
|
|
74
|
+
* @param object - Root object to start from
|
|
75
|
+
* @param filter - RegExp for material names or predicate function
|
|
76
|
+
* @returns Array of matching materials
|
|
91
77
|
*/
|
|
92
|
-
static filterMaterials(object: Object3D,
|
|
78
|
+
static filterMaterials(object: Object3D, filter: RegExp | ((object: Material) => boolean)): Material[];
|
|
93
79
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* Performs depth-first search through all Mesh objects and collects mesh objects
|
|
97
|
-
* whose materials have names that match the regular expression.
|
|
80
|
+
* Returns all mesh objects that use any of the specified materials.
|
|
98
81
|
*
|
|
99
|
-
* @param object -
|
|
100
|
-
* @param
|
|
101
|
-
* @returns Array of
|
|
82
|
+
* @param object - Root object to start from
|
|
83
|
+
* @param materials - Array of materials to search for
|
|
84
|
+
* @returns Array of mesh objects using the materials
|
|
102
85
|
*/
|
|
103
|
-
static findMaterialUsers(object: Object3D,
|
|
86
|
+
static findMaterialUsers(object: Object3D, materials: Material[]): Mesh[];
|
|
104
87
|
}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import type { AnimationClip, Object3D, SkinnedMesh } from "three";
|
|
2
2
|
import { Mesh } from "three";
|
|
3
|
-
/** Converts skinned meshes to static meshes */
|
|
3
|
+
/** Converts skinned meshes to static meshes. */
|
|
4
4
|
export declare class SkinnedMeshBaker {
|
|
5
5
|
/**
|
|
6
|
-
* Converts
|
|
7
|
-
* The resulting mesh has no bones but looks identical.
|
|
6
|
+
* Converts skinned mesh to static mesh in current pose.
|
|
8
7
|
*
|
|
9
8
|
* @param skinnedMesh - Mesh to convert
|
|
10
|
-
* @returns Static mesh with baked
|
|
9
|
+
* @returns Static mesh with baked positions
|
|
11
10
|
*/
|
|
12
11
|
static bakePose(skinnedMesh: SkinnedMesh): Mesh;
|
|
13
12
|
/**
|
|
14
|
-
* Bakes
|
|
13
|
+
* Bakes animation frame to static mesh.
|
|
15
14
|
*
|
|
16
15
|
* @param armature - Root object with bones
|
|
17
16
|
* @param skinnedMesh - Mesh to convert
|
|
18
|
-
* @param timeOffset - Time in seconds within
|
|
19
|
-
* @param clip - Animation
|
|
20
|
-
* @returns Static mesh with baked
|
|
17
|
+
* @param timeOffset - Time in seconds within animation
|
|
18
|
+
* @param clip - Animation clip for pose
|
|
19
|
+
* @returns Static mesh with baked positions
|
|
21
20
|
*/
|
|
22
21
|
static bakeAnimationFrame(armature: Object3D, skinnedMesh: SkinnedMesh, timeOffset: number, clip: AnimationClip): Mesh;
|
|
23
22
|
}
|
|
@@ -1,67 +1,45 @@
|
|
|
1
1
|
import type { MeshStandardMaterial } from "three";
|
|
2
2
|
import { MeshBasicMaterial } from "three";
|
|
3
3
|
/**
|
|
4
|
-
* Configuration options for
|
|
4
|
+
* Configuration options for material conversion.
|
|
5
5
|
*/
|
|
6
6
|
export interface StandardToBasicConverterOptions {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Preserve original material name.
|
|
9
9
|
* @defaultValue true
|
|
10
10
|
*/
|
|
11
11
|
preserveName: boolean;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Copy user data from original material.
|
|
14
14
|
* @defaultValue true
|
|
15
15
|
*/
|
|
16
16
|
copyUserData: boolean;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Dispose original material after conversion.
|
|
19
19
|
* @defaultValue false
|
|
20
20
|
*/
|
|
21
21
|
disposeOriginal: boolean;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Apply emissive color to base color for brightness compensation.
|
|
24
24
|
* @defaultValue true
|
|
25
25
|
*/
|
|
26
26
|
combineEmissive: boolean;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Brightness adjustment factor to compensate for loss of lighting.
|
|
29
29
|
* @defaultValue 1.3
|
|
30
30
|
*/
|
|
31
31
|
brightnessFactor: number;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Converts
|
|
35
|
-
*
|
|
36
|
-
* Handles translation from PBR StandardMaterial to unlit BasicMaterial.
|
|
37
|
-
* Since BasicMaterial doesn't respond to lighting, applies compensation
|
|
38
|
-
* techniques including brightness adjustments and emissive color combination.
|
|
34
|
+
* Converts MeshStandardMaterial to MeshBasicMaterial with brightness compensation.
|
|
39
35
|
*/
|
|
40
36
|
export declare class StandardToBasicConverter {
|
|
41
37
|
/**
|
|
42
|
-
* Converts
|
|
38
|
+
* Converts MeshStandardMaterial to MeshBasicMaterial.
|
|
43
39
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* @param standardMaterial - The source MeshStandardMaterial to convert
|
|
48
|
-
* @param options - Configuration options for the conversion
|
|
49
|
-
* @returns A new MeshBasicMaterial with properties mapped from the standard material
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* ```typescript
|
|
53
|
-
* const standardMaterial = new MeshStandardMaterial({
|
|
54
|
-
* color: 0x00ff00,
|
|
55
|
-
* metalness: 0.5,
|
|
56
|
-
* emissive: 0x111111,
|
|
57
|
-
* emissiveIntensity: 0.2
|
|
58
|
-
* });
|
|
59
|
-
*
|
|
60
|
-
* const basicMaterial = StandardToBasicConverter.convert(standardMaterial, {
|
|
61
|
-
* brightnessFactor: 1.4,
|
|
62
|
-
* combineEmissive: true
|
|
63
|
-
* });
|
|
64
|
-
* ```
|
|
40
|
+
* @param standardMaterial - Source material to convert
|
|
41
|
+
* @param options - Conversion options
|
|
42
|
+
* @returns New MeshBasicMaterial with mapped properties
|
|
65
43
|
*/
|
|
66
44
|
static convert(standardMaterial: MeshStandardMaterial, options?: Partial<StandardToBasicConverterOptions>): MeshBasicMaterial;
|
|
67
45
|
}
|
|
@@ -1,58 +1,40 @@
|
|
|
1
1
|
import type { MeshStandardMaterial } from "three";
|
|
2
2
|
import { MeshLambertMaterial } from "three";
|
|
3
3
|
/**
|
|
4
|
-
* Configuration options for
|
|
4
|
+
* Configuration options for material conversion.
|
|
5
5
|
*/
|
|
6
6
|
export interface StandardToLambertConverterOptions {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Preserve original material name.
|
|
9
9
|
* @defaultValue true
|
|
10
10
|
*/
|
|
11
11
|
preserveName: boolean;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Copy user data from original material.
|
|
14
14
|
* @defaultValue true
|
|
15
15
|
*/
|
|
16
16
|
copyUserData: boolean;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Dispose original material after conversion.
|
|
19
19
|
* @defaultValue false
|
|
20
20
|
*/
|
|
21
21
|
disposeOriginal: boolean;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Color adjustment factor for roughness compensation.
|
|
24
24
|
* @defaultValue 0.8
|
|
25
25
|
*/
|
|
26
26
|
roughnessColorFactor: number;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Converts
|
|
30
|
-
*
|
|
31
|
-
* Handles translation between PBR properties of StandardMaterial and
|
|
32
|
-
* the Lambertian reflectance model used by LambertMaterial. Applies
|
|
33
|
-
* color compensation based on metalness and roughness values.
|
|
29
|
+
* Converts MeshStandardMaterial to MeshLambertMaterial with PBR compensation.
|
|
34
30
|
*/
|
|
35
31
|
export declare class StandardToLambertConverter {
|
|
36
32
|
/**
|
|
37
|
-
* Converts
|
|
33
|
+
* Converts MeshStandardMaterial to MeshLambertMaterial.
|
|
38
34
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @param material - The source MeshStandardMaterial to convert
|
|
43
|
-
* @param options - Configuration options for the conversion
|
|
44
|
-
* @returns A new MeshLambertMaterial with properties mapped from the standard material
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```typescript
|
|
48
|
-
* const standardMaterial = new MeshStandardMaterial({
|
|
49
|
-
* color: 0xff0000,
|
|
50
|
-
* metalness: 0.8,
|
|
51
|
-
* roughness: 0.2
|
|
52
|
-
* });
|
|
53
|
-
*
|
|
54
|
-
* const lambertMaterial = StandardToLambertConverter.convert(standardMaterial);
|
|
55
|
-
* ```
|
|
35
|
+
* @param material - Source material to convert
|
|
36
|
+
* @param options - Conversion options
|
|
37
|
+
* @returns New MeshLambertMaterial with mapped properties
|
|
56
38
|
*/
|
|
57
39
|
static convert(material: MeshStandardMaterial, options?: Partial<StandardToLambertConverterOptions>): MeshLambertMaterial;
|
|
58
40
|
}
|
package/dist/Sun.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { Texture } from "three";
|
|
2
2
|
import { Box3, DirectionalLight } from "three";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Extends Three.js DirectionalLight to provide spherical coordinate control
|
|
7
|
-
* (distance, elevation, azimuth) and shadow map configuration for bounding boxes.
|
|
8
|
-
* Also supports sun direction calculation from HDR environment maps.
|
|
4
|
+
* Directional light with spherical positioning and HDR environment support.
|
|
9
5
|
*/
|
|
10
6
|
export declare class Sun extends DirectionalLight {
|
|
11
7
|
/** Internal vectors to avoid garbage collection during calculations */
|
|
@@ -20,59 +16,40 @@ export declare class Sun extends DirectionalLight {
|
|
|
20
16
|
private readonly tempBox3;
|
|
21
17
|
private readonly tempSpherical;
|
|
22
18
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @returns The distance in world units
|
|
19
|
+
* @returns Distance from light position to origin
|
|
26
20
|
*/
|
|
27
21
|
get distance(): number;
|
|
28
22
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* @returns The elevation angle in radians (phi angle from Three.js Spherical coordinates)
|
|
23
|
+
* @returns Elevation angle in radians (phi angle)
|
|
32
24
|
*/
|
|
33
25
|
get elevation(): number;
|
|
34
26
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* @returns The azimuth angle in radians (theta angle from Three.js Spherical coordinates)
|
|
27
|
+
* @returns Azimuth angle in radians (theta angle)
|
|
38
28
|
*/
|
|
39
29
|
get azimuth(): number;
|
|
40
30
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* @param value - The new distance in world units
|
|
31
|
+
* @param value - New distance in world units
|
|
44
32
|
*/
|
|
45
33
|
set distance(value: number);
|
|
46
34
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* @param value - The new elevation angle in radians (phi angle for Three.js Spherical coordinates)
|
|
35
|
+
* @param value - New elevation angle in radians (phi angle)
|
|
50
36
|
*/
|
|
51
37
|
set elevation(value: number);
|
|
52
38
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* @param value - The new azimuth angle in radians (theta angle for Three.js Spherical coordinates)
|
|
39
|
+
* @param value - New azimuth angle in radians (theta angle)
|
|
56
40
|
*/
|
|
57
41
|
set azimuth(value: number);
|
|
58
42
|
/**
|
|
59
|
-
* Configures
|
|
43
|
+
* Configures shadow camera frustum to cover bounding box.
|
|
60
44
|
*
|
|
61
|
-
*
|
|
62
|
-
* provided bounding box by transforming box corners to light space and
|
|
63
|
-
* setting camera bounds accordingly.
|
|
64
|
-
*
|
|
65
|
-
* @param box3 - The 3D bounding box to cover with shadows
|
|
45
|
+
* @param box3 - 3D bounding box to cover with shadows
|
|
66
46
|
*/
|
|
67
47
|
configureShadowsForBoundingBox(box3: Box3): void;
|
|
68
48
|
/**
|
|
69
|
-
* Sets
|
|
70
|
-
*
|
|
71
|
-
* Analyzes an HDR texture to find the pixel with the highest luminance value
|
|
72
|
-
* and positions the sun to shine from that direction using spherical coordinates.
|
|
49
|
+
* Sets sun direction based on brightest point in HDR environment map.
|
|
73
50
|
*
|
|
74
|
-
* @param texture -
|
|
75
|
-
* @param distance -
|
|
51
|
+
* @param texture - HDR texture to analyze (must have image data)
|
|
52
|
+
* @param distance - Distance to place sun from origin
|
|
76
53
|
*/
|
|
77
54
|
setDirectionFromHDRTexture(texture: Texture, distance?: number): void;
|
|
78
55
|
}
|