@types/three 0.177.0 → 0.178.1

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 (178) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/capabilities/WebGL.d.ts +0 -11
  3. three/examples/jsm/controls/TransformControls.d.ts +16 -1
  4. three/examples/jsm/helpers/TextureHelper.d.ts +2 -2
  5. three/examples/jsm/helpers/TextureHelperGPU.d.ts +2 -2
  6. three/examples/jsm/loaders/SVGLoader.d.ts +1 -1
  7. three/examples/jsm/physics/RapierPhysics.d.ts +1 -0
  8. three/examples/jsm/transpiler/AST.d.ts +77 -26
  9. three/examples/jsm/transpiler/TSLEncoder.d.ts +9 -3
  10. three/examples/jsm/tsl/display/AnamorphicNode.d.ts +4 -4
  11. three/examples/jsm/tsl/display/BleachBypass.d.ts +2 -2
  12. three/examples/jsm/tsl/display/BloomNode.d.ts +2 -2
  13. three/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts +20 -0
  14. three/examples/jsm/tsl/display/DenoiseNode.d.ts +4 -4
  15. three/examples/jsm/tsl/display/DepthOfFieldNode.d.ts +6 -6
  16. three/examples/jsm/tsl/display/DotScreenNode.d.ts +2 -2
  17. three/examples/jsm/tsl/display/FXAANode.d.ts +3 -3
  18. three/examples/jsm/tsl/display/FilmNode.d.ts +4 -4
  19. three/examples/jsm/tsl/display/GTAONode.d.ts +3 -3
  20. three/examples/jsm/tsl/display/GaussianBlurNode.d.ts +5 -5
  21. three/examples/jsm/tsl/display/LensflareNode.d.ts +8 -8
  22. three/examples/jsm/tsl/display/Lut3DNode.d.ts +4 -4
  23. three/examples/jsm/tsl/display/MotionBlur.d.ts +4 -4
  24. three/examples/jsm/tsl/display/OutlineNode.d.ts +3 -3
  25. three/examples/jsm/tsl/display/RGBShiftNode.d.ts +3 -3
  26. three/examples/jsm/tsl/display/SMAANode.d.ts +3 -3
  27. three/examples/jsm/tsl/display/SSRNode.d.ts +5 -5
  28. three/examples/jsm/tsl/display/Sepia.d.ts +2 -2
  29. three/examples/jsm/tsl/display/SobelOperatorNode.d.ts +3 -3
  30. three/examples/jsm/tsl/display/TransitionNode.d.ts +4 -4
  31. three/examples/jsm/tsl/display/hashBlur.d.ts +5 -5
  32. three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +5 -5
  33. three/package.json +2 -2
  34. three/src/Three.TSL.d.ts +9 -16
  35. three/src/Three.WebGPU.d.ts +2 -0
  36. three/src/constants.d.ts +13 -5
  37. three/src/core/BufferGeometry.d.ts +6 -1
  38. three/src/core/GLBufferAttribute.d.ts +18 -1
  39. three/src/helpers/AxesHelper.d.ts +3 -1
  40. three/src/materials/LineBasicMaterial.d.ts +66 -34
  41. three/src/materials/LineDashedMaterial.d.ts +41 -21
  42. three/src/materials/Material.d.ts +408 -398
  43. three/src/materials/MeshBasicMaterial.d.ts +101 -62
  44. three/src/materials/MeshDepthMaterial.d.ts +71 -32
  45. three/src/materials/MeshDistanceMaterial.d.ts +65 -29
  46. three/src/materials/MeshLambertMaterial.d.ts +179 -103
  47. three/src/materials/MeshMatcapMaterial.d.ts +97 -55
  48. three/src/materials/MeshNormalMaterial.d.ts +76 -41
  49. three/src/materials/MeshPhongMaterial.d.ts +164 -100
  50. three/src/materials/MeshPhysicalMaterial.d.ts +171 -111
  51. three/src/materials/MeshStandardMaterial.d.ts +178 -91
  52. three/src/materials/MeshToonMaterial.d.ts +130 -81
  53. three/src/materials/PointsMaterial.d.ts +77 -30
  54. three/src/materials/RawShaderMaterial.d.ts +12 -7
  55. three/src/materials/ShaderMaterial.d.ts +186 -98
  56. three/src/materials/ShadowMaterial.d.ts +49 -23
  57. three/src/materials/SpriteMaterial.d.ts +62 -33
  58. three/src/materials/nodes/Line2NodeMaterial.d.ts +87 -40
  59. three/src/materials/nodes/LineBasicNodeMaterial.d.ts +35 -16
  60. three/src/materials/nodes/LineDashedNodeMaterial.d.ts +75 -20
  61. three/src/materials/nodes/MeshBasicNodeMaterial.d.ts +49 -30
  62. three/src/materials/nodes/MeshLambertNodeMaterial.d.ts +49 -42
  63. three/src/materials/nodes/MeshMatcapNodeMaterial.d.ts +38 -26
  64. three/src/materials/nodes/MeshNormalNodeMaterial.d.ts +36 -22
  65. three/src/materials/nodes/MeshPhongNodeMaterial.d.ts +68 -48
  66. three/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts +240 -65
  67. three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +99 -3
  68. three/src/materials/nodes/MeshStandardNodeMaterial.d.ts +83 -47
  69. three/src/materials/nodes/MeshToonNodeMaterial.d.ts +42 -36
  70. three/src/materials/nodes/NodeMaterial.d.ts +417 -56
  71. three/src/materials/nodes/NodeMaterials.d.ts +3 -2
  72. three/src/materials/nodes/PointsNodeMaterial.d.ts +31 -7
  73. three/src/materials/nodes/ShadowNodeMaterial.d.ts +38 -11
  74. three/src/materials/nodes/SpriteNodeMaterial.d.ts +68 -20
  75. three/src/materials/nodes/VolumeNodeMaterial.d.ts +50 -14
  76. three/src/math/Color.d.ts +1 -1
  77. three/src/nodes/Nodes.d.ts +1 -3
  78. three/src/nodes/TSL.d.ts +4 -3
  79. three/src/nodes/accessors/AccessorsUtils.d.ts +3 -3
  80. three/src/nodes/accessors/Bitangent.d.ts +0 -2
  81. three/src/nodes/accessors/CubeTextureNode.d.ts +7 -7
  82. three/src/nodes/accessors/Normal.d.ts +19 -5
  83. three/src/nodes/accessors/ReferenceBaseNode.d.ts +1 -1
  84. three/src/nodes/accessors/StorageBufferNode.d.ts +3 -2
  85. three/src/nodes/accessors/StorageTextureNode.d.ts +5 -5
  86. three/src/nodes/accessors/Tangent.d.ts +0 -2
  87. three/src/nodes/accessors/TangentUtils.d.ts +22 -0
  88. three/src/nodes/accessors/Texture3DNode.d.ts +5 -4
  89. three/src/nodes/accessors/TextureBicubic.d.ts +4 -2
  90. three/src/nodes/accessors/TextureNode.d.ts +16 -16
  91. three/src/nodes/accessors/TextureSizeNode.d.ts +3 -3
  92. three/src/nodes/accessors/UniformArrayNode.d.ts +2 -7
  93. three/src/nodes/code/FunctionCallNode.d.ts +3 -1
  94. three/src/nodes/code/FunctionNode.d.ts +2 -2
  95. three/src/nodes/code/ScriptableNode.d.ts +2 -2
  96. three/src/nodes/core/AssignNode.d.ts +2 -2
  97. three/src/nodes/core/AttributeNode.d.ts +1 -1
  98. three/src/nodes/core/BypassNode.d.ts +2 -2
  99. three/src/nodes/core/CacheNode.d.ts +0 -2
  100. three/src/nodes/core/ContextNode.d.ts +3 -3
  101. three/src/nodes/core/StackNode.d.ts +3 -13
  102. three/src/nodes/core/SubBuildNode.d.ts +15 -0
  103. three/src/nodes/core/VarNode.d.ts +4 -4
  104. three/src/nodes/core/VaryingNode.d.ts +3 -3
  105. three/src/nodes/display/BlendModes.d.ts +12 -12
  106. three/src/nodes/display/BumpMapNode.d.ts +4 -3
  107. three/src/nodes/display/ColorAdjustment.d.ts +17 -17
  108. three/src/nodes/display/ColorSpaceFunctions.d.ts +3 -3
  109. three/src/nodes/display/ColorSpaceNode.d.ts +4 -4
  110. three/src/nodes/display/FrontFacingNode.d.ts +1 -0
  111. three/src/nodes/display/PosterizeNode.d.ts +3 -3
  112. three/src/nodes/display/RenderOutputNode.d.ts +2 -2
  113. three/src/nodes/display/ScreenNode.d.ts +0 -10
  114. three/src/nodes/display/ToneMappingFunctions.d.ts +7 -7
  115. three/src/nodes/display/ToneMappingNode.d.ts +6 -6
  116. three/src/nodes/display/ViewportDepthTextureNode.d.ts +3 -3
  117. three/src/nodes/fog/Fog.d.ts +10 -10
  118. three/src/nodes/functions/BSDF/Schlick_to_F0.d.ts +4 -4
  119. three/src/nodes/functions/material/getAlphaHashThreshold.d.ts +2 -2
  120. three/src/nodes/functions/material/getParallaxCorrectNormal.d.ts +4 -4
  121. three/src/nodes/geometry/RangeNode.d.ts +9 -2
  122. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +20 -20
  123. three/src/nodes/gpgpu/ComputeNode.d.ts +2 -2
  124. three/src/nodes/lighting/PointShadowNode.d.ts +11 -11
  125. three/src/nodes/lighting/ShadowFilterNode.d.ts +11 -11
  126. three/src/nodes/materialx/MaterialXNodes.d.ts +59 -59
  127. three/src/nodes/materialx/lib/mx_hsv.d.ts +3 -3
  128. three/src/nodes/materialx/lib/mx_noise.d.ts +206 -206
  129. three/src/nodes/materialx/lib/mx_transform_color.d.ts +2 -2
  130. three/src/nodes/math/ConditionalNode.d.ts +4 -19
  131. three/src/nodes/math/Hash.d.ts +2 -2
  132. three/src/nodes/math/MathNode.d.ts +21 -17
  133. three/src/nodes/math/OperatorNode.d.ts +41 -52
  134. three/src/nodes/math/TriNoise3D.d.ts +6 -6
  135. three/src/nodes/pmrem/PMREMNode.d.ts +3 -3
  136. three/src/nodes/pmrem/PMREMUtils.d.ts +20 -20
  137. three/src/nodes/procedural/Checker.d.ts +2 -2
  138. three/src/nodes/shapes/Shapes.d.ts +2 -2
  139. three/src/nodes/tsl/TSLBase.d.ts +1 -0
  140. three/src/nodes/tsl/TSLCore.d.ts +176 -76
  141. three/src/nodes/utils/CubeMapNode.d.ts +2 -2
  142. three/src/nodes/utils/DebugNode.d.ts +2 -2
  143. three/src/nodes/utils/Discard.d.ts +2 -2
  144. three/src/nodes/utils/EquirectUV.d.ts +4 -0
  145. three/src/nodes/utils/LoopNode.d.ts +2 -7
  146. three/src/nodes/utils/MatcapUV.d.ts +4 -0
  147. three/src/nodes/utils/Oscillators.d.ts +5 -5
  148. three/src/nodes/utils/Packing.d.ts +3 -3
  149. three/src/nodes/utils/PostProcessingUtils.d.ts +9 -9
  150. three/src/nodes/utils/RTTNode.d.ts +3 -3
  151. three/src/nodes/utils/RemapNode.d.ts +9 -9
  152. three/src/nodes/utils/RotateNode.d.ts +3 -3
  153. three/src/nodes/utils/SampleNode.d.ts +16 -0
  154. three/src/nodes/utils/SpriteSheetUVNode.d.ts +4 -4
  155. three/src/nodes/utils/SpriteUtils.d.ts +2 -2
  156. three/src/nodes/utils/StorageArrayElementNode.d.ts +4 -3
  157. three/src/nodes/utils/TriplanarTextures.d.ts +20 -0
  158. three/src/nodes/utils/UVUtils.d.ts +8 -7
  159. three/src/nodes/utils/ViewportUtils.d.ts +2 -2
  160. three/src/objects/LOD.d.ts +1 -1
  161. three/src/renderers/WebGLRenderer.d.ts +1 -1
  162. three/src/renderers/common/Backend.d.ts +3 -3
  163. three/src/renderers/common/RenderObject.d.ts +10 -2
  164. three/src/renderers/common/Renderer.d.ts +5 -5
  165. three/src/renderers/common/Storage3DTexture.d.ts +40 -0
  166. three/src/renderers/common/StorageArrayTexture.d.ts +29 -0
  167. three/src/renderers/common/Textures.d.ts +2 -2
  168. three/src/renderers/common/XRRenderTarget.d.ts +3 -2
  169. three/src/renderers/common/nodes/NodeLibrary.d.ts +4 -9
  170. three/src/renderers/common/nodes/NodeSampledTexture.d.ts +1 -1
  171. three/src/renderers/common/nodes/Nodes.d.ts +1 -1
  172. three/src/renderers/webgpu/WebGPURenderer.d.ts +3 -0
  173. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +65 -0
  174. three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +9 -0
  175. three/src/nodes/utils/EquirectUVNode.d.ts +0 -8
  176. three/src/nodes/utils/MatcapUVNode.d.ts +0 -8
  177. three/src/nodes/utils/TriplanarTexturesNode.d.ts +0 -36
  178. three/src/renderers/common/nodes/StandardNodeLibrary.d.ts +0 -5
