@types/three 0.165.0 → 0.166.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/exporters/GLTFExporter.d.ts +6 -0
- three/examples/jsm/geometries/TeapotGeometry.d.ts +24 -0
- three/examples/jsm/helpers/ViewHelper.d.ts +8 -6
- three/examples/jsm/lines/LineMaterial.d.ts +2 -4
- three/examples/jsm/loaders/DDSLoader.d.ts +8 -2
- three/examples/jsm/loaders/GLTFLoader.d.ts +3 -1
- three/examples/jsm/loaders/KTXLoader.d.ts +8 -2
- three/examples/jsm/loaders/PVRLoader.d.ts +2 -2
- three/examples/jsm/nodes/Nodes.d.ts +10 -3
- three/examples/jsm/nodes/accessors/BufferAttributeNode.d.ts +1 -0
- three/examples/jsm/nodes/accessors/StorageBufferNode.d.ts +7 -0
- three/examples/jsm/nodes/accessors/StorageTextureNode.d.ts +40 -0
- three/examples/jsm/nodes/core/CacheNode.d.ts +4 -5
- three/examples/jsm/nodes/core/LightingModel.d.ts +11 -0
- three/examples/jsm/nodes/core/Node.d.ts +3 -0
- three/examples/jsm/nodes/core/NodeBuilder.d.ts +7 -3
- three/examples/jsm/nodes/core/NodeCache.d.ts +12 -4
- three/examples/jsm/nodes/core/NodeFunction.d.ts +2 -2
- three/examples/jsm/nodes/core/NodeUniform.d.ts +1 -1
- three/examples/jsm/nodes/core/UniformNode.d.ts +2 -0
- three/examples/jsm/nodes/core/VarNode.d.ts +2 -0
- three/examples/jsm/nodes/display/DepthOfFieldNode.d.ts +30 -0
- three/examples/jsm/nodes/display/DotScreenNode.d.ts +32 -0
- three/examples/jsm/nodes/display/PassNode.d.ts +1 -1
- three/examples/jsm/nodes/display/RGBShiftNode.d.ts +24 -0
- three/examples/jsm/nodes/display/SobelOperatorNode.d.ts +17 -0
- three/examples/jsm/nodes/display/ViewportDepthNode.d.ts +4 -6
- three/examples/jsm/nodes/functions/BSDF/LTC.d.ts +9 -0
- three/examples/jsm/nodes/lighting/RectAreaLightNode.d.ts +10 -0
- three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.d.ts +2 -3
- three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.d.ts +17 -18
- three/examples/jsm/nodes/materials/MeshSSSNodeMaterial.d.ts +6 -7
- three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +3 -4
- three/examples/jsm/nodes/materials/NodeMaterial.d.ts +32 -33
- three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +2 -3
- three/examples/jsm/nodes/materialx/lib/mx_hsv.d.ts +1 -0
- three/examples/jsm/nodes/materialx/lib/mx_noise.d.ts +230 -0
- three/examples/jsm/nodes/math/MathNode.d.ts +5 -1
- three/examples/jsm/nodes/utils/DiscardNode.d.ts +1 -0
- three/examples/jsm/renderers/common/BindGroup.d.ts +9 -0
- three/examples/jsm/renderers/common/Bindings.d.ts +11 -14
- three/examples/jsm/renderers/common/Geometries.d.ts +3 -3
- three/examples/jsm/renderers/common/Info.d.ts +6 -1
- three/examples/jsm/renderers/common/PostProcessing.d.ts +2 -0
- three/examples/jsm/renderers/common/RenderObject.d.ts +3 -3
- three/examples/jsm/renderers/common/Renderer.d.ts +11 -0
- three/examples/jsm/renderers/common/SampledTexture.d.ts +27 -0
- three/examples/jsm/renderers/common/Sampler.d.ts +11 -0
- three/examples/jsm/renderers/common/Uniform.d.ts +3 -3
- three/examples/jsm/renderers/common/UniformsGroup.d.ts +4 -2
- three/examples/jsm/renderers/common/nodes/NodeBuilderState.d.ts +8 -4
- three/examples/jsm/renderers/common/nodes/NodeSampledTexture.d.ts +29 -0
- three/examples/jsm/renderers/common/nodes/NodeSampler.d.ts +12 -0
- three/examples/jsm/renderers/common/nodes/NodeUniform.d.ts +4 -4
- three/examples/jsm/renderers/common/nodes/NodeUniformsGroup.d.ts +0 -1
- three/examples/jsm/renderers/common/nodes/Nodes.d.ts +1 -0
- three/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +123 -0
- three/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.d.ts +6 -0
- three/examples/jsm/renderers/webgpu/nodes/WGSLNodeParser.d.ts +6 -0
- three/examples/jsm/renderers/webgpu/utils/WebGPUConstants.d.ts +328 -0
- three/package.json +4 -4
- three/src/Three.d.ts +1 -0
- three/src/constants.d.ts +6 -0
- three/src/extras/ShapeUtils.d.ts +5 -8
- three/src/extras/TextureUtils.d.ts +42 -0
- three/src/lights/LightShadow.d.ts +5 -0
- three/src/materials/Material.d.ts +21 -12
- three/src/math/Vector4.d.ts +6 -0
- three/src/objects/BatchedMesh.d.ts +58 -54
- three/src/renderers/shaders/UniformsLib.d.ts +3 -0
- three/src/renderers/webxr/WebXRDepthSensing.d.ts +2 -0
- three/src/renderers/webxr/WebXRManager.d.ts +33 -23
- three/src/textures/CompressedArrayTexture.d.ts +4 -4
- three/src/textures/CompressedTexture.d.ts +16 -8
- three/src/textures/Texture.d.ts +3 -1
- three/examples/jsm/renderers/webgl/nodes/SlotNode.d.ts +0 -17
- three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +0 -37
- three/examples/jsm/renderers/webgl/nodes/WebGLNodes.d.ts +0 -3
|
@@ -9,26 +9,36 @@ import { Mesh } from "./Mesh.js";
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* A special version of {@link Mesh} with multi draw batch rendering support. Use {@link BatchedMesh} if you have to
|
|
12
|
-
* render a large number of objects with the same material but with different world transformations
|
|
13
|
-
*
|
|
12
|
+
* render a large number of objects with the same material but with different world transformations. The usage of
|
|
13
|
+
* {@link BatchedMesh} will help you to reduce the number of draw calls and thus improve the overall rendering
|
|
14
14
|
* performance in your application.
|
|
15
15
|
*
|
|
16
16
|
* If the {@link https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw WEBGL_multi_draw extension} is not
|
|
17
|
-
* supported then a less performant
|
|
17
|
+
* supported then a less performant fallback is used.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* const box = new THREE.BoxGeometry( 1, 1, 1 );
|
|
21
|
-
* const sphere = new THREE.
|
|
21
|
+
* const sphere = new THREE.SphereGeometry( 1, 12, 12 );
|
|
22
22
|
* const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
|
|
23
23
|
*
|
|
24
24
|
* // initialize and add geometries into the batched mesh
|
|
25
25
|
* const batchedMesh = new BatchedMesh( 10, 5000, 10000, material );
|
|
26
|
-
* const
|
|
27
|
-
* const
|
|
26
|
+
* const boxGeometryId = batchedMesh.addGeometry( box );
|
|
27
|
+
* const sphereGeometryId = batchedMesh.addGeometry( sphere );
|
|
28
|
+
*
|
|
29
|
+
* // create instances of those geometries
|
|
30
|
+
* const boxInstancedId1 = batchedMesh.addInstance( boxGeometryId );
|
|
31
|
+
* const boxInstancedId2 = batchedMesh.addInstance( boxGeometryId );
|
|
32
|
+
*
|
|
33
|
+
* const sphereInstancedId1 = batchedMesh.addInstance( sphereGeometryId );
|
|
34
|
+
* const sphereInstancedId2 = batchedMesh.addInstance( sphereGeometryId );
|
|
28
35
|
*
|
|
29
36
|
* // position the geometries
|
|
30
|
-
* batchedMesh.setMatrixAt(
|
|
31
|
-
* batchedMesh.setMatrixAt(
|
|
37
|
+
* batchedMesh.setMatrixAt( boxInstancedId1, boxMatrix1 );
|
|
38
|
+
* batchedMesh.setMatrixAt( boxInstancedId2, boxMatrix2 );
|
|
39
|
+
*
|
|
40
|
+
* batchedMesh.setMatrixAt( sphereInstancedId1, sphereMatrix1 );
|
|
41
|
+
* batchedMesh.setMatrixAt( sphereInstancedId2, sphereMatrix2 );
|
|
32
42
|
*
|
|
33
43
|
* scene.add( batchedMesh );
|
|
34
44
|
*
|
|
@@ -68,20 +78,20 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
|
|
|
68
78
|
/**
|
|
69
79
|
* The maximum number of individual geometries that can be stored in the {@link BatchedMesh}. Read only.
|
|
70
80
|
*/
|
|
71
|
-
get
|
|
81
|
+
get maxInstanceCount(): number;
|
|
72
82
|
|
|
73
83
|
/**
|
|
74
84
|
* Read-only flag to check if a given object is of type {@link BatchedMesh}.
|
|
75
85
|
*/
|
|
76
|
-
isBatchedMesh: true;
|
|
86
|
+
readonly isBatchedMesh: true;
|
|
77
87
|
|
|
78
88
|
/**
|
|
79
|
-
* @param
|
|
89
|
+
* @param maxInstanceCount the max number of individual geometries planned to be added.
|
|
80
90
|
* @param maxVertexCount the max number of vertices to be used by all geometries.
|
|
81
91
|
* @param maxIndexCount the max number of indices to be used by all geometries.
|
|
82
|
-
* @param material an instance of
|
|
92
|
+
* @param material an instance of {@link Material}. Default is a new {@link MeshBasicMaterial}.
|
|
83
93
|
*/
|
|
84
|
-
constructor(
|
|
94
|
+
constructor(maxInstanceCount: number, maxVertexCount: number, maxIndexCount?: number, material?: Material);
|
|
85
95
|
|
|
86
96
|
/**
|
|
87
97
|
* Computes the bounding box, updating {@link .boundingBox} attribute.
|
|
@@ -102,54 +112,55 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
|
|
|
102
112
|
dispose(): this;
|
|
103
113
|
|
|
104
114
|
/**
|
|
105
|
-
* Takes a sort a function that is run before render. The function takes a list of
|
|
106
|
-
* objects in the list include a "z" field to perform a depth-ordered sort with.
|
|
115
|
+
* Takes a sort a function that is run before render. The function takes a list of instances to sort and a camera.
|
|
116
|
+
* The objects in the list include a "z" field to perform a depth-ordered sort with.
|
|
107
117
|
*/
|
|
108
118
|
setCustomSort(
|
|
109
|
-
|
|
119
|
+
sortFunction:
|
|
120
|
+
| ((this: this, list: Array<{ start: number; count: number; z: number }>, camera: Camera) => void)
|
|
121
|
+
| null,
|
|
110
122
|
): this;
|
|
111
123
|
|
|
112
124
|
/**
|
|
113
125
|
* Get the color of the defined geometry.
|
|
114
|
-
* @param
|
|
115
|
-
* @param
|
|
126
|
+
* @param instanceId The id of an instance to get the color of.
|
|
127
|
+
* @param target The target object to copy the color in to.
|
|
116
128
|
*/
|
|
117
|
-
getColorAt(
|
|
129
|
+
getColorAt(instanceId: number, target: Color): void;
|
|
118
130
|
|
|
119
131
|
/**
|
|
120
132
|
* Get the local transformation matrix of the defined instance.
|
|
121
|
-
* @param
|
|
122
|
-
* @param
|
|
133
|
+
* @param instanceId The id of an instance to get the matrix of.
|
|
134
|
+
* @param target This 4x4 matrix will be set to the local transformation matrix of the defined instance.
|
|
123
135
|
*/
|
|
124
|
-
getMatrixAt(
|
|
136
|
+
getMatrixAt(instanceId: number, target: Matrix4): Matrix4;
|
|
125
137
|
|
|
126
138
|
/**
|
|
127
139
|
* Get whether the given instance is marked as "visible" or not.
|
|
128
|
-
* @param
|
|
140
|
+
* @param instanceId The id of an instance to get the visibility state of.
|
|
129
141
|
*/
|
|
130
|
-
getVisibleAt(
|
|
142
|
+
getVisibleAt(instanceId: number): boolean;
|
|
131
143
|
|
|
132
144
|
/**
|
|
133
|
-
* Sets the given color to the defined geometry.
|
|
134
|
-
* @param
|
|
135
|
-
* @param color The color
|
|
145
|
+
* Sets the given color to the defined geometry instance.
|
|
146
|
+
* @param instanceId The id of the instance to set the color of.
|
|
147
|
+
* @param color The color to set the instance to.
|
|
136
148
|
*/
|
|
137
|
-
setColorAt(
|
|
149
|
+
setColorAt(instanceId: number, color: Color): void;
|
|
138
150
|
|
|
139
151
|
/**
|
|
140
|
-
* Sets the given local transformation matrix to the defined instance.
|
|
141
|
-
*
|
|
142
|
-
* @param index The index of an instance. Values have to be in the range [0, count].
|
|
152
|
+
* Sets the given local transformation matrix to the defined instance.
|
|
153
|
+
* @param instanceId The id of an instance to set the matrix of.
|
|
143
154
|
* @param matrix A 4x4 matrix representing the local transformation of a single instance.
|
|
144
155
|
*/
|
|
145
|
-
setMatrixAt(
|
|
156
|
+
setMatrixAt(instanceId: number, matrix: Matrix4): this;
|
|
146
157
|
|
|
147
158
|
/**
|
|
148
|
-
* Sets the visibility of the
|
|
149
|
-
* @param
|
|
159
|
+
* Sets the visibility of the instance at the given index.
|
|
160
|
+
* @param instanceId The id of the instance to set the visibility of.
|
|
150
161
|
* @param visible A boolean value indicating the visibility state.
|
|
151
162
|
*/
|
|
152
|
-
setVisibleAt(
|
|
163
|
+
setVisibleAt(instanceId: number, visible: boolean): this;
|
|
153
164
|
|
|
154
165
|
/**
|
|
155
166
|
* Adds the given geometry to the {@link BatchedMesh} and returns the associated index referring to it.
|
|
@@ -164,30 +175,23 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
|
|
|
164
175
|
addGeometry(geometry: BufferGeometry, reservedVertexRange?: number, reservedIndexRange?: number): number;
|
|
165
176
|
|
|
166
177
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
* @param
|
|
170
|
-
*
|
|
178
|
+
* Adds a new instance to the {@link BatchedMesh} using the geometry of the given geometryId and returns a new id
|
|
179
|
+
* referring to the new instance to be used by other functions.
|
|
180
|
+
* @param geometryId The id of a previously added geometry via "addGeometry" to add into the {@link BatchedMesh} to
|
|
181
|
+
* render.
|
|
171
182
|
*/
|
|
172
|
-
|
|
183
|
+
addInstance(geometryId: number): number;
|
|
173
184
|
|
|
174
185
|
/**
|
|
175
|
-
*
|
|
176
|
-
*
|
|
186
|
+
* Replaces the geometry at `geometryId` with the provided geometry. Throws an error if there is not enough space
|
|
187
|
+
* reserved for geometry. Calling this will change all instances that are rendering that geometry.
|
|
188
|
+
* @param geometryId Which geometry id to replace with this geometry.
|
|
189
|
+
* @param geometry The geometry to substitute at the given geometry id.
|
|
177
190
|
*/
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Sets an instance count of the geometry at `index`.
|
|
182
|
-
* @param index Which geometry index to configure an instance count for.
|
|
183
|
-
* @param instanceCount The number of instances to render of the given geometry index.
|
|
184
|
-
*/
|
|
185
|
-
setInstanceCountAt(index: number, instanceCount: number): number;
|
|
186
|
-
|
|
187
|
-
deleteGeometry(index: number): this;
|
|
191
|
+
setGeometryAt(geometryId: number, geometry: BufferGeometry): number;
|
|
188
192
|
|
|
189
|
-
getBoundingBoxAt(
|
|
190
|
-
getBoundingSphereAt(
|
|
193
|
+
getBoundingBoxAt(geometryId: number, target: Box3): Box3 | null;
|
|
194
|
+
getBoundingSphereAt(geometryId: number, target: Sphere): Sphere | null;
|
|
191
195
|
}
|
|
192
196
|
|
|
193
197
|
export { BatchedMesh };
|
|
@@ -89,6 +89,7 @@ export const UniformsLib: {
|
|
|
89
89
|
directionalLightShadows: {
|
|
90
90
|
value: unknown[];
|
|
91
91
|
properties: {
|
|
92
|
+
shadowIntensity: number;
|
|
92
93
|
shadowBias: {};
|
|
93
94
|
shadowNormalBias: {};
|
|
94
95
|
shadowRadius: {};
|
|
@@ -112,6 +113,7 @@ export const UniformsLib: {
|
|
|
112
113
|
spotLightShadows: {
|
|
113
114
|
value: unknown[];
|
|
114
115
|
properties: {
|
|
116
|
+
shadowIntensity: number;
|
|
115
117
|
shadowBias: {};
|
|
116
118
|
shadowNormalBias: {};
|
|
117
119
|
shadowRadius: {};
|
|
@@ -133,6 +135,7 @@ export const UniformsLib: {
|
|
|
133
135
|
pointLightShadows: {
|
|
134
136
|
value: unknown[];
|
|
135
137
|
properties: {
|
|
138
|
+
shadowIntensity: number;
|
|
136
139
|
shadowBias: {};
|
|
137
140
|
shadowNormalBias: {};
|
|
138
141
|
shadowRadius: {};
|
|
@@ -6,6 +6,8 @@ import { ArrayCamera } from "../../cameras/ArrayCamera.js";
|
|
|
6
6
|
import { PerspectiveCamera } from "../../cameras/PerspectiveCamera.js";
|
|
7
7
|
import { EventDispatcher } from "../../core/EventDispatcher.js";
|
|
8
8
|
import { Vector4 } from "../../math/Vector4.js";
|
|
9
|
+
import { Mesh } from "../../objects/Mesh.js";
|
|
10
|
+
import { Texture } from "../../textures/Texture.js";
|
|
9
11
|
import { WebGLRenderer } from "../WebGLRenderer.js";
|
|
10
12
|
import { XRGripSpace, XRHandSpace, XRTargetRaySpace } from "./WebXRController.js";
|
|
11
13
|
|
|
@@ -22,7 +24,10 @@ export interface WebXRManagerEventMap {
|
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
export class WebXRManager extends EventDispatcher<WebXRManagerEventMap> {
|
|
25
|
-
|
|
27
|
+
/**
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
cameraAutoUpdate: boolean;
|
|
26
31
|
|
|
27
32
|
/**
|
|
28
33
|
* @default false
|
|
@@ -34,44 +39,49 @@ export class WebXRManager extends EventDispatcher<WebXRManagerEventMap> {
|
|
|
34
39
|
*/
|
|
35
40
|
isPresenting: boolean;
|
|
36
41
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
constructor(renderer: WebGLRenderer, gl: WebGLRenderingContext);
|
|
43
|
+
|
|
44
|
+
getController: (index: number) => XRTargetRaySpace;
|
|
45
|
+
|
|
46
|
+
getControllerGrip: (index: number) => XRGripSpace;
|
|
47
|
+
|
|
48
|
+
getHand: (index: number) => XRHandSpace;
|
|
49
|
+
|
|
50
|
+
setFramebufferScaleFactor: (value: number) => void;
|
|
41
51
|
|
|
42
|
-
|
|
52
|
+
setReferenceSpaceType: (value: XRReferenceSpaceType) => void;
|
|
43
53
|
|
|
44
|
-
|
|
54
|
+
getReferenceSpace: () => XRReferenceSpace | null;
|
|
45
55
|
|
|
46
|
-
|
|
56
|
+
setReferenceSpace: (value: XRReferenceSpace) => void;
|
|
47
57
|
|
|
48
|
-
|
|
58
|
+
getBaseLayer: () => XRWebGLLayer | XRProjectionLayer;
|
|
49
59
|
|
|
50
|
-
|
|
60
|
+
getBinding: () => XRWebGLBinding;
|
|
51
61
|
|
|
52
|
-
|
|
62
|
+
getFrame: () => XRFrame;
|
|
53
63
|
|
|
54
|
-
|
|
64
|
+
getSession: () => XRSession | null;
|
|
55
65
|
|
|
56
|
-
|
|
66
|
+
setSession: (value: XRSession | null) => Promise<void>;
|
|
57
67
|
|
|
58
|
-
|
|
68
|
+
getEnvironmentBlendMode: () => XREnvironmentBlendMode | undefined;
|
|
59
69
|
|
|
60
|
-
|
|
70
|
+
getDepthTexture: () => Texture | null;
|
|
61
71
|
|
|
62
|
-
|
|
72
|
+
updateCamera: (camera: PerspectiveCamera) => void;
|
|
63
73
|
|
|
64
|
-
|
|
74
|
+
getCamera: () => WebXRArrayCamera;
|
|
65
75
|
|
|
66
|
-
|
|
76
|
+
getFoveation: () => number | undefined;
|
|
67
77
|
|
|
68
|
-
|
|
78
|
+
setFoveation: (value: number) => void;
|
|
69
79
|
|
|
70
|
-
|
|
80
|
+
hasDepthSensing: () => boolean;
|
|
71
81
|
|
|
72
|
-
|
|
82
|
+
getDepthSensingMesh: () => Mesh | null;
|
|
73
83
|
|
|
74
|
-
|
|
84
|
+
setAnimationLoop: (callback: XRFrameRequestCallback | null) => void;
|
|
75
85
|
|
|
76
|
-
dispose()
|
|
86
|
+
dispose: () => void;
|
|
77
87
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CompressedPixelFormat, TextureDataType, Wrapping } from "../constants.js";
|
|
2
|
-
import { CompressedTexture } from "./CompressedTexture.js";
|
|
2
|
+
import { CompressedTexture, CompressedTextureMipmap } from "./CompressedTexture.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Creates an texture 2D array based on data in compressed form, for example from a
|
|
@@ -37,8 +37,8 @@ export class CompressedArrayTexture extends CompressedTexture {
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Create a new instance of {@link CompressedArrayTexture}
|
|
40
|
-
* @param mipmaps The mipmaps array should contain objects with data, width and height.
|
|
41
|
-
*
|
|
40
|
+
* @param mipmaps The mipmaps array should contain objects with data, width and height. The mipmaps should be of the
|
|
41
|
+
* correct format and type.
|
|
42
42
|
* @param width The width of the biggest mipmap.
|
|
43
43
|
* @param height The height of the biggest mipmap.
|
|
44
44
|
* @param depth The number of layers of the 2D array texture
|
|
@@ -46,7 +46,7 @@ export class CompressedArrayTexture extends CompressedTexture {
|
|
|
46
46
|
* @param type See {@link Texture.type | .type}. Default {@link THREE.UnsignedByteType}
|
|
47
47
|
*/
|
|
48
48
|
constructor(
|
|
49
|
-
mipmaps:
|
|
49
|
+
mipmaps: CompressedTextureMipmap[],
|
|
50
50
|
width: number,
|
|
51
51
|
height: number,
|
|
52
52
|
depth: number,
|
|
@@ -7,8 +7,15 @@ import {
|
|
|
7
7
|
TextureDataType,
|
|
8
8
|
Wrapping,
|
|
9
9
|
} from "../constants.js";
|
|
10
|
+
import { TypedArray } from "../core/BufferAttribute.js";
|
|
10
11
|
import { Texture } from "./Texture.js";
|
|
11
12
|
|
|
13
|
+
export interface CompressedTextureMipmap {
|
|
14
|
+
data: TypedArray;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
/**
|
|
13
20
|
* Creates a texture based on data in compressed form, for example from a {@link https://en.wikipedia.org/wiki/DirectDraw_Surface | DDS} file.
|
|
14
21
|
* @remarks For use with the {@link THREE.CompressedTextureLoader | CompressedTextureLoader}.
|
|
@@ -18,8 +25,8 @@ import { Texture } from "./Texture.js";
|
|
|
18
25
|
export class CompressedTexture extends Texture {
|
|
19
26
|
/**
|
|
20
27
|
* This creates a new {@link THREE.CompressedTexture | CompressedTexture} object.
|
|
21
|
-
* @param mipmaps The mipmaps array should contain objects with data, width and height.
|
|
22
|
-
*
|
|
28
|
+
* @param mipmaps The mipmaps array should contain objects with data, width and height. The mipmaps should be of the
|
|
29
|
+
* correct format and type.
|
|
23
30
|
* @param width The width of the biggest mipmap.
|
|
24
31
|
* @param height The height of the biggest mipmap.
|
|
25
32
|
* @param format The format used in the mipmaps. See {@link THREE.CompressedPixelFormat}.
|
|
@@ -33,10 +40,10 @@ export class CompressedTexture extends Texture {
|
|
|
33
40
|
* @param colorSpace See {@link Texture.colorSpace .colorSpace}. Default {@link NoColorSpace}
|
|
34
41
|
*/
|
|
35
42
|
constructor(
|
|
36
|
-
mipmaps
|
|
37
|
-
width
|
|
38
|
-
height
|
|
39
|
-
format
|
|
43
|
+
mipmaps?: CompressedTextureMipmap[],
|
|
44
|
+
width?: number,
|
|
45
|
+
height?: number,
|
|
46
|
+
format?: CompressedPixelFormat,
|
|
40
47
|
type?: TextureDataType,
|
|
41
48
|
mapping?: Mapping,
|
|
42
49
|
wrapS?: Wrapping,
|
|
@@ -62,9 +69,10 @@ export class CompressedTexture extends Texture {
|
|
|
62
69
|
set image(value: { width: number; height: number });
|
|
63
70
|
|
|
64
71
|
/**
|
|
65
|
-
* The mipmaps array should contain objects with data, width and height. The mipmaps should be of the correct
|
|
72
|
+
* The mipmaps array should contain objects with data, width and height. The mipmaps should be of the correct
|
|
73
|
+
* format and type.
|
|
66
74
|
*/
|
|
67
|
-
mipmaps:
|
|
75
|
+
mipmaps: CompressedTextureMipmap[] | undefined;
|
|
68
76
|
|
|
69
77
|
/**
|
|
70
78
|
* @override
|
three/src/textures/Texture.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
import { EventDispatcher } from "../core/EventDispatcher.js";
|
|
14
14
|
import { Matrix3 } from "../math/Matrix3.js";
|
|
15
15
|
import { Vector2 } from "../math/Vector2.js";
|
|
16
|
+
import { CompressedTextureMipmap } from "./CompressedTexture.js";
|
|
17
|
+
import { CubeTexture } from "./CubeTexture.js";
|
|
16
18
|
import { Source } from "./Source.js";
|
|
17
19
|
|
|
18
20
|
/** Shim for OffscreenCanvas. */
|
|
@@ -127,7 +129,7 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
|
|
|
127
129
|
* Array of user-specified mipmaps
|
|
128
130
|
* @defaultValue `[]`
|
|
129
131
|
*/
|
|
130
|
-
mipmaps:
|
|
132
|
+
mipmaps: CompressedTextureMipmap[] | CubeTexture[] | HTMLCanvasElement[] | undefined;
|
|
131
133
|
|
|
132
134
|
/**
|
|
133
135
|
* How the image is applied to the object.
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import Node from "../../../nodes/core/Node.js";
|
|
2
|
-
|
|
3
|
-
export interface SlotNodeParameters<TNode extends Node = Node> {
|
|
4
|
-
node?: TNode;
|
|
5
|
-
nodeType?: string;
|
|
6
|
-
source?: string | null;
|
|
7
|
-
target?: string | null;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default class SlotNode<TNode extends Node = Node> extends Node {
|
|
11
|
-
inclusionType: "replace";
|
|
12
|
-
node: TNode | null;
|
|
13
|
-
source: null;
|
|
14
|
-
target: null;
|
|
15
|
-
|
|
16
|
-
constructor(params: SlotNodeParameters<TNode>);
|
|
17
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Object3D, Renderer } from "three";
|
|
2
|
-
import { NodeShaderStage } from "../../../nodes/core/constants.js";
|
|
3
|
-
import Node from "../../../nodes/core/Node.js";
|
|
4
|
-
import NodeBuilder from "../../../nodes/core/NodeBuilder.js";
|
|
5
|
-
import SlotNode from "./SlotNode.js";
|
|
6
|
-
|
|
7
|
-
export class WebGLNodeBuilder extends NodeBuilder {
|
|
8
|
-
constructor(
|
|
9
|
-
object: Object3D,
|
|
10
|
-
renderer: Renderer,
|
|
11
|
-
shader: { uniforms: any; vertexShader: any; fragmentShader: any },
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
addSlot(shaderStage: NodeShaderStage, slotNode: SlotNode): Node;
|
|
15
|
-
|
|
16
|
-
getUniforms(shaderStage: string): string;
|
|
17
|
-
|
|
18
|
-
getAttributes(shaderStage: string): string;
|
|
19
|
-
|
|
20
|
-
getVarys(shaderStage: string): string;
|
|
21
|
-
|
|
22
|
-
addCode(shaderStage: string, source: string, code: string, scope?: this): string;
|
|
23
|
-
addCodeAfterInclude(shaderStage: string, snippet: string, code: string): string;
|
|
24
|
-
|
|
25
|
-
replaceCode(shaderStage: string, source: string, target: string, scope?: this): void;
|
|
26
|
-
parseInclude(shaderStage: string, ...includes: string[]): void;
|
|
27
|
-
|
|
28
|
-
getInstanceIndex(): string;
|
|
29
|
-
getFrontFacing(): string;
|
|
30
|
-
getFragCoord(): "gl_FragCoord";
|
|
31
|
-
isFlipY(): true;
|
|
32
|
-
|
|
33
|
-
buildCode(): void;
|
|
34
|
-
build(): this;
|
|
35
|
-
|
|
36
|
-
getSlot(shaderStage: string, name: string): Node;
|
|
37
|
-
}
|