@types/three 0.184.0 → 0.185.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.
Files changed (208) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +2 -0
  3. three/examples/jsm/controls/FirstPersonControls.d.ts +9 -0
  4. three/examples/jsm/controls/OrbitControls.d.ts +2 -2
  5. three/examples/jsm/controls/TransformControls.d.ts +32 -1
  6. three/examples/jsm/csm/CSMFrustum.d.ts +73 -13
  7. three/examples/jsm/exporters/DRACOExporter.d.ts +1 -1
  8. three/examples/jsm/exporters/GLTFExporter.d.ts +2 -2
  9. three/examples/jsm/exporters/PLYExporter.d.ts +5 -4
  10. three/examples/jsm/exporters/USDZExporter.d.ts +5 -1
  11. three/examples/jsm/generators/CityGenerator.d.ts +75 -0
  12. three/examples/jsm/generators/ForestGenerator.d.ts +79 -0
  13. three/examples/jsm/generators/TerrainGenerator.d.ts +67 -0
  14. three/examples/jsm/generators/TreeGenerator.d.ts +97 -0
  15. three/examples/jsm/generators/city/SidewalkGenerator.d.ts +40 -0
  16. three/examples/jsm/generators/city/SkyscraperGenerator.d.ts +83 -0
  17. three/examples/jsm/geometries/LoftGeometry.d.ts +83 -0
  18. three/examples/jsm/inspector/tabs/Parameters.d.ts +5 -2
  19. three/examples/jsm/lighting/ClusteredLighting.d.ts +45 -0
  20. three/examples/jsm/lighting/LightProbeGrid.d.ts +131 -13
  21. three/examples/jsm/loaders/DRACOLoader.d.ts +20 -6
  22. three/examples/jsm/loaders/EXRLoader.d.ts +2 -12
  23. three/examples/jsm/loaders/GLTFLoader.d.ts +1 -1
  24. three/examples/jsm/loaders/HDRLoader.d.ts +2 -12
  25. three/examples/jsm/loaders/KTX2Loader.d.ts +1 -1
  26. three/examples/jsm/loaders/LWOLoader.d.ts +6 -0
  27. three/examples/jsm/loaders/RGBELoader.d.ts +1 -7
  28. three/examples/jsm/loaders/SVGLoader.d.ts +9 -6
  29. three/examples/jsm/loaders/TGALoader.d.ts +2 -2
  30. three/examples/jsm/loaders/TIFFLoader.d.ts +2 -11
  31. three/examples/jsm/loaders/USDLoader.d.ts +6 -1
  32. three/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts +49 -0
  33. three/examples/jsm/objects/MarchingCubes.d.ts +2 -2
  34. three/examples/jsm/objects/Reflector.d.ts +38 -5
  35. three/examples/jsm/objects/SkyMesh.d.ts +1 -1
  36. three/examples/jsm/physics/RapierPhysics.d.ts +1 -0
  37. three/examples/jsm/tsl/display/BloomNode.d.ts +23 -6
  38. three/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts +84 -0
  39. three/examples/jsm/tsl/display/RecurrentDenoiseNode.d.ts +89 -0
  40. three/examples/jsm/tsl/display/SSAAPassNode.d.ts +0 -2
  41. three/examples/jsm/tsl/display/SSGINode.d.ts +4 -1
  42. three/examples/jsm/tsl/display/SSRNode.d.ts +303 -30
  43. three/examples/jsm/tsl/display/TRAANode.d.ts +1 -1
  44. three/examples/jsm/tsl/display/TemporalReprojectNode.d.ts +64 -0
  45. three/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts +54 -0
  46. three/examples/jsm/tsl/math/curlNoise.d.ts +38 -0
  47. three/examples/jsm/tsl/utils/GroundedSkybox.d.ts +17 -0
  48. three/examples/jsm/tsl/utils/RNoise.d.ts +12 -0
  49. three/examples/jsm/tsl/utils/SpecularHelpers.d.ts +20 -0
  50. three/examples/jsm/webxr/WebGLXRFallback.d.ts +14 -0
  51. three/package.json +3 -3
  52. three/src/Three.TSL.d.ts +10 -3
  53. three/src/Three.WebGPU.Nodes.d.ts +2 -2
  54. three/src/Three.WebGPU.d.ts +5 -3
  55. three/src/animation/AnimationClip.d.ts +0 -10
  56. three/src/cameras/Camera.d.ts +1 -1
  57. three/src/core/InterleavedBuffer.d.ts +1 -1
  58. three/src/core/Object3D.d.ts +8 -4
  59. three/src/core/RenderTarget.d.ts +11 -0
  60. three/src/core/Timer.d.ts +1 -1
  61. three/src/core/UniformsGroup.d.ts +1 -1
  62. three/src/extras/Controls.d.ts +6 -5
  63. three/src/extras/core/ShapePath.d.ts +61 -65
  64. three/src/loaders/DataTextureLoader.d.ts +37 -3
  65. three/src/loaders/MaterialLoader.d.ts +8 -0
  66. three/src/materials/LineBasicMaterial.d.ts +5 -0
  67. three/src/materials/Material.d.ts +9 -1
  68. three/src/materials/MeshBasicMaterial.d.ts +30 -0
  69. three/src/materials/MeshDepthMaterial.d.ts +13 -0
  70. three/src/materials/MeshDistanceMaterial.d.ts +13 -0
  71. three/src/materials/MeshLambertMaterial.d.ts +50 -1
  72. three/src/materials/MeshMatcapMaterial.d.ts +31 -1
  73. three/src/materials/MeshNormalMaterial.d.ts +11 -1
  74. three/src/materials/MeshPhongMaterial.d.ts +50 -1
  75. three/src/materials/MeshPhysicalMaterial.d.ts +50 -0
  76. three/src/materials/MeshStandardMaterial.d.ts +53 -1
  77. three/src/materials/MeshToonMaterial.d.ts +43 -1
  78. three/src/materials/PointsMaterial.d.ts +9 -0
  79. three/src/materials/ShaderMaterial.d.ts +2 -0
  80. three/src/materials/SpriteMaterial.d.ts +9 -0
  81. three/src/materials/nodes/Line2NodeMaterial.d.ts +18 -13
  82. three/src/materials/nodes/NodeMaterial.d.ts +33 -13
  83. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +0 -84
  84. three/src/math/Box2.d.ts +3 -3
  85. three/src/math/Box3.d.ts +255 -19
  86. three/src/math/Color.d.ts +10 -10
  87. three/src/math/FrustumArray.d.ts +75 -16
  88. three/src/math/Interpolant.d.ts +111 -8
  89. three/src/math/Matrix2.d.ts +1 -1
  90. three/src/math/Matrix3.d.ts +10 -1
  91. three/src/math/Matrix4.d.ts +329 -105
  92. three/src/math/Vector2.d.ts +1 -2
  93. three/src/math/Vector3.d.ts +3 -4
  94. three/src/math/Vector4.d.ts +1 -2
  95. three/src/math/interpolants/BezierInterpolant.d.ts +19 -3
  96. three/src/math/interpolants/CubicInterpolant.d.ts +18 -3
  97. three/src/math/interpolants/DiscreteInterpolant.d.ts +8 -3
  98. three/src/math/interpolants/LinearInterpolant.d.ts +7 -3
  99. three/src/math/interpolants/QuaternionLinearInterpolant.d.ts +7 -3
  100. three/src/nodes/Nodes.d.ts +4 -13
  101. three/src/nodes/TSL.d.ts +7 -5
  102. three/src/nodes/accessors/Batch.d.ts +19 -0
  103. three/src/nodes/accessors/Instance.d.ts +34 -0
  104. three/src/nodes/accessors/MaterialNode.d.ts +86 -79
  105. three/src/nodes/accessors/Morph.d.ts +11 -0
  106. three/src/nodes/accessors/Skinning.d.ts +23 -0
  107. three/src/nodes/accessors/StorageBufferNode.d.ts +22 -23
  108. three/src/nodes/accessors/StorageTexture3DNode.d.ts +17 -0
  109. three/src/nodes/accessors/StorageTextureNode.d.ts +6 -4
  110. three/src/nodes/accessors/TextureNode.d.ts +15 -10
  111. three/src/nodes/core/ArrayNode.d.ts +16 -8
  112. three/src/nodes/core/ContextNode.d.ts +5 -6
  113. three/src/nodes/core/LightingModel.d.ts +2 -0
  114. three/src/nodes/core/Node.d.ts +50 -51
  115. three/src/nodes/core/NodeBuilder.d.ts +1 -133
  116. three/src/nodes/core/OverrideContextNode.d.ts +92 -0
  117. three/src/nodes/core/PropertyNode.d.ts +13 -2
  118. three/src/nodes/core/StructNode.d.ts +0 -2
  119. three/src/nodes/core/StructTypeNode.d.ts +5 -4
  120. three/src/nodes/core/UniformNode.d.ts +48 -9
  121. three/src/nodes/display/BlendModes.d.ts +72 -11
  122. three/src/nodes/display/FrontFacingNode.d.ts +62 -3
  123. three/src/nodes/display/PassNode.d.ts +0 -2
  124. three/src/nodes/display/PremultiplyAlphaFunctions.d.ts +37 -0
  125. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +53 -45
  126. three/src/nodes/lighting/LightingContextNode.d.ts +9 -2
  127. three/src/nodes/lighting/LightsNode.d.ts +4 -4
  128. three/src/nodes/math/MathNode.d.ts +358 -304
  129. three/src/nodes/math/OperatorNode.d.ts +253 -82
  130. three/src/nodes/tsl/TSLCore.d.ts +16 -9
  131. three/src/nodes/utils/ArrayElementNode.d.ts +5 -4
  132. three/src/nodes/utils/EquirectUV.d.ts +31 -1
  133. three/src/nodes/utils/Packing.d.ts +50 -3
  134. three/src/nodes/utils/RTTNode.d.ts +7 -12
  135. three/src/nodes/utils/Remap.d.ts +216 -29
  136. three/src/nodes/utils/SampleNode.d.ts +18 -8
  137. three/src/objects/BatchedMesh.d.ts +1 -1
  138. three/src/objects/InstancedMesh.d.ts +0 -8
  139. three/src/objects/Skeleton.d.ts +0 -2
  140. three/src/renderers/common/Backend.d.ts +0 -3
  141. three/src/renderers/common/CanvasTarget.d.ts +0 -49
  142. three/src/renderers/common/ClippingContext.d.ts +6 -1
  143. three/src/renderers/common/CubeRenderTarget.d.ts +2 -1
  144. three/src/renderers/common/Info.d.ts +26 -66
  145. three/src/renderers/common/InspectorBase.d.ts +0 -7
  146. three/src/renderers/common/Lighting.d.ts +49 -5
  147. three/src/renderers/common/Renderer.d.ts +34 -458
  148. three/src/renderers/common/RendererUtils.d.ts +1 -2
  149. three/src/renderers/common/TimestampQueryPool.d.ts +1 -1
  150. three/src/renderers/common/XRManager.d.ts +32 -299
  151. three/src/renderers/common/nodes/NodeLibrary.d.ts +0 -117
  152. three/src/renderers/webgl/WebGLPrograms.d.ts +2 -0
  153. three/src/renderers/webgl/WebGLRenderLists.d.ts +5 -1
  154. three/src/renderers/webgl/WebGLState.d.ts +2 -0
  155. three/src/renderers/webgl-fallback/WebGLBackend.d.ts +1 -1
  156. three/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts +0 -10
  157. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +0 -1
  158. three/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +5 -121
  159. three/src/textures/CubeDepthTexture.d.ts +2 -3
  160. three/src/textures/DataTexture.d.ts +2 -1
  161. three/src/textures/DepthTexture.d.ts +5 -5
  162. three/examples/jsm/lighting/TiledLighting.d.ts +0 -9
  163. three/examples/jsm/tsl/display/AnamorphicNode.d.ts +0 -31
  164. three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +0 -22
  165. three/src/nodes/accessors/BatchNode.d.ts +0 -12
  166. three/src/nodes/accessors/InstanceNode.d.ts +0 -30
  167. three/src/nodes/accessors/InstancedMeshNode.d.ts +0 -10
  168. three/src/nodes/accessors/MorphNode.d.ts +0 -14
  169. three/src/nodes/accessors/SkinningNode.d.ts +0 -32
  170. three/src/renderers/common/Animation.d.ts +0 -102
  171. three/src/renderers/common/Attributes.d.ts +0 -59
  172. three/src/renderers/common/Background.d.ts +0 -47
  173. three/src/renderers/common/BindGroup.d.ts +0 -39
  174. three/src/renderers/common/Binding.d.ts +0 -50
  175. three/src/renderers/common/Bindings.d.ts +0 -132
  176. three/src/renderers/common/Buffer.d.ts +0 -90
  177. three/src/renderers/common/ChainMap.d.ts +0 -49
  178. three/src/renderers/common/Color4.d.ts +0 -55
  179. three/src/renderers/common/ComputePipeline.d.ts +0 -34
  180. three/src/renderers/common/DataMap.d.ts +0 -42
  181. three/src/renderers/common/Geometries.d.ts +0 -111
  182. three/src/renderers/common/Pipeline.d.ts +0 -29
  183. three/src/renderers/common/Pipelines.d.ts +0 -186
  184. three/src/renderers/common/ProgrammableStage.d.ts +0 -73
  185. three/src/renderers/common/RenderBundle.d.ts +0 -25
  186. three/src/renderers/common/RenderBundles.d.ts +0 -34
  187. three/src/renderers/common/RenderContext.d.ts +0 -235
  188. three/src/renderers/common/RenderContexts.d.ts +0 -47
  189. three/src/renderers/common/RenderList.d.ts +0 -226
  190. three/src/renderers/common/RenderLists.d.ts +0 -46
  191. three/src/renderers/common/RenderObject.d.ts +0 -448
  192. three/src/renderers/common/RenderObjectPipeline.d.ts +0 -33
  193. three/src/renderers/common/RenderObjects.d.ts +0 -151
  194. three/src/renderers/common/SampledTexture.d.ts +0 -28
  195. three/src/renderers/common/Sampler.d.ts +0 -19
  196. three/src/renderers/common/Textures.d.ts +0 -125
  197. three/src/renderers/common/Uniform.d.ts +0 -262
  198. three/src/renderers/common/UniformBuffer.d.ts +0 -20
  199. three/src/renderers/common/UniformsGroup.d.ts +0 -152
  200. three/src/renderers/common/XRRenderTarget.d.ts +0 -67
  201. three/src/renderers/common/nodes/NodeBuilderState.d.ts +0 -121
  202. three/src/renderers/common/nodes/NodeManager.d.ts +0 -309
  203. three/src/renderers/common/nodes/NodeSampledTexture.d.ts +0 -29
  204. three/src/renderers/common/nodes/NodeSampler.d.ts +0 -12
  205. three/src/renderers/common/nodes/NodeUniform.d.ts +0 -250
  206. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +0 -41
  207. three/src/renderers/webgpu/nodes/WGSLNodeFunction.d.ts +0 -6
  208. three/src/renderers/webgpu/nodes/WGSLNodeParser.d.ts +0 -6