@@ -1,213 +1,300 @@
1
1
  import { NormalMapTypes } from "../constants.js";
2
- import { Color, ColorRepresentation } from "../math/Color.js";
2
+ import { Color } from "../math/Color.js";
3
3
  import { Euler } from "../math/Euler.js";
4
4
  import { Vector2 } from "../math/Vector2.js";
5
5
  import { Texture } from "../textures/Texture.js";
6
- import { Material, MaterialParameters } from "./Material.js";
7
-
8
- export interface MeshStandardMaterialParameters extends MaterialParameters {
9
- color?: ColorRepresentation | undefined;
10
- roughness?: number | undefined;
11
- metalness?: number | undefined;
12
- map?: Texture | null | undefined;
13
- lightMap?: Texture | null | undefined;
14
- lightMapIntensity?: number | undefined;
15
- aoMap?: Texture | null | undefined;
16
- aoMapIntensity?: number | undefined;
17
- emissive?: ColorRepresentation | undefined;
18
- emissiveIntensity?: number | undefined;
19
- emissiveMap?: Texture | null | undefined;
20
- bumpMap?: Texture | null | undefined;
21
- bumpScale?: number | undefined;
22
- normalMap?: Texture | null | undefined;
23
- normalMapType?: NormalMapTypes | undefined;
24
- normalScale?: Vector2 | undefined;
25
- displacementMap?: Texture | null | undefined;
26
- displacementScale?: number | undefined;
27
- displacementBias?: number | undefined;
28
- roughnessMap?: Texture | null | undefined;
29
- metalnessMap?: Texture | null | undefined;
30
- alphaMap?: Texture | null | undefined;
31
- envMap?: Texture | null | undefined;
32
- envMapRotation?: Euler | undefined;
33
- envMapIntensity?: number | undefined;
34
- wireframe?: boolean | undefined;
35
- wireframeLinewidth?: number | undefined;
36
- fog?: boolean | undefined;
37
- flatShading?: boolean | undefined;
38
- }
39
-
40
- export class MeshStandardMaterial extends Material {
41
- constructor(parameters?: MeshStandardMaterialParameters);
6
+ import { MapColorPropertiesToColorRepresentations, Material, MaterialProperties } from "./Material.js";
42
7
 
8
+ export interface MeshStandardMaterialProperties extends MaterialProperties {
43
9
  /**
44
- * Read-only flag to check if a given object is of type {@link MeshStandardMaterial}.
45
- * @remarks This is a _constant_ value
46
- * @defaultValue `true`
47
- */
48
- readonly isMeshStandardMaterial: true;
49
-
50
- /**
51
- * @default { 'STANDARD': '' }
52
- */
53
- defines: { [key: string]: any };
54
-
55
- /**
56
- * @default new THREE.Color( 0xffffff )
10
+ * Color of the material.
11
+ *
12
+ * @default (1,1,1)
57
13
  */
58
14
  color: Color;
59
-
60
15
  /**
16
+ * How rough the material appears. `0.0` means a smooth mirror reflection, `1.0`
17
+ * means fully diffuse. If `roughnessMap` is also provided,
18
+ * both values are multiplied.
19
+ *
61
20
  * @default 1
62
21
  */
63
22
  roughness: number;
64
-
65
23
  /**
24
+ * How much the material is like a metal. Non-metallic materials such as wood
25
+ * or stone use `0.0`, metallic use `1.0`, with nothing (usually) in between.
26
+ * A value between `0.0` and `1.0` could be used for a rusty metal look.
27
+ * If `metalnessMap` is also provided, both values are multiplied.
28
+ *
66
29
  * @default 0
67
30
  */
68
31
  metalness: number;
69
-
70
32
  /**
33
+ * The color map. May optionally include an alpha channel, typically combined
34
+ * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
35
+ * color is modulated by the diffuse `color`.
36
+ *
71
37
  * @default null
72
38
  */
73
39
  map: Texture | null;
74
-
75
40
  /**
41
+ * The light map. Requires a second set of UVs.
42
+ *
76
43
  * @default null
77
44
  */
78
45
  lightMap: Texture | null;
79
-
80
46
  /**
47
+ * Intensity of the baked light.
48
+ *
81
49
  * @default 1
82
50
  */
83
51
  lightMapIntensity: number;
84
-
85
52
  /**
53
+ * The red channel of this texture is used as the ambient occlusion map.
54
+ * Requires a second set of UVs.
55
+ *
86
56
  * @default null
87
57
  */
88
58
  aoMap: Texture | null;
89
-
90
59
  /**
60
+ * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0`
61
+ * disables ambient occlusion. Where intensity is `1` and the AO map's
62
+ * red channel is also `1`, ambient light is fully occluded on a surface.
63
+ *
91
64
  * @default 1
92
65
  */
93
66
  aoMapIntensity: number;
94
-
95
67
  /**
96
- * @default new THREE.Color( 0x000000 )
68
+ * Emissive (light) color of the material, essentially a solid color
69
+ * unaffected by other lighting.
70
+ *
71
+ * @default (0,0,0)
97
72
  */
98
73
  emissive: Color;
99
-
100
74
  /**
75
+ * Intensity of the emissive light. Modulates the emissive color.
76
+ *
101
77
  * @default 1
102
78
  */
103
79
  emissiveIntensity: number;
104
-
105
80
  /**
81
+ * Set emissive (glow) map. The emissive map color is modulated by the
82
+ * emissive color and the emissive intensity. If you have an emissive map,
83
+ * be sure to set the emissive color to something other than black.
84
+ *
106
85
  * @default null
107
86
  */
108
87
  emissiveMap: Texture | null;
109
-
110
88
  /**
89
+ * The texture to create a bump map. The black and white values map to the
90
+ * perceived depth in relation to the lights. Bump doesn't actually affect
91
+ * the geometry of the object, only the lighting. If a normal map is defined
92
+ * this will be ignored.
93
+ *
111
94
  * @default null
112
95
  */
113
96
  bumpMap: Texture | null;
114
-
115
97
  /**
98
+ * How much the bump map affects the material. Typical range is `[0,1]`.
99
+ *
116
100
  * @default 1
117
101
  */
118
102
  bumpScale: number;
119
-
120
103
  /**
104
+ * The texture to create a normal map. The RGB values affect the surface
105
+ * normal for each pixel fragment and change the way the color is lit. Normal
106
+ * maps do not change the actual shape of the surface, only the lighting. In
107
+ * case the material has a normal map authored using the left handed
108
+ * convention, the `y` component of `normalScale` should be negated to compensate
109
+ * for the different handedness.
110
+ *
121
111
  * @default null
122
112
  */
123
113
  normalMap: Texture | null;
124
-
125
114
  /**
126
- * @default THREE.TangentSpaceNormalMap
115
+ * The type of normal map.
116
+ *
117
+ * @default TangentSpaceNormalMap
127
118
  */
128
119
  normalMapType: NormalMapTypes;
129
-
130
120
  /**
131
- * @default new THREE.Vector2( 1, 1 )
121
+ * How much the normal map affects the material. Typical value range is `[0,1]`.
122
+ *
123
+ * @default (1,1)
132
124
  */
133
125
  normalScale: Vector2;
134
-
135
126
  /**
127
+ * The displacement map affects the position of the mesh's vertices. Unlike
128
+ * other maps which only affect the light and shade of the material the
129
+ * displaced vertices can cast shadows, block other objects, and otherwise
130
+ * act as real geometry. The displacement texture is an image where the value
131
+ * of each pixel (white being the highest) is mapped against, and
132
+ * repositions, the vertices of the mesh.
133
+ *
136
134
  * @default null
137
135
  */
138
136
  displacementMap: Texture | null;
139
-
140
137
  /**
141
- * @default 1
138
+ * How much the displacement map affects the mesh (where black is no
139
+ * displacement, and white is maximum displacement). Without a displacement
140
+ * map set, this value is not applied.
141
+ *
142
+ * @default 0
142
143
  */
143
144
  displacementScale: number;
144
-
145
145
  /**
146
+ * The offset of the displacement map's values on the mesh's vertices.
147
+ * The bias is added to the scaled sample of the displacement map.
148
+ * Without a displacement map set, this value is not applied.
149
+ *
146
150
  * @default 0
147
151
  */
148
152
  displacementBias: number;
149
-
150
153
  /**
154
+ * The green channel of this texture is used to alter the roughness of the
155
+ * material.
156
+ *
151
157
  * @default null
152
158
  */
153
159
  roughnessMap: Texture | null;
154
-
155
160
  /**
161
+ * The blue channel of this texture is used to alter the metalness of the
162
+ * material.
163
+ *
156
164
  * @default null
157
165
  */
158
166
  metalnessMap: Texture | null;
159
-
160
167
  /**
168
+ * The alpha map is a grayscale texture that controls the opacity across the
169
+ * surface (black: fully transparent; white: fully opaque).
170
+ *
171
+ * Only the color of the texture is used, ignoring the alpha channel if one
172
+ * exists. For RGB and RGBA textures, the renderer will use the green channel
173
+ * when sampling this texture due to the extra bit of precision provided for
174
+ * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
175
+ * luminance/alpha textures will also still work as expected.
176
+ *
161
177
  * @default null
162
178
  */
163
179
  alphaMap: Texture | null;
164
-
165
180
  /**
181
+ * The environment map. To ensure a physically correct rendering, environment maps
182
+ * are internally pre-processed with {@link PMREMGenerator}.
183
+ *
166
184
  * @default null
167
185
  */
168
186
  envMap: Texture | null;
169
-
170
187
  /**
171
- * The rotation of the environment map in radians. Default is `(0,0,0)`.
188
+ * The rotation of the environment map in radians.
189
+ *
190
+ * @default (0,0,0)
172
191
  */
173
192
  envMapRotation: Euler;
174
-
175
193
  /**
194
+ * Scales the effect of the environment map by multiplying its color.
195
+ *
176
196
  * @default 1
177
197
  */
178
198
  envMapIntensity: number;
179
-
180
199
  /**
200
+ * Renders the geometry as a wireframe.
201
+ *
181
202
  * @default false
182
203
  */
183
204
  wireframe: boolean;
184
-
185
205
  /**
206
+ * Controls the thickness of the wireframe.
207
+ *
208
+ * Can only be used with {@link SVGRenderer}.
209
+ *
186
210
  * @default 1
187
211
  */
188
212
  wireframeLinewidth: number;
189
-
190
213
  /**
214
+ * Defines appearance of wireframe ends.
215
+ *
216
+ * Can only be used with {@link SVGRenderer}.
217
+ *
191
218
  * @default 'round'
192
219
  */
193
- wireframeLinecap: string;
194
-
220
+ wireframeLinecap: "round" | "bevel" | "miter";
195
221
  /**
222
+ * Defines appearance of wireframe joints.
223
+ *
224
+ * Can only be used with {@link SVGRenderer}.
225
+ *
196
226
  * @default 'round'
197
227
  */
198
- wireframeLinejoin: string;
199
-
228
+ wireframeLinejoin: "round" | "bevel" | "miter";
200
229
  /**
201
- * Define whether the material is rendered with flat shading. Default is false.
230
+ * Whether the material is rendered with flat shading or not.
231
+ *
202
232
  * @default false
203
233
  */
204
234
  flatShading: boolean;
205
-
206
235
  /**
207
- * Whether the material is affected by fog. Default is true.
208
- * @default fog
236
+ * Whether the material is affected by fog or not.
237
+ *
238
+ * @default true
209
239
  */
210
240
  fog: boolean;
241
+ }
211
242
 
212
- setValues(parameters: MeshStandardMaterialParameters): void;
243
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
244
+ export interface MeshStandardMaterialParameters
245
+ extends Partial<MapColorPropertiesToColorRepresentations<MeshStandardMaterialProperties>>
246
+ {}
247
+
248
+ /**
249
+ * A standard physically based material, using Metallic-Roughness workflow.
250
+ *
251
+ * Physically based rendering (PBR) has recently become the standard in many
252
+ * 3D applications, such as [Unity]{@link https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/},
253
+ * [Unreal]{@link https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/} and
254
+ * [3D Studio Max]{@link http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017}.
255
+ *
256
+ * This approach differs from older approaches in that instead of using
257
+ * approximations for the way in which light interacts with a surface, a
258
+ * physically correct model is used. The idea is that, instead of tweaking
259
+ * materials to look good under specific lighting, a material can be created
260
+ * that will react 'correctly' under all lighting scenarios.
261
+ *
262
+ * In practice this gives a more accurate and realistic looking result than
263
+ * the {@link MeshLambertMaterial} or {@link MeshPhongMaterial}, at the cost of
264
+ * being somewhat more computationally expensive. `MeshStandardMaterial` uses per-fragment
265
+ * shading.
266
+ *
267
+ * Note that for best results you should always specify an environment map when using this material.
268
+ *
269
+ * For a non-technical introduction to the concept of PBR and how to set up a
270
+ * PBR material, check out these articles by the people at [marmoset]{@link https://www.marmoset.co}:
271
+ *
272
+ * - [Basic Theory of Physically Based Rendering]{@link https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/}
273
+ * - [Physically Based Rendering and You Can Too]{@link https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/}
274
+ *
275
+ * Technical details of the approach used in three.js (and most other PBR systems) can be found is this
276
+ * [paper from Disney]{@link https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf}
277
+ * (pdf), by Brent Burley.
278
+ */
279
+ export class MeshStandardMaterial extends Material {
280
+ /**
281
+ * Constructs a new mesh standard material.
282
+ *
283
+ * @param {Object} [parameters] - An object with one or more properties
284
+ * defining the material's appearance. Any property of the material
285
+ * (including any property from inherited materials) can be passed
286
+ * in here. Color values can be passed any type of value accepted
287
+ * by {@link Color#set}.
288
+ */
289
+ constructor(parameters?: MeshStandardMaterialParameters);
290
+ /**
291
+ * This flag can be used for type testing.
292
+ *
293
+ * @default true
294
+ */
295
+ readonly isMeshStandardMaterial: boolean;
296
+ setValues(values?: MeshStandardMaterialParameters): void;
213
297
  }
298
+
299
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
300
+ export interface MeshStandardMaterial extends MeshStandardMaterialProperties {}
@@ -1,173 +1,222 @@
1
1
  import { NormalMapTypes } from "../constants.js";
2
- import { Color, ColorRepresentation } from "../math/Color.js";
2
+ import { Color } from "../math/Color.js";
3
3
  import { Vector2 } from "../math/Vector2.js";
4
4
  import { Texture } from "../textures/Texture.js";
5
- import { Material, MaterialParameters } from "./Material.js";
6
-
7
- export interface MeshToonMaterialParameters extends MaterialParameters {
8
- /** geometry color in hexadecimal. Default is 0xffffff. */
9
- color?: ColorRepresentation | undefined;
10
- opacity?: number | undefined;
11
- gradientMap?: Texture | null | undefined;
12
- map?: Texture | null | undefined;
13
- lightMap?: Texture | null | undefined;
14
- lightMapIntensity?: number | undefined;
15
- aoMap?: Texture | null | undefined;
16
- aoMapIntensity?: number | undefined;
17
- emissive?: ColorRepresentation | undefined;
18
- emissiveIntensity?: number | undefined;
19
- emissiveMap?: Texture | null | undefined;
20
- bumpMap?: Texture | null | undefined;
21
- bumpScale?: number | undefined;
22
- normalMap?: Texture | null | undefined;
23
- normalMapType?: NormalMapTypes | undefined;
24
- normalScale?: Vector2 | undefined;
25
- displacementMap?: Texture | null | undefined;
26
- displacementScale?: number | undefined;
27
- displacementBias?: number | undefined;
28
- alphaMap?: Texture | null | undefined;
29
- wireframe?: boolean | undefined;
30
- wireframeLinewidth?: number | undefined;
31
- wireframeLinecap?: string | undefined;
32
- wireframeLinejoin?: string | undefined;
33
- fog?: boolean | undefined;
34
- }
35
-
36
- export class MeshToonMaterial extends Material {
37
- constructor(parameters?: MeshToonMaterialParameters);
5
+ import { MapColorPropertiesToColorRepresentations, Material, MaterialProperties } from "./Material.js";
38
6
 
7
+ export interface MeshToonMaterialProperties extends MaterialProperties {
39
8
  /**
40
- * Read-only flag to check if a given object is of type {@link MeshToonMaterial}.
41
- * @remarks This is a _constant_ value
42
- * @defaultValue `true`
43
- */
44
- readonly isMeshToonMaterial: true;
45
-
46
- /**
47
- * @default { 'TOON': '' }
48
- */
49
- defines: { [key: string]: any };
50
-
51
- /**
52
- * @default new THREE.Color( 0xffffff )
9
+ * Color of the material.
10
+ *
11
+ * @default (1,1,1)
53
12
  */
54
13
  color: Color;
55
-
56
14
  /**
15
+ * The color map. May optionally include an alpha channel, typically combined
16
+ * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
17
+ * color is modulated by the diffuse `color`.
18
+ *
57
19
  * @default null
58
20
  */
59
- gradientMap: Texture | null;
60
-
21
+ map: Texture | null;
61
22
  /**
23
+ * Gradient map for toon shading. It's required to set
24
+ * {@link Texture#minFilter} and {@link Texture#magFilter} to {@linkNearestFilter}
25
+ * when using this type of texture.
26
+ *
62
27
  * @default null
63
28
  */
64
- map: Texture | null;
65
-
29
+ gradientMap: Texture | null;
66
30
  /**
31
+ * The light map. Requires a second set of UVs.
32
+ *
67
33
  * @default null
68
34
  */
69
35
  lightMap: Texture | null;
70
-
71
36
  /**
37
+ * Intensity of the baked light.
38
+ *
72
39
  * @default 1
73
40
  */
74
41
  lightMapIntensity: number;
75
-
76
42
  /**
43
+ * The red channel of this texture is used as the ambient occlusion map.
44
+ * Requires a second set of UVs.
45
+ *
77
46
  * @default null
78
47
  */
79
48
  aoMap: Texture | null;
80
-
81
49
  /**
50
+ * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0`
51
+ * disables ambient occlusion. Where intensity is `1` and the AO map's
52
+ * red channel is also `1`, ambient light is fully occluded on a surface.
53
+ *
82
54
  * @default 1
83
55
  */
84
56
  aoMapIntensity: number;
85
-
86
57
  /**
87
- * @default new THREE.Color( 0x000000 )
58
+ * Emissive (light) color of the material, essentially a solid color
59
+ * unaffected by other lighting.
60
+ *
61
+ * @default (0,0,0)
88
62
  */
89
63
  emissive: Color;
90
-
91
64
  /**
65
+ * Intensity of the emissive light. Modulates the emissive color.
66
+ *
92
67
  * @default 1
93
68
  */
94
69
  emissiveIntensity: number;
95
-
96
70
  /**
71
+ * Set emissive (glow) map. The emissive map color is modulated by the
72
+ * emissive color and the emissive intensity. If you have an emissive map,
73
+ * be sure to set the emissive color to something other than black.
74
+ *
97
75
  * @default null
98
76
  */
99
77
  emissiveMap: Texture | null;
100
-
101
78
  /**
79
+ * The texture to create a bump map. The black and white values map to the
80
+ * perceived depth in relation to the lights. Bump doesn't actually affect
81
+ * the geometry of the object, only the lighting. If a normal map is defined
82
+ * this will be ignored.
83
+ *
102
84
  * @default null
103
85
  */
104
86
  bumpMap: Texture | null;
105
-
106
87
  /**
88
+ * How much the bump map affects the material. Typical range is `[0,1]`.
89
+ *
107
90
  * @default 1
108
91
  */
109
92
  bumpScale: number;
110
-
111
93
  /**
94
+ * The texture to create a normal map. The RGB values affect the surface
95
+ * normal for each pixel fragment and change the way the color is lit. Normal
96
+ * maps do not change the actual shape of the surface, only the lighting. In
97
+ * case the material has a normal map authored using the left handed
98
+ * convention, the `y` component of `normalScale` should be negated to compensate
99
+ * for the different handedness.
100
+ *
112
101
  * @default null
113
102
  */
114
103
  normalMap: Texture | null;
115
-
116
104
  /**
117
- * @default THREE.TangentSpaceNormalMap
105
+ * The type of normal map.
106
+ *
107
+ * @default TangentSpaceNormalMap
118
108
  */
119
109
  normalMapType: NormalMapTypes;
120
-
121
110
  /**
122
- * @default new THREE.Vector2( 1, 1 )
111
+ * How much the normal map affects the material. Typical value range is `[0,1]`.
112
+ *
113
+ * @default (1,1)
123
114
  */
124
115
  normalScale: Vector2;
125
-
126
116
  /**
117
+ * The displacement map affects the position of the mesh's vertices. Unlike
118
+ * other maps which only affect the light and shade of the material the
119
+ * displaced vertices can cast shadows, block other objects, and otherwise
120
+ * act as real geometry. The displacement texture is an image where the value
121
+ * of each pixel (white being the highest) is mapped against, and
122
+ * repositions, the vertices of the mesh.
123
+ *
127
124
  * @default null
128
125
  */
129
126
  displacementMap: Texture | null;
130
-
131
127
  /**
132
- * @default 1
128
+ * How much the displacement map affects the mesh (where black is no
129
+ * displacement, and white is maximum displacement). Without a displacement
130
+ * map set, this value is not applied.
131
+ *
132
+ * @default 0
133
133
  */
134
134
  displacementScale: number;
135
-
136
135
  /**
136
+ * The offset of the displacement map's values on the mesh's vertices.
137
+ * The bias is added to the scaled sample of the displacement map.
138
+ * Without a displacement map set, this value is not applied.
139
+ *
137
140
  * @default 0
138
141
  */
139
142
  displacementBias: number;
140
-
141
143
  /**
144
+ * The alpha map is a grayscale texture that controls the opacity across the
145
+ * surface (black: fully transparent; white: fully opaque).
146
+ *
147
+ * Only the color of the texture is used, ignoring the alpha channel if one
148
+ * exists. For RGB and RGBA textures, the renderer will use the green channel
149
+ * when sampling this texture due to the extra bit of precision provided for
150
+ * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
151
+ * luminance/alpha textures will also still work as expected.
152
+ *
142
153
  * @default null
143
154
  */
144
155
  alphaMap: Texture | null;
145
-
146
156
  /**
157
+ * Renders the geometry as a wireframe.
158
+ *
147
159
  * @default false
148
160
  */
149
161
  wireframe: boolean;
150
-
151
162
  /**
163
+ * Controls the thickness of the wireframe.
164
+ *
165
+ * Can only be used with {@link SVGRenderer}.
166
+ *
152
167
  * @default 1
153
168
  */
154
169
  wireframeLinewidth: number;
155
-
156
170
  /**
171
+ * Defines appearance of wireframe ends.
172
+ *
173
+ * Can only be used with {@link SVGRenderer}.
174
+ *
157
175
  * @default 'round'
158
176
  */
159
- wireframeLinecap: string;
160
-
177
+ wireframeLinecap: "round" | "bevel" | "miter";
161
178
  /**
179
+ * Defines appearance of wireframe joints.
180
+ *
181
+ * Can only be used with {@link SVGRenderer}.
182
+ *
162
183
  * @default 'round'
163
184
  */
164
- wireframeLinejoin: string;
165
-
185
+ wireframeLinejoin: "round" | "bevel" | "miter";
166
186
  /**
167
- * Whether the material is affected by fog. Default is true.
168
- * @default fog
187
+ * Whether the material is affected by fog or not.
188
+ *
189
+ * @default true
169
190
  */
170
191
  fog: boolean;
192
+ }
193
+
194
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
195
+ export interface MeshToonMaterialParameters
196
+ extends Partial<MapColorPropertiesToColorRepresentations<MeshToonMaterialProperties>>
197
+ {}
171
198
 
172
- setValues(parameters: MeshToonMaterialParameters): void;
199
+ /**
200
+ * A material implementing toon shading.
201
+ */
202
+ export class MeshToonMaterial extends Material {
203
+ /**
204
+ * Constructs a new mesh toon material.
205
+ *
206
+ * @param {Object} [parameters] - An object with one or more properties
207
+ * defining the material's appearance. Any property of the material
208
+ * (including any property from inherited materials) can be passed
209
+ * in here. Color values can be passed any type of value accepted
210
+ * by {@link Color#set}.
211
+ */
212
+ constructor(parameters?: MeshToonMaterialParameters);
213
+ /**
214
+ * This flag can be used for type testing.
215
+ *
216
+ * @default true
217
+ */
218
+ readonly isMeshToonMaterial: boolean;
173
219
  }
220
+
221
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
222
+ export interface MeshToonMaterial extends MeshToonMaterialProperties {}