@types/three 0.150.2 → 0.152.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 +2 -2
- three/build/three.min.d.ts +2 -0
- three/build/three.module.min.d.ts +2 -0
- three/examples/jsm/controls/MapControls.d.ts +21 -0
- three/examples/jsm/controls/OrbitControls.d.ts +1 -5
- three/examples/jsm/controls/PointerLockControls.d.ts +3 -0
- three/examples/jsm/controls/TrackballControls.d.ts +2 -0
- three/examples/jsm/helpers/ViewHelper.d.ts +3 -4
- three/examples/jsm/libs/tween.module.d.ts +2 -0
- three/examples/jsm/loaders/GLTFLoader.d.ts +2 -4
- three/examples/jsm/loaders/SVGLoader.d.ts +15 -3
- three/examples/jsm/nodes/Nodes.d.ts +131 -226
- three/examples/jsm/nodes/{core → code}/CodeNode.d.ts +2 -3
- three/examples/jsm/nodes/{core → code}/ExpressionNode.d.ts +2 -2
- three/examples/jsm/nodes/{core → code}/FunctionCallNode.d.ts +2 -2
- three/examples/jsm/nodes/{core → code}/FunctionNode.d.ts +4 -4
- three/examples/jsm/nodes/core/InputNode.d.ts +4 -0
- three/examples/jsm/nodes/core/NodeBuilder.d.ts +1 -11
- three/examples/jsm/nodes/core/NodeUtils.d.ts +8 -2
- three/examples/jsm/nodes/core/{VaryNode.d.ts → VaryingNode.d.ts} +1 -1
- three/examples/jsm/nodes/core/constants.d.ts +1 -0
- three/examples/jsm/nodes/fog/FogNode.d.ts +1 -1
- three/examples/jsm/nodes/geometry/RangeNode.d.ts +2 -1
- three/examples/jsm/nodes/lighting/LightUtils.d.ts +4 -0
- three/examples/jsm/nodes/lighting/PointLightNode.d.ts +10 -0
- three/examples/jsm/nodes/lighting/SpotLightNode.d.ts +15 -0
- three/examples/jsm/nodes/materials/LineBasicNodeMaterial.d.ts +0 -7
- three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.d.ts +0 -9
- three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +0 -9
- three/examples/jsm/nodes/materials/NodeMaterial.d.ts +17 -1
- three/examples/jsm/nodes/math/MathNode.d.ts +2 -2
- three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts +2 -2
- three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts +0 -2
- three/examples/jsm/objects/{GroundProjectedEnv.d.ts → GroundProjectedSkybox.d.ts} +1 -1
- three/examples/jsm/postprocessing/Pass.d.ts +2 -0
- three/examples/jsm/renderers/CSS2DRenderer.d.ts +2 -1
- three/examples/jsm/renderers/CSS3DRenderer.d.ts +2 -2
- three/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.d.ts +1 -21
- three/examples/jsm/utils/BufferGeometryUtils.d.ts +12 -2
- three/examples/jsm/utils/SkeletonUtils.d.ts +3 -19
- three/index.d.ts +1 -1
- three/package.json +3 -2
- three/src/Three.d.ts +1 -0
- three/src/constants.d.ts +3 -23
- three/src/core/BufferGeometry.d.ts +60 -33
- three/src/core/Raycaster.d.ts +2 -1
- three/src/extras/DataUtils.d.ts +13 -0
- three/src/extras/Earcut.d.ts +12 -0
- three/src/extras/ImageUtils.d.ts +20 -20
- three/src/extras/PMREMGenerator.d.ts +66 -0
- three/src/extras/ShapeUtils.d.ts +19 -1
- three/src/extras/core/Curve.d.ts +86 -31
- three/src/extras/core/CurvePath.d.ts +46 -4
- three/src/extras/core/Interpolations.d.ts +36 -0
- three/src/extras/core/Path.d.ts +122 -15
- three/src/extras/core/Shape.d.ts +56 -6
- three/src/extras/core/ShapePath.d.ts +73 -8
- three/src/extras/curves/ArcCurve.d.ts +35 -3
- three/src/extras/curves/CatmullRomCurve3.d.ts +62 -15
- three/src/extras/curves/CubicBezierCurve.d.ts +48 -7
- three/src/extras/curves/CubicBezierCurve3.d.ts +48 -7
- three/src/extras/curves/EllipseCurve.d.ts +73 -18
- three/src/extras/curves/LineCurve.d.ts +26 -5
- three/src/extras/curves/LineCurve3.d.ts +26 -5
- three/src/extras/curves/QuadraticBezierCurve.d.ts +44 -6
- three/src/extras/curves/QuadraticBezierCurve3.d.ts +44 -6
- three/src/extras/curves/SplineCurve.d.ts +39 -3
- three/src/helpers/ArrowHelper.d.ts +47 -16
- three/src/helpers/AxesHelper.d.ts +35 -3
- three/src/helpers/Box3Helper.d.ts +28 -4
- three/src/helpers/BoxHelper.d.ts +44 -4
- three/src/helpers/CameraHelper.d.ts +38 -19
- three/src/helpers/DirectionalLightHelper.d.ts +57 -10
- three/src/helpers/GridHelper.d.ts +32 -6
- three/src/helpers/HemisphereLightHelper.d.ts +56 -3
- three/src/helpers/PlaneHelper.d.ts +31 -8
- three/src/helpers/PointLightHelper.d.ts +54 -6
- three/src/helpers/PolarGridHelper.d.ts +35 -8
- three/src/helpers/SkeletonHelper.d.ts +56 -8
- three/src/helpers/SpotLightHelper.d.ts +59 -4
- three/src/lights/AmbientLight.d.ts +23 -10
- three/src/lights/AmbientLightProbe.d.ts +18 -0
- three/src/lights/DirectionalLight.d.ts +75 -20
- three/src/lights/DirectionalLightShadow.d.ts +68 -2
- three/src/lights/HemisphereLight.d.ts +45 -12
- three/src/lights/HemisphereLightProbe.d.ts +19 -0
- three/src/lights/Light.d.ts +40 -43
- three/src/lights/LightProbe.d.ts +32 -5
- three/src/lights/LightShadow.d.ts +100 -18
- three/src/lights/PointLight.d.ts +57 -12
- three/src/lights/PointLightShadow.d.ts +18 -2
- three/src/lights/RectAreaLight.d.ts +60 -8
- three/src/lights/SpotLight.d.ts +105 -20
- three/src/lights/SpotLightShadow.d.ts +63 -3
- three/src/materials/LineBasicMaterial.d.ts +7 -1
- three/src/materials/MeshDistanceMaterial.d.ts +0 -15
- three/src/materials/ShaderMaterial.d.ts +1 -1
- three/src/math/Color.d.ts +23 -2
- three/src/math/Quaternion.d.ts +6 -0
- three/src/math/Triangle.d.ts +40 -0
- three/src/math/Vector2.d.ts +5 -0
- three/src/math/Vector3.d.ts +10 -3
- three/src/objects/InstancedMesh.d.ts +22 -30
- three/src/objects/LineSegments.d.ts +2 -0
- three/src/objects/Points.d.ts +7 -6
- three/src/objects/Skeleton.d.ts +5 -1
- three/src/objects/SkinnedMesh.d.ts +37 -25
- three/src/renderers/WebGLRenderTarget.d.ts +3 -0
- three/src/renderers/WebGLRenderer.d.ts +25 -1
- three/src/renderers/shaders/ShaderChunk.d.ts +58 -37
- three/src/renderers/shaders/UniformsLib.d.ts +88 -57
- three/src/textures/CanvasTexture.d.ts +0 -1
- three/src/textures/CompressedTexture.d.ts +3 -2
- three/src/textures/CubeTexture.d.ts +3 -4
- three/src/textures/DataTexture.d.ts +3 -3
- three/src/textures/Texture.d.ts +37 -24
- three/examples/jsm/nodes/functions/light/getDistanceAttenuation.d.ts +0 -5
- three/examples/jsm/nodes/lighting/PunctualLightNode.d.ts +0 -12
three/src/lights/PointLight.d.ts
CHANGED
|
@@ -3,12 +3,30 @@ import { Light } from './Light';
|
|
|
3
3
|
import { PointLightShadow } from './PointLightShadow';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
+
* A light that gets emitted from a single point in all directions
|
|
7
|
+
* @remarks
|
|
8
|
+
* A common use case for this is to replicate the light emitted from a bare lightbulb.
|
|
6
9
|
* @example
|
|
7
|
-
*
|
|
8
|
-
* light.
|
|
9
|
-
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const light = new THREE.PointLight(0xff0000, 1, 100);
|
|
12
|
+
* light.position.set(50, 50, 50);
|
|
13
|
+
* scene.add(light);
|
|
14
|
+
* ```
|
|
15
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_lights_pointlights | lights / pointlights }
|
|
16
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_effects_anaglyph | effects / anaglyph }
|
|
17
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_geometry_text | geometry / text }
|
|
18
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_lensflares | lensflares }
|
|
19
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/lights/PointLight | Official Documentation}
|
|
20
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/lights/PointLight.js | Source}
|
|
10
21
|
*/
|
|
11
|
-
export class PointLight extends Light {
|
|
22
|
+
export class PointLight extends Light<PointLightShadow> {
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new PointLight.
|
|
25
|
+
* @param color Hexadecimal color of the light. Default is 0xffffff (white). Expects a `Integer`
|
|
26
|
+
* @param intensity Numeric value of the light's strength/intensity. Expects a `Float`. Default `1`
|
|
27
|
+
* @param distance Maximum range of the light. Default is 0 (no limit).
|
|
28
|
+
* @param decay The amount the light dims along the distance of the light. Expects a `Float`. Default `2`
|
|
29
|
+
*/
|
|
12
30
|
constructor(color?: ColorRepresentation, intensity?: number, distance?: number, decay?: number);
|
|
13
31
|
|
|
14
32
|
/**
|
|
@@ -17,34 +35,61 @@ export class PointLight extends Light {
|
|
|
17
35
|
type: string;
|
|
18
36
|
|
|
19
37
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
38
|
+
* The light's intensity.
|
|
39
|
+
*
|
|
40
|
+
* When **{@link WebGLRenderer.physicallyCorrectLights | physically correct} mode** — intensity is the luminous intensity of the light measured in candela (cd).
|
|
41
|
+
* @remarks Changing the intensity will also change the light's power.
|
|
42
|
+
* @remarks Expects a `Float`
|
|
43
|
+
* @defaultValue `1`
|
|
22
44
|
*/
|
|
23
45
|
intensity: number;
|
|
24
46
|
|
|
25
47
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
48
|
+
* When **Default mode** — When distance is zero, light does not attenuate. When distance is non-zero,
|
|
49
|
+
* light will attenuate linearly from maximum intensity at the light's position down to zero at this distance from the light.
|
|
50
|
+
*
|
|
51
|
+
* When **{@link WebGLRenderer.physicallyCorrectLights | Physically correct} rendering mode** — When distance is zero,
|
|
52
|
+
* light will attenuate according to inverse-square law to infinite distance.
|
|
53
|
+
* When distance is non-zero, light will attenuate according to inverse-square law until near the distance cutoff,
|
|
54
|
+
* where it will then attenuate quickly and smoothly to 0. Inherently, cutoffs are not physically correct.
|
|
55
|
+
*
|
|
56
|
+
* @defaultValue `0.0`
|
|
57
|
+
* @remarks Expects a `Float`
|
|
28
58
|
*/
|
|
29
59
|
distance: number;
|
|
30
60
|
|
|
31
61
|
/**
|
|
32
62
|
* If set to `true` light will cast dynamic shadows.
|
|
33
63
|
* **Warning**: This is expensive and requires tweaking to get shadows looking right.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
64
|
+
* @see {@link THREE.PointLightShadow | PointLightShadow} for details.
|
|
65
|
+
* @defaultValue `false`
|
|
36
66
|
*/
|
|
37
67
|
castShadow: boolean;
|
|
38
68
|
|
|
39
69
|
/**
|
|
40
|
-
*
|
|
70
|
+
* The amount the light dims along the distance of the light.
|
|
71
|
+
* In **{@link WebGLRenderer.physicallyCorrectLights | physically correct} rendering mode** — the default value **should not** be changed.
|
|
72
|
+
* @remarks Expects a `Float`
|
|
73
|
+
* @defaultValue `2`
|
|
41
74
|
*/
|
|
42
75
|
decay: number;
|
|
43
76
|
|
|
44
77
|
/**
|
|
45
|
-
* @
|
|
78
|
+
* A {@link THREE.PointLightShadow | PointLightShadow} used to calculate shadows for this light.
|
|
79
|
+
* The lightShadow's {@link LightShadow.camera | camera} is set to
|
|
80
|
+
* a {@link THREE.PerspectiveCamera | PerspectiveCamera} with {@link PerspectiveCamera.fov | fov} of 90,
|
|
81
|
+
* {@link PerspectiveCamera.aspect | aspect} of 1,
|
|
82
|
+
* {@link PerspectiveCamera.near | near} clipping plane at 0.5
|
|
83
|
+
* and {@link PerspectiveCamera.far | far} clipping plane at 500.
|
|
84
|
+
* @defaultValue new THREE.PointLightShadow()
|
|
46
85
|
*/
|
|
47
86
|
shadow: PointLightShadow;
|
|
48
87
|
|
|
88
|
+
/**
|
|
89
|
+
* The light's power.
|
|
90
|
+
* When **{@link WebGLRenderer.physicallyCorrectLights | physically correct} rendering mode** — power is the luminous power of the light measured in lumens (lm).
|
|
91
|
+
* @remarks Changing the power will also change the light's intensity.
|
|
92
|
+
* @remarks Expects a `Float`
|
|
93
|
+
*/
|
|
49
94
|
power: number;
|
|
50
95
|
}
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { PerspectiveCamera } from './../cameras/PerspectiveCamera';
|
|
2
|
+
import { Light } from './Light';
|
|
2
3
|
import { LightShadow } from './LightShadow';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Shadow for {@link THREE.PointLight | PointLight}
|
|
7
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/lights/PointLightShadow.js | Source}
|
|
8
|
+
*/
|
|
9
|
+
export class PointLightShadow extends LightShadow<PerspectiveCamera> {
|
|
10
|
+
/**
|
|
11
|
+
* Read-only flag to check if a given object is of type {@link PointLightShadow}.
|
|
12
|
+
* @remarks This is a _constant_ value
|
|
13
|
+
* @defaultValue `true`
|
|
14
|
+
*/
|
|
15
|
+
readonly isPointLightShadow = true;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Update the matrices for the camera and shadow, used internally by the renderer.
|
|
19
|
+
* @param light The light for which the shadow is being rendered.
|
|
20
|
+
*/
|
|
21
|
+
override updateMatrices(light: Light, viewportIndex?: number): void;
|
|
6
22
|
}
|
|
@@ -1,30 +1,82 @@
|
|
|
1
1
|
import { Light } from './Light';
|
|
2
2
|
import { ColorRepresentation } from '../math/Color';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* {@link RectAreaLight} emits light uniformly across the face a rectangular plane
|
|
6
|
+
* @remarks
|
|
7
|
+
* This light type can be used to simulate light sources such as bright windows or strip lighting.
|
|
8
|
+
* Important Notes:
|
|
9
|
+
* - There is no shadow support.
|
|
10
|
+
* - Only {@link MeshStandardMaterial | MeshStandardMaterial} and {@link MeshPhysicalMaterial | MeshPhysicalMaterial} are supported.
|
|
11
|
+
* - You have to include {@link https://threejs.org/examples/jsm/lights/RectAreaLightUniformsLib.js | RectAreaLightUniformsLib} into your scene and call `init()`.
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const width = 10;
|
|
15
|
+
* const height = 10;
|
|
16
|
+
* const intensity = 1;
|
|
17
|
+
* const rectLight = new THREE.RectAreaLight(0xffffff, intensity, width, height);
|
|
18
|
+
* rectLight.position.set(5, 5, 0);
|
|
19
|
+
* rectLight.lookAt(0, 0, 0);
|
|
20
|
+
* scene.add(rectLight)
|
|
21
|
+
* const rectLightHelper = new RectAreaLightHelper(rectLight);
|
|
22
|
+
* rectLight.add(rectLightHelper);
|
|
23
|
+
* ```
|
|
24
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_lights_rectarealight | WebGL / {@link RectAreaLight} }
|
|
25
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/lights/RectAreaLight | Official Documentation}
|
|
26
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/lights/RectAreaLight.js | Source}
|
|
27
|
+
*/
|
|
28
|
+
export class RectAreaLight extends Light<undefined> {
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new {@link RectAreaLight}.
|
|
31
|
+
* @param color Hexadecimal color of the light. Default `0xffffff` _(white)_.
|
|
32
|
+
* @param intensity The light's intensity, or brightness. Expects a `Float`. Default `1`
|
|
33
|
+
* @param width Width of the light. Expects a `Float`. Default `10`
|
|
34
|
+
* @param height Height of the light. Expects a `Float`. Default `10`
|
|
35
|
+
*/
|
|
5
36
|
constructor(color?: ColorRepresentation, intensity?: number, width?: number, height?: number);
|
|
6
37
|
|
|
7
38
|
/**
|
|
8
|
-
* @
|
|
39
|
+
* Read-only flag to check if a given object is of type {@link RectAreaLight}.
|
|
40
|
+
* @remarks This is a _constant_ value
|
|
41
|
+
* @defaultValue `true`
|
|
42
|
+
*/
|
|
43
|
+
readonly isRectAreaLight: true;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A Read-only _string_ to check if `this` object type.
|
|
47
|
+
* @remarks Sub-classes will update this value.
|
|
48
|
+
* @defaultValue `RectAreaLight`
|
|
9
49
|
*/
|
|
10
|
-
type: string;
|
|
50
|
+
override readonly type: string | 'RectAreaLight';
|
|
11
51
|
|
|
12
52
|
/**
|
|
13
|
-
*
|
|
53
|
+
* The width of the light.
|
|
54
|
+
* @remarks Expects a `Float`
|
|
55
|
+
* @defaultValue `10`
|
|
14
56
|
*/
|
|
15
57
|
width: number;
|
|
16
58
|
|
|
17
59
|
/**
|
|
18
|
-
*
|
|
60
|
+
* The height of the light.
|
|
61
|
+
* @remarks Expects a `Float`
|
|
62
|
+
* @defaultValue `10`
|
|
19
63
|
*/
|
|
20
64
|
height: number;
|
|
21
65
|
|
|
22
66
|
/**
|
|
23
|
-
*
|
|
67
|
+
* The light's intensity.
|
|
68
|
+
* @remarks Changing the intensity will also change the light's power.
|
|
69
|
+
* In **{@link WebGLRenderer.physicallyCorrectLights | physically correct} rendering mode** — intensity is the luminance (brightness) of the light measured in nits (cd/m^2).
|
|
70
|
+
* @remarks Expects a `Float`
|
|
71
|
+
* @defaultValue `1`
|
|
24
72
|
*/
|
|
25
73
|
intensity: number;
|
|
26
74
|
|
|
75
|
+
/**
|
|
76
|
+
* The light's power.
|
|
77
|
+
* @remarks Changing the power will also change the light's intensity.
|
|
78
|
+
* In **{@link WebGLRenderer.physicallyCorrectLights | physically correct} rendering mode** — power is the luminous power of the light measured in lumens (lm).
|
|
79
|
+
* @remarks Expects a `Float`
|
|
80
|
+
*/
|
|
27
81
|
power: number;
|
|
28
|
-
|
|
29
|
-
readonly isRectAreaLight: true;
|
|
30
82
|
}
|
three/src/lights/SpotLight.d.ts
CHANGED
|
@@ -6,9 +6,36 @@ import { ColorRepresentation } from '../math/Color';
|
|
|
6
6
|
import { Texture } from '../textures/Texture';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* This light gets emitted from a single point in one direction, along a cone that increases in size the further from the light it gets.
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // white {@link SpotLight} shining from the side, modulated by a texture, casting a shadow
|
|
13
|
+
* const {@link SpotLight} = new THREE.SpotLight(0xffffff);
|
|
14
|
+
* spotLight.position.set(100, 1000, 100);
|
|
15
|
+
* spotLight.map = new THREE.TextureLoader().load(url);
|
|
16
|
+
* spotLight.castShadow = true;
|
|
17
|
+
* spotLight.shadow.mapSize.width = 1024;
|
|
18
|
+
* spotLight.shadow.mapSize.height = 1024;
|
|
19
|
+
* spotLight.shadow.camera.near = 500;
|
|
20
|
+
* spotLight.shadow.camera.far = 4000;
|
|
21
|
+
* spotLight.shadow.camera.fov = 30;
|
|
22
|
+
* scene.add(spotLight);
|
|
23
|
+
* ```
|
|
24
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_lights_spotlight | lights / {@link SpotLight} }
|
|
25
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_lights_spotlights | lights / spotlights }
|
|
26
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/lights/SpotLight | Official Documentation}
|
|
27
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/lights/SpotLight.js | Source}
|
|
10
28
|
*/
|
|
11
|
-
export class SpotLight extends Light {
|
|
29
|
+
export class SpotLight extends Light<SpotLightShadow> {
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new SpotLight.
|
|
32
|
+
* @param color Hexadecimal color of the light. Default `0xffffff` _(white)_.
|
|
33
|
+
* @param intensity Numeric value of the light's strength/intensity. Expects a `Float`. Default `1`.
|
|
34
|
+
* @param distance Maximum range of the light. Default is 0 (no limit). Expects a `Float`.
|
|
35
|
+
* @param angle Maximum angle of light dispersion from its direction whose upper bound is Math.PI/2.
|
|
36
|
+
* @param penumbra Percent of the {@link SpotLight} cone that is attenuated due to penumbra. Takes values between zero and 1. Expects a `Float`. Default `0`.
|
|
37
|
+
* @param decay The amount the light dims along the distance of the light. Expects a `Float`. Default `2`.
|
|
38
|
+
*/
|
|
12
39
|
constructor(
|
|
13
40
|
color?: ColorRepresentation,
|
|
14
41
|
intensity?: number,
|
|
@@ -19,61 +46,119 @@ export class SpotLight extends Light {
|
|
|
19
46
|
);
|
|
20
47
|
|
|
21
48
|
/**
|
|
22
|
-
* @
|
|
49
|
+
* Read-only flag to check if a given object is of type {@link SpotLight}.
|
|
50
|
+
* @remarks This is a _constant_ value
|
|
51
|
+
* @defaultValue `true`
|
|
23
52
|
*/
|
|
24
|
-
|
|
53
|
+
readonly isSpotLight: true;
|
|
25
54
|
|
|
26
55
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* @
|
|
56
|
+
* A Read-only _string_ to check if `this` object type.
|
|
57
|
+
* @remarks Sub-classes will update this value.
|
|
58
|
+
* @defaultValue `SpotLight`
|
|
59
|
+
*/
|
|
60
|
+
override readonly type: string | 'SpotLight';
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* This is set equal to {@link THREE.Object3D.DEFAULT_UP | Object3D.DEFAULT_UP} (0, 1, 0), so that the light shines from the top down.
|
|
64
|
+
* @defaultValue `{@link Object3D.DEFAULT_UP}`
|
|
30
65
|
*/
|
|
31
66
|
position: Vector3;
|
|
32
67
|
|
|
33
68
|
/**
|
|
34
|
-
*
|
|
35
|
-
* @
|
|
69
|
+
* The {@link SpotLight} points from its {@link SpotLight.position | position} to target.position.
|
|
70
|
+
* @remarks
|
|
71
|
+
* **Note**: For the target's position to be changed to anything other than the default,
|
|
72
|
+
* it must be added to the {@link Scene | scene} using
|
|
73
|
+
*
|
|
74
|
+
* ```typescript
|
|
75
|
+
* scene.add( light.target );
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* This is so that the target's {@link Object3D.matrixWorld | matrixWorld} gets automatically updated each frame.
|
|
79
|
+
* It is also possible to set the target to be another object in the scene (anything with a {@link THREE.Object3D.position | position} property), like so:
|
|
80
|
+
* ```typescript
|
|
81
|
+
* const targetObject = new THREE.Object3D();
|
|
82
|
+
* scene.add(targetObject);
|
|
83
|
+
* light.target = targetObject;
|
|
84
|
+
* ```
|
|
85
|
+
* The {@link SpotLight} will now track the target object.
|
|
86
|
+
* @defaultValue `new THREE.Object3D()` _The default position of the target is *(0, 0, 0)*._
|
|
36
87
|
*/
|
|
37
88
|
target: Object3D;
|
|
38
89
|
|
|
39
90
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @
|
|
91
|
+
* If set to `true` light will cast dynamic shadows.
|
|
92
|
+
* @remarks **Warning**: This is expensive and requires tweaking to get shadows looking right. the {@link THREE.SpotLightShadow | SpotLightShadow} for details.
|
|
93
|
+
* @defaultValue `false`
|
|
94
|
+
*/
|
|
95
|
+
override castShadow: boolean;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The light's intensity.
|
|
99
|
+
* @remarks Changing the intensity will also change the light's power.
|
|
100
|
+
* When **{@link WebGLRenderer.physicallyCorrectLights | Physically correct} rendering mode** — intensity is the luminous intensity of the light measured in candela (cd).
|
|
101
|
+
* @remarks Expects a `Float`
|
|
102
|
+
* @defaultValue `1`
|
|
42
103
|
*/
|
|
43
104
|
intensity: number;
|
|
44
105
|
|
|
45
106
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
107
|
+
* When **Default mode** — When distance is zero, light does not attenuate. When distance is non-zero,
|
|
108
|
+
* light will attenuate linearly from maximum intensity at the light's position down to zero at this distance from the light.
|
|
109
|
+
*
|
|
110
|
+
* When **{@link WebGLRenderer.physicallyCorrectLights | Physically correct} rendering mode** — When distance is zero,
|
|
111
|
+
* light will attenuate according to inverse-square law to infinite distance.
|
|
112
|
+
* When distance is non-zero, light will attenuate according to inverse-square law until near the distance cutoff,
|
|
113
|
+
* where it will then attenuate quickly and smoothly to `0`. Inherently, cutoffs are not physically correct.
|
|
114
|
+
* @remarks Expects a `Float`
|
|
115
|
+
* @defaultValue `0.0`
|
|
48
116
|
*/
|
|
49
117
|
distance: number;
|
|
50
118
|
|
|
51
119
|
/**
|
|
52
120
|
* Maximum extent of the spotlight, in radians, from its direction.
|
|
53
|
-
* @
|
|
121
|
+
* @remarks Should be no more than `Math.PI/2`.
|
|
122
|
+
* @remarks Expects a `Float`
|
|
123
|
+
* @defaultValue `Math.PI / 3`
|
|
54
124
|
*/
|
|
55
125
|
angle: number;
|
|
56
126
|
|
|
57
127
|
/**
|
|
58
|
-
*
|
|
128
|
+
* The amount the light dims along the distance of the light.
|
|
129
|
+
* In **{@link WebGLRenderer.physicallyCorrectLights | physically correct} rendering mode** — the default value should not be changed.
|
|
130
|
+
* @remarks Expects a `Float`
|
|
131
|
+
* @defaultValue `2`
|
|
59
132
|
*/
|
|
60
133
|
decay: number;
|
|
61
134
|
|
|
62
135
|
/**
|
|
63
|
-
* @
|
|
136
|
+
* A {@link THREE.SpotLightShadow | SpotLightShadow} used to calculate shadows for this light.
|
|
137
|
+
* @defaultValue `new THREE.SpotLightShadow()`
|
|
64
138
|
*/
|
|
65
139
|
shadow: SpotLightShadow;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The light's power.
|
|
143
|
+
* @remarks Changing the power will also change the light's intensity.
|
|
144
|
+
* In **{@link WebGLRenderer.physicallyCorrectLights | physically correct} rendering mode** — power is the luminous power of the light measured in lumens (lm).
|
|
145
|
+
* @remarks Expects a `Float`
|
|
146
|
+
*/
|
|
66
147
|
power: number;
|
|
67
148
|
|
|
68
149
|
/**
|
|
69
|
-
* @
|
|
150
|
+
* Percent of the {@link SpotLight} cone that is attenuated due to penumbra.
|
|
151
|
+
* @remarks Takes values between zero and 1.
|
|
152
|
+
* @remarks Expects a `Float`
|
|
153
|
+
* @defaultValue `0.0`
|
|
70
154
|
*/
|
|
71
155
|
penumbra: number;
|
|
72
156
|
|
|
73
157
|
/**
|
|
74
|
-
* @
|
|
158
|
+
* A {@link THREE.Texture | Texture} used to modulate the color of the light.
|
|
159
|
+
* The spot light color is mixed with the _RGB_ value of this texture, with a ratio corresponding to its alpha value.
|
|
160
|
+
* The cookie-like masking effect is reproduced using pixel values (0, 0, 0, 1-cookie_value).
|
|
161
|
+
* @remarks **Warning**: {@link SpotLight.map} is disabled if {@link SpotLight.castShadow} is `false`.
|
|
75
162
|
*/
|
|
76
163
|
map: Texture | null;
|
|
77
|
-
|
|
78
|
-
readonly isSpotLight: true;
|
|
79
164
|
}
|
|
@@ -1,12 +1,72 @@
|
|
|
1
1
|
import { PerspectiveCamera } from './../cameras/PerspectiveCamera';
|
|
2
2
|
import { LightShadow } from './LightShadow';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* This is used internally by {@link SpotLight | SpotLights} for calculating shadows.
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* //Create a WebGLRenderer and turn on shadows in the renderer
|
|
9
|
+
* const renderer = new THREE.WebGLRenderer();
|
|
10
|
+
* renderer.shadowMap.enabled = true;
|
|
11
|
+
* renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap
|
|
12
|
+
* //Create a SpotLight and turn on shadows for the light
|
|
13
|
+
* const light = new THREE.SpotLight(0xffffff);
|
|
14
|
+
* light.castShadow = true; // default false
|
|
15
|
+
* scene.add(light);
|
|
16
|
+
* //Set up shadow properties for the light
|
|
17
|
+
* light.shadow.mapSize.width = 512; // default
|
|
18
|
+
* light.shadow.mapSize.height = 512; // default
|
|
19
|
+
* light.shadow.camera.near = 0.5; // default
|
|
20
|
+
* light.shadow.camera.far = 500; // default
|
|
21
|
+
* light.shadow.focus = 1; // default
|
|
22
|
+
* //Create a sphere that cast shadows (but does not receive them)
|
|
23
|
+
* const sphereGeometry = new THREE.SphereGeometry(5, 32, 32);
|
|
24
|
+
* const sphereMaterial = new THREE.MeshStandardMaterial({
|
|
25
|
+
* color: 0xff0000
|
|
26
|
+
* });
|
|
27
|
+
* const sphere = new THREE.Mesh(sphereGeometry, sphereMaterial);
|
|
28
|
+
* sphere.castShadow = true; //default is false
|
|
29
|
+
* sphere.receiveShadow = false; //default
|
|
30
|
+
* scene.add(sphere);
|
|
31
|
+
* //Create a plane that receives shadows (but does not cast them)
|
|
32
|
+
* const planeGeometry = new THREE.PlaneGeometry(20, 20, 32, 32);
|
|
33
|
+
* const planeMaterial = new THREE.MeshStandardMaterial({
|
|
34
|
+
* color: 0x00ff00
|
|
35
|
+
* })
|
|
36
|
+
* const plane = new THREE.Mesh(planeGeometry, planeMaterial);
|
|
37
|
+
* plane.receiveShadow = true;
|
|
38
|
+
* scene.add(plane);
|
|
39
|
+
* //Create a helper for the shadow camera (optional)
|
|
40
|
+
* const helper = new THREE.CameraHelper(light.shadow.camera);
|
|
41
|
+
* scene.add(helper);
|
|
42
|
+
* ```
|
|
43
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/lights/shadows/SpotLightShadow | Official Documentation}
|
|
44
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/lights/SpotLightShadow.js | Source}
|
|
45
|
+
*/
|
|
46
|
+
export class SpotLightShadow extends LightShadow<PerspectiveCamera> {
|
|
47
|
+
/**
|
|
48
|
+
* Read-only flag to check if a given object is of type {@link SpotLightShadow}.
|
|
49
|
+
* @remarks This is a _constant_ value
|
|
50
|
+
* @defaultValue `true`
|
|
51
|
+
*/
|
|
6
52
|
readonly isSpotLightShadow: true;
|
|
7
53
|
|
|
8
54
|
/**
|
|
9
|
-
*
|
|
55
|
+
* The light's view of the world.
|
|
56
|
+
* @remarks This is used to generate a depth map of the scene; objects behind other objects from the light's perspective will be in shadow.
|
|
57
|
+
* @remarks
|
|
58
|
+
* The {@link THREE.PerspectiveCamera.fov | fov} will track the {@link THREE.SpotLight.angle | angle} property
|
|
59
|
+
* of the owning {@link SpotLight | SpotLight} via the {@link SpotLightShadow.update | update} method.
|
|
60
|
+
* Similarly, the {@link THREE.PerspectiveCamera.aspect | aspect} property will track the aspect of the {@link LightShadow.mapSize | mapSize}.
|
|
61
|
+
* If the {@link SpotLight.distance | distance} property of the light is set, the {@link THREE.PerspectiveCamera.far | far} clipping plane will track that, otherwise it defaults to `500`.
|
|
62
|
+
* @defaultValue is a {@link THREE.PerspectiveCamera | PerspectiveCamera} with {@link THREE.PerspectiveCamera.near | near} clipping plane at `0.5`.
|
|
63
|
+
*/
|
|
64
|
+
camera: PerspectiveCamera;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Used to focus the shadow camera.
|
|
68
|
+
* @remarks The camera's field of view is set as a percentage of the spotlight's field-of-view. Range is `[0, 1]`. 0`.
|
|
69
|
+
* @defaultValue `1`
|
|
10
70
|
*/
|
|
11
71
|
focus: number;
|
|
12
72
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Color, ColorRepresentation } from '
|
|
1
|
+
import { Color, ColorRepresentation } from '../math/Color';
|
|
2
2
|
import { MaterialParameters, Material } from './Material';
|
|
3
|
+
import { Texture } from '../textures/Texture';
|
|
3
4
|
|
|
4
5
|
export interface LineBasicMaterialParameters extends MaterialParameters {
|
|
5
6
|
color?: ColorRepresentation | undefined;
|
|
@@ -43,5 +44,10 @@ export class LineBasicMaterial extends Material {
|
|
|
43
44
|
*/
|
|
44
45
|
linejoin: string;
|
|
45
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Sets the color of the lines using data from a {@link Texture}.
|
|
49
|
+
*/
|
|
50
|
+
map: Texture | null;
|
|
51
|
+
|
|
46
52
|
setValues(parameters: LineBasicMaterialParameters): void;
|
|
47
53
|
}
|
|
@@ -46,21 +46,6 @@ export class MeshDistanceMaterial extends Material {
|
|
|
46
46
|
*/
|
|
47
47
|
displacementBias: number;
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* @default 1000
|
|
51
|
-
*/
|
|
52
|
-
farDistance: number;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @default 1
|
|
56
|
-
*/
|
|
57
|
-
nearDistance: number;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @default new THREE.Vector3()
|
|
61
|
-
*/
|
|
62
|
-
referencePosition: Vector3;
|
|
63
|
-
|
|
64
49
|
/**
|
|
65
50
|
* @default false
|
|
66
51
|
*/
|
three/src/math/Color.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ColorSpace } from '../constants';
|
|
2
|
+
import { Matrix3 } from './Matrix3';
|
|
3
|
+
import { Vector3 } from './Vector3';
|
|
2
4
|
|
|
3
|
-
import { BufferAttribute } from '
|
|
4
|
-
import { InterleavedBufferAttribute } from '
|
|
5
|
+
import { BufferAttribute } from '../core/BufferAttribute';
|
|
6
|
+
import { InterleavedBufferAttribute } from '../core/InterleavedBufferAttribute';
|
|
5
7
|
|
|
6
8
|
export { SRGBToLinear } from './ColorManagement';
|
|
7
9
|
|
|
@@ -203,6 +205,13 @@ export class Color {
|
|
|
203
205
|
b: number;
|
|
204
206
|
|
|
205
207
|
set(color: ColorRepresentation): Color;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Sets this color's {@link r}, {@link g} and {@link b} components from the x, y, and z components of the specified
|
|
211
|
+
* {@link Vector3 | vector}.
|
|
212
|
+
*/
|
|
213
|
+
setFromVector3(vector: Vector3): this;
|
|
214
|
+
|
|
206
215
|
setScalar(scalar: number): Color;
|
|
207
216
|
setHex(hex: number, colorSpace?: ColorSpace): Color;
|
|
208
217
|
|
|
@@ -295,6 +304,12 @@ export class Color {
|
|
|
295
304
|
add(color: Color): this;
|
|
296
305
|
addColors(color1: Color, color2: Color): this;
|
|
297
306
|
addScalar(s: number): this;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Applies the transform {@link Matrix3 | m} to this color's RGB components.
|
|
310
|
+
*/
|
|
311
|
+
applyMatrix3(m: Matrix3): this;
|
|
312
|
+
|
|
298
313
|
sub(color: Color): this;
|
|
299
314
|
multiply(color: Color): this;
|
|
300
315
|
multiplyScalar(s: number): this;
|
|
@@ -326,6 +341,12 @@ export class Color {
|
|
|
326
341
|
*/
|
|
327
342
|
toArray(xyz: ArrayLike<number>, offset?: number): ArrayLike<number>;
|
|
328
343
|
|
|
344
|
+
/**
|
|
345
|
+
* This method defines the serialization result of Color.
|
|
346
|
+
* @return The color as a hexadecimal value.
|
|
347
|
+
*/
|
|
348
|
+
toJSON(): number;
|
|
349
|
+
|
|
329
350
|
fromBufferAttribute(attribute: BufferAttribute | InterleavedBufferAttribute, index: number): this;
|
|
330
351
|
|
|
331
352
|
[Symbol.iterator](): Generator<number, void>;
|
three/src/math/Quaternion.d.ts
CHANGED
|
@@ -138,6 +138,12 @@ export class Quaternion {
|
|
|
138
138
|
*/
|
|
139
139
|
toArray(array: ArrayLike<number>, offset?: number): ArrayLike<number>;
|
|
140
140
|
|
|
141
|
+
/**
|
|
142
|
+
* This method defines the serialization result of Quaternion.
|
|
143
|
+
* @return The numerical elements of this quaternion in an array of format [x, y, z, w].
|
|
144
|
+
*/
|
|
145
|
+
toJSON(): [number, number, number, number];
|
|
146
|
+
|
|
141
147
|
/**
|
|
142
148
|
* Sets x, y, z, w properties of this quaternion from the attribute.
|
|
143
149
|
* @param attribute the source attribute.
|
three/src/math/Triangle.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Vector2 } from './Vector2';
|
|
2
2
|
import { Vector3 } from './Vector3';
|
|
3
|
+
import { Vector4 } from './Vector4';
|
|
3
4
|
import { Plane } from './Plane';
|
|
4
5
|
import { Box3 } from './Box3';
|
|
5
6
|
|
|
@@ -39,7 +40,13 @@ export class Triangle {
|
|
|
39
40
|
getNormal(target: Vector3): Vector3;
|
|
40
41
|
getPlane(target: Plane): Plane;
|
|
41
42
|
getBarycoord(point: Vector3, target: Vector3): Vector3;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Triangle.getUV() has been renamed to Triangle.getInterpolation().
|
|
45
|
+
*/
|
|
42
46
|
getUV(point: Vector3, uv1: Vector2, uv2: Vector2, uv3: Vector2, target: Vector2): Vector2;
|
|
47
|
+
getInterpolation(point: Vector3, v1: Vector2, v2: Vector2, v3: Vector2, target: Vector2): Vector2;
|
|
48
|
+
getInterpolation(point: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, target: Vector3): Vector3;
|
|
49
|
+
getInterpolation(point: Vector3, v1: Vector4, v2: Vector4, v3: Vector4, target: Vector4): Vector4;
|
|
43
50
|
containsPoint(point: Vector3): boolean;
|
|
44
51
|
intersectsBox(box: Box3): boolean;
|
|
45
52
|
isFrontFacing(direction: Vector3): boolean;
|
|
@@ -49,6 +56,9 @@ export class Triangle {
|
|
|
49
56
|
static getNormal(a: Vector3, b: Vector3, c: Vector3, target: Vector3): Vector3;
|
|
50
57
|
static getBarycoord(point: Vector3, a: Vector3, b: Vector3, c: Vector3, target: Vector3): Vector3;
|
|
51
58
|
static containsPoint(point: Vector3, a: Vector3, b: Vector3, c: Vector3): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().
|
|
61
|
+
*/
|
|
52
62
|
static getUV(
|
|
53
63
|
point: Vector3,
|
|
54
64
|
p1: Vector3,
|
|
@@ -59,5 +69,35 @@ export class Triangle {
|
|
|
59
69
|
uv3: Vector2,
|
|
60
70
|
target: Vector2,
|
|
61
71
|
): Vector2;
|
|
72
|
+
static getInterpolation(
|
|
73
|
+
point: Vector3,
|
|
74
|
+
p1: Vector3,
|
|
75
|
+
p2: Vector3,
|
|
76
|
+
p3: Vector3,
|
|
77
|
+
v1: Vector2,
|
|
78
|
+
v2: Vector2,
|
|
79
|
+
v3: Vector2,
|
|
80
|
+
target: Vector2,
|
|
81
|
+
): Vector2;
|
|
82
|
+
static getInterpolation(
|
|
83
|
+
point: Vector3,
|
|
84
|
+
p1: Vector3,
|
|
85
|
+
p2: Vector3,
|
|
86
|
+
p3: Vector3,
|
|
87
|
+
v1: Vector3,
|
|
88
|
+
v2: Vector3,
|
|
89
|
+
v3: Vector3,
|
|
90
|
+
target: Vector3,
|
|
91
|
+
): Vector3;
|
|
92
|
+
static getInterpolation(
|
|
93
|
+
point: Vector3,
|
|
94
|
+
p1: Vector3,
|
|
95
|
+
p2: Vector3,
|
|
96
|
+
p3: Vector3,
|
|
97
|
+
v1: Vector4,
|
|
98
|
+
v2: Vector4,
|
|
99
|
+
v3: Vector4,
|
|
100
|
+
target: Vector4,
|
|
101
|
+
): Vector4;
|
|
62
102
|
static isFrontFacing(a: Vector3, b: Vector3, c: Vector3, direction: Vector3): boolean;
|
|
63
103
|
}
|
three/src/math/Vector2.d.ts
CHANGED
|
@@ -354,6 +354,11 @@ export class Vector2 implements Vector {
|
|
|
354
354
|
*/
|
|
355
355
|
angle(): number;
|
|
356
356
|
|
|
357
|
+
/**
|
|
358
|
+
* Returns the angle between this vector and vector {@link Vector2 | v} in radians.
|
|
359
|
+
*/
|
|
360
|
+
angleTo(v: Vector2): number;
|
|
361
|
+
|
|
357
362
|
/**
|
|
358
363
|
* Computes distance of this vector to v.
|
|
359
364
|
*/
|