@types/three 0.171.0 → 0.173.0
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.
- three/README.md +1 -1
- three/examples/jsm/Addons.d.ts +0 -5
- three/examples/jsm/controls/ArcballControls.d.ts +1 -1
- three/examples/jsm/controls/OrbitControls.d.ts +5 -0
- three/examples/jsm/csm/CSMShadowNode.d.ts +2 -3
- three/examples/jsm/geometries/TextGeometry.d.ts +0 -8
- three/examples/jsm/helpers/VertexNormalsHelper.d.ts +2 -0
- three/examples/jsm/interactive/InteractiveGroup.d.ts +9 -1
- three/examples/jsm/lines/LineSegments2.d.ts +3 -1
- three/examples/jsm/materials/MeshGouraudMaterial.d.ts +3 -0
- three/examples/jsm/modifiers/CurveModifier.d.ts +1 -1
- three/examples/jsm/modifiers/CurveModifierGPU.d.ts +1 -1
- three/examples/jsm/postprocessing/OutlinePass.d.ts +1 -1
- three/examples/jsm/postprocessing/UnrealBloomPass.d.ts +1 -1
- three/examples/jsm/utils/ShadowMapViewer.d.ts +2 -2
- three/examples/jsm/webxr/XRButton.d.ts +4 -2
- three/package.json +2 -2
- three/src/Three.Core.d.ts +4 -1
- three/src/Three.TSL.d.ts +18 -5
- three/src/Three.WebGPU.Nodes.d.ts +2 -2
- three/src/Three.WebGPU.d.ts +2 -2
- three/src/animation/AnimationClip.d.ts +1 -1
- three/src/cameras/ArrayCamera.d.ts +7 -6
- three/src/cameras/Camera.d.ts +7 -7
- three/src/cameras/CubeCamera.d.ts +19 -2
- three/src/constants.d.ts +6 -0
- three/src/core/BufferAttribute.d.ts +5 -0
- three/src/core/RenderTarget.d.ts +3 -5
- three/src/core/RenderTarget3D.d.ts +9 -0
- three/src/core/RenderTargetArray.d.ts +9 -0
- three/src/materials/Material.d.ts +3 -1
- three/src/materials/MeshDepthMaterial.d.ts +0 -5
- three/src/materials/MeshDistanceMaterial.d.ts +0 -5
- three/src/materials/nodes/Line2NodeMaterial.d.ts +1 -0
- three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +6 -6
- three/src/materials/nodes/NodeMaterial.d.ts +3 -0
- three/src/materials/nodes/NodeMaterials.d.ts +0 -4
- three/src/materials/nodes/PointsNodeMaterial.d.ts +7 -14
- three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +57 -0
- three/src/math/Matrix4.d.ts +2 -1
- three/src/nodes/Nodes.d.ts +6 -7
- three/src/nodes/TSL.d.ts +6 -3
- three/src/nodes/accessors/Arrays.d.ts +10 -2
- three/src/nodes/accessors/BufferAttributeNode.d.ts +117 -0
- three/src/nodes/accessors/BufferNode.d.ts +4 -4
- three/src/nodes/accessors/Camera.d.ts +1 -0
- three/src/nodes/accessors/MaterialNode.d.ts +6 -6
- three/src/nodes/accessors/ModelNode.d.ts +10 -2
- three/src/nodes/accessors/ModelViewProjectionNode.d.ts +2 -6
- three/src/nodes/accessors/StorageBufferNode.d.ts +12 -4
- three/src/nodes/accessors/TextureNode.d.ts +5 -0
- three/src/nodes/accessors/UniformArrayNode.d.ts +3 -2
- three/src/nodes/core/ArrayNode.d.ts +26 -0
- three/src/nodes/core/Node.d.ts +245 -0
- three/src/nodes/core/NodeAttribute.d.ts +13 -0
- three/src/nodes/core/NodeBuilder.d.ts +1 -2
- three/src/nodes/core/NodeCache.d.ts +23 -1
- three/src/nodes/core/NodeParser.d.ts +11 -0
- three/src/nodes/core/NodeUniform.d.ts +28 -0
- three/src/nodes/core/NodeVar.d.ts +18 -2
- three/src/nodes/core/NodeVarying.d.ts +14 -0
- three/src/nodes/core/StructNode.d.ts +21 -0
- three/src/nodes/core/StructType.d.ts +8 -0
- three/src/nodes/core/StructTypeNode.d.ts +41 -4
- three/src/nodes/core/UniformNode.d.ts +44 -0
- three/src/nodes/core/VarNode.d.ts +8 -1
- three/src/nodes/core/VaryingNode.d.ts +12 -0
- three/src/nodes/core/constants.d.ts +35 -0
- three/src/nodes/display/PassNode.d.ts +1 -1
- three/src/nodes/fog/Fog.d.ts +26 -0
- three/src/nodes/geometry/RangeNode.d.ts +6 -11
- three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +5 -0
- three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +1 -0
- three/src/nodes/gpgpu/ComputeNode.d.ts +6 -1
- three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +2 -0
- three/src/nodes/lighting/ShadowBaseNode.d.ts +15 -0
- three/src/nodes/lighting/ShadowNode.d.ts +2 -1
- three/src/nodes/math/MathNode.d.ts +15 -4
- three/src/nodes/math/OperatorNode.d.ts +2 -0
- three/src/nodes/shapes/Shapes.d.ts +4 -0
- three/src/nodes/tsl/TSLBase.d.ts +1 -0
- three/src/nodes/tsl/TSLCore.d.ts +62 -17
- three/src/nodes/utils/EquirectUVNode.d.ts +2 -2
- three/src/nodes/utils/LoopNode.d.ts +23 -2
- three/src/nodes/utils/MemberNode.d.ts +11 -0
- three/src/objects/BatchedMesh.d.ts +1 -0
- three/src/objects/ClippingGroup.d.ts +1 -1
- three/src/objects/InstancedMesh.d.ts +4 -3
- three/src/renderers/WebGLRenderer.d.ts +10 -10
- three/src/renderers/common/Animation.d.ts +43 -1
- three/src/renderers/common/Attributes.d.ts +31 -0
- three/src/renderers/common/Backend.d.ts +11 -0
- three/src/renderers/common/Background.d.ts +22 -0
- three/src/renderers/common/BindGroup.d.ts +15 -0
- three/src/renderers/common/Binding.d.ts +24 -0
- three/src/renderers/common/Bindings.d.ts +54 -0
- three/src/renderers/common/Buffer.d.ts +31 -0
- three/src/renderers/common/BufferUtils.d.ts +26 -0
- three/src/renderers/common/BundleGroup.d.ts +22 -0
- three/src/renderers/common/ChainMap.d.ts +33 -3
- three/src/renderers/common/ClippingContext.d.ts +45 -0
- three/src/renderers/common/Color4.d.ts +40 -0
- three/src/renderers/common/ComputePipeline.d.ts +12 -0
- three/src/renderers/common/CubeRenderTarget.d.ts +13 -0
- three/src/renderers/common/DataMap.d.ts +30 -0
- three/src/renderers/common/Geometries.d.ts +52 -0
- three/src/renderers/common/Info.d.ts +21 -5
- three/src/renderers/common/Pipeline.d.ts +11 -0
- three/src/renderers/common/Pipelines.d.ts +104 -0
- three/src/renderers/common/PostProcessing.d.ts +1 -1
- three/src/renderers/common/ProgrammableStage.d.ts +19 -1
- three/src/renderers/common/RenderBundle.d.ts +15 -4
- three/src/renderers/common/RenderBundles.d.ts +20 -2
- three/src/renderers/common/RenderContext.d.ts +27 -3
- three/src/renderers/common/RenderContexts.d.ts +37 -6
- three/src/renderers/common/RenderList.d.ts +85 -0
- three/src/renderers/common/RenderLists.d.ts +21 -0
- three/src/renderers/common/RenderObject.d.ts +163 -4
- three/src/renderers/common/RenderObjects.d.ts +53 -0
- three/src/renderers/common/RenderPipeline.d.ts +13 -0
- three/src/renderers/common/Renderer.d.ts +604 -10
- three/src/renderers/common/{PostProcessingUtils.d.ts → RendererUtils.d.ts} +16 -4
- three/src/renderers/common/StorageBufferAttribute.d.ts +1 -1
- three/src/renderers/common/Textures.d.ts +66 -0
- three/src/renderers/common/TimestampQueryPool.d.ts +31 -0
- three/src/renderers/common/Uniform.d.ts +133 -1
- three/src/renderers/common/UniformBuffer.d.ts +12 -0
- three/src/renderers/common/UniformsGroup.d.ts +103 -0
- three/src/renderers/common/XRManager.d.ts +196 -0
- three/src/renderers/common/XRRenderTarget.d.ts +23 -0
- three/src/renderers/common/nodes/NodeBuilderState.d.ts +32 -2
- three/src/renderers/common/nodes/NodeLibrary.d.ts +71 -0
- three/src/renderers/common/nodes/NodeUniform.d.ts +185 -0
- three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +14 -2
- three/src/renderers/common/nodes/Nodes.d.ts +192 -17
- three/src/renderers/webgpu/WebGPUBackend.d.ts +2 -1
- three/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +10 -0
- three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +11 -0
- three/src/textures/DataTexture.d.ts +2 -2
- three/src/textures/Texture.d.ts +5 -5
- three/src/textures/VideoFrameTexture.d.ts +27 -0
- three/examples/jsm/animation/MMDAnimationHelper.d.ts +0 -99
- three/examples/jsm/animation/MMDPhysics.d.ts +0 -128
- three/examples/jsm/exporters/MMDExporter.d.ts +0 -11
- three/examples/jsm/loaders/MMDLoader.d.ts +0 -60
- three/examples/jsm/shaders/MMDToonShader.d.ts +0 -15
- three/src/Three.Legacy.d.ts +0 -20
- three/src/materials/nodes/InstancedPointsNodeMaterial.d.ts +0 -33
- three/src/nodes/core/UniformGroup.d.ts +0 -7
- three/src/nodes/fog/FogExp2Node.d.ts +0 -14
- three/src/nodes/fog/FogNode.d.ts +0 -20
- three/src/nodes/fog/FogRangeNode.d.ts +0 -19
|
@@ -6,6 +6,7 @@ import { RenderTarget } from "../../core/RenderTarget.js";
|
|
|
6
6
|
import { Material } from "../../materials/Material.js";
|
|
7
7
|
import { Color } from "../../math/Color.js";
|
|
8
8
|
import MRTNode from "../../nodes/core/MRTNode.js";
|
|
9
|
+
import Node from "../../nodes/core/Node.js";
|
|
9
10
|
import LightsNode from "../../nodes/lighting/LightsNode.js";
|
|
10
11
|
import { Scene } from "../../scenes/Scene.js";
|
|
11
12
|
import { CubeTexture } from "../../textures/CubeTexture.js";
|
|
@@ -43,24 +44,35 @@ export interface RendererState {
|
|
|
43
44
|
|
|
44
45
|
export function saveRendererState(renderer: Renderer, state?: RendererState): RendererState;
|
|
45
46
|
|
|
46
|
-
export function resetRendererState(renderer: Renderer, state
|
|
47
|
+
export function resetRendererState(renderer: Renderer, state: RendererState): RendererState;
|
|
47
48
|
|
|
48
49
|
export function restoreRendererState(renderer: Renderer, state: RendererState): void;
|
|
49
50
|
|
|
50
|
-
//
|
|
51
|
+
// scene state
|
|
51
52
|
|
|
52
|
-
export interface
|
|
53
|
+
export interface SceneState {
|
|
53
54
|
background: Color | Texture | CubeTexture | null;
|
|
54
55
|
backgroundNode: Node | null | undefined;
|
|
55
56
|
overrideMaterial: Material | null;
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
export function saveSceneState(scene: Scene, state?: SceneState): SceneState;
|
|
60
|
+
|
|
61
|
+
export function resetSceneState(scene: Scene, state: SceneState): SceneState;
|
|
62
|
+
|
|
63
|
+
export function restoreSceneState(scene: Scene, state: SceneState): SceneState;
|
|
64
|
+
|
|
65
|
+
// renderer and scene state
|
|
66
|
+
|
|
67
|
+
export interface RendererAndSceneState extends RendererState, SceneState {
|
|
68
|
+
}
|
|
69
|
+
|
|
58
70
|
export function saveRendererAndSceneState(
|
|
59
71
|
renderer: RendererState,
|
|
60
72
|
scene: Scene,
|
|
61
73
|
state?: RendererAndSceneState,
|
|
62
74
|
): RendererAndSceneState;
|
|
63
75
|
|
|
64
|
-
export function resetRendererAndSceneState(renderer: Renderer, state
|
|
76
|
+
export function resetRendererAndSceneState(renderer: Renderer, state: RendererAndSceneState): RendererAndSceneState;
|
|
65
77
|
|
|
66
78
|
export function restoreRendererAndSceneState(renderer: Renderer, state: RendererAndSceneState): void;
|
|
@@ -3,5 +3,5 @@ import { BufferAttribute, TypedArray } from "../../core/BufferAttribute.js";
|
|
|
3
3
|
export default class StorageBufferAttribute extends BufferAttribute {
|
|
4
4
|
readonly isStorageBufferAttribute: true;
|
|
5
5
|
|
|
6
|
-
constructor(array: TypedArray, itemSize: number);
|
|
6
|
+
constructor(array: TypedArray | number, itemSize: number);
|
|
7
7
|
}
|
|
@@ -43,6 +43,12 @@ interface TextureOptions {
|
|
|
43
43
|
needsMipmaps?: boolean;
|
|
44
44
|
levels?: number;
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* This module manages the textures of the renderer.
|
|
48
|
+
*
|
|
49
|
+
* @private
|
|
50
|
+
* @augments DataMap
|
|
51
|
+
*/
|
|
46
52
|
declare class Textures extends DataMap<{
|
|
47
53
|
renderTarget: {
|
|
48
54
|
key: RenderTarget;
|
|
@@ -56,13 +62,73 @@ declare class Textures extends DataMap<{
|
|
|
56
62
|
renderer: Renderer;
|
|
57
63
|
backend: Backend;
|
|
58
64
|
info: Info;
|
|
65
|
+
/**
|
|
66
|
+
* Constructs a new texture management component.
|
|
67
|
+
*
|
|
68
|
+
* @param {Renderer} renderer - The renderer.
|
|
69
|
+
* @param {Backend} backend - The renderer's backend.
|
|
70
|
+
* @param {Info} info - Renderer component for managing metrics and monitoring data.
|
|
71
|
+
*/
|
|
59
72
|
constructor(renderer: Renderer, backend: Backend, info: Info);
|
|
73
|
+
/**
|
|
74
|
+
* Updates the given render target. Based on the given render target configuration,
|
|
75
|
+
* it updates the texture states representing the attachments of the framebuffer.
|
|
76
|
+
*
|
|
77
|
+
* @param {RenderTarget} renderTarget - The render target to update.
|
|
78
|
+
* @param {Number} [activeMipmapLevel=0] - The active mipmap level.
|
|
79
|
+
*/
|
|
60
80
|
updateRenderTarget(renderTarget: RenderTarget, activeMipmapLevel?: number): void;
|
|
81
|
+
/**
|
|
82
|
+
* Updates the given texture. Depending on the texture state, this method
|
|
83
|
+
* triggers the upload of texture data to the GPU memory. If the texture data are
|
|
84
|
+
* not yet ready for the upload, it uses default texture data for as a placeholder.
|
|
85
|
+
*
|
|
86
|
+
* @param {Texture} texture - The texture to update.
|
|
87
|
+
* @param {Object} [options={}] - The options.
|
|
88
|
+
*/
|
|
61
89
|
updateTexture(texture: Texture, options?: TextureOptions): void;
|
|
90
|
+
/**
|
|
91
|
+
* Computes the size of the given texture and writes the result
|
|
92
|
+
* into the target vector. This vector is also returned by the
|
|
93
|
+
* method.
|
|
94
|
+
*
|
|
95
|
+
* If no texture data are available for the compute yet, the method
|
|
96
|
+
* returns default size values.
|
|
97
|
+
*
|
|
98
|
+
* @param {Texture} texture - The texture to compute the size for.
|
|
99
|
+
* @param {Vector3} target - The target vector.
|
|
100
|
+
* @return {Vector3} The target vector.
|
|
101
|
+
*/
|
|
62
102
|
getSize(texture: Texture, target?: SizeVector3Unitialized): SizeVector3;
|
|
103
|
+
/**
|
|
104
|
+
* Computes the number of mipmap levels for the given texture.
|
|
105
|
+
*
|
|
106
|
+
* @param {Texture} texture - The texture.
|
|
107
|
+
* @param {Number} width - The texture's width.
|
|
108
|
+
* @param {Number} height - The texture's height.
|
|
109
|
+
* @return {Number} The number of mipmap levels.
|
|
110
|
+
*/
|
|
63
111
|
getMipLevels(texture: Texture, width: number, height: number): number;
|
|
112
|
+
/**
|
|
113
|
+
* Returns `true` if the given texture requires mipmaps.
|
|
114
|
+
*
|
|
115
|
+
* @param {Texture} texture - The texture.
|
|
116
|
+
* @return {Boolean} Whether mipmaps are required or not.
|
|
117
|
+
*/
|
|
64
118
|
needsMipmaps(texture: Texture): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Returns `true` if the given texture is an environment map.
|
|
121
|
+
*
|
|
122
|
+
* @param {Texture} texture - The texture.
|
|
123
|
+
* @return {Boolean} Whether the given texture is an environment map or not.
|
|
124
|
+
*/
|
|
65
125
|
isEnvironmentTexture(texture: Texture): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Frees internal resource when the given texture isn't
|
|
128
|
+
* required anymore.
|
|
129
|
+
*
|
|
130
|
+
* @param {Texture} texture - The texture to destroy.
|
|
131
|
+
*/
|
|
66
132
|
_destroyTexture(texture: Texture): void;
|
|
67
133
|
}
|
|
68
134
|
export default Textures;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import RenderContext from "./RenderContext.js";
|
|
2
|
+
declare abstract class TimestampQueryPool {
|
|
3
|
+
trackTimestamp: boolean;
|
|
4
|
+
maxQueries: number;
|
|
5
|
+
currentQueryIndex: number;
|
|
6
|
+
queryOffsets: Map<number, number>;
|
|
7
|
+
isDisposed: boolean;
|
|
8
|
+
lastValue: number;
|
|
9
|
+
pendingResolve: boolean;
|
|
10
|
+
constructor(maxQueries?: number);
|
|
11
|
+
/**
|
|
12
|
+
* Allocate queries for a specific renderContext.
|
|
13
|
+
*
|
|
14
|
+
* @abstract
|
|
15
|
+
*/
|
|
16
|
+
abstract allocateQueriesForContext(renderContext: RenderContext): number | null;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve all timestamps and return data (or process them).
|
|
19
|
+
*
|
|
20
|
+
* @abstract
|
|
21
|
+
* @returns {Promise<Number>|Number} The resolved timestamp value.
|
|
22
|
+
*/
|
|
23
|
+
abstract resolveQueriesAsync(): Promise<number>;
|
|
24
|
+
/**
|
|
25
|
+
* Dispose of the query pool.
|
|
26
|
+
*
|
|
27
|
+
* @abstract
|
|
28
|
+
*/
|
|
29
|
+
abstract dispose(): void;
|
|
30
|
+
}
|
|
31
|
+
export default TimestampQueryPool;
|
|
@@ -1,45 +1,177 @@
|
|
|
1
1
|
import { Color } from "../../math/Color.js";
|
|
2
|
+
import { Matrix2 } from "../../math/Matrix2.js";
|
|
2
3
|
import { Matrix3 } from "../../math/Matrix3.js";
|
|
3
4
|
import { Matrix4 } from "../../math/Matrix4.js";
|
|
4
5
|
import { Vector2 } from "../../math/Vector2.js";
|
|
5
6
|
import { Vector3 } from "../../math/Vector3.js";
|
|
6
7
|
import { Vector4 } from "../../math/Vector4.js";
|
|
8
|
+
/**
|
|
9
|
+
* Abstract base class for uniforms.
|
|
10
|
+
*
|
|
11
|
+
* @abstract
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
7
14
|
declare class Uniform<TValue> {
|
|
8
15
|
name: string;
|
|
9
16
|
value: TValue;
|
|
10
17
|
boundary: number;
|
|
11
18
|
itemSize: number;
|
|
12
19
|
offset: number;
|
|
20
|
+
/**
|
|
21
|
+
* Constructs a new uniform.
|
|
22
|
+
*
|
|
23
|
+
* @param {String} name - The uniform's name.
|
|
24
|
+
* @param {Any} value - The uniform's value.
|
|
25
|
+
*/
|
|
13
26
|
constructor(name: string, value: TValue);
|
|
27
|
+
/**
|
|
28
|
+
* Sets the uniform's value.
|
|
29
|
+
*
|
|
30
|
+
* @param {Any} value - The value to set.
|
|
31
|
+
*/
|
|
14
32
|
setValue(value: TValue): void;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the uniform's value.
|
|
35
|
+
*
|
|
36
|
+
* @return {Any} The value.
|
|
37
|
+
*/
|
|
15
38
|
getValue(): TValue;
|
|
16
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Represents a Number uniform.
|
|
42
|
+
*
|
|
43
|
+
* @private
|
|
44
|
+
* @augments Uniform
|
|
45
|
+
*/
|
|
17
46
|
declare class NumberUniform extends Uniform<number> {
|
|
18
47
|
readonly isNumberUniform: true;
|
|
48
|
+
/**
|
|
49
|
+
* Constructs a new Number uniform.
|
|
50
|
+
*
|
|
51
|
+
* @param {String} name - The uniform's name.
|
|
52
|
+
* @param {Number} value - The uniform's value.
|
|
53
|
+
*/
|
|
19
54
|
constructor(name: string, value?: number);
|
|
20
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Represents a Vector2 uniform.
|
|
58
|
+
*
|
|
59
|
+
* @private
|
|
60
|
+
* @augments Uniform
|
|
61
|
+
*/
|
|
21
62
|
declare class Vector2Uniform extends Uniform<Vector2> {
|
|
22
63
|
readonly isVector2Uniform: true;
|
|
64
|
+
/**
|
|
65
|
+
* Constructs a new Number uniform.
|
|
66
|
+
*
|
|
67
|
+
* @param {String} name - The uniform's name.
|
|
68
|
+
* @param {Vector2} value - The uniform's value.
|
|
69
|
+
*/
|
|
23
70
|
constructor(name: string, value?: Vector2);
|
|
24
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Represents a Vector3 uniform.
|
|
74
|
+
*
|
|
75
|
+
* @private
|
|
76
|
+
* @augments Uniform
|
|
77
|
+
*/
|
|
25
78
|
declare class Vector3Uniform extends Uniform<Vector3> {
|
|
26
79
|
readonly isVector3Uniform: true;
|
|
80
|
+
/**
|
|
81
|
+
* Constructs a new Number uniform.
|
|
82
|
+
*
|
|
83
|
+
* @param {String} name - The uniform's name.
|
|
84
|
+
* @param {Vector3} value - The uniform's value.
|
|
85
|
+
*/
|
|
27
86
|
constructor(name: string, value?: Vector3);
|
|
28
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Represents a Vector4 uniform.
|
|
90
|
+
*
|
|
91
|
+
* @private
|
|
92
|
+
* @augments Uniform
|
|
93
|
+
*/
|
|
29
94
|
declare class Vector4Uniform extends Uniform<Vector4> {
|
|
30
95
|
readonly isVector4Uniform: true;
|
|
96
|
+
/**
|
|
97
|
+
* Constructs a new Number uniform.
|
|
98
|
+
*
|
|
99
|
+
* @param {String} name - The uniform's name.
|
|
100
|
+
* @param {Vector4} value - The uniform's value.
|
|
101
|
+
*/
|
|
31
102
|
constructor(name: string, value?: Vector4);
|
|
32
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Represents a Color uniform.
|
|
106
|
+
*
|
|
107
|
+
* @private
|
|
108
|
+
* @augments Uniform
|
|
109
|
+
*/
|
|
33
110
|
declare class ColorUniform extends Uniform<Color> {
|
|
34
111
|
readonly isColorUniform: true;
|
|
112
|
+
/**
|
|
113
|
+
* Constructs a new Number uniform.
|
|
114
|
+
*
|
|
115
|
+
* @param {String} name - The uniform's name.
|
|
116
|
+
* @param {Color} value - The uniform's value.
|
|
117
|
+
*/
|
|
35
118
|
constructor(name: string, value?: Color);
|
|
36
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Represents a Matrix2 uniform.
|
|
122
|
+
*
|
|
123
|
+
* @private
|
|
124
|
+
* @augments Uniform
|
|
125
|
+
*/
|
|
126
|
+
declare class Matrix2Uniform extends Uniform<Matrix2> {
|
|
127
|
+
readonly isMatrix2Uniform: true;
|
|
128
|
+
/**
|
|
129
|
+
* Constructs a new Number uniform.
|
|
130
|
+
*
|
|
131
|
+
* @param {String} name - The uniform's name.
|
|
132
|
+
* @param {Matrix2} value - The uniform's value.
|
|
133
|
+
*/
|
|
134
|
+
constructor(name: string, value?: Matrix2);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Represents a Matrix3 uniform.
|
|
138
|
+
*
|
|
139
|
+
* @private
|
|
140
|
+
* @augments Uniform
|
|
141
|
+
*/
|
|
37
142
|
declare class Matrix3Uniform extends Uniform<Matrix3> {
|
|
38
143
|
readonly isMatrix3Uniform: true;
|
|
144
|
+
/**
|
|
145
|
+
* Constructs a new Number uniform.
|
|
146
|
+
*
|
|
147
|
+
* @param {String} name - The uniform's name.
|
|
148
|
+
* @param {Matrix3} value - The uniform's value.
|
|
149
|
+
*/
|
|
39
150
|
constructor(name: string, value?: Matrix3);
|
|
40
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Represents a Matrix4 uniform.
|
|
154
|
+
*
|
|
155
|
+
* @private
|
|
156
|
+
* @augments Uniform
|
|
157
|
+
*/
|
|
41
158
|
declare class Matrix4Uniform extends Uniform<Matrix4> {
|
|
42
159
|
readonly isMatrix4Uniform: true;
|
|
160
|
+
/**
|
|
161
|
+
* Constructs a new Number uniform.
|
|
162
|
+
*
|
|
163
|
+
* @param {String} name - The uniform's name.
|
|
164
|
+
* @param {Matrix4} value - The uniform's value.
|
|
165
|
+
*/
|
|
43
166
|
constructor(name: string, value?: Matrix4);
|
|
44
167
|
}
|
|
45
|
-
export {
|
|
168
|
+
export {
|
|
169
|
+
ColorUniform,
|
|
170
|
+
Matrix2Uniform,
|
|
171
|
+
Matrix3Uniform,
|
|
172
|
+
Matrix4Uniform,
|
|
173
|
+
NumberUniform,
|
|
174
|
+
Vector2Uniform,
|
|
175
|
+
Vector3Uniform,
|
|
176
|
+
Vector4Uniform,
|
|
177
|
+
};
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import Buffer from "./Buffer.js";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a uniform buffer binding type.
|
|
4
|
+
*
|
|
5
|
+
* @private
|
|
6
|
+
* @augments Buffer
|
|
7
|
+
*/
|
|
2
8
|
declare class UniformBuffer extends Buffer {
|
|
3
9
|
readonly isUniformBuffer: true;
|
|
10
|
+
/**
|
|
11
|
+
* Constructs a new uniform buffer.
|
|
12
|
+
*
|
|
13
|
+
* @param {String} name - The buffer's name.
|
|
14
|
+
* @param {TypedArray} [buffer=null] - The buffer.
|
|
15
|
+
*/
|
|
4
16
|
constructor(name?: string, buffer?: null);
|
|
5
17
|
}
|
|
6
18
|
export default UniformBuffer;
|
|
@@ -9,25 +9,128 @@ import {
|
|
|
9
9
|
Vector4NodeUniform,
|
|
10
10
|
} from "./nodes/NodeUniform.js";
|
|
11
11
|
import UniformBuffer from "./UniformBuffer.js";
|
|
12
|
+
/**
|
|
13
|
+
* This class represents a uniform buffer binding but with
|
|
14
|
+
* an API that allows to maintain individual uniform objects.
|
|
15
|
+
*
|
|
16
|
+
* @private
|
|
17
|
+
* @augments UniformBuffer
|
|
18
|
+
*/
|
|
12
19
|
declare class UniformsGroup extends UniformBuffer {
|
|
13
20
|
readonly isUniformsGroup: true;
|
|
14
21
|
_values: number[] | null;
|
|
15
22
|
uniforms: NodeUniformGPU[];
|
|
23
|
+
/**
|
|
24
|
+
* Constructs a new uniforms group.
|
|
25
|
+
*
|
|
26
|
+
* @param {String} name - The group's name.
|
|
27
|
+
*/
|
|
16
28
|
constructor(name?: string);
|
|
29
|
+
/**
|
|
30
|
+
* Adds a uniform to this group.
|
|
31
|
+
*
|
|
32
|
+
* @param {Uniform} uniform - The uniform to add.
|
|
33
|
+
* @return {UniformsGroup} A reference to this group.
|
|
34
|
+
*/
|
|
17
35
|
addUniform(uniform: NodeUniformGPU): this;
|
|
36
|
+
/**
|
|
37
|
+
* Removes a uniform from this group.
|
|
38
|
+
*
|
|
39
|
+
* @param {Uniform} uniform - The uniform to remove.
|
|
40
|
+
* @return {UniformsGroup} A reference to this group.
|
|
41
|
+
*/
|
|
18
42
|
removeUniform(uniform: NodeUniformGPU): this;
|
|
43
|
+
/**
|
|
44
|
+
* An array with the raw uniform values.
|
|
45
|
+
*
|
|
46
|
+
* @type {Array<Number>}
|
|
47
|
+
*/
|
|
19
48
|
get values(): number[];
|
|
49
|
+
/**
|
|
50
|
+
* A Float32 array buffer with the uniform values.
|
|
51
|
+
*
|
|
52
|
+
* @type {Float32Array}
|
|
53
|
+
*/
|
|
20
54
|
get buffer(): Float32Array;
|
|
55
|
+
/**
|
|
56
|
+
* The byte length of the buffer with correct buffer alignment.
|
|
57
|
+
*
|
|
58
|
+
* @type {Number}
|
|
59
|
+
*/
|
|
21
60
|
get byteLength(): number;
|
|
61
|
+
/**
|
|
62
|
+
* Updates this group by updating each uniform object of
|
|
63
|
+
* the internal uniform list. The uniform objects check if their
|
|
64
|
+
* values has actually changed so this method only returns
|
|
65
|
+
* `true` if there is a real value change.
|
|
66
|
+
*
|
|
67
|
+
* @return {Boolean} Whether the uniforms have been updated and
|
|
68
|
+
* must be uploaded to the GPU.
|
|
69
|
+
*/
|
|
22
70
|
update(): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Updates a given uniform by calling an update method matching
|
|
73
|
+
* the uniforms type.
|
|
74
|
+
*
|
|
75
|
+
* @param {Uniform} uniform - The uniform to update.
|
|
76
|
+
* @return {Boolean} Whether the uniform has been updated or not.
|
|
77
|
+
*/
|
|
23
78
|
updateByType(uniform: NodeUniformGPU): boolean | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Updates a given Number uniform.
|
|
81
|
+
*
|
|
82
|
+
* @param {NumberUniform} uniform - The Number uniform.
|
|
83
|
+
* @return {Boolean} Whether the uniform has been updated or not.
|
|
84
|
+
*/
|
|
24
85
|
updateNumber(uniform: NumberNodeUniform): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Updates a given Vector2 uniform.
|
|
88
|
+
*
|
|
89
|
+
* @param {Vector2Uniform} uniform - The Vector2 uniform.
|
|
90
|
+
* @return {Boolean} Whether the uniform has been updated or not.
|
|
91
|
+
*/
|
|
25
92
|
updateVector2(uniform: Vector2NodeUniform): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Updates a given Vector3 uniform.
|
|
95
|
+
*
|
|
96
|
+
* @param {Vector3Uniform} uniform - The Vector3 uniform.
|
|
97
|
+
* @return {Boolean} Whether the uniform has been updated or not.
|
|
98
|
+
*/
|
|
26
99
|
updateVector3(uniform: Vector3NodeUniform): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Updates a given Vector4 uniform.
|
|
102
|
+
*
|
|
103
|
+
* @param {Vector4Uniform} uniform - The Vector4 uniform.
|
|
104
|
+
* @return {Boolean} Whether the uniform has been updated or not.
|
|
105
|
+
*/
|
|
27
106
|
updateVector4(uniform: Vector4NodeUniform): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Updates a given Color uniform.
|
|
109
|
+
*
|
|
110
|
+
* @param {ColorUniform} uniform - The Color uniform.
|
|
111
|
+
* @return {Boolean} Whether the uniform has been updated or not.
|
|
112
|
+
*/
|
|
28
113
|
updateColor(uniform: ColorNodeUniform): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Updates a given Matrix3 uniform.
|
|
116
|
+
*
|
|
117
|
+
* @param {Matrix3Uniform} uniform - The Matrix3 uniform.
|
|
118
|
+
* @return {Boolean} Whether the uniform has been updated or not.
|
|
119
|
+
*/
|
|
29
120
|
updateMatrix3(uniform: Matrix3NodeUniform): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Updates a given Matrix4 uniform.
|
|
123
|
+
*
|
|
124
|
+
* @param {Matrix4Uniform} uniform - The Matrix4 uniform.
|
|
125
|
+
* @return {Boolean} Whether the uniform has been updated or not.
|
|
126
|
+
*/
|
|
30
127
|
updateMatrix4(uniform: Matrix4NodeUniform): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Returns a typed array that matches the given data type.
|
|
130
|
+
*
|
|
131
|
+
* @param {String} type - The data type.
|
|
132
|
+
* @return {TypedArray} The typed array.
|
|
133
|
+
*/
|
|
31
134
|
_getBufferForType(type: string | null): Int32Array | Uint32Array | Float32Array;
|
|
32
135
|
}
|
|
33
136
|
export default UniformsGroup;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { ArrayCamera } from "../../cameras/ArrayCamera.js";
|
|
2
|
+
import { PerspectiveCamera } from "../../cameras/PerspectiveCamera.js";
|
|
3
|
+
import { EventDispatcher } from "../../core/EventDispatcher.js";
|
|
4
|
+
import { RenderTarget } from "../../core/RenderTarget.js";
|
|
5
|
+
import { Vector2 } from "../../math/Vector2.js";
|
|
6
|
+
import { WebXRController } from "../webxr/WebXRController.js";
|
|
7
|
+
import { AnimationContext } from "./Animation.js";
|
|
8
|
+
import Renderer from "./Renderer.js";
|
|
9
|
+
import { XRRenderTarget } from "./XRRenderTarget.js";
|
|
10
|
+
export interface XRManagerEventMap {
|
|
11
|
+
sessionstart: {};
|
|
12
|
+
sessionend: {};
|
|
13
|
+
planesdetected: {
|
|
14
|
+
data: XRFrame;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The XR manager is built on top of the WebXR Device API to
|
|
19
|
+
* manage XR sessions with `WebGPURenderer`.
|
|
20
|
+
*
|
|
21
|
+
* XR is currently only supported with a WebGL 2 backend.
|
|
22
|
+
*
|
|
23
|
+
* @augments EventDispatcher
|
|
24
|
+
*/
|
|
25
|
+
declare class XRManager extends EventDispatcher<XRManagerEventMap> {
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
isPresenting: boolean;
|
|
28
|
+
cameraAutoUpdate: boolean;
|
|
29
|
+
_renderer: Renderer;
|
|
30
|
+
_cameraL: PerspectiveCamera;
|
|
31
|
+
_cameraR: PerspectiveCamera;
|
|
32
|
+
_cameras: PerspectiveCamera[];
|
|
33
|
+
_cameraXR: ArrayCamera;
|
|
34
|
+
_currentDepthNear: number | null;
|
|
35
|
+
_currentDepthFar: number | null;
|
|
36
|
+
_controllers: WebXRController[];
|
|
37
|
+
_controllerInputSources: (XRInputSource | null)[];
|
|
38
|
+
_currentRenderTarget: RenderTarget | null;
|
|
39
|
+
_xrRenderTarget: XRRenderTarget | null;
|
|
40
|
+
_currentAnimationContext: AnimationContext | null;
|
|
41
|
+
_currentAnimationLoop: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
|
|
42
|
+
_currentPixelRatio: number | null;
|
|
43
|
+
_currentSize: Vector2;
|
|
44
|
+
_onSessionEvent: (event: XRInputSourceEvent) => void;
|
|
45
|
+
_onSessionEnd: () => void;
|
|
46
|
+
_onInputSourcesChange: (event: XRInputSourcesChangeEvent) => void;
|
|
47
|
+
_onAnimationFrame: (time: DOMHighResTimeStamp, frame?: XRFrame) => void;
|
|
48
|
+
_referenceSpace: XRReferenceSpace | null;
|
|
49
|
+
_referenceSpaceType: XRReferenceSpaceType;
|
|
50
|
+
_customReferenceSpace: XRReferenceSpace | null;
|
|
51
|
+
_framebufferScaleFactor: number;
|
|
52
|
+
_foveation: number;
|
|
53
|
+
_session: XRSession | null;
|
|
54
|
+
_glBaseLayer: XRWebGLLayer | null;
|
|
55
|
+
_glBinding: XRWebGLBinding | null;
|
|
56
|
+
_glProjLayer: XRProjectionLayer | null;
|
|
57
|
+
_xrFrame: XRFrame | null;
|
|
58
|
+
_useLayers: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Constructs a new XR manager.
|
|
61
|
+
*
|
|
62
|
+
* @param {Renderer} renderer - The renderer.
|
|
63
|
+
*/
|
|
64
|
+
constructor(renderer: Renderer);
|
|
65
|
+
/**
|
|
66
|
+
* Returns an instance of `THREE.Group` that represents the transformation
|
|
67
|
+
* of a XR controller in target ray space. The requested controller is defined
|
|
68
|
+
* by the given index.
|
|
69
|
+
*
|
|
70
|
+
* @param {Number} index - The index of the XR controller.
|
|
71
|
+
* @return {Group} A group that represents the controller's transformation.
|
|
72
|
+
*/
|
|
73
|
+
getController(index: number): import("../webxr/WebXRController.js").XRTargetRaySpace;
|
|
74
|
+
/**
|
|
75
|
+
* Returns an instance of `THREE.Group` that represents the transformation
|
|
76
|
+
* of a XR controller in grip space. The requested controller is defined
|
|
77
|
+
* by the given index.
|
|
78
|
+
*
|
|
79
|
+
* @param {Number} index - The index of the XR controller.
|
|
80
|
+
* @return {Group} A group that represents the controller's transformation.
|
|
81
|
+
*/
|
|
82
|
+
getControllerGrip(index: number): import("../webxr/WebXRController.js").XRGripSpace;
|
|
83
|
+
/**
|
|
84
|
+
* Returns an instance of `THREE.Group` that represents the transformation
|
|
85
|
+
* of a XR controller in hand space. The requested controller is defined
|
|
86
|
+
* by the given index.
|
|
87
|
+
*
|
|
88
|
+
* @param {Number} index - The index of the XR controller.
|
|
89
|
+
* @return {Group} A group that represents the controller's transformation.
|
|
90
|
+
*/
|
|
91
|
+
getHand(index: number): import("../webxr/WebXRController.js").XRHandSpace;
|
|
92
|
+
/**
|
|
93
|
+
* Returns the foveation value.
|
|
94
|
+
*
|
|
95
|
+
* @return {Number|undefined} The foveation value. Returns `undefined` if no base or projection layer is defined.
|
|
96
|
+
*/
|
|
97
|
+
getFoveation(): number | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Sets the foveation value.
|
|
100
|
+
*
|
|
101
|
+
* @param {Number} foveation - A number in the range `[0,1]` where `0` means no foveation (full resolution)
|
|
102
|
+
* and `1` means maximum foveation (the edges render at lower resolution).
|
|
103
|
+
*/
|
|
104
|
+
setFoveation(foveation: number): void;
|
|
105
|
+
/**
|
|
106
|
+
* Returns the framebuffer scale factor.
|
|
107
|
+
*
|
|
108
|
+
* @return {Number} The framebuffer scale factor.
|
|
109
|
+
*/
|
|
110
|
+
getFramebufferScaleFactor(): number;
|
|
111
|
+
/**
|
|
112
|
+
* Sets the framebuffer scale factor.
|
|
113
|
+
*
|
|
114
|
+
* This method can not be used during a XR session.
|
|
115
|
+
*
|
|
116
|
+
* @param {Number} factor - The framebuffer scale factor.
|
|
117
|
+
*/
|
|
118
|
+
setFramebufferScaleFactor(factor: number): void;
|
|
119
|
+
/**
|
|
120
|
+
* Returns the reference space type.
|
|
121
|
+
*
|
|
122
|
+
* @return {String} The reference space type.
|
|
123
|
+
*/
|
|
124
|
+
getReferenceSpaceType(): XRReferenceSpaceType;
|
|
125
|
+
/**
|
|
126
|
+
* Sets the reference space type.
|
|
127
|
+
*
|
|
128
|
+
* This method can not be used during a XR session.
|
|
129
|
+
*
|
|
130
|
+
* @param {String} type - The reference space type.
|
|
131
|
+
*/
|
|
132
|
+
setReferenceSpaceType(type: XRReferenceSpaceType): void;
|
|
133
|
+
/**
|
|
134
|
+
* Returns the XR reference space.
|
|
135
|
+
*
|
|
136
|
+
* @return {XRReferenceSpace} The XR reference space.
|
|
137
|
+
*/
|
|
138
|
+
getReferenceSpace(): XRReferenceSpace | null;
|
|
139
|
+
/**
|
|
140
|
+
* Sets a custom XR reference space.
|
|
141
|
+
*
|
|
142
|
+
* @param {XRReferenceSpace} space - The XR reference space.
|
|
143
|
+
*/
|
|
144
|
+
setReferenceSpace(space: XRReferenceSpace): void;
|
|
145
|
+
/**
|
|
146
|
+
* Returns the XR camera.
|
|
147
|
+
*
|
|
148
|
+
* @return {ArrayCamera} The XR camera.
|
|
149
|
+
*/
|
|
150
|
+
getCamera(): ArrayCamera;
|
|
151
|
+
/**
|
|
152
|
+
* Returns the environment blend mode from the current XR session.
|
|
153
|
+
*
|
|
154
|
+
* @return {('opaque'|'additive'|'alpha-blend')?} The environment blend mode. Returns `null` when used outside of a XR session.
|
|
155
|
+
*/
|
|
156
|
+
getEnvironmentBlendMode(): XREnvironmentBlendMode | undefined;
|
|
157
|
+
/**
|
|
158
|
+
* Returns the current XR frame.
|
|
159
|
+
*
|
|
160
|
+
* @return {XRFrame?} The XR frame. Returns `null` when used outside a XR session.
|
|
161
|
+
*/
|
|
162
|
+
getFrame(): XRFrame | null;
|
|
163
|
+
/**
|
|
164
|
+
* Returns the current XR session.
|
|
165
|
+
*
|
|
166
|
+
* @return {XRSession?} The XR session. Returns `null` when used outside a XR session.
|
|
167
|
+
*/
|
|
168
|
+
getSession(): XRSession | null;
|
|
169
|
+
/**
|
|
170
|
+
* After a XR session has been requested usually with one of the `*Button` modules, it
|
|
171
|
+
* is injected into the renderer with this method. This method triggers the start of
|
|
172
|
+
* the actual XR rendering.
|
|
173
|
+
*
|
|
174
|
+
* @async
|
|
175
|
+
* @param {XRSession} session - The XR session to set.
|
|
176
|
+
* @return {Promise} A Promise that resolves when the session has been set.
|
|
177
|
+
*/
|
|
178
|
+
setSession(session: XRSession): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* This method is called by the renderer per frame and updates the XR camera
|
|
181
|
+
* and it sub cameras based on the given camera. The given camera is the "user"
|
|
182
|
+
* camera created on application level and used for non-XR rendering.
|
|
183
|
+
*
|
|
184
|
+
* @param {PerspectiveCamera} camera - The camera.
|
|
185
|
+
*/
|
|
186
|
+
updateCamera(camera: PerspectiveCamera): void;
|
|
187
|
+
/**
|
|
188
|
+
* Returns a WebXR controller for the given controller index.
|
|
189
|
+
*
|
|
190
|
+
* @private
|
|
191
|
+
* @param {Number} index - The controller index.
|
|
192
|
+
* @return {WebXRController} The XR controller.
|
|
193
|
+
*/
|
|
194
|
+
_getController(index: number): WebXRController;
|
|
195
|
+
}
|
|
196
|
+
export default XRManager;
|