@@ -4,95 +4,91 @@ import { Path } from "./Path.js";
4
4
  import { Shape } from "./Shape.js";
5
5
 
6
6
  /**
7
- * This class is used to convert a series of shapes to an array of {@link THREE.Path | Path's},
8
- * for example an SVG shape to a path.
9
- * @see {@link https://threejs.org/docs/index.html#api/en/extras/core/ShapePath | Official Documentation}
10
- * @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/core/ShapePath.js | Source}
7
+ * This class is used to convert a series of paths to an array of
8
+ * shapes. It is specifically used in context of fonts and SVG.
11
9
  */
12
10
  export class ShapePath {
11
+ type: string;
13
12
  /**
14
- * Creates a new {@link ShapePath}
15
- * @remarks
16
- * Unlike a {@link THREE.Path | Path}, no points are passed in as the {@link ShapePath} is designed to be generated after creation.
13
+ * The color of the shape.
14
+ *
15
+ * @type {Color}
17
16
  */
18
- constructor();
19
-
20
- /**
21
- * A Read-only _string_ to check if `this` object type.
22
- * @remarks Sub-classes will update this value.
23
- * @defaultValue `ShapePath`
24
- */
25
- readonly type: "ShapePath";
26
-
17
+ color: Color;
27
18
  /**
28
- * Array of {@link THREE.Path | Path's}s.
29
- * @defaultValue `[]`
19
+ * The paths that have been generated for this shape.
20
+ *
21
+ * @type {Array<Path>}
22
+ * @default null
30
23
  */
31
- subPaths: Path[];
32
-
24
+ subPaths: Array<Path>;
33
25
  /**
34
- * The current {@link THREE.Path | Path} that is being generated.
35
- * @defaultValue `null`
26
+ * The current path that is being generated.
27
+ *
28
+ * @type {?Path}
29
+ * @default null
36
30
  */
37
- readonly currentPath: Path | null;
38
-
31
+ currentPath: Path | null;
39
32
  /**
40
- * {@link THREE.Color | Color} of the shape, by default set to white _(0xffffff)_.
41
- * @defaultValue `new THREE.Color()`
33
+ * An object that can be used to store custom data about the shape path.
34
+ * Mainly used by SVGLoader to store style information.
35
+ *
36
+ * @type {Object}
42
37
  */
43
- color: Color;
44
-
38
+ userData: Record<string, unknown>;
45
39
  /**
46
- * Starts a new {@link THREE.Path | Path} and calls {@link THREE.Path.moveTo | Path.moveTo}( x, y ) on that {@link THREE.Path | Path}
47
- * @remarks
48
- * Also points {@link ShapePath.currentPath | currentPath} to that {@link THREE.Path | Path}.
49
- * @param x Expects a `Float`
50
- * @param y Expects a `Float`
40
+ * Creates a new path and moves it current point to the given one.
41
+ *
42
+ * @param {number} x - The x coordinate.
43
+ * @param {number} y - The y coordinate.
44
+ * @return {ShapePath} A reference to this shape path.
51
45
  */
52
46
  moveTo(x: number, y: number): this;
53
-
54
47
  /**
55
- * This creates a line from the {@link ShapePath.currentPath | currentPath}'s offset to X and Y and updates the offset to X and Y.
56
- * @param x Expects a `Float`
57
- * @param y Expects a `Float`
48
+ * Adds an instance of {@link LineCurve} to the path by connecting
49
+ * the current point with the given one.
50
+ *
51
+ * @param {number} x - The x coordinate of the end point.
52
+ * @param {number} y - The y coordinate of the end point.
53
+ * @return {ShapePath} A reference to this shape path.
58
54
  */
59
55
  lineTo(x: number, y: number): this;
60
-
61
56
  /**
62
- * This creates a quadratic curve from the {@link ShapePath.currentPath | currentPath}'s
63
- * offset to _x_ and _y_ with _cpX_ and _cpY_ as control point and updates the {@link ShapePath.currentPath | currentPath}'s offset to _x_ and _y_.
64
- * @param cpX Expects a `Float`
65
- * @param cpY Expects a `Float`
66
- * @param x Expects a `Float`
67
- * @param y Expects a `Float`
57
+ * Adds an instance of {@link QuadraticBezierCurve} to the path by connecting
58
+ * the current point with the given one.
59
+ *
60
+ * @param {number} aCPx - The x coordinate of the control point.
61
+ * @param {number} aCPy - The y coordinate of the control point.
62
+ * @param {number} aX - The x coordinate of the end point.
63
+ * @param {number} aY - The y coordinate of the end point.
64
+ * @return {ShapePath} A reference to this shape path.
68
65
  */
69
66
  quadraticCurveTo(aCPx: number, aCPy: number, aX: number, aY: number): this;
70
-
71
67
  /**
72
- * This creates a bezier curve from the {@link ShapePath.currentPath | currentPath}'s
73
- * offset to _x_ and _y_ with _cp1X_, _cp1Y_ and _cp2X_, _cp2Y_ as control points and
74
- * updates the {@link ShapePath.currentPath | currentPath}'s offset to _x_ and _y_.
75
- * @param cp1X Expects a `Float`
76
- * @param cp1Y Expects a `Float`
77
- * @param cp2X Expects a `Float`
78
- * @param cp2Y Expects a `Float`
79
- * @param x Expects a `Float`
80
- * @param y Expects a `Float`
68
+ * Adds an instance of {@link CubicBezierCurve} to the path by connecting
69
+ * the current point with the given one.
70
+ *
71
+ * @param {number} aCP1x - The x coordinate of the first control point.
72
+ * @param {number} aCP1y - The y coordinate of the first control point.
73
+ * @param {number} aCP2x - The x coordinate of the second control point.
74
+ * @param {number} aCP2y - The y coordinate of the second control point.
75
+ * @param {number} aX - The x coordinate of the end point.
76
+ * @param {number} aY - The y coordinate of the end point.
77
+ * @return {ShapePath} A reference to this shape path.
81
78
  */
82
79
  bezierCurveTo(aCP1x: number, aCP1y: number, aCP2x: number, aCP2y: number, aX: number, aY: number): this;
83
-
84
80
  /**
85
- * Connects a new {@link THREE.SplineCurve | SplineCurve} onto the {@link ShapePath.currentPath | currentPath}.
86
- * @param points An array of {@link THREE.Vector2 | Vector2}s
81
+ * Adds an instance of {@link SplineCurve} to the path by connecting
82
+ * the current point with the given list of points.
83
+ *
84
+ * @param {Array<Vector2>} pts - An array of points in 2D space.
85
+ * @return {ShapePath} A reference to this shape path.
87
86
  */
88
- splineThru(pts: Vector2[]): this;
89
-
87
+ splineThru(pts: Array<Vector2>): this;
90
88
  /**
91
- * Converts the {@link ShapePath.subPaths | subPaths} array into an array of Shapes
92
- * @remarks
93
- * By default solid shapes are defined clockwise (CW) and holes are defined counterclockwise (CCW)
94
- * If isCCW is set to true, then those are flipped.
95
- * @param isCCW Changes how solids and holes are generated
89
+ * Converts the paths into an array of shapes.
90
+ *
91
+ * @return {Array<Shape>} An array of shapes.
96
92
  */
97
- toShapes(isCCW: boolean): Shape[];
93
+ toShapes(): Array<Shape>;
98
94
  }
