@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.
- three/README.md +1 -1
- three/examples/jsm/capabilities/WebGL.d.ts +0 -11
- three/examples/jsm/controls/TransformControls.d.ts +16 -1
- three/examples/jsm/helpers/TextureHelper.d.ts +2 -2
- three/examples/jsm/helpers/TextureHelperGPU.d.ts +2 -2
- three/examples/jsm/loaders/SVGLoader.d.ts +1 -1
- three/examples/jsm/physics/RapierPhysics.d.ts +1 -0
- three/examples/jsm/transpiler/AST.d.ts +77 -26
- three/examples/jsm/transpiler/TSLEncoder.d.ts +9 -3
- three/examples/jsm/tsl/display/AnamorphicNode.d.ts +4 -4
- three/examples/jsm/tsl/display/BleachBypass.d.ts +2 -2
- three/examples/jsm/tsl/display/BloomNode.d.ts +2 -2
- three/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts +20 -0
- three/examples/jsm/tsl/display/DenoiseNode.d.ts +4 -4
- three/examples/jsm/tsl/display/DepthOfFieldNode.d.ts +6 -6
- three/examples/jsm/tsl/display/DotScreenNode.d.ts +2 -2
- three/examples/jsm/tsl/display/FXAANode.d.ts +3 -3
- three/examples/jsm/tsl/display/FilmNode.d.ts +4 -4
- three/examples/jsm/tsl/display/GTAONode.d.ts +3 -3
- three/examples/jsm/tsl/display/GaussianBlurNode.d.ts +5 -5
- three/examples/jsm/tsl/display/LensflareNode.d.ts +8 -8
- three/examples/jsm/tsl/display/Lut3DNode.d.ts +4 -4
- three/examples/jsm/tsl/display/MotionBlur.d.ts +4 -4
- three/examples/jsm/tsl/display/OutlineNode.d.ts +3 -3
- three/examples/jsm/tsl/display/RGBShiftNode.d.ts +3 -3
- three/examples/jsm/tsl/display/SMAANode.d.ts +3 -3
- three/examples/jsm/tsl/display/SSRNode.d.ts +5 -5
- three/examples/jsm/tsl/display/Sepia.d.ts +2 -2
- three/examples/jsm/tsl/display/SobelOperatorNode.d.ts +3 -3
- three/examples/jsm/tsl/display/TransitionNode.d.ts +4 -4
- three/examples/jsm/tsl/display/hashBlur.d.ts +5 -5
- three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +5 -5
- three/package.json +2 -2
- three/src/Three.TSL.d.ts +9 -16
- three/src/Three.WebGPU.d.ts +2 -0
- three/src/constants.d.ts +13 -5
- three/src/core/BufferGeometry.d.ts +6 -1
- three/src/core/GLBufferAttribute.d.ts +18 -1
- three/src/helpers/AxesHelper.d.ts +3 -1
- three/src/materials/LineBasicMaterial.d.ts +66 -34
- three/src/materials/LineDashedMaterial.d.ts +41 -21
- three/src/materials/Material.d.ts +408 -398
- three/src/materials/MeshBasicMaterial.d.ts +101 -62
- three/src/materials/MeshDepthMaterial.d.ts +71 -32
- three/src/materials/MeshDistanceMaterial.d.ts +65 -29
- three/src/materials/MeshLambertMaterial.d.ts +179 -103
- three/src/materials/MeshMatcapMaterial.d.ts +97 -55
- three/src/materials/MeshNormalMaterial.d.ts +76 -41
- three/src/materials/MeshPhongMaterial.d.ts +164 -100
- three/src/materials/MeshPhysicalMaterial.d.ts +171 -111
- three/src/materials/MeshStandardMaterial.d.ts +178 -91
- three/src/materials/MeshToonMaterial.d.ts +130 -81
- three/src/materials/PointsMaterial.d.ts +77 -30
- three/src/materials/RawShaderMaterial.d.ts +12 -7
- three/src/materials/ShaderMaterial.d.ts +186 -98
- three/src/materials/ShadowMaterial.d.ts +49 -23
- three/src/materials/SpriteMaterial.d.ts +62 -33
- three/src/materials/nodes/Line2NodeMaterial.d.ts +87 -40
- three/src/materials/nodes/LineBasicNodeMaterial.d.ts +35 -16
- three/src/materials/nodes/LineDashedNodeMaterial.d.ts +75 -20
- three/src/materials/nodes/MeshBasicNodeMaterial.d.ts +49 -30
- three/src/materials/nodes/MeshLambertNodeMaterial.d.ts +49 -42
- three/src/materials/nodes/MeshMatcapNodeMaterial.d.ts +38 -26
- three/src/materials/nodes/MeshNormalNodeMaterial.d.ts +36 -22
- three/src/materials/nodes/MeshPhongNodeMaterial.d.ts +68 -48
- three/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts +240 -65
- three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +99 -3
- three/src/materials/nodes/MeshStandardNodeMaterial.d.ts +83 -47
- three/src/materials/nodes/MeshToonNodeMaterial.d.ts +42 -36
- three/src/materials/nodes/NodeMaterial.d.ts +417 -56
- three/src/materials/nodes/NodeMaterials.d.ts +3 -2
- three/src/materials/nodes/PointsNodeMaterial.d.ts +31 -7
- three/src/materials/nodes/ShadowNodeMaterial.d.ts +38 -11
- three/src/materials/nodes/SpriteNodeMaterial.d.ts +68 -20
- three/src/materials/nodes/VolumeNodeMaterial.d.ts +50 -14
- three/src/math/Color.d.ts +1 -1
- three/src/nodes/Nodes.d.ts +1 -3
- three/src/nodes/TSL.d.ts +4 -3
- three/src/nodes/accessors/AccessorsUtils.d.ts +3 -3
- three/src/nodes/accessors/Bitangent.d.ts +0 -2
- three/src/nodes/accessors/CubeTextureNode.d.ts +7 -7
- three/src/nodes/accessors/Normal.d.ts +19 -5
- three/src/nodes/accessors/ReferenceBaseNode.d.ts +1 -1
- three/src/nodes/accessors/StorageBufferNode.d.ts +3 -2
- three/src/nodes/accessors/StorageTextureNode.d.ts +5 -5
- three/src/nodes/accessors/Tangent.d.ts +0 -2
- three/src/nodes/accessors/TangentUtils.d.ts +22 -0
- three/src/nodes/accessors/Texture3DNode.d.ts +5 -4
- three/src/nodes/accessors/TextureBicubic.d.ts +4 -2
- three/src/nodes/accessors/TextureNode.d.ts +16 -16
- three/src/nodes/accessors/TextureSizeNode.d.ts +3 -3
- three/src/nodes/accessors/UniformArrayNode.d.ts +2 -7
- three/src/nodes/code/FunctionCallNode.d.ts +3 -1
- three/src/nodes/code/FunctionNode.d.ts +2 -2
- three/src/nodes/code/ScriptableNode.d.ts +2 -2
- three/src/nodes/core/AssignNode.d.ts +2 -2
- three/src/nodes/core/AttributeNode.d.ts +1 -1
- three/src/nodes/core/BypassNode.d.ts +2 -2
- three/src/nodes/core/CacheNode.d.ts +0 -2
- three/src/nodes/core/ContextNode.d.ts +3 -3
- three/src/nodes/core/StackNode.d.ts +3 -13
- three/src/nodes/core/SubBuildNode.d.ts +15 -0
- three/src/nodes/core/VarNode.d.ts +4 -4
- three/src/nodes/core/VaryingNode.d.ts +3 -3
- three/src/nodes/display/BlendModes.d.ts +12 -12
- three/src/nodes/display/BumpMapNode.d.ts +4 -3
- three/src/nodes/display/ColorAdjustment.d.ts +17 -17
- three/src/nodes/display/ColorSpaceFunctions.d.ts +3 -3
- three/src/nodes/display/ColorSpaceNode.d.ts +4 -4
- three/src/nodes/display/FrontFacingNode.d.ts +1 -0
- three/src/nodes/display/PosterizeNode.d.ts +3 -3
- three/src/nodes/display/RenderOutputNode.d.ts +2 -2
- three/src/nodes/display/ScreenNode.d.ts +0 -10
- three/src/nodes/display/ToneMappingFunctions.d.ts +7 -7
- three/src/nodes/display/ToneMappingNode.d.ts +6 -6
- three/src/nodes/display/ViewportDepthTextureNode.d.ts +3 -3
- three/src/nodes/fog/Fog.d.ts +10 -10
- three/src/nodes/functions/BSDF/Schlick_to_F0.d.ts +4 -4
- three/src/nodes/functions/material/getAlphaHashThreshold.d.ts +2 -2
- three/src/nodes/functions/material/getParallaxCorrectNormal.d.ts +4 -4
- three/src/nodes/geometry/RangeNode.d.ts +9 -2
- three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +20 -20
- three/src/nodes/gpgpu/ComputeNode.d.ts +2 -2
- three/src/nodes/lighting/PointShadowNode.d.ts +11 -11
- three/src/nodes/lighting/ShadowFilterNode.d.ts +11 -11
- three/src/nodes/materialx/MaterialXNodes.d.ts +59 -59
- three/src/nodes/materialx/lib/mx_hsv.d.ts +3 -3
- three/src/nodes/materialx/lib/mx_noise.d.ts +206 -206
- three/src/nodes/materialx/lib/mx_transform_color.d.ts +2 -2
- three/src/nodes/math/ConditionalNode.d.ts +4 -19
- three/src/nodes/math/Hash.d.ts +2 -2
- three/src/nodes/math/MathNode.d.ts +21 -17
- three/src/nodes/math/OperatorNode.d.ts +41 -52
- three/src/nodes/math/TriNoise3D.d.ts +6 -6
- three/src/nodes/pmrem/PMREMNode.d.ts +3 -3
- three/src/nodes/pmrem/PMREMUtils.d.ts +20 -20
- three/src/nodes/procedural/Checker.d.ts +2 -2
- three/src/nodes/shapes/Shapes.d.ts +2 -2
- three/src/nodes/tsl/TSLBase.d.ts +1 -0
- three/src/nodes/tsl/TSLCore.d.ts +176 -76
- three/src/nodes/utils/CubeMapNode.d.ts +2 -2
- three/src/nodes/utils/DebugNode.d.ts +2 -2
- three/src/nodes/utils/Discard.d.ts +2 -2
- three/src/nodes/utils/EquirectUV.d.ts +4 -0
- three/src/nodes/utils/LoopNode.d.ts +2 -7
- three/src/nodes/utils/MatcapUV.d.ts +4 -0
- three/src/nodes/utils/Oscillators.d.ts +5 -5
- three/src/nodes/utils/Packing.d.ts +3 -3
- three/src/nodes/utils/PostProcessingUtils.d.ts +9 -9
- three/src/nodes/utils/RTTNode.d.ts +3 -3
- three/src/nodes/utils/RemapNode.d.ts +9 -9
- three/src/nodes/utils/RotateNode.d.ts +3 -3
- three/src/nodes/utils/SampleNode.d.ts +16 -0
- three/src/nodes/utils/SpriteSheetUVNode.d.ts +4 -4
- three/src/nodes/utils/SpriteUtils.d.ts +2 -2
- three/src/nodes/utils/StorageArrayElementNode.d.ts +4 -3
- three/src/nodes/utils/TriplanarTextures.d.ts +20 -0
- three/src/nodes/utils/UVUtils.d.ts +8 -7
- three/src/nodes/utils/ViewportUtils.d.ts +2 -2
- three/src/objects/LOD.d.ts +1 -1
- three/src/renderers/WebGLRenderer.d.ts +1 -1
- three/src/renderers/common/Backend.d.ts +3 -3
- three/src/renderers/common/RenderObject.d.ts +10 -2
- three/src/renderers/common/Renderer.d.ts +5 -5
- three/src/renderers/common/Storage3DTexture.d.ts +40 -0
- three/src/renderers/common/StorageArrayTexture.d.ts +29 -0
- three/src/renderers/common/Textures.d.ts +2 -2
- three/src/renderers/common/XRRenderTarget.d.ts +3 -2
- three/src/renderers/common/nodes/NodeLibrary.d.ts +4 -9
- three/src/renderers/common/nodes/NodeSampledTexture.d.ts +1 -1
- three/src/renderers/common/nodes/Nodes.d.ts +1 -1
- three/src/renderers/webgpu/WebGPURenderer.d.ts +3 -0
- three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +65 -0
- three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +9 -0
- three/src/nodes/utils/EquirectUVNode.d.ts +0 -8
- three/src/nodes/utils/MatcapUVNode.d.ts +0 -8
- three/src/nodes/utils/TriplanarTexturesNode.d.ts +0 -36
- three/src/renderers/common/nodes/StandardNodeLibrary.d.ts +0 -5
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
Combine,
|
|
8
8
|
DepthModes,
|
|
9
9
|
NormalMapTypes,
|
|
10
|
-
PixelFormat,
|
|
11
10
|
Side,
|
|
12
11
|
StencilFunc,
|
|
13
12
|
StencilOp,
|
|
@@ -16,62 +15,351 @@ import { BufferGeometry } from "../core/BufferGeometry.js";
|
|
|
16
15
|
import { EventDispatcher } from "../core/EventDispatcher.js";
|
|
17
16
|
import { JSONMeta, Object3D } from "../core/Object3D.js";
|
|
18
17
|
import { Color, ColorRepresentation } from "../math/Color.js";
|
|
18
|
+
import { EulerTuple } from "../math/Euler.js";
|
|
19
19
|
import { Plane } from "../math/Plane.js";
|
|
20
|
+
import { Vector2Tuple } from "../math/Vector2.js";
|
|
20
21
|
import { Group } from "../objects/Group.js";
|
|
21
22
|
import { WebGLProgramParametersWithUniforms } from "../renderers/webgl/WebGLPrograms.js";
|
|
22
23
|
import { WebGLRenderer } from "../renderers/WebGLRenderer.js";
|
|
23
24
|
import { Scene } from "../scenes/Scene.js";
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
25
|
+
import { SourceJSON } from "../textures/Source.js";
|
|
26
|
+
import { TextureJSON } from "../textures/Texture.js";
|
|
27
|
+
|
|
28
|
+
export interface MaterialProperties {
|
|
29
|
+
/**
|
|
30
|
+
* The name of the material.
|
|
31
|
+
*/
|
|
32
|
+
name: string;
|
|
33
|
+
/**
|
|
34
|
+
* Defines the blending type of the material.
|
|
35
|
+
*
|
|
36
|
+
* It must be set to `CustomBlending` if custom blending properties like
|
|
37
|
+
* {@link Material#blendSrc}, {@link Material#blendDst} or {@link Material#blendEquation}
|
|
38
|
+
* should have any effect.
|
|
39
|
+
*
|
|
40
|
+
* @default NormalBlending
|
|
41
|
+
*/
|
|
42
|
+
blending: Blending;
|
|
43
|
+
/**
|
|
44
|
+
* Defines which side of faces will be rendered - front, back or both.
|
|
45
|
+
*
|
|
46
|
+
* @default FrontSide
|
|
47
|
+
*/
|
|
48
|
+
side: Side;
|
|
49
|
+
/**
|
|
50
|
+
* If set to `true`, vertex colors should be used.
|
|
51
|
+
*
|
|
52
|
+
* The engine supports RGB and RGBA vertex colors depending on whether a three (RGB) or
|
|
53
|
+
* four (RGBA) component color buffer attribute is used.
|
|
54
|
+
*
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
vertexColors: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Defines how transparent the material is.
|
|
60
|
+
* A value of `0.0` indicates fully transparent, `1.0` is fully opaque.
|
|
61
|
+
*
|
|
62
|
+
* If the {@link Material#transparent} is not set to `true`,
|
|
63
|
+
* the material will remain fully opaque and this value will only affect its color.
|
|
64
|
+
*
|
|
65
|
+
* @default 1
|
|
66
|
+
*/
|
|
67
|
+
opacity: number;
|
|
68
|
+
/**
|
|
69
|
+
* Defines whether this material is transparent. This has an effect on
|
|
70
|
+
* rendering as transparent objects need special treatment and are rendered
|
|
71
|
+
* after non-transparent objects.
|
|
72
|
+
*
|
|
73
|
+
* When set to true, the extent to which the material is transparent is
|
|
74
|
+
* controlled by {@link Material#opacity}.
|
|
75
|
+
*
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
transparent: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Enables alpha hashed transparency, an alternative to {@link Material#transparent} or
|
|
81
|
+
* {@link Material#alphaTest}. The material will not be rendered if opacity is lower than
|
|
82
|
+
* a random threshold. Randomization introduces some grain or noise, but approximates alpha
|
|
83
|
+
* blending without the associated problems of sorting. Using TAA can reduce the resulting noise.
|
|
84
|
+
*
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
alphaHash: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Defines the blending source factor.
|
|
90
|
+
*
|
|
91
|
+
* @default SrcAlphaFactor
|
|
92
|
+
*/
|
|
93
|
+
blendSrc: BlendingSrcFactor;
|
|
94
|
+
/**
|
|
95
|
+
* Defines the blending destination factor.
|
|
96
|
+
*
|
|
97
|
+
* @default OneMinusSrcAlphaFactor
|
|
98
|
+
*/
|
|
99
|
+
blendDst: BlendingDstFactor;
|
|
100
|
+
/**
|
|
101
|
+
* Defines the blending equation.
|
|
102
|
+
*
|
|
103
|
+
* @default AddEquation
|
|
104
|
+
*/
|
|
105
|
+
blendEquation: BlendingEquation;
|
|
106
|
+
/**
|
|
107
|
+
* Defines the blending source alpha factor.
|
|
108
|
+
*
|
|
109
|
+
* @default null
|
|
110
|
+
*/
|
|
111
|
+
blendSrcAlpha: BlendingSrcFactor | null;
|
|
112
|
+
/**
|
|
113
|
+
* Defines the blending destination alpha factor.
|
|
114
|
+
*
|
|
115
|
+
* @default null
|
|
116
|
+
*/
|
|
117
|
+
blendDstAlpha: BlendingDstFactor | null;
|
|
118
|
+
/**
|
|
119
|
+
* Defines the blending equation of the alpha channel.
|
|
120
|
+
*
|
|
121
|
+
* @default null
|
|
122
|
+
*/
|
|
123
|
+
blendEquationAlpha: BlendingEquation | null;
|
|
124
|
+
/**
|
|
125
|
+
* Represents the RGB values of the constant blend color.
|
|
126
|
+
*
|
|
127
|
+
* This property has only an effect when using custom blending with `ConstantColor` or `OneMinusConstantColor`.
|
|
128
|
+
*
|
|
129
|
+
* @default (0,0,0)
|
|
130
|
+
*/
|
|
131
|
+
blendColor: Color;
|
|
132
|
+
/**
|
|
133
|
+
* Represents the alpha value of the constant blend color.
|
|
134
|
+
*
|
|
135
|
+
* This property has only an effect when using custom blending with `ConstantAlpha` or `OneMinusConstantAlpha`.
|
|
136
|
+
*
|
|
137
|
+
* @default 0
|
|
138
|
+
*/
|
|
139
|
+
blendAlpha: number;
|
|
140
|
+
/**
|
|
141
|
+
* Defines the depth function.
|
|
142
|
+
*
|
|
143
|
+
* @default LessEqualDepth
|
|
144
|
+
*/
|
|
145
|
+
depthFunc: DepthModes;
|
|
146
|
+
/**
|
|
147
|
+
* Whether to have depth test enabled when rendering this material.
|
|
148
|
+
* When the depth test is disabled, the depth write will also be implicitly disabled.
|
|
149
|
+
*
|
|
150
|
+
* @default true
|
|
151
|
+
*/
|
|
152
|
+
depthTest: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Whether rendering this material has any effect on the depth buffer.
|
|
155
|
+
*
|
|
156
|
+
* When drawing 2D overlays it can be useful to disable the depth writing in
|
|
157
|
+
* order to layer several things together without creating z-index artifacts.
|
|
158
|
+
*
|
|
159
|
+
* @default true
|
|
160
|
+
*/
|
|
161
|
+
depthWrite: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* The bit mask to use when writing to the stencil buffer.
|
|
164
|
+
*
|
|
165
|
+
* @default 0xff
|
|
166
|
+
*/
|
|
167
|
+
stencilWriteMask: number;
|
|
168
|
+
/**
|
|
169
|
+
* The stencil comparison function to use.
|
|
170
|
+
*
|
|
171
|
+
* @default AlwaysStencilFunc
|
|
172
|
+
*/
|
|
173
|
+
stencilFunc: StencilFunc;
|
|
174
|
+
/**
|
|
175
|
+
* The value to use when performing stencil comparisons or stencil operations.
|
|
176
|
+
*
|
|
177
|
+
* @default 0
|
|
178
|
+
*/
|
|
179
|
+
stencilRef: number;
|
|
180
|
+
/**
|
|
181
|
+
* The bit mask to use when comparing against the stencil buffer.
|
|
182
|
+
*
|
|
183
|
+
* @default 0xff
|
|
184
|
+
*/
|
|
185
|
+
stencilFuncMask: number;
|
|
186
|
+
/**
|
|
187
|
+
* Which stencil operation to perform when the comparison function returns `false`.
|
|
188
|
+
*
|
|
189
|
+
* @default KeepStencilOp
|
|
190
|
+
*/
|
|
191
|
+
stencilFail: StencilOp;
|
|
192
|
+
/**
|
|
193
|
+
* Which stencil operation to perform when the comparison function returns
|
|
194
|
+
* `true` but the depth test fails.
|
|
195
|
+
*
|
|
196
|
+
* @default KeepStencilOp
|
|
197
|
+
*/
|
|
198
|
+
stencilZFail: StencilOp;
|
|
199
|
+
/**
|
|
200
|
+
* Which stencil operation to perform when the comparison function returns
|
|
201
|
+
* `true` and the depth test passes.
|
|
202
|
+
*
|
|
203
|
+
* @default KeepStencilOp
|
|
204
|
+
*/
|
|
205
|
+
stencilZPass: StencilOp;
|
|
206
|
+
/**
|
|
207
|
+
* Whether stencil operations are performed against the stencil buffer. In
|
|
208
|
+
* order to perform writes or comparisons against the stencil buffer this
|
|
209
|
+
* value must be `true`.
|
|
210
|
+
*
|
|
211
|
+
* @default false
|
|
212
|
+
*/
|
|
213
|
+
stencilWrite: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* User-defined clipping planes specified as THREE.Plane objects in world
|
|
216
|
+
* space. These planes apply to the objects this material is attached to.
|
|
217
|
+
* Points in space whose signed distance to the plane is negative are clipped
|
|
218
|
+
* (not rendered). This requires {@link WebGLRenderer#localClippingEnabled} to
|
|
219
|
+
* be `true`.
|
|
220
|
+
*
|
|
221
|
+
* @default null
|
|
222
|
+
*/
|
|
223
|
+
clippingPlanes: Array<Plane> | null;
|
|
224
|
+
/**
|
|
225
|
+
* Changes the behavior of clipping planes so that only their intersection is
|
|
226
|
+
* clipped, rather than their union.
|
|
227
|
+
*
|
|
228
|
+
* @default false
|
|
229
|
+
*/
|
|
230
|
+
clipIntersection: boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Defines whether to clip shadows according to the clipping planes specified
|
|
233
|
+
* on this material.
|
|
234
|
+
*
|
|
235
|
+
* @default false
|
|
236
|
+
*/
|
|
237
|
+
clipShadows: boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Defines which side of faces cast shadows. If `null`, the side casting shadows
|
|
240
|
+
* is determined as follows:
|
|
241
|
+
*
|
|
242
|
+
* - When {@link Material#side} is set to `FrontSide`, the back side cast shadows.
|
|
243
|
+
* - When {@link Material#side} is set to `BackSide`, the front side cast shadows.
|
|
244
|
+
* - When {@link Material#side} is set to `DoubleSide`, both sides cast shadows.
|
|
245
|
+
*
|
|
246
|
+
* @default null
|
|
247
|
+
*/
|
|
248
|
+
shadowSide: Side | null;
|
|
249
|
+
/**
|
|
250
|
+
* Whether to render the material's color.
|
|
251
|
+
*
|
|
252
|
+
* This can be used in conjunction with {@link Object3D#renderOder} to create invisible
|
|
253
|
+
* objects that occlude other objects.
|
|
254
|
+
*
|
|
255
|
+
* @default true
|
|
256
|
+
*/
|
|
257
|
+
colorWrite: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Override the renderer's default precision for this material.
|
|
260
|
+
*
|
|
261
|
+
* @default null
|
|
262
|
+
*/
|
|
263
|
+
precision: ("highp" | "mediump" | "lowp") | null;
|
|
264
|
+
/**
|
|
265
|
+
* Whether to use polygon offset or not. When enabled, each fragment's depth value will
|
|
266
|
+
* be offset after it is interpolated from the depth values of the appropriate vertices.
|
|
267
|
+
* The offset is added before the depth test is performed and before the value is written
|
|
268
|
+
* into the depth buffer.
|
|
269
|
+
*
|
|
270
|
+
* Can be useful for rendering hidden-line images, for applying decals to surfaces, and for
|
|
271
|
+
* rendering solids with highlighted edges.
|
|
272
|
+
*
|
|
273
|
+
* @default false
|
|
274
|
+
*/
|
|
275
|
+
polygonOffset: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* Specifies a scale factor that is used to create a variable depth offset for each polygon.
|
|
278
|
+
*
|
|
279
|
+
* @default 0
|
|
280
|
+
*/
|
|
281
|
+
polygonOffsetFactor: number;
|
|
282
|
+
/**
|
|
283
|
+
* Is multiplied by an implementation-specific value to create a constant depth offset.
|
|
284
|
+
*
|
|
285
|
+
* @default 0
|
|
286
|
+
*/
|
|
287
|
+
polygonOffsetUnits: number;
|
|
288
|
+
/**
|
|
289
|
+
* Whether to apply dithering to the color to remove the appearance of banding.
|
|
290
|
+
*
|
|
291
|
+
* @default false
|
|
292
|
+
*/
|
|
293
|
+
dithering: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Whether alpha to coverage should be enabled or not. Can only be used with MSAA-enabled contexts
|
|
296
|
+
* (meaning when the renderer was created with *antialias* parameter set to `true`). Enabling this
|
|
297
|
+
* will smooth aliasing on clip plane edges and alphaTest-clipped edges.
|
|
298
|
+
*
|
|
299
|
+
* @default false
|
|
300
|
+
*/
|
|
301
|
+
alphaToCoverage: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Whether to premultiply the alpha (transparency) value.
|
|
304
|
+
*
|
|
305
|
+
* @default false
|
|
306
|
+
*/
|
|
307
|
+
premultipliedAlpha: boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Whether double-sided, transparent objects should be rendered with a single pass or not.
|
|
310
|
+
*
|
|
311
|
+
* The engine renders double-sided, transparent objects with two draw calls (back faces first,
|
|
312
|
+
* then front faces) to mitigate transparency artifacts. There are scenarios however where this
|
|
313
|
+
* approach produces no quality gains but still doubles draw calls e.g. when rendering flat
|
|
314
|
+
* vegetation like grass sprites. In these cases, set the `forceSinglePass` flag to `true` to
|
|
315
|
+
* disable the two pass rendering to avoid performance issues.
|
|
316
|
+
*
|
|
317
|
+
* @default false
|
|
318
|
+
*/
|
|
319
|
+
forceSinglePass: boolean;
|
|
320
|
+
/**
|
|
321
|
+
* Whether it's possible to override the material with {@link Scene#overrideMaterial} or not.
|
|
322
|
+
*
|
|
323
|
+
* @default true
|
|
324
|
+
*/
|
|
325
|
+
allowOverride: boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Defines whether 3D objects using this material are visible.
|
|
328
|
+
*
|
|
329
|
+
* @default true
|
|
330
|
+
*/
|
|
331
|
+
visible: boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Defines whether this material is tone mapped according to the renderer's tone mapping setting.
|
|
334
|
+
*
|
|
335
|
+
* It is ignored when rendering to a render target or using post processing or when using
|
|
336
|
+
* `WebGPURenderer`. In all these cases, all materials are honored by tone mapping.
|
|
337
|
+
*
|
|
338
|
+
* @default true
|
|
339
|
+
*/
|
|
340
|
+
toneMapped: boolean;
|
|
341
|
+
/**
|
|
342
|
+
* An object that can be used to store custom data about the Material. It
|
|
343
|
+
* should not hold references to functions as these will not be cloned.
|
|
344
|
+
*/
|
|
345
|
+
userData: Record<string, any>;
|
|
346
|
+
set alphaTest(value: number);
|
|
347
|
+
/**
|
|
348
|
+
* Sets the alpha value to be used when running an alpha test. The material
|
|
349
|
+
* will not be rendered if the opacity is lower than this value.
|
|
350
|
+
*
|
|
351
|
+
* @default 0
|
|
352
|
+
*/
|
|
353
|
+
get alphaTest(): number;
|
|
73
354
|
}
|
|
74
355
|
|
|
356
|
+
export type MapColorPropertiesToColorRepresentations<T> = {
|
|
357
|
+
[P in keyof T]: T[P] extends Color ? ColorRepresentation : T[P];
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
361
|
+
export interface MaterialParameters extends Partial<MapColorPropertiesToColorRepresentations<MaterialProperties>> {}
|
|
362
|
+
|
|
75
363
|
export interface MaterialJSON {
|
|
76
364
|
metadata: { version: number; type: string; generator: string };
|
|
77
365
|
|
|
@@ -232,337 +520,45 @@ export interface MaterialJSON {
|
|
|
232
520
|
}
|
|
233
521
|
|
|
234
522
|
/**
|
|
235
|
-
*
|
|
523
|
+
* Abstract base class for materials.
|
|
524
|
+
*
|
|
525
|
+
* Materials define the appearance of renderable 3D objects.
|
|
526
|
+
*
|
|
527
|
+
* @abstract
|
|
236
528
|
*/
|
|
237
529
|
export class Material extends EventDispatcher<{ dispose: {} }> {
|
|
238
|
-
constructor();
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Read-only flag to check if a given object is of type {@link Material}.
|
|
242
|
-
* @remarks This is a _constant_ value
|
|
243
|
-
* @defaultValue `true`
|
|
244
|
-
*/
|
|
245
|
-
readonly isMaterial: true;
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Value is the string 'Material'. This shouldn't be changed, and can be used to find all objects of this type in a
|
|
249
|
-
* scene.
|
|
250
|
-
*/
|
|
251
|
-
type: string;
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Enables alpha hashed transparency, an alternative to {@link .transparent} or {@link .alphaTest}. The material
|
|
255
|
-
* will not be rendered if opacity is lower than a random threshold. Randomization introduces some grain or noise,
|
|
256
|
-
* but approximates alpha blending without the associated problems of sorting. Using TAARenderPass can reduce the
|
|
257
|
-
* resulting noise.
|
|
258
|
-
*/
|
|
259
|
-
alphaHash: boolean;
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Enables alpha to coverage. Can only be used with MSAA-enabled rendering contexts (meaning when the renderer was
|
|
263
|
-
* created with *antialias* parameter set to `true`). Enabling this will smooth aliasing on clip plane edges and
|
|
264
|
-
* alphaTest-clipped edges.
|
|
265
|
-
* @default false
|
|
266
|
-
*/
|
|
267
|
-
alphaToCoverage: boolean;
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Represents the alpha value of the constant blend color. This property has only an effect when using custom
|
|
271
|
-
* blending with {@link ConstantAlphaFactor} or {@link OneMinusConstantAlphaFactor}.
|
|
272
|
-
* @default 0
|
|
273
|
-
*/
|
|
274
|
-
blendAlpha: number;
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Represent the RGB values of the constant blend color. This property has only an effect when using custom
|
|
278
|
-
* blending with {@link ConstantColorFactor} or {@link OneMinusConstantColorFactor}.
|
|
279
|
-
* @default 0x000000
|
|
280
|
-
*/
|
|
281
|
-
blendColor: Color;
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Blending destination. It's one of the blending mode constants defined in Three.js. Default is {@link OneMinusSrcAlphaFactor}.
|
|
285
|
-
* @default THREE.OneMinusSrcAlphaFactor
|
|
286
|
-
*/
|
|
287
|
-
blendDst: BlendingDstFactor;
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* The transparency of the .blendDst. Default is null.
|
|
291
|
-
* @default null
|
|
292
|
-
*/
|
|
293
|
-
blendDstAlpha: number | null;
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* Blending equation to use when applying blending. It's one of the constants defined in Three.js. Default is {@link AddEquation}.
|
|
297
|
-
* @default THREE.AddEquation
|
|
298
|
-
*/
|
|
299
|
-
blendEquation: BlendingEquation;
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* The transparency of the .blendEquation. Default is null.
|
|
303
|
-
* @default null
|
|
304
|
-
*/
|
|
305
|
-
blendEquationAlpha: number | null;
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* Which blending to use when displaying objects with this material. Default is {@link NormalBlending}.
|
|
309
|
-
* @default THREE.NormalBlending
|
|
310
|
-
*/
|
|
311
|
-
blending: Blending;
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Blending source. It's one of the blending mode constants defined in Three.js. Default is {@link SrcAlphaFactor}.
|
|
315
|
-
* @default THREE.SrcAlphaFactor
|
|
316
|
-
*/
|
|
317
|
-
blendSrc: BlendingSrcFactor | BlendingDstFactor;
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* The transparency of the .blendSrc. Default is null.
|
|
321
|
-
* @default null
|
|
322
|
-
*/
|
|
323
|
-
blendSrcAlpha: number | null;
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union. Default is false.
|
|
327
|
-
* @default false
|
|
328
|
-
*/
|
|
329
|
-
clipIntersection: boolean;
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* User-defined clipping planes specified as THREE.Plane objects in world space.
|
|
333
|
-
* These planes apply to the objects this material is attached to.
|
|
334
|
-
* Points in space whose signed distance to the plane is negative are clipped (not rendered).
|
|
335
|
-
* See the WebGL / clipping /intersection example. Default is null.
|
|
336
|
-
* @default null
|
|
337
|
-
*/
|
|
338
|
-
clippingPlanes: Plane[] | null;
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Defines whether to clip shadows according to the clipping planes specified on this material. Default is false.
|
|
342
|
-
* @default false
|
|
343
|
-
*/
|
|
344
|
-
clipShadows: boolean;
|
|
345
|
-
|
|
346
530
|
/**
|
|
347
|
-
*
|
|
348
|
-
* @default true
|
|
349
|
-
*/
|
|
350
|
-
colorWrite: boolean;
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Custom defines to be injected into the shader. These are passed in form of an object literal, with key/value pairs. { MY_CUSTOM_DEFINE: '' , PI2: Math.PI * 2 }.
|
|
354
|
-
* The pairs are defined in both vertex and fragment shaders. Default is undefined.
|
|
355
|
-
* @default undefined
|
|
356
|
-
*/
|
|
357
|
-
defines: undefined | { [key: string]: any };
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Which depth function to use. Default is {@link LessEqualDepth}. See the depth mode constants for all possible values.
|
|
361
|
-
* @default THREE.LessEqualDepth
|
|
362
|
-
*/
|
|
363
|
-
depthFunc: DepthModes;
|
|
364
|
-
|
|
365
|
-
/**
|
|
366
|
-
* Whether to have depth test enabled when rendering this material. When the depth test is disabled, the depth write
|
|
367
|
-
* will also be implicitly disabled.
|
|
368
|
-
* @default true
|
|
369
|
-
*/
|
|
370
|
-
depthTest: boolean;
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Whether rendering this material has any effect on the depth buffer. Default is true.
|
|
374
|
-
* When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.
|
|
375
|
-
* @default true
|
|
376
|
-
*/
|
|
377
|
-
depthWrite: boolean;
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* Unique number of this material instance.
|
|
381
|
-
*/
|
|
382
|
-
id: number;
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Whether rendering this material has any effect on the stencil buffer. Default is *false*.
|
|
386
|
-
* @default false
|
|
387
|
-
*/
|
|
388
|
-
stencilWrite: boolean;
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* The stencil comparison function to use. Default is {@link AlwaysStencilFunc}. See stencil operation constants for all possible values.
|
|
392
|
-
* @default THREE.AlwaysStencilFunc
|
|
393
|
-
*/
|
|
394
|
-
stencilFunc: StencilFunc;
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* The value to use when performing stencil comparisons or stencil operations. Default is *0*.
|
|
398
|
-
* @default 0
|
|
399
|
-
*/
|
|
400
|
-
stencilRef: number;
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* The bit mask to use when writing to the stencil buffer. Default is *0xFF*.
|
|
404
|
-
* @default 0xff
|
|
405
|
-
*/
|
|
406
|
-
stencilWriteMask: number;
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* The bit mask to use when comparing against the stencil buffer. Default is *0xFF*.
|
|
410
|
-
* @default 0xff
|
|
411
|
-
*/
|
|
412
|
-
stencilFuncMask: number;
|
|
413
|
-
|
|
414
|
-
/**
|
|
415
|
-
* Which stencil operation to perform when the comparison function returns false. Default is {@link KeepStencilOp}. See the stencil operation constants for all possible values.
|
|
416
|
-
* @default THREE.KeepStencilOp
|
|
417
|
-
*/
|
|
418
|
-
stencilFail: StencilOp;
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Which stencil operation to perform when the comparison function returns true but the depth test fails.
|
|
422
|
-
* Default is {@link KeepStencilOp}.
|
|
423
|
-
* See the stencil operation constants for all possible values.
|
|
424
|
-
* @default THREE.KeepStencilOp
|
|
425
|
-
*/
|
|
426
|
-
stencilZFail: StencilOp;
|
|
427
|
-
|
|
428
|
-
/**
|
|
429
|
-
* Which stencil operation to perform when the comparison function returns true and the depth test passes.
|
|
430
|
-
* Default is {@link KeepStencilOp}.
|
|
431
|
-
* See the stencil operation constants for all possible values.
|
|
432
|
-
* @default THREE.KeepStencilOp
|
|
433
|
-
*/
|
|
434
|
-
stencilZPass: StencilOp;
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* Material name. Default is an empty string.
|
|
438
|
-
* @default ''
|
|
439
|
-
*/
|
|
440
|
-
name: string;
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Opacity. Default is 1.
|
|
444
|
-
* @default 1
|
|
445
|
-
*/
|
|
446
|
-
opacity: number;
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
* Whether to use polygon offset. Default is false. This corresponds to the POLYGON_OFFSET_FILL WebGL feature.
|
|
450
|
-
* @default false
|
|
451
|
-
*/
|
|
452
|
-
polygonOffset: boolean;
|
|
453
|
-
|
|
454
|
-
/**
|
|
455
|
-
* Sets the polygon offset factor. Default is 0.
|
|
456
|
-
* @default 0
|
|
457
|
-
*/
|
|
458
|
-
polygonOffsetFactor: number;
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* Sets the polygon offset units. Default is 0.
|
|
462
|
-
* @default 0
|
|
463
|
-
*/
|
|
464
|
-
polygonOffsetUnits: number;
|
|
465
|
-
|
|
466
|
-
/**
|
|
467
|
-
* Override the renderer's default precision for this material. Can be "highp", "mediump" or "lowp". Defaults is null.
|
|
468
|
-
* @default null
|
|
469
|
-
*/
|
|
470
|
-
precision: "highp" | "mediump" | "lowp" | null;
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* Whether to premultiply the alpha (transparency) value. See WebGL / Materials / Transparency for an example of the difference. Default is false.
|
|
474
|
-
* @default false
|
|
475
|
-
*/
|
|
476
|
-
premultipliedAlpha: boolean;
|
|
477
|
-
|
|
478
|
-
/**
|
|
479
|
-
* @default false
|
|
480
|
-
*/
|
|
481
|
-
forceSinglePass: boolean;
|
|
482
|
-
|
|
483
|
-
allowOverride: boolean;
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Whether to apply dithering to the color to remove the appearance of banding. Default is false.
|
|
487
|
-
* @default false
|
|
488
|
-
*/
|
|
489
|
-
dithering: boolean;
|
|
490
|
-
|
|
491
|
-
/**
|
|
492
|
-
* Defines which of the face sides will be rendered - front, back or both.
|
|
493
|
-
* Default is {@link THREE.FrontSide}. Other options are {@link THREE.BackSide} and {@link THREE.DoubleSide}.
|
|
531
|
+
* This flag can be used for type testing.
|
|
494
532
|
*
|
|
495
|
-
* @default {@link THREE.FrontSide}
|
|
496
|
-
*/
|
|
497
|
-
side: Side;
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* Defines which of the face sides will cast shadows. Default is *null*.
|
|
501
|
-
* If *null*, the value is opposite that of side, above.
|
|
502
|
-
* @default null
|
|
503
|
-
*/
|
|
504
|
-
shadowSide: Side | null;
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
* Defines whether this material is tone mapped according to the renderer's
|
|
508
|
-
* {@link WebGLRenderer.toneMapping toneMapping} setting. It is ignored when rendering to a render target or using
|
|
509
|
-
* post processing.
|
|
510
|
-
* @default true
|
|
511
|
-
*/
|
|
512
|
-
toneMapped: boolean;
|
|
513
|
-
|
|
514
|
-
/**
|
|
515
|
-
* Defines whether this material is transparent. This has an effect on rendering as transparent objects need special treatment and are rendered after non-transparent objects.
|
|
516
|
-
* When set to true, the extent to which the material is transparent is controlled by setting it's .opacity property.
|
|
517
|
-
* @default false
|
|
518
|
-
*/
|
|
519
|
-
transparent: boolean;
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* UUID of this material instance. This gets automatically assigned, so this shouldn't be edited.
|
|
523
|
-
*/
|
|
524
|
-
uuid: string;
|
|
525
|
-
|
|
526
|
-
/**
|
|
527
|
-
* Defines whether vertex coloring is used. Default is false.
|
|
528
|
-
* @default false
|
|
529
|
-
*/
|
|
530
|
-
vertexColors: boolean;
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* Defines whether this material is visible. Default is true.
|
|
534
533
|
* @default true
|
|
535
534
|
*/
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* An object that can be used to store custom data about the Material. It should not hold references to functions as these will not be cloned.
|
|
540
|
-
* @default {}
|
|
541
|
-
*/
|
|
542
|
-
userData: Record<string, any>;
|
|
543
|
-
|
|
535
|
+
readonly isMaterial: boolean;
|
|
544
536
|
/**
|
|
545
|
-
*
|
|
546
|
-
* @default 0
|
|
537
|
+
* The UUID of the material.
|
|
547
538
|
*/
|
|
548
|
-
|
|
549
|
-
|
|
539
|
+
readonly uuid: string;
|
|
550
540
|
/**
|
|
551
|
-
*
|
|
552
|
-
*
|
|
541
|
+
* The type property is used for detecting the object type
|
|
542
|
+
* in context of serialization/deserialization.
|
|
553
543
|
*/
|
|
554
|
-
|
|
555
|
-
|
|
544
|
+
readonly type: string;
|
|
556
545
|
/**
|
|
557
|
-
*
|
|
546
|
+
* This starts at `0` and counts how many times {@link Material#needsUpdate} is set to `true`.
|
|
547
|
+
*
|
|
558
548
|
* @default 0
|
|
559
549
|
*/
|
|
560
|
-
|
|
561
|
-
|
|
550
|
+
readonly version: number;
|
|
562
551
|
/**
|
|
563
552
|
* An optional callback that is executed immediately before the material is used to render a 3D object.
|
|
564
|
-
*
|
|
565
|
-
* This
|
|
553
|
+
*
|
|
554
|
+
* This method can only be used when rendering with {@link WebGLRenderer}.
|
|
555
|
+
*
|
|
556
|
+
* @param {WebGLRenderer} renderer - The renderer.
|
|
557
|
+
* @param {Scene} scene - The scene.
|
|
558
|
+
* @param {Camera} camera - The camera that is used to render the scene.
|
|
559
|
+
* @param {BufferGeometry} geometry - The 3D object's geometry.
|
|
560
|
+
* @param {Object3D} object - The 3D object.
|
|
561
|
+
* @param {Object} group - The geometry group data.
|
|
566
562
|
*/
|
|
567
563
|
onBeforeRender(
|
|
568
564
|
renderer: WebGLRenderer,
|
|
@@ -572,60 +568,74 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
|
|
|
572
568
|
object: Object3D,
|
|
573
569
|
group: Group,
|
|
574
570
|
): void;
|
|
575
|
-
|
|
576
571
|
/**
|
|
577
|
-
* An optional callback that is executed immediately before the shader
|
|
578
|
-
* This function is called with the shader source code
|
|
579
|
-
* Useful for the modification of built-in materials
|
|
580
|
-
*
|
|
581
|
-
*
|
|
582
|
-
*
|
|
583
|
-
*
|
|
584
|
-
*
|
|
585
|
-
* @param
|
|
572
|
+
* An optional callback that is executed immediately before the shader
|
|
573
|
+
* program is compiled. This function is called with the shader source code
|
|
574
|
+
* as a parameter. Useful for the modification of built-in materials.
|
|
575
|
+
*
|
|
576
|
+
* This method can only be used when rendering with {@link WebGLRenderer}. The
|
|
577
|
+
* recommended approach when customizing materials is to use `WebGPURenderer` with the new
|
|
578
|
+
* Node Material system and [TSL]{@link https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language}.
|
|
579
|
+
*
|
|
580
|
+
* @param {{vertexShader:string,fragmentShader:string,uniforms:Object}} shaderobject - The object holds the uniforms and the vertex and fragment shader source.
|
|
581
|
+
* @param {WebGLRenderer} renderer - A reference to the renderer.
|
|
586
582
|
*/
|
|
587
583
|
onBeforeCompile(parameters: WebGLProgramParametersWithUniforms, renderer: WebGLRenderer): void;
|
|
588
|
-
|
|
589
584
|
/**
|
|
590
|
-
* In case onBeforeCompile is used, this callback can be used to identify
|
|
585
|
+
* In case {@link Material#onBeforeCompile} is used, this callback can be used to identify
|
|
586
|
+
* values of settings used in `onBeforeCompile()`, so three.js can reuse a cached
|
|
587
|
+
* shader or recompile the shader for this material as needed.
|
|
588
|
+
*
|
|
589
|
+
* This method can only be used when rendering with {@link WebGLRenderer}.
|
|
590
|
+
*
|
|
591
|
+
* @return {string} The custom program cache key.
|
|
591
592
|
*/
|
|
592
593
|
customProgramCacheKey(): string;
|
|
593
|
-
|
|
594
594
|
/**
|
|
595
|
-
*
|
|
596
|
-
*
|
|
595
|
+
* This method can be used to set default values from parameter objects.
|
|
596
|
+
* It is a generic implementation so it can be used with different types
|
|
597
|
+
* of materials.
|
|
598
|
+
*
|
|
599
|
+
* @param {Object} [values] - The material values to set.
|
|
597
600
|
*/
|
|
598
|
-
setValues(values
|
|
599
|
-
|
|
601
|
+
setValues(values?: MaterialParameters): void;
|
|
600
602
|
/**
|
|
601
|
-
*
|
|
602
|
-
*
|
|
603
|
+
* Serializes the material into JSON.
|
|
604
|
+
*
|
|
605
|
+
* @param {?(Object|string)} meta - An optional value holding meta information about the serialization.
|
|
606
|
+
* @return {Object} A JSON object representing the serialized material.
|
|
607
|
+
* @see {@link ObjectLoader#parse}
|
|
603
608
|
*/
|
|
604
609
|
toJSON(meta?: JSONMeta): MaterialJSON;
|
|
605
|
-
|
|
606
610
|
/**
|
|
607
|
-
*
|
|
611
|
+
* Returns a new material with copied values from this instance.
|
|
612
|
+
*
|
|
613
|
+
* @return {Material} A clone of this instance.
|
|
608
614
|
*/
|
|
609
615
|
clone(): this;
|
|
610
|
-
|
|
611
616
|
/**
|
|
612
|
-
*
|
|
613
|
-
*
|
|
617
|
+
* Copies the values of the given material to this instance.
|
|
618
|
+
*
|
|
619
|
+
* @param {Material} source - The material to copy.
|
|
620
|
+
* @return {Material} A reference to this instance.
|
|
614
621
|
*/
|
|
615
|
-
copy(
|
|
616
|
-
|
|
622
|
+
copy(source: Material): this;
|
|
617
623
|
/**
|
|
618
|
-
* Frees the GPU-related resources allocated by this instance. Call this
|
|
619
|
-
* used in your app.
|
|
624
|
+
* Frees the GPU-related resources allocated by this instance. Call this
|
|
625
|
+
* method whenever this instance is no longer used in your app.
|
|
620
626
|
*
|
|
621
|
-
* Material
|
|
627
|
+
* @fires Material#dispose
|
|
622
628
|
*/
|
|
623
629
|
dispose(): void;
|
|
624
|
-
|
|
625
630
|
/**
|
|
626
|
-
*
|
|
627
|
-
*
|
|
631
|
+
* Setting this property to `true` indicates the engine the material
|
|
632
|
+
* needs to be recompiled.
|
|
633
|
+
*
|
|
628
634
|
* @default false
|
|
635
|
+
* @param {boolean} value
|
|
629
636
|
*/
|
|
630
637
|
set needsUpdate(value: boolean);
|
|
631
638
|
}
|
|
639
|
+
|
|
640
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
641
|
+
export interface Material extends MaterialProperties {}
|