@types/three 0.176.0 → 0.178.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- three/README.md +1 -1
- three/examples/jsm/Addons.d.ts +0 -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/LDrawLoader.d.ts +8 -3
- three/examples/jsm/loaders/SVGLoader.d.ts +1 -1
- three/examples/jsm/math/Octree.d.ts +3 -0
- three/examples/jsm/physics/RapierPhysics.d.ts +1 -0
- three/examples/jsm/postprocessing/AfterimagePass.d.ts +13 -10
- three/examples/jsm/postprocessing/FXAAPass.d.ts +7 -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 +10 -4
- three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +5 -5
- three/package.json +3 -3
- three/src/Three.Core.d.ts +0 -2
- three/src/Three.TSL.d.ts +11 -18
- three/src/Three.WebGPU.Nodes.d.ts +1 -0
- three/src/Three.WebGPU.d.ts +3 -0
- three/src/animation/tracks/NumberKeyframeTrack.d.ts +1 -1
- three/src/animation/tracks/QuaternionKeyframeTrack.d.ts +1 -1
- three/src/animation/tracks/StringKeyframeTrack.d.ts +1 -1
- three/src/animation/tracks/VectorKeyframeTrack.d.ts +1 -1
- three/src/constants.d.ts +13 -5
- three/src/core/BufferGeometry.d.ts +11 -2
- three/src/core/GLBufferAttribute.d.ts +18 -1
- three/src/core/RenderTarget.d.ts +3 -20
- three/src/extras/DataUtils.d.ts +4 -4
- three/src/geometries/CapsuleGeometry.d.ts +1 -0
- three/src/helpers/AxesHelper.d.ts +3 -1
- three/src/lights/SpotLightShadow.d.ts +2 -0
- three/src/lights/webgpu/ProjectorLight.d.ts +17 -0
- 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 +164 -116
- 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 +418 -55
- 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 -18
- three/src/materials/nodes/VolumeNodeMaterial.d.ts +50 -14
- three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +4 -0
- three/src/math/Box3.d.ts +8 -0
- three/src/math/Color.d.ts +1 -1
- three/src/math/ColorManagement.d.ts +12 -2
- three/src/math/Sphere.d.ts +8 -0
- three/src/math/Triangle.d.ts +3 -3
- three/src/nodes/Nodes.d.ts +2 -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 +16 -5
- 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 +24 -19
- 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 +7 -3
- 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 +1 -0
- three/src/nodes/core/ContextNode.d.ts +3 -3
- three/src/nodes/core/Node.d.ts +5 -4
- three/src/nodes/core/NodeUtils.d.ts +4 -0
- 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 +14 -10
- 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 +6 -16
- 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/ProjectorLightNode.d.ts +5 -0
- three/src/nodes/lighting/ShadowFilterNode.d.ts +11 -11
- three/src/nodes/lighting/SpotLightNode.d.ts +15 -1
- 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 +186 -81
- 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/ReflectorNode.d.ts +1 -0
- 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/objects/Mesh.d.ts +8 -0
- three/src/objects/Sprite.d.ts +8 -0
- three/src/renderers/WebGLRenderer.d.ts +3 -3
- 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 +10 -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/XRManager.d.ts +45 -0
- 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/nodes/WGSLNodeBuilder.d.ts +1 -0
- three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +10 -1
- three/src/textures/DepthTexture.d.ts +4 -2
- three/src/textures/Source.d.ts +20 -16
- three/src/textures/Texture.d.ts +69 -2
- three/examples/jsm/effects/PeppersGhostEffect.d.ts +0 -10
- three/src/core/RenderTargetArray.d.ts +0 -9
- 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
- three/src/textures/DepthArrayTexture.d.ts +0 -14
|
@@ -1,88 +1,123 @@
|
|
|
1
1
|
import { NormalMapTypes } from "../constants.js";
|
|
2
2
|
import { Vector2 } from "../math/Vector2.js";
|
|
3
3
|
import { Texture } from "../textures/Texture.js";
|
|
4
|
-
import { Material,
|
|
5
|
-
|
|
6
|
-
export interface MeshNormalMaterialParameters extends MaterialParameters {
|
|
7
|
-
bumpMap?: Texture | null | undefined;
|
|
8
|
-
bumpScale?: number | undefined;
|
|
9
|
-
normalMap?: Texture | null | undefined;
|
|
10
|
-
normalMapType?: NormalMapTypes | undefined;
|
|
11
|
-
normalScale?: Vector2 | undefined;
|
|
12
|
-
displacementMap?: Texture | null | undefined;
|
|
13
|
-
displacementScale?: number | undefined;
|
|
14
|
-
displacementBias?: number | undefined;
|
|
15
|
-
wireframe?: boolean | undefined;
|
|
16
|
-
wireframeLinewidth?: number | undefined;
|
|
17
|
-
|
|
18
|
-
flatShading?: boolean | undefined;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class MeshNormalMaterial extends Material {
|
|
22
|
-
constructor(parameters?: MeshNormalMaterialParameters);
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Read-only flag to check if a given object is of type {@link MeshNormalMaterial}.
|
|
26
|
-
* @remarks This is a _constant_ value
|
|
27
|
-
* @defaultValue `true`
|
|
28
|
-
*/
|
|
29
|
-
readonly isMeshNormalMaterial: true;
|
|
4
|
+
import { MapColorPropertiesToColorRepresentations, Material, MaterialProperties } from "./Material.js";
|
|
30
5
|
|
|
6
|
+
export interface MeshNormalMaterialProperties extends MaterialProperties {
|
|
31
7
|
/**
|
|
8
|
+
* The texture to create a bump map. The black and white values map to the
|
|
9
|
+
* perceived depth in relation to the lights. Bump doesn't actually affect
|
|
10
|
+
* the geometry of the object, only the lighting. If a normal map is defined
|
|
11
|
+
* this will be ignored.
|
|
12
|
+
*
|
|
32
13
|
* @default null
|
|
33
14
|
*/
|
|
34
15
|
bumpMap: Texture | null;
|
|
35
|
-
|
|
36
16
|
/**
|
|
17
|
+
* How much the bump map affects the material. Typical range is `[0,1]`.
|
|
18
|
+
*
|
|
37
19
|
* @default 1
|
|
38
20
|
*/
|
|
39
21
|
bumpScale: number;
|
|
40
|
-
|
|
41
22
|
/**
|
|
23
|
+
* The texture to create a normal map. The RGB values affect the surface
|
|
24
|
+
* normal for each pixel fragment and change the way the color is lit. Normal
|
|
25
|
+
* maps do not change the actual shape of the surface, only the lighting. In
|
|
26
|
+
* case the material has a normal map authored using the left handed
|
|
27
|
+
* convention, the `y` component of `normalScale` should be negated to compensate
|
|
28
|
+
* for the different handedness.
|
|
29
|
+
*
|
|
42
30
|
* @default null
|
|
43
31
|
*/
|
|
44
32
|
normalMap: Texture | null;
|
|
45
|
-
|
|
46
33
|
/**
|
|
47
|
-
*
|
|
34
|
+
* The type of normal map.
|
|
35
|
+
*
|
|
36
|
+
* @default TangentSpaceNormalMap
|
|
48
37
|
*/
|
|
49
38
|
normalMapType: NormalMapTypes;
|
|
50
|
-
|
|
51
39
|
/**
|
|
52
|
-
*
|
|
40
|
+
* How much the normal map affects the material. Typical value range is `[0,1]`.
|
|
41
|
+
*
|
|
42
|
+
* @default (1,1)
|
|
53
43
|
*/
|
|
54
44
|
normalScale: Vector2;
|
|
55
|
-
|
|
56
45
|
/**
|
|
46
|
+
* The displacement map affects the position of the mesh's vertices. Unlike
|
|
47
|
+
* other maps which only affect the light and shade of the material the
|
|
48
|
+
* displaced vertices can cast shadows, block other objects, and otherwise
|
|
49
|
+
* act as real geometry. The displacement texture is an image where the value
|
|
50
|
+
* of each pixel (white being the highest) is mapped against, and
|
|
51
|
+
* repositions, the vertices of the mesh.
|
|
52
|
+
*
|
|
57
53
|
* @default null
|
|
58
54
|
*/
|
|
59
55
|
displacementMap: Texture | null;
|
|
60
|
-
|
|
61
56
|
/**
|
|
62
|
-
*
|
|
57
|
+
* How much the displacement map affects the mesh (where black is no
|
|
58
|
+
* displacement, and white is maximum displacement). Without a displacement
|
|
59
|
+
* map set, this value is not applied.
|
|
60
|
+
*
|
|
61
|
+
* @default 0
|
|
63
62
|
*/
|
|
64
63
|
displacementScale: number;
|
|
65
|
-
|
|
66
64
|
/**
|
|
65
|
+
* The offset of the displacement map's values on the mesh's vertices.
|
|
66
|
+
* The bias is added to the scaled sample of the displacement map.
|
|
67
|
+
* Without a displacement map set, this value is not applied.
|
|
68
|
+
*
|
|
67
69
|
* @default 0
|
|
68
70
|
*/
|
|
69
71
|
displacementBias: number;
|
|
70
|
-
|
|
71
72
|
/**
|
|
73
|
+
* Renders the geometry as a wireframe.
|
|
74
|
+
*
|
|
72
75
|
* @default false
|
|
73
76
|
*/
|
|
74
77
|
wireframe: boolean;
|
|
75
|
-
|
|
76
78
|
/**
|
|
79
|
+
* Controls the thickness of the wireframe.
|
|
80
|
+
*
|
|
81
|
+
* WebGL and WebGPU ignore this property and always render
|
|
82
|
+
* 1 pixel wide lines.
|
|
83
|
+
*
|
|
77
84
|
* @default 1
|
|
78
85
|
*/
|
|
79
86
|
wireframeLinewidth: number;
|
|
80
|
-
|
|
81
87
|
/**
|
|
82
|
-
*
|
|
88
|
+
* Whether the material is rendered with flat shading or not.
|
|
89
|
+
*
|
|
83
90
|
* @default false
|
|
84
91
|
*/
|
|
85
92
|
flatShading: boolean;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
96
|
+
export interface MeshNormalMaterialParameters
|
|
97
|
+
extends Partial<MapColorPropertiesToColorRepresentations<MeshNormalMaterialProperties>>
|
|
98
|
+
{}
|
|
86
99
|
|
|
87
|
-
|
|
100
|
+
/**
|
|
101
|
+
* A material that maps the normal vectors to RGB colors.
|
|
102
|
+
*/
|
|
103
|
+
export class MeshNormalMaterial extends Material {
|
|
104
|
+
/**
|
|
105
|
+
* Constructs a new mesh normal material.
|
|
106
|
+
*
|
|
107
|
+
* @param {Object} [parameters] - An object with one or more properties
|
|
108
|
+
* defining the material's appearance. Any property of the material
|
|
109
|
+
* (including any property from inherited materials) can be passed
|
|
110
|
+
* in here. Color values can be passed any type of value accepted
|
|
111
|
+
* by {@link Color#set}.
|
|
112
|
+
*/
|
|
113
|
+
constructor(parameters?: MeshNormalMaterialParameters);
|
|
114
|
+
/**
|
|
115
|
+
* This flag can be used for type testing.
|
|
116
|
+
*
|
|
117
|
+
* @default true
|
|
118
|
+
*/
|
|
119
|
+
readonly isMeshNormalMaterial: boolean;
|
|
88
120
|
}
|
|
121
|
+
|
|
122
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
123
|
+
export interface MeshNormalMaterial extends MeshNormalMaterialProperties {}
|
|
@@ -1,223 +1,287 @@
|
|
|
1
1
|
import { Combine, NormalMapTypes } from "../constants.js";
|
|
2
|
-
import { Color
|
|
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,
|
|
7
|
-
|
|
8
|
-
export interface MeshPhongMaterialParameters extends MaterialParameters {
|
|
9
|
-
/** geometry color in hexadecimal. Default is 0xffffff. */
|
|
10
|
-
color?: ColorRepresentation | undefined;
|
|
11
|
-
specular?: ColorRepresentation | undefined;
|
|
12
|
-
shininess?: number | undefined;
|
|
13
|
-
opacity?: number | undefined;
|
|
14
|
-
map?: Texture | null | undefined;
|
|
15
|
-
lightMap?: Texture | null | undefined;
|
|
16
|
-
lightMapIntensity?: number | undefined;
|
|
17
|
-
aoMap?: Texture | null | undefined;
|
|
18
|
-
aoMapIntensity?: number | undefined;
|
|
19
|
-
emissive?: ColorRepresentation | undefined;
|
|
20
|
-
emissiveIntensity?: number | undefined;
|
|
21
|
-
emissiveMap?: Texture | null | undefined;
|
|
22
|
-
bumpMap?: Texture | null | undefined;
|
|
23
|
-
bumpScale?: number | undefined;
|
|
24
|
-
normalMap?: Texture | null | undefined;
|
|
25
|
-
normalMapType?: NormalMapTypes | undefined;
|
|
26
|
-
normalScale?: Vector2 | undefined;
|
|
27
|
-
displacementMap?: Texture | null | undefined;
|
|
28
|
-
displacementScale?: number | undefined;
|
|
29
|
-
displacementBias?: number | undefined;
|
|
30
|
-
specularMap?: Texture | null | undefined;
|
|
31
|
-
alphaMap?: Texture | null | undefined;
|
|
32
|
-
envMap?: Texture | null | undefined;
|
|
33
|
-
envMapRotation?: Euler | undefined;
|
|
34
|
-
combine?: Combine | undefined;
|
|
35
|
-
reflectivity?: number | undefined;
|
|
36
|
-
refractionRatio?: number | undefined;
|
|
37
|
-
wireframe?: boolean | undefined;
|
|
38
|
-
wireframeLinewidth?: number | undefined;
|
|
39
|
-
wireframeLinecap?: string | undefined;
|
|
40
|
-
wireframeLinejoin?: string | undefined;
|
|
41
|
-
fog?: boolean | undefined;
|
|
42
|
-
flatShading?: boolean | undefined;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export class MeshPhongMaterial extends Material {
|
|
46
|
-
constructor(parameters?: MeshPhongMaterialParameters);
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Read-only flag to check if a given object is of type {@link MeshPhongMaterial}.
|
|
50
|
-
* @remarks This is a _constant_ value
|
|
51
|
-
* @defaultValue `true`
|
|
52
|
-
*/
|
|
53
|
-
readonly isMeshPhongMaterial: true;
|
|
6
|
+
import { MapColorPropertiesToColorRepresentations, Material, MaterialProperties } from "./Material.js";
|
|
54
7
|
|
|
8
|
+
export interface MeshPhongMaterialProperties extends MaterialProperties {
|
|
55
9
|
/**
|
|
56
|
-
*
|
|
10
|
+
* Color of the material.
|
|
11
|
+
*
|
|
12
|
+
* @default (1,1,1)
|
|
57
13
|
*/
|
|
58
14
|
color: Color;
|
|
59
|
-
|
|
60
15
|
/**
|
|
61
|
-
*
|
|
16
|
+
* Specular color of the material. The default color is set to `0x111111` (very dark grey)
|
|
17
|
+
*
|
|
18
|
+
* This defines how shiny the material is and the color of its shine.
|
|
62
19
|
*/
|
|
63
20
|
specular: Color;
|
|
64
|
-
|
|
65
21
|
/**
|
|
22
|
+
* How shiny the specular highlight is; a higher value gives a sharper highlight.
|
|
23
|
+
*
|
|
66
24
|
* @default 30
|
|
67
25
|
*/
|
|
68
26
|
shininess: number;
|
|
69
|
-
|
|
70
27
|
/**
|
|
28
|
+
* The color map. May optionally include an alpha channel, typically combined
|
|
29
|
+
* with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
|
|
30
|
+
* color is modulated by the diffuse `color`.
|
|
31
|
+
*
|
|
71
32
|
* @default null
|
|
72
33
|
*/
|
|
73
34
|
map: Texture | null;
|
|
74
|
-
|
|
75
35
|
/**
|
|
36
|
+
* The light map. Requires a second set of UVs.
|
|
37
|
+
*
|
|
76
38
|
* @default null
|
|
77
39
|
*/
|
|
78
40
|
lightMap: Texture | null;
|
|
79
|
-
|
|
80
41
|
/**
|
|
81
|
-
*
|
|
42
|
+
* Intensity of the baked light.
|
|
43
|
+
*
|
|
44
|
+
* @default 1
|
|
82
45
|
*/
|
|
83
46
|
lightMapIntensity: number;
|
|
84
|
-
|
|
85
47
|
/**
|
|
48
|
+
* The red channel of this texture is used as the ambient occlusion map.
|
|
49
|
+
* Requires a second set of UVs.
|
|
50
|
+
*
|
|
86
51
|
* @default null
|
|
87
52
|
*/
|
|
88
53
|
aoMap: Texture | null;
|
|
89
|
-
|
|
90
54
|
/**
|
|
91
|
-
*
|
|
55
|
+
* Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0`
|
|
56
|
+
* disables ambient occlusion. Where intensity is `1` and the AO map's
|
|
57
|
+
* red channel is also `1`, ambient light is fully occluded on a surface.
|
|
58
|
+
*
|
|
59
|
+
* @default 1
|
|
92
60
|
*/
|
|
93
61
|
aoMapIntensity: number;
|
|
94
|
-
|
|
95
62
|
/**
|
|
96
|
-
*
|
|
63
|
+
* Emissive (light) color of the material, essentially a solid color
|
|
64
|
+
* unaffected by other lighting.
|
|
65
|
+
*
|
|
66
|
+
* @default (0,0,0)
|
|
97
67
|
*/
|
|
98
68
|
emissive: Color;
|
|
99
|
-
|
|
100
69
|
/**
|
|
70
|
+
* Intensity of the emissive light. Modulates the emissive color.
|
|
71
|
+
*
|
|
101
72
|
* @default 1
|
|
102
73
|
*/
|
|
103
74
|
emissiveIntensity: number;
|
|
104
|
-
|
|
105
75
|
/**
|
|
76
|
+
* Set emissive (glow) map. The emissive map color is modulated by the
|
|
77
|
+
* emissive color and the emissive intensity. If you have an emissive map,
|
|
78
|
+
* be sure to set the emissive color to something other than black.
|
|
79
|
+
*
|
|
106
80
|
* @default null
|
|
107
81
|
*/
|
|
108
82
|
emissiveMap: Texture | null;
|
|
109
|
-
|
|
110
83
|
/**
|
|
84
|
+
* The texture to create a bump map. The black and white values map to the
|
|
85
|
+
* perceived depth in relation to the lights. Bump doesn't actually affect
|
|
86
|
+
* the geometry of the object, only the lighting. If a normal map is defined
|
|
87
|
+
* this will be ignored.
|
|
88
|
+
*
|
|
111
89
|
* @default null
|
|
112
90
|
*/
|
|
113
91
|
bumpMap: Texture | null;
|
|
114
|
-
|
|
115
92
|
/**
|
|
93
|
+
* How much the bump map affects the material. Typical range is `[0,1]`.
|
|
94
|
+
*
|
|
116
95
|
* @default 1
|
|
117
96
|
*/
|
|
118
97
|
bumpScale: number;
|
|
119
|
-
|
|
120
98
|
/**
|
|
99
|
+
* The texture to create a normal map. The RGB values affect the surface
|
|
100
|
+
* normal for each pixel fragment and change the way the color is lit. Normal
|
|
101
|
+
* maps do not change the actual shape of the surface, only the lighting. In
|
|
102
|
+
* case the material has a normal map authored using the left handed
|
|
103
|
+
* convention, the `y` component of `normalScale` should be negated to compensate
|
|
104
|
+
* for the different handedness.
|
|
105
|
+
*
|
|
121
106
|
* @default null
|
|
122
107
|
*/
|
|
123
108
|
normalMap: Texture | null;
|
|
124
|
-
|
|
125
109
|
/**
|
|
126
|
-
*
|
|
110
|
+
* The type of normal map.
|
|
111
|
+
*
|
|
112
|
+
* @default TangentSpaceNormalMap
|
|
127
113
|
*/
|
|
128
114
|
normalMapType: NormalMapTypes;
|
|
129
|
-
|
|
130
115
|
/**
|
|
131
|
-
*
|
|
116
|
+
* How much the normal map affects the material. Typical value range is `[0,1]`.
|
|
117
|
+
*
|
|
118
|
+
* @default (1,1)
|
|
132
119
|
*/
|
|
133
120
|
normalScale: Vector2;
|
|
134
|
-
|
|
135
121
|
/**
|
|
122
|
+
* The displacement map affects the position of the mesh's vertices. Unlike
|
|
123
|
+
* other maps which only affect the light and shade of the material the
|
|
124
|
+
* displaced vertices can cast shadows, block other objects, and otherwise
|
|
125
|
+
* act as real geometry. The displacement texture is an image where the value
|
|
126
|
+
* of each pixel (white being the highest) is mapped against, and
|
|
127
|
+
* repositions, the vertices of the mesh.
|
|
128
|
+
*
|
|
136
129
|
* @default null
|
|
137
130
|
*/
|
|
138
131
|
displacementMap: Texture | null;
|
|
139
|
-
|
|
140
132
|
/**
|
|
141
|
-
*
|
|
133
|
+
* How much the displacement map affects the mesh (where black is no
|
|
134
|
+
* displacement, and white is maximum displacement). Without a displacement
|
|
135
|
+
* map set, this value is not applied.
|
|
136
|
+
*
|
|
137
|
+
* @default 0
|
|
142
138
|
*/
|
|
143
139
|
displacementScale: number;
|
|
144
|
-
|
|
145
140
|
/**
|
|
141
|
+
* The offset of the displacement map's values on the mesh's vertices.
|
|
142
|
+
* The bias is added to the scaled sample of the displacement map.
|
|
143
|
+
* Without a displacement map set, this value is not applied.
|
|
144
|
+
*
|
|
146
145
|
* @default 0
|
|
147
146
|
*/
|
|
148
147
|
displacementBias: number;
|
|
149
|
-
|
|
150
148
|
/**
|
|
149
|
+
* The specular map value affects both how much the specular surface
|
|
150
|
+
* highlight contributes and how much of the environment map affects the
|
|
151
|
+
* surface.
|
|
152
|
+
*
|
|
151
153
|
* @default null
|
|
152
154
|
*/
|
|
153
155
|
specularMap: Texture | null;
|
|
154
|
-
|
|
155
156
|
/**
|
|
157
|
+
* The alpha map is a grayscale texture that controls the opacity across the
|
|
158
|
+
* surface (black: fully transparent; white: fully opaque).
|
|
159
|
+
*
|
|
160
|
+
* Only the color of the texture is used, ignoring the alpha channel if one
|
|
161
|
+
* exists. For RGB and RGBA textures, the renderer will use the green channel
|
|
162
|
+
* when sampling this texture due to the extra bit of precision provided for
|
|
163
|
+
* green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
|
|
164
|
+
* luminance/alpha textures will also still work as expected.
|
|
165
|
+
*
|
|
156
166
|
* @default null
|
|
157
167
|
*/
|
|
158
168
|
alphaMap: Texture | null;
|
|
159
|
-
|
|
160
169
|
/**
|
|
170
|
+
* The environment map.
|
|
171
|
+
*
|
|
161
172
|
* @default null
|
|
162
173
|
*/
|
|
163
174
|
envMap: Texture | null;
|
|
164
|
-
|
|
165
175
|
/**
|
|
166
|
-
* The rotation of the environment map in radians.
|
|
176
|
+
* The rotation of the environment map in radians.
|
|
177
|
+
*
|
|
178
|
+
* @default (0,0,0)
|
|
167
179
|
*/
|
|
168
180
|
envMapRotation: Euler;
|
|
169
|
-
|
|
170
181
|
/**
|
|
171
|
-
*
|
|
182
|
+
* How to combine the result of the surface's color with the environment map, if any.
|
|
183
|
+
*
|
|
184
|
+
* When set to `MixOperation`, the {@link MeshBasicMaterial#reflectivity} is used to
|
|
185
|
+
* blend between the two colors.
|
|
186
|
+
*
|
|
187
|
+
* @default MultiplyOperation
|
|
172
188
|
*/
|
|
173
189
|
combine: Combine;
|
|
174
|
-
|
|
175
190
|
/**
|
|
191
|
+
* How much the environment map affects the surface.
|
|
192
|
+
* The valid range is between `0` (no reflections) and `1` (full reflections).
|
|
193
|
+
*
|
|
176
194
|
* @default 1
|
|
177
195
|
*/
|
|
178
196
|
reflectivity: number;
|
|
179
|
-
|
|
180
197
|
/**
|
|
198
|
+
* The index of refraction (IOR) of air (approximately 1) divided by the
|
|
199
|
+
* index of refraction of the material. It is used with environment mapping
|
|
200
|
+
* modes {@link CubeRefractionMapping} and {@link EquirectangularRefractionMapping}.
|
|
201
|
+
* The refraction ratio should not exceed `1`.
|
|
202
|
+
*
|
|
181
203
|
* @default 0.98
|
|
182
204
|
*/
|
|
183
205
|
refractionRatio: number;
|
|
184
|
-
|
|
185
206
|
/**
|
|
207
|
+
* Renders the geometry as a wireframe.
|
|
208
|
+
*
|
|
186
209
|
* @default false
|
|
187
210
|
*/
|
|
188
211
|
wireframe: boolean;
|
|
189
|
-
|
|
190
212
|
/**
|
|
213
|
+
* Controls the thickness of the wireframe.
|
|
214
|
+
*
|
|
215
|
+
* Can only be used with {@link SVGRenderer}.
|
|
216
|
+
*
|
|
191
217
|
* @default 1
|
|
192
218
|
*/
|
|
193
219
|
wireframeLinewidth: number;
|
|
194
|
-
|
|
195
220
|
/**
|
|
221
|
+
* Defines appearance of wireframe ends.
|
|
222
|
+
*
|
|
223
|
+
* Can only be used with {@link SVGRenderer}.
|
|
224
|
+
*
|
|
196
225
|
* @default 'round'
|
|
197
226
|
*/
|
|
198
|
-
wireframeLinecap:
|
|
199
|
-
|
|
227
|
+
wireframeLinecap: "round" | "bevel" | "miter";
|
|
200
228
|
/**
|
|
229
|
+
* Defines appearance of wireframe joints.
|
|
230
|
+
*
|
|
231
|
+
* Can only be used with {@link SVGRenderer}.
|
|
232
|
+
*
|
|
201
233
|
* @default 'round'
|
|
202
234
|
*/
|
|
203
|
-
wireframeLinejoin:
|
|
204
|
-
|
|
235
|
+
wireframeLinejoin: "round" | "bevel" | "miter";
|
|
205
236
|
/**
|
|
206
|
-
*
|
|
237
|
+
* Whether the material is rendered with flat shading or not.
|
|
238
|
+
*
|
|
207
239
|
* @default false
|
|
208
240
|
*/
|
|
209
241
|
flatShading: boolean;
|
|
210
|
-
|
|
211
242
|
/**
|
|
212
|
-
*
|
|
243
|
+
* Whether the material is affected by fog or not.
|
|
244
|
+
*
|
|
245
|
+
* @default true
|
|
213
246
|
*/
|
|
214
|
-
|
|
247
|
+
fog: boolean;
|
|
248
|
+
}
|
|
215
249
|
|
|
250
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
251
|
+
export interface MeshPhongMaterialParameters
|
|
252
|
+
extends Partial<MapColorPropertiesToColorRepresentations<MeshPhongMaterialProperties>>
|
|
253
|
+
{}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* A material for shiny surfaces with specular highlights.
|
|
257
|
+
*
|
|
258
|
+
* The material uses a non-physically based [Blinn-Phong]{@link https://en.wikipedia.org/wiki/Blinn-Phong_shading_model}
|
|
259
|
+
* model for calculating reflectance. Unlike the Lambertian model used in the
|
|
260
|
+
* {@link MeshLambertMaterial} this can simulate shiny surfaces with specular
|
|
261
|
+
* highlights (such as varnished wood). `MeshPhongMaterial` uses per-fragment shading.
|
|
262
|
+
*
|
|
263
|
+
* Performance will generally be greater when using this material over the
|
|
264
|
+
* {@link MeshStandardMaterial} or {@link MeshPhysicalMaterial}, at the cost of
|
|
265
|
+
* some graphical accuracy.
|
|
266
|
+
*/
|
|
267
|
+
export class MeshPhongMaterial extends Material {
|
|
216
268
|
/**
|
|
217
|
-
*
|
|
218
|
-
*
|
|
269
|
+
* Constructs a new mesh phong material.
|
|
270
|
+
*
|
|
271
|
+
* @param {Object} [parameters] - An object with one or more properties
|
|
272
|
+
* defining the material's appearance. Any property of the material
|
|
273
|
+
* (including any property from inherited materials) can be passed
|
|
274
|
+
* in here. Color values can be passed any type of value accepted
|
|
275
|
+
* by {@link Color#set}.
|
|
219
276
|
*/
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
277
|
+
constructor(parameters?: MeshPhongMaterialParameters);
|
|
278
|
+
/**
|
|
279
|
+
* This flag can be used for type testing.
|
|
280
|
+
*
|
|
281
|
+
* @default true
|
|
282
|
+
*/
|
|
283
|
+
readonly isMeshPhongMaterial: boolean;
|
|
223
284
|
}
|
|
285
|
+
|
|
286
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
287
|
+
export interface MeshPhongMaterial extends MeshPhongMaterialProperties {}
|