@@ -1,14 +1,48 @@
1
- import { DataTexture } from "../textures/DataTexture.js";
1
+ import {
2
+ ColorSpace,
3
+ MagnificationTextureFilter,
4
+ MinificationTextureFilter,
5
+ PixelFormat,
6
+ TextureDataType,
7
+ Wrapping,
8
+ } from "../constants.js";
9
+ import { TypedArray } from "../core/BufferAttribute.js";
10
+ import { CompressedTextureMipmap } from "../textures/CompressedTexture.js";
11
+ import { CubeTexture } from "../textures/CubeTexture.js";
12
+ import { DataTexture, DataTextureImageData } from "../textures/DataTexture.js";
2
13
  import { Loader } from "./Loader.js";
3
14
  import { LoadingManager } from "./LoadingManager.js";
4
15
 
5
- export class DataTextureLoader extends Loader<DataTexture> {
16
+ export interface DataTextureLoaderTexData {
17
+ image?: DataTextureImageData | undefined;
18
+ width?: number | undefined;
19
+ height?: number | undefined;
20
+ data?: TypedArray | undefined;
21
+ format?: PixelFormat | undefined;
22
+ type?: TextureDataType | undefined;
23
+ flipY?: boolean | undefined;
24
+ wrapS?: Wrapping | undefined;
25
+ wrapT?: Wrapping | undefined;
26
+ anisotropy?: number | undefined;
27
+ generateMipmaps?: boolean | undefined;
28
+ colorSpace?: ColorSpace | undefined;
29
+ magFilter?: MagnificationTextureFilter | undefined;
30
+ minFilter?: MinificationTextureFilter | undefined;
31
+ mipmaps?: CompressedTextureMipmap[] | CubeTexture[] | HTMLCanvasElement[] | undefined;
32
+ mipmapCount?: number | undefined;
33
+ }
34
+
35
+ export abstract class DataTextureLoader extends Loader<DataTexture> {
6
36
  constructor(manager?: LoadingManager);
7
37
 
8
38
  load(
9
39
  url: string,
10
- onLoad?: (data: DataTexture, texData: object) => void,
40
+ onLoad?: (data: DataTexture, texData: DataTextureLoaderTexData) => void,
11
41
  onProgress?: (event: ProgressEvent) => void,
12
42
  onError?: (err: unknown) => void,
13
43
  ): DataTexture;
44
+
45
+ abstract parse(buffer: ArrayBuffer): DataTextureLoaderTexData;
46
+
47
+ createDataTexture(buffer: ArrayBuffer): DataTexture;
14
48
  }
@@ -18,4 +18,12 @@ export class MaterialLoader extends Loader<Material> {
18
18
  createMaterialFromType(type: string): Material;
19
19
 
20
20
  static createMaterialFromType(type: string): Material;
21
+
22
+ /**
23
+ * Registers the given material at the internal material library.
24
+ *
25
+ * @param type The material type.
26
+ * @param materialClass The material class.
27
+ */
28
+ static registerMaterial(type: string, materialClass: new() => Material): void;
21
29
  }
@@ -13,6 +13,11 @@ export interface LineBasicMaterialProperties extends MaterialProperties {
13
13
  * Sets the color of the lines using data from a texture. The texture map
14
14
  * color is modulated by the diffuse `color`.
15
15
  *
16
+ * `map` represents color data, and the texture must be assigned a
17
+ * {@link Texture#colorSpace}. Most `map` textures set
18
+ * `texture.colorSpace = SRGBColorSpace`.
19
+ *
20
+ * @type {?Texture}
16
21
  * @default null
17
22
  */
18
23
  map: Texture | null;
@@ -23,7 +23,7 @@ import { WebGLProgramParametersWithUniforms } from "../renderers/webgl/WebGLProg
23
23
  import { WebGLRenderer } from "../renderers/WebGLRenderer.js";
24
24
  import { Scene } from "../scenes/Scene.js";
25
25
  import { SourceJSON } from "../textures/Source.js";
26
- import { TextureJSON } from "../textures/Texture.js";
26
+ import { Texture, TextureJSON } from "../textures/Texture.js";
27
27
 
28
28
  export interface MaterialProperties {
29
29
  /**
@@ -612,6 +612,14 @@ export class Material<TEventMap extends MaterialEventMap = MaterialEventMap> ext
612
612
  * @see {@link ObjectLoader#parse}
613
613
  */
614
614
  toJSON(meta?: JSONMeta): MaterialJSON;
615
+ /**
616
+ * Deserializes the material from the given JSON.
617
+ *
618
+ * @param {Object} json - The JSON holding the serialized material.
619
+ * @param {Object<string,Texture>} textures - A dictionary holding textures referenced by the material.
620
+ * @return {Material} A reference to this material.
621
+ */
622
+ fromJSON(json: MaterialJSON, textures: Record<string, Texture>): this;
615
623
  /**
616
624
  * Returns a new material with copied values from this instance.
617
625
  *
@@ -16,12 +16,23 @@ export interface MeshBasicMaterialProperties extends MaterialProperties {
16
16
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
17
17
  * color is modulated by the diffuse `color`.
18
18
  *
19
+ * `map` represents color data, and the texture must be assigned a
20
+ * {@link Texture#colorSpace}. Most `map` textures set
21
+ * `texture.colorSpace = SRGBColorSpace`.
22
+ *
23
+ * @type {?Texture}
19
24
  * @default null
20
25
  */
21
26
  map: Texture | null;
22
27
  /**
23
28
  * The light map. Requires a second set of UVs.
24
29
  *
30
+ * `lightMap` represents pre-baked illuminance data, and the texture must be assigned
31
+ * a {@link Texture#colorSpace}. Most `lightMap` textures set
32
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
33
+ * such as `.exr` or `.hdr`.
34
+ *
35
+ * @type {?Texture}
25
36
  * @default null
26
37
  */
27
38
  lightMap: Texture | null;
@@ -35,6 +46,10 @@ export interface MeshBasicMaterialProperties extends MaterialProperties {
35
46
  * The red channel of this texture is used as the ambient occlusion map.
36
47
  * Requires a second set of UVs.
37
48
  *
49
+ * `aoMap` represents non-color data. Any texture assigned must have
50
+ * `texture.colorSpace = NoColorSpace` (default).
51
+ *
52
+ * @type {?Texture}
38
53
  * @default null
39
54
  */
40
55
  aoMap: Texture | null;
@@ -49,6 +64,11 @@ export interface MeshBasicMaterialProperties extends MaterialProperties {
49
64
  /**
50
65
  * Specular map used by the material.
51
66
  *
67
+ * `specularMap` represents color data, and the texture must be assigned a
68
+ * {@link Texture#colorSpace}. Most `specularMap` textures set
69
+ * `texture.colorSpace = SRGBColorSpace`.
70
+ *
71
+ * @type {?Texture}
52
72
  * @default null
53
73
  */
54
74
  specularMap: Texture | null;
@@ -62,12 +82,22 @@ export interface MeshBasicMaterialProperties extends MaterialProperties {
62
82
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
63
83
  * luminance/alpha textures will also still work as expected.
64
84
  *
85
+ * `alphaMap` represents non-color data. Any texture assigned must have
86
+ * `texture.colorSpace = NoColorSpace` (default).
87
+ *
88
+ * @type {?Texture}
65
89
  * @default null
66
90
  */
67
91
  alphaMap: Texture | null;
68
92
  /**
69
93
  * The environment map.
70
94
  *
95
+ * `envMap` represents luminance data, and the texture must be assigned
96
+ * a {@link Texture#colorSpace}. Most `envMap` textures set
97
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
98
+ * such as `.exr` or `.hdr`.
99
+ *
100
+ * @type {?Texture}
71
101
  * @default null
72
102
  */
73
103
  envMap: Texture | null;
@@ -13,6 +13,11 @@ export interface MeshDepthMaterialProperties extends MaterialProperties {
13
13
  * The color map. May optionally include an alpha channel, typically combined
14
14
  * with {@link Material#transparent} or {@link Material#alphaTest}.
15
15
  *
16
+ * `map` represents color data, and the texture must be assigned a
17
+ * {@link Texture#colorSpace}. Most `map` textures set
18
+ * `texture.colorSpace = SRGBColorSpace`.
19
+ *
20
+ * @type {?Texture}
16
21
  * @default null
17
22
  */
18
23
  map: Texture | null;
@@ -26,6 +31,10 @@ export interface MeshDepthMaterialProperties extends MaterialProperties {
26
31
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
27
32
  * luminance/alpha textures will also still work as expected.
28
33
  *
34
+ * `alphaMap` represents non-color data. Any texture assigned must have
35
+ * `texture.colorSpace = NoColorSpace` (default).
36
+ *
37
+ * @type {?Texture}
29
38
  * @default null
30
39
  */
31
40
  alphaMap: Texture | null;
@@ -37,6 +46,10 @@ export interface MeshDepthMaterialProperties extends MaterialProperties {
37
46
  * of each pixel (white being the highest) is mapped against, and
38
47
  * repositions, the vertices of the mesh.
39
48
  *
49
+ * `displacementMap` represents non-color data. Any texture assigned must have
50
+ * `texture.colorSpace = NoColorSpace` (default).
51
+ *
52
+ * @type {?Texture}
40
53
  * @default null
41
54
  */
42
55
  displacementMap: Texture | null;
@@ -6,6 +6,11 @@ export interface MeshDistanceMaterialProperties extends MaterialProperties {
6
6
  * The color map. May optionally include an alpha channel, typically combined
7
7
  * with {@link Material#transparent} or {@link Material#alphaTest}.
8
8
  *
9
+ * `map` represents color data, and the texture must be assigned a
10
+ * {@link Texture#colorSpace}. Most `map` textures set
11
+ * `texture.colorSpace = SRGBColorSpace`.
12
+ *
13
+ * @type {?Texture}
9
14
  * @default null
10
15
  */
11
16
  map: Texture | null;
@@ -19,6 +24,10 @@ export interface MeshDistanceMaterialProperties extends MaterialProperties {
19
24
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
20
25
  * luminance/alpha textures will also still work as expected.
21
26
  *
27
+ * `alphaMap` represents non-color data. Any texture assigned must have
28
+ * `texture.colorSpace = NoColorSpace` (default).
29
+ *
30
+ * @type {?Texture}
22
31
  * @default null
23
32
  */
24
33
  alphaMap: Texture | null;
@@ -30,6 +39,10 @@ export interface MeshDistanceMaterialProperties extends MaterialProperties {
30
39
  * of each pixel (white being the highest) is mapped against, and
31
40
  * repositions, the vertices of the mesh.
32
41
  *
42
+ * `displacementMap` represents non-color data. Any texture assigned must have
43
+ * `texture.colorSpace = NoColorSpace` (default).
44
+ *
45
+ * @type {?Texture}
33
46
  * @default null
34
47
  */
35
48
  displacementMap: Texture | null;
@@ -17,12 +17,23 @@ export interface MeshLambertMaterialProperties extends MaterialProperties {
17
17
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
18
18
  * color is modulated by the diffuse `color`.
19
19
  *
20
+ * `map` represents color data, and the texture must be assigned a
21
+ * {@link Texture#colorSpace}. Most `map` textures set
22
+ * `texture.colorSpace = SRGBColorSpace`.
23
+ *
24
+ * @type {?Texture}
20
25
  * @default null
21
26
  */
22
27
  map: Texture | null;
23
28
  /**
24
29
  * The light map. Requires a second set of UVs.
25
30
  *
31
+ * `lightMap` represents pre-baked illuminance data, and the texture must be assigned
32
+ * a {@link Texture#colorSpace}. Most `lightMap` textures set
33
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
34
+ * such as `.exr` or `.hdr`.
35
+ *
36
+ * @type {?Texture}
26
37
  * @default null
27
38
  */
28
39
  lightMap: Texture | null;
@@ -36,6 +47,10 @@ export interface MeshLambertMaterialProperties extends MaterialProperties {
36
47
  * The red channel of this texture is used as the ambient occlusion map.
37
48
  * Requires a second set of UVs.
38
49
  *
50
+ * `aoMap` represents non-color data. Any texture assigned must have
51
+ * `texture.colorSpace = NoColorSpace` (default).
52
+ *
53
+ * @type {?Texture}
39
54
  * @default null
40
55
  */
41
56
  aoMap: Texture | null;
@@ -65,6 +80,11 @@ export interface MeshLambertMaterialProperties extends MaterialProperties {
65
80
  * emissive color and the emissive intensity. If you have an emissive map,
66
81
  * be sure to set the emissive color to something other than black.
67
82
  *
83
+ * `emissiveMap` represents color data, and the texture must be assigned a
84
+ * {@link Texture#colorSpace}. Most `emissiveMap` textures set
85
+ * `texture.colorSpace = SRGBColorSpace`.
86
+ *
87
+ * @type {?Texture}
68
88
  * @default null
69
89
  */
70
90
  emissiveMap: Texture | null;
@@ -74,6 +94,10 @@ export interface MeshLambertMaterialProperties extends MaterialProperties {
74
94
  * the geometry of the object, only the lighting. If a normal map is defined
75
95
  * this will be ignored.
76
96
  *
97
+ * `bumpMap` represents non-color data. Any texture assigned must have
98
+ * `texture.colorSpace = NoColorSpace` (default).
99
+ *
100
+ * @type {?Texture}
77
101
  * @default null
78
102
  */
79
103
  bumpMap: Texture | null;
@@ -91,6 +115,10 @@ export interface MeshLambertMaterialProperties extends MaterialProperties {
91
115
  * convention, the `y` component of `normalScale` should be negated to compensate
92
116
  * for the different handedness.
93
117
  *
118
+ * `normalMap` represents non-color data. Any texture assigned must have
119
+ * `texture.colorSpace = NoColorSpace` (default).
120
+ *
121
+ * @type {?Texture}
94
122
  * @default null
95
123
  */
96
124
  normalMap: Texture | null;
@@ -112,8 +140,14 @@ export interface MeshLambertMaterialProperties extends MaterialProperties {
112
140
  * displaced vertices can cast shadows, block other objects, and otherwise
113
141
  * act as real geometry. The displacement texture is an image where the value
114
142
  * of each pixel (white being the highest) is mapped against, and
115
- * repositions, the vertices of the mesh.
143
+ * repositions, the vertices of the mesh. For best results, pair a
144
+ * displacement map with a matching normal map, since the renderer can
145
+ * not recompute surface normals from the displaced vertices.
146
+ *
147
+ * `displacementMap` represents non-color data. Any texture assigned must have
148
+ * `texture.colorSpace = NoColorSpace` (default).
116
149
  *
150
+ * @type {?Texture}
117
151
  * @default null
118
152
  */
119
153
  displacementMap: Texture | null;
@@ -136,6 +170,11 @@ export interface MeshLambertMaterialProperties extends MaterialProperties {
136
170
  /**
137
171
  * Specular map used by the material.
138
172
  *
173
+ * `specularMap` represents color data, and the texture must be assigned a
174
+ * {@link Texture#colorSpace}. Most `specularMap` textures set
175
+ * `texture.colorSpace = SRGBColorSpace`.
176
+ *
177
+ * @type {?Texture}
139
178
  * @default null
140
179
  */
141
180
  specularMap: Texture | null;
@@ -149,12 +188,22 @@ export interface MeshLambertMaterialProperties extends MaterialProperties {
149
188
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
150
189
  * luminance/alpha textures will also still work as expected.
151
190
  *
191
+ * `alphaMap` represents non-color data. Any texture assigned must have
192
+ * `texture.colorSpace = NoColorSpace` (default).
193
+ *
194
+ * @type {?Texture}
152
195
  * @default null
153
196
  */
154
197
  alphaMap: Texture | null;
155
198
  /**
156
199
  * The environment map.
157
200
  *
201
+ * `envMap` represents luminance data, and the texture must be assigned
202
+ * a {@link Texture#colorSpace}. Most `envMap` textures set
203
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
204
+ * such as `.exr` or `.hdr`.
205
+ *
206
+ * @type {?Texture}
158
207
  * @default null
159
208
  */
160
209
  envMap: Texture | null;
@@ -14,6 +14,13 @@ export interface MeshMatcapMaterialProperties extends MaterialProperties {
14
14
  /**
15
15
  * The matcap map.
16
16
  *
17
+ * `matcap` represents luminance data, and the texture must be assigned
18
+ * a {@link Texture#colorSpace}. HDR `matcap` textures (e.g. `.exr`)
19
+ * typically set `texture.colorSpace = LinearSRGBColorSpace`, while LDR
20
+ * `matcap` textures (e.g. `.png`, `.jpg`, `.webp`) typically set
21
+ * `texture.colorSpace = SRGBColorSpace`.
22
+ *
23
+ * @type {?Texture}
17
24
  * @default null
18
25
  */
19
26
  matcap: Texture | null;
@@ -22,6 +29,11 @@ export interface MeshMatcapMaterialProperties extends MaterialProperties {
22
29
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
23
30
  * color is modulated by the diffuse `color`.
24
31
  *
32
+ * `map` represents color data, and the texture must be assigned a
33
+ * {@link Texture#colorSpace}. Most `map` textures set
34
+ * `texture.colorSpace = SRGBColorSpace`.
35
+ *
36
+ * @type {?Texture}
25
37
  * @default null
26
38
  */
27
39
  map: Texture | null;
@@ -31,6 +43,10 @@ export interface MeshMatcapMaterialProperties extends MaterialProperties {
31
43
  * the geometry of the object, only the lighting. If a normal map is defined
32
44
  * this will be ignored.
33
45
  *
46
+ * `bumpMap` represents non-color data. Any texture assigned must have
47
+ * `texture.colorSpace = NoColorSpace` (default).
48
+ *
49
+ * @type {?Texture}
34
50
  * @default null
35
51
  */
36
52
  bumpMap: Texture | null;
@@ -48,6 +64,10 @@ export interface MeshMatcapMaterialProperties extends MaterialProperties {
48
64
  * convention, the `y` component of `normalScale` should be negated to compensate
49
65
  * for the different handedness.
50
66
  *
67
+ * `normalMap` represents non-color data. Any texture assigned must have
68
+ * `texture.colorSpace = NoColorSpace` (default).
69
+ *
70
+ * @type {?Texture}
51
71
  * @default null
52
72
  */
53
73
  normalMap: Texture | null;
@@ -69,8 +89,14 @@ export interface MeshMatcapMaterialProperties extends MaterialProperties {
69
89
  * displaced vertices can cast shadows, block other objects, and otherwise
70
90
  * act as real geometry. The displacement texture is an image where the value
71
91
  * of each pixel (white being the highest) is mapped against, and
72
- * repositions, the vertices of the mesh.
92
+ * repositions, the vertices of the mesh. For best results, pair a
93
+ * displacement map with a matching normal map, since the renderer can
94
+ * not recompute surface normals from the displaced vertices.
95
+ *
96
+ * `displacementMap` represents non-color data. Any texture assigned must have
97
+ * `texture.colorSpace = NoColorSpace` (default).
73
98
  *
99
+ * @type {?Texture}
74
100
  * @default null
75
101
  */
76
102
  displacementMap: Texture | null;
@@ -100,6 +126,10 @@ export interface MeshMatcapMaterialProperties extends MaterialProperties {
100
126
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
101
127
  * luminance/alpha textures will also still work as expected.
102
128
  *
129
+ * `alphaMap` represents non-color data. Any texture assigned must have
130
+ * `texture.colorSpace = NoColorSpace` (default).
131
+ *
132
+ * @type {?Texture}
103
133
  * @default null
104
134
  */
105
135
  alphaMap: Texture | null;
@@ -10,6 +10,10 @@ export interface MeshNormalMaterialProperties extends MaterialProperties {
10
10
  * the geometry of the object, only the lighting. If a normal map is defined
11
11
  * this will be ignored.
12
12
  *
13
+ * `bumpMap` represents non-color data. Any texture assigned must have
14
+ * `texture.colorSpace = NoColorSpace` (default).
15
+ *
16
+ * @type {?Texture}
13
17
  * @default null
14
18
  */
15
19
  bumpMap: Texture | null;
@@ -27,6 +31,10 @@ export interface MeshNormalMaterialProperties extends MaterialProperties {
27
31
  * convention, the `y` component of `normalScale` should be negated to compensate
28
32
  * for the different handedness.
29
33
  *
34
+ * `normalMap` represents non-color data. Any texture assigned must have
35
+ * `texture.colorSpace = NoColorSpace` (default).
36
+ *
37
+ * @type {?Texture}
30
38
  * @default null
31
39
  */
32
40
  normalMap: Texture | null;
@@ -48,7 +56,9 @@ export interface MeshNormalMaterialProperties extends MaterialProperties {
48
56
  * displaced vertices can cast shadows, block other objects, and otherwise
49
57
  * act as real geometry. The displacement texture is an image where the value
50
58
  * of each pixel (white being the highest) is mapped against, and
51
- * repositions, the vertices of the mesh.
59
+ * repositions, the vertices of the mesh. For best results, pair a
60
+ * displacement map with a matching normal map, since the renderer can
61
+ * not recompute surface normals from the displaced vertices.
52
62
  *
53
63
  * @default null
54
64
  */