@types/three 0.150.1 → 0.151.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/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/loaders/GLTFLoader.d.ts +2 -4
- three/examples/jsm/loaders/SVGLoader.d.ts +15 -3
- three/examples/jsm/nodes/Nodes.d.ts +130 -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 -3
- 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/fog/FogNode.d.ts +1 -1
- three/examples/jsm/nodes/geometry/RangeNode.d.ts +2 -1
- three/examples/jsm/nodes/lighting/PointLightNode.d.ts +10 -0
- three/examples/jsm/nodes/lighting/SpotLightNode.d.ts +15 -0
- three/examples/jsm/nodes/math/MathNode.d.ts +2 -2
- three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts +2 -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/webgl/nodes/WebGLNodeBuilder.d.ts +0 -1
- three/examples/jsm/utils/BufferGeometryUtils.d.ts +12 -2
- three/index.d.ts +1 -1
- three/package.json +2 -2
- three/src/Three.d.ts +1 -1
- three/src/core/Raycaster.d.ts +1 -0
- 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 +48 -17
- three/src/helpers/AxesHelper.d.ts +35 -3
- three/src/helpers/Box3Helper.d.ts +28 -4
- three/src/helpers/BoxHelper.d.ts +45 -5
- three/src/helpers/CameraHelper.d.ts +38 -19
- three/src/helpers/DirectionalLightHelper.d.ts +58 -11
- three/src/helpers/GridHelper.d.ts +33 -7
- three/src/helpers/HemisphereLightHelper.d.ts +57 -5
- three/src/helpers/PlaneHelper.d.ts +31 -8
- three/src/helpers/PointLightHelper.d.ts +55 -7
- three/src/helpers/PolarGridHelper.d.ts +36 -9
- three/src/helpers/SkeletonHelper.d.ts +56 -8
- three/src/helpers/SpotLightHelper.d.ts +60 -5
- three/src/lights/AmbientLight.d.ts +24 -11
- three/src/lights/AmbientLightProbe.d.ts +19 -1
- three/src/lights/DirectionalLight.d.ts +76 -21
- three/src/lights/DirectionalLightShadow.d.ts +68 -2
- three/src/lights/HemisphereLight.d.ts +46 -14
- three/src/lights/HemisphereLightProbe.d.ts +20 -1
- 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 +58 -13
- three/src/lights/PointLightShadow.d.ts +18 -2
- three/src/lights/RectAreaLight.d.ts +61 -9
- three/src/lights/SpotLight.d.ts +106 -22
- three/src/lights/SpotLightShadow.d.ts +63 -3
- three/src/materials/LineBasicMaterial.d.ts +7 -2
- three/src/materials/MeshBasicMaterial.d.ts +1 -2
- three/src/materials/MeshDistanceMaterial.d.ts +0 -15
- three/src/materials/MeshLambertMaterial.d.ts +1 -2
- three/src/materials/MeshMatcapMaterial.d.ts +1 -2
- three/src/materials/MeshPhongMaterial.d.ts +1 -2
- three/src/materials/MeshStandardMaterial.d.ts +1 -2
- three/src/materials/MeshToonMaterial.d.ts +1 -2
- three/src/materials/PointsMaterial.d.ts +1 -2
- three/src/materials/ShadowMaterial.d.ts +1 -2
- three/src/materials/SpriteMaterial.d.ts +1 -2
- three/src/math/Color.d.ts +25 -5
- 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/Skeleton.d.ts +5 -1
- three/src/objects/SkinnedMesh.d.ts +37 -25
- three/src/renderers/WebGLRenderer.d.ts +17 -2
- three/src/renderers/shaders/ShaderChunk.d.ts +58 -37
- three/src/renderers/shaders/UniformsLib.d.ts +88 -57
- three/src/scenes/Fog.d.ts +1 -2
- three/src/scenes/FogExp2.d.ts +1 -2
- three/src/textures/Texture.d.ts +5 -22
- three/examples/jsm/nodes/lighting/PunctualLightNode.d.ts +0 -12
- three/src/utils.d.ts +0 -6
|
@@ -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,6 +1,6 @@
|
|
|
1
|
-
import { ColorRepresentation } from '../
|
|
2
|
-
import { Color } from './../math/Color';
|
|
1
|
+
import { Color, ColorRepresentation } from '../math/Color';
|
|
3
2
|
import { MaterialParameters, Material } from './Material';
|
|
3
|
+
import { Texture } from '../textures/Texture';
|
|
4
4
|
|
|
5
5
|
export interface LineBasicMaterialParameters extends MaterialParameters {
|
|
6
6
|
color?: ColorRepresentation | undefined;
|
|
@@ -44,5 +44,10 @@ export class LineBasicMaterial extends Material {
|
|
|
44
44
|
*/
|
|
45
45
|
linejoin: string;
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Sets the color of the lines using data from a {@link Texture}.
|
|
49
|
+
*/
|
|
50
|
+
map: Texture | null;
|
|
51
|
+
|
|
47
52
|
setValues(parameters: LineBasicMaterialParameters): void;
|
|
48
53
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Color } from './../math/Color';
|
|
1
|
+
import { Color, ColorRepresentation } from './../math/Color';
|
|
2
2
|
import { Texture } from './../textures/Texture';
|
|
3
3
|
import { MaterialParameters, Material } from './Material';
|
|
4
4
|
import { Combine } from '../constants';
|
|
5
|
-
import { ColorRepresentation } from '../utils';
|
|
6
5
|
/**
|
|
7
6
|
* parameters is an object with one or more properties defining the material's appearance.
|
|
8
7
|
*/
|
|
@@ -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
|
*/
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Color } from './../math/Color';
|
|
1
|
+
import { Color, ColorRepresentation } from './../math/Color';
|
|
2
2
|
import { Texture } from './../textures/Texture';
|
|
3
3
|
import { MaterialParameters, Material } from './Material';
|
|
4
4
|
import { Combine, NormalMapTypes } from '../constants';
|
|
5
|
-
import { ColorRepresentation } from '../utils';
|
|
6
5
|
import { Vector2 } from '../Three';
|
|
7
6
|
|
|
8
7
|
export interface MeshLambertMaterialParameters extends MaterialParameters {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Color } from './../math/Color';
|
|
1
|
+
import { Color, ColorRepresentation } from './../math/Color';
|
|
2
2
|
import { Texture } from './../textures/Texture';
|
|
3
3
|
import { Vector2 } from './../math/Vector2';
|
|
4
4
|
import { MaterialParameters, Material } from './Material';
|
|
5
5
|
import { NormalMapTypes } from '../constants';
|
|
6
|
-
import { ColorRepresentation } from '../utils';
|
|
7
6
|
|
|
8
7
|
export interface MeshMatcapMaterialParameters extends MaterialParameters {
|
|
9
8
|
color?: ColorRepresentation | undefined;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Color } from './../math/Color';
|
|
1
|
+
import { Color, ColorRepresentation } from './../math/Color';
|
|
2
2
|
import { Texture } from './../textures/Texture';
|
|
3
3
|
import { Vector2 } from './../math/Vector2';
|
|
4
4
|
import { MaterialParameters, Material } from './Material';
|
|
5
5
|
import { Combine, NormalMapTypes } from '../constants';
|
|
6
|
-
import { ColorRepresentation } from '../utils';
|
|
7
6
|
|
|
8
7
|
export interface MeshPhongMaterialParameters extends MaterialParameters {
|
|
9
8
|
/** geometry color in hexadecimal. Default is 0xffffff. */
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Color } from './../math/Color';
|
|
1
|
+
import { Color, ColorRepresentation } from './../math/Color';
|
|
2
2
|
import { Texture } from './../textures/Texture';
|
|
3
3
|
import { Vector2 } from './../math/Vector2';
|
|
4
4
|
import { MaterialParameters, Material } from './Material';
|
|
5
5
|
import { NormalMapTypes } from '../constants';
|
|
6
|
-
import { ColorRepresentation } from '../utils';
|
|
7
6
|
|
|
8
7
|
export interface MeshStandardMaterialParameters extends MaterialParameters {
|
|
9
8
|
color?: ColorRepresentation | undefined;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Color } from './../math/Color';
|
|
1
|
+
import { Color, ColorRepresentation } from './../math/Color';
|
|
2
2
|
import { Texture } from './../textures/Texture';
|
|
3
3
|
import { Vector2 } from './../math/Vector2';
|
|
4
4
|
import { MaterialParameters, Material } from './Material';
|
|
5
5
|
import { NormalMapTypes } from '../constants';
|
|
6
|
-
import { ColorRepresentation } from '../utils';
|
|
7
6
|
|
|
8
7
|
export interface MeshToonMaterialParameters extends MaterialParameters {
|
|
9
8
|
/** geometry color in hexadecimal. Default is 0xffffff. */
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Material, MaterialParameters } from './Material';
|
|
2
|
-
import { Color } from './../math/Color';
|
|
2
|
+
import { Color, ColorRepresentation } from './../math/Color';
|
|
3
3
|
import { Texture } from './../textures/Texture';
|
|
4
|
-
import { ColorRepresentation } from '../utils';
|
|
5
4
|
|
|
6
5
|
export interface PointsMaterialParameters extends MaterialParameters {
|
|
7
6
|
color?: ColorRepresentation | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ColorRepresentation } from '
|
|
2
|
-
import { Color } from './../math/Color';
|
|
1
|
+
import { Color, ColorRepresentation } from './../math/Color';
|
|
3
2
|
import { MaterialParameters, Material } from './Material';
|
|
4
3
|
|
|
5
4
|
export interface ShadowMaterialParameters extends MaterialParameters {
|
three/src/math/Color.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ColorSpace } from '../constants';
|
|
2
|
-
import {
|
|
2
|
+
import { Matrix3 } from './Matrix3';
|
|
3
|
+
import { Vector3 } from './Vector3';
|
|
3
4
|
|
|
4
|
-
import { BufferAttribute } from '
|
|
5
|
-
import { InterleavedBufferAttribute } from '
|
|
5
|
+
import { BufferAttribute } from '../core/BufferAttribute';
|
|
6
|
+
import { InterleavedBufferAttribute } from '../core/InterleavedBufferAttribute';
|
|
6
7
|
|
|
7
8
|
export { SRGBToLinear } from './ColorManagement';
|
|
8
9
|
|
|
@@ -157,7 +158,7 @@ declare const _colorKeywords: {
|
|
|
157
158
|
yellowgreen: 0x9acd32;
|
|
158
159
|
};
|
|
159
160
|
|
|
160
|
-
export type
|
|
161
|
+
export type ColorRepresentation = Color | string | number;
|
|
161
162
|
|
|
162
163
|
export interface HSL {
|
|
163
164
|
h: number;
|
|
@@ -204,6 +205,13 @@ export class Color {
|
|
|
204
205
|
b: number;
|
|
205
206
|
|
|
206
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
|
+
|
|
207
215
|
setScalar(scalar: number): Color;
|
|
208
216
|
setHex(hex: number, colorSpace?: ColorSpace): Color;
|
|
209
217
|
|
|
@@ -236,7 +244,7 @@ export class Color {
|
|
|
236
244
|
* Faster than {@link Color#setStyle .setStyle()} method if you don't need the other CSS-style formats.
|
|
237
245
|
* @param style Color name in X11 format.
|
|
238
246
|
*/
|
|
239
|
-
setColorName(style:
|
|
247
|
+
setColorName(style: string, colorSpace?: ColorSpace): Color;
|
|
240
248
|
|
|
241
249
|
/**
|
|
242
250
|
* Clones this color.
|
|
@@ -296,6 +304,12 @@ export class Color {
|
|
|
296
304
|
add(color: Color): this;
|
|
297
305
|
addColors(color1: Color, color2: Color): this;
|
|
298
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
|
+
|
|
299
313
|
sub(color: Color): this;
|
|
300
314
|
multiply(color: Color): this;
|
|
301
315
|
multiplyScalar(s: number): this;
|
|
@@ -327,6 +341,12 @@ export class Color {
|
|
|
327
341
|
*/
|
|
328
342
|
toArray(xyz: ArrayLike<number>, offset?: number): ArrayLike<number>;
|
|
329
343
|
|
|
344
|
+
/**
|
|
345
|
+
* This method defines the serialization result of Color.
|
|
346
|
+
* @return The color as a hexadecimal value.
|
|
347
|
+
*/
|
|
348
|
+
toJSON(): number;
|
|
349
|
+
|
|
330
350
|
fromBufferAttribute(attribute: BufferAttribute | InterleavedBufferAttribute, index: number): this;
|
|
331
351
|
|
|
332
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
|
*/
|
three/src/math/Vector3.d.ts
CHANGED
|
@@ -2,12 +2,13 @@ import { Euler } from './Euler';
|
|
|
2
2
|
import { Matrix3 } from './Matrix3';
|
|
3
3
|
import { Matrix4 } from './Matrix4';
|
|
4
4
|
import { Quaternion } from './Quaternion';
|
|
5
|
-
import { Camera } from '
|
|
5
|
+
import { Camera } from '../cameras/Camera';
|
|
6
6
|
import { Spherical } from './Spherical';
|
|
7
7
|
import { Cylindrical } from './Cylindrical';
|
|
8
|
-
import { BufferAttribute } from '
|
|
9
|
-
import { InterleavedBufferAttribute } from '
|
|
8
|
+
import { BufferAttribute } from '../core/BufferAttribute';
|
|
9
|
+
import { InterleavedBufferAttribute } from '../core/InterleavedBufferAttribute';
|
|
10
10
|
import { Vector } from './Vector2';
|
|
11
|
+
import { Color } from './Color';
|
|
11
12
|
|
|
12
13
|
export type Vector3Tuple = [number, number, number];
|
|
13
14
|
|
|
@@ -68,6 +69,12 @@ export class Vector3 implements Vector {
|
|
|
68
69
|
|
|
69
70
|
setComponent(index: number, value: number): this;
|
|
70
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Sets this vector's {@link x}, {@link y} and {@link z} components from the r, g, and b components of the specified
|
|
74
|
+
* {@link Color | color}.
|
|
75
|
+
*/
|
|
76
|
+
setFromColor(color: Color): this;
|
|
77
|
+
|
|
71
78
|
getComponent(index: number): number;
|
|
72
79
|
|
|
73
80
|
/**
|
|
@@ -39,23 +39,19 @@ export class InstancedMesh<
|
|
|
39
39
|
*/
|
|
40
40
|
readonly isInstancedMesh: true;
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// * @defaultValue `null`
|
|
49
|
-
// */
|
|
50
|
-
// boundingBox: Box3 | null;
|
|
42
|
+
/**
|
|
43
|
+
* This bounding box encloses all instances of the {@link InstancedMesh},, which can be calculated with {@link computeBoundingBox | .computeBoundingBox()}.
|
|
44
|
+
* @remarks Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
|
|
45
|
+
* @defaultValue `null`
|
|
46
|
+
*/
|
|
47
|
+
boundingBox: Box3 | null;
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/////////////////////////////////////////////////
|
|
49
|
+
/**
|
|
50
|
+
* This bounding sphere encloses all instances of the {@link InstancedMesh}, which can be calculated with {@link computeBoundingSphere | .computeBoundingSphere()}.
|
|
51
|
+
* @remarks bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
|
|
52
|
+
* @defaultValue `null`
|
|
53
|
+
*/
|
|
54
|
+
boundingSphere: Sphere | null;
|
|
59
55
|
|
|
60
56
|
/**
|
|
61
57
|
* The number of instances.
|
|
@@ -80,21 +76,17 @@ export class InstancedMesh<
|
|
|
80
76
|
*/
|
|
81
77
|
instanceMatrix: InstancedBufferAttribute;
|
|
82
78
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
// * @remarks Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
|
|
89
|
-
// */
|
|
90
|
-
// computeBoundingBox(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Computes bounding box of the all instances, updating {@link boundingBox | .boundingBox} attribute.
|
|
81
|
+
* @remarks Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
|
|
82
|
+
*/
|
|
83
|
+
computeBoundingBox(): void;
|
|
91
84
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
/////////////////////////////////////////////////
|
|
85
|
+
/**
|
|
86
|
+
* Computes bounding sphere of the all instances, updating {@link boundingSphere | .boundingSphere} attribute.
|
|
87
|
+
* @remarks bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
|
|
88
|
+
*/
|
|
89
|
+
computeBoundingSphere(): void;
|
|
98
90
|
|
|
99
91
|
/**
|
|
100
92
|
* Get the color of the defined instance.
|
three/src/objects/Skeleton.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export class Skeleton {
|
|
|
32
32
|
* @param bones The array of {@link THREE.Bone | bones}. Default `[]`.
|
|
33
33
|
* @param boneInverses An array of {@link THREE.Matrix4 | Matrix4s}. Default `[]`.
|
|
34
34
|
*/
|
|
35
|
-
constructor(bones
|
|
35
|
+
constructor(bones?: Bone[], boneInverses?: Matrix4[]);
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* {@link http://en.wikipedia.org/wiki/Universally_unique_identifier | UUID} of this object instance.
|
|
@@ -112,4 +112,8 @@ export class Skeleton {
|
|
|
112
112
|
* Call this method whenever this instance is no longer used in your app.
|
|
113
113
|
*/
|
|
114
114
|
dispose(): void;
|
|
115
|
+
|
|
116
|
+
toJSON(): unknown;
|
|
117
|
+
|
|
118
|
+
fromJSON(json: unknown, bones: Record<string, Bone>): void;
|
|
115
119
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Material } from './../materials/Material';
|
|
2
|
+
import { Box3 } from '../math/Box3';
|
|
2
3
|
import { Matrix4 } from './../math/Matrix4';
|
|
3
4
|
import { Vector3 } from './../math/Vector3';
|
|
4
5
|
import { Skeleton } from './Skeleton';
|
|
5
6
|
import { Mesh } from './Mesh';
|
|
6
7
|
import { BufferGeometry } from '../core/BufferGeometry';
|
|
8
|
+
import { Sphere } from '../math/Sphere';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* A mesh that has a {@link THREE.Skeleton | Skeleton} with {@link Bone | bones} that can then be used to animate the vertices of the geometry.
|
|
@@ -86,6 +88,18 @@ export class SkinnedMesh<
|
|
|
86
88
|
*/
|
|
87
89
|
bindMatrixInverse: Matrix4;
|
|
88
90
|
|
|
91
|
+
/**
|
|
92
|
+
* The bounding box of the SkinnedMesh. Can be calculated with {@link computeBoundingBox | .computeBoundingBox()}.
|
|
93
|
+
* @default `null`
|
|
94
|
+
*/
|
|
95
|
+
boundingBox: Box3;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The bounding box of the SkinnedMesh. Can be calculated with {@link computeBoundingSphere | .computeBoundingSphere()}.
|
|
99
|
+
* @default `null`
|
|
100
|
+
*/
|
|
101
|
+
boundingSphere: Sphere;
|
|
102
|
+
|
|
89
103
|
/**
|
|
90
104
|
* {@link THREE.Skeleton | Skeleton} representing the bone hierarchy of the skinned mesh.
|
|
91
105
|
*/
|
|
@@ -100,6 +114,23 @@ export class SkinnedMesh<
|
|
|
100
114
|
*/
|
|
101
115
|
bind(skeleton: Skeleton, bindMatrix?: Matrix4): void;
|
|
102
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Computes the bounding box, updating {@link boundingBox | .boundingBox} attribute.
|
|
119
|
+
* @remarks
|
|
120
|
+
* Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`. If an
|
|
121
|
+
* instance of SkinnedMesh is animated, this method should be called per frame to compute a correct bounding box.
|
|
122
|
+
*/
|
|
123
|
+
computeBoundingBox(): void;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Computes the bounding sphere, updating {@link boundingSphere | .boundingSphere} attribute.
|
|
127
|
+
* @remarks
|
|
128
|
+
* Bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are `null`. If
|
|
129
|
+
* an instance of SkinnedMesh is animated, this method should be called per frame to compute a correct bounding
|
|
130
|
+
* sphere.
|
|
131
|
+
*/
|
|
132
|
+
computeBoundingSphere(): void;
|
|
133
|
+
|
|
103
134
|
/**
|
|
104
135
|
* This method sets the skinned mesh in the rest pose (resets the pose).
|
|
105
136
|
*/
|
|
@@ -110,35 +141,16 @@ export class SkinnedMesh<
|
|
|
110
141
|
*/
|
|
111
142
|
normalizeSkinWeights(): void;
|
|
112
143
|
|
|
113
|
-
/////////////////////////////////////////////////
|
|
114
|
-
// FUTURE - r151
|
|
115
|
-
/////////////////////////////////////////////////
|
|
116
|
-
// /**
|
|
117
|
-
// * Applies the bone transform associated with the given index to the given position vector
|
|
118
|
-
// * @remarks Returns the updated vector.
|
|
119
|
-
// * @param index Expects a `Integer`
|
|
120
|
-
// * @param vector
|
|
121
|
-
// */
|
|
122
|
-
// applyBoneTransform(index: number, vector: Vector3): Vector3;
|
|
123
|
-
|
|
124
|
-
// /**
|
|
125
|
-
// * @deprecated {@link THREE.SkinnedMesh}: {@link boneTransform | .boneTransform()} was renamed to {@link applyBoneTransform | .applyBoneTransform()} in **r151**.
|
|
126
|
-
// */
|
|
127
|
-
// boneTransform(index: number, target: Vector3): Vector3;
|
|
128
|
-
/////////////////////////////////////////////////
|
|
129
|
-
|
|
130
144
|
/**
|
|
131
|
-
* Applies the bone transform associated with the given index to the given position vector
|
|
132
|
-
* Calculates the position of the vertex at the given index relative to the current bone transformations.
|
|
133
|
-
* Target vector must be initialized with the vertex coordinates prior to the transformation:
|
|
134
|
-
* ```typescript
|
|
135
|
-
* const target = new THREE.Vector3();
|
|
136
|
-
* target.fromBufferAttribute( mesh.geometry.attributes.position, index );
|
|
137
|
-
* mesh.boneTransform( index, target );
|
|
138
|
-
* ```
|
|
145
|
+
* Applies the bone transform associated with the given index to the given position vector
|
|
139
146
|
* @remarks Returns the updated vector.
|
|
140
147
|
* @param index Expects a `Integer`
|
|
141
148
|
* @param vector
|
|
142
149
|
*/
|
|
150
|
+
applyBoneTransform(index: number, vector: Vector3): Vector3;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @deprecated {@link THREE.SkinnedMesh}: {@link boneTransform | .boneTransform()} was renamed to {@link applyBoneTransform | .applyBoneTransform()} in **r151**.
|
|
154
|
+
*/
|
|
143
155
|
boneTransform(index: number, target: Vector3): Vector3;
|
|
144
156
|
}
|
|
@@ -9,7 +9,7 @@ import { WebGLRenderLists } from './webgl/WebGLRenderLists';
|
|
|
9
9
|
import { WebGLState } from './webgl/WebGLState';
|
|
10
10
|
import { Vector2 } from './../math/Vector2';
|
|
11
11
|
import { Vector4 } from './../math/Vector4';
|
|
12
|
-
import { Color } from './../math/Color';
|
|
12
|
+
import { Color, ColorRepresentation } from './../math/Color';
|
|
13
13
|
import { WebGLRenderTarget } from './WebGLRenderTarget';
|
|
14
14
|
import { WebGLMultipleRenderTargets } from './WebGLMultipleRenderTargets';
|
|
15
15
|
import { Object3D } from './../core/Object3D';
|
|
@@ -22,7 +22,7 @@ import { Data3DTexture } from '../textures/Data3DTexture';
|
|
|
22
22
|
import { Vector3 } from '../math/Vector3';
|
|
23
23
|
import { Box3 } from '../math/Box3';
|
|
24
24
|
import { DataArrayTexture } from '../textures/DataArrayTexture';
|
|
25
|
-
import {
|
|
25
|
+
import { WebGLProgram } from './webgl/WebGLProgram';
|
|
26
26
|
|
|
27
27
|
export interface Renderer {
|
|
28
28
|
domElement: HTMLCanvasElement;
|
|
@@ -100,6 +100,21 @@ export interface WebGLDebug {
|
|
|
100
100
|
* Enables error checking and reporting when shader programs are being compiled.
|
|
101
101
|
*/
|
|
102
102
|
checkShaderErrors: boolean;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* A callback function that can be used for custom error reporting. The callback receives the WebGL context, an
|
|
106
|
+
* instance of WebGLProgram as well two instances of WebGLShader representing the vertex and fragment shader.
|
|
107
|
+
* Assigning a custom function disables the default error reporting.
|
|
108
|
+
* @default `null`
|
|
109
|
+
*/
|
|
110
|
+
onShaderError:
|
|
111
|
+
| ((
|
|
112
|
+
gl: WebGLRenderingContext,
|
|
113
|
+
program: WebGLProgram,
|
|
114
|
+
glVertexShader: WebGLShader,
|
|
115
|
+
glFragmentShader: WebGLShader,
|
|
116
|
+
) => void)
|
|
117
|
+
| null;
|
|
103
118
|
}
|
|
104
119
|
|
|
105
120
|
/**
|