@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,5 +1,6 @@
|
|
|
1
1
|
import { Color, Vector2, Vector3, Vector4 } from '../../../../src/Three';
|
|
2
2
|
import Node from '../core/Node';
|
|
3
|
+
import NodeBuilder from '../core/NodeBuilder';
|
|
3
4
|
|
|
4
5
|
export type RangeModeBound = number | Color | Vector2 | Vector3 | Vector4;
|
|
5
6
|
|
|
@@ -8,5 +9,5 @@ export default class RangeNode extends Node {
|
|
|
8
9
|
max: RangeModeBound;
|
|
9
10
|
|
|
10
11
|
constructor(min: RangeModeBound, max: RangeModeBound);
|
|
11
|
-
getVectorLength(): number;
|
|
12
|
+
getVectorLength(builder: NodeBuilder): number;
|
|
12
13
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import AnalyticLightNode from './AnalyticLightNode';
|
|
2
|
+
import Node from '../core/Node';
|
|
3
|
+
import { PointLight } from '../../../../src/Three';
|
|
4
|
+
|
|
5
|
+
export default class PointLightNode extends AnalyticLightNode<PointLight> {
|
|
6
|
+
cutoffDistanceNode: Node;
|
|
7
|
+
decayExponentNode: Node;
|
|
8
|
+
|
|
9
|
+
constructor(light?: PointLight | null);
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import AnalyticLightNode from './AnalyticLightNode';
|
|
2
|
+
import Node from '../core/Node';
|
|
3
|
+
import { SpotLight } from '../../../../src/Three';
|
|
4
|
+
|
|
5
|
+
export default class PointLightNode extends AnalyticLightNode<SpotLight> {
|
|
6
|
+
directionNode: Node;
|
|
7
|
+
|
|
8
|
+
coneCosNode: Node;
|
|
9
|
+
penumbraCosNode: Node;
|
|
10
|
+
|
|
11
|
+
cutoffDistanceNode: Node;
|
|
12
|
+
decayExponentNode: Node;
|
|
13
|
+
|
|
14
|
+
constructor(light?: SpotLight | null);
|
|
15
|
+
}
|
|
@@ -24,7 +24,7 @@ export type MathNodeMethod1 =
|
|
|
24
24
|
| typeof MathNode.SIGN
|
|
25
25
|
| typeof MathNode.LENGTH
|
|
26
26
|
| typeof MathNode.NEGATE
|
|
27
|
-
| typeof MathNode.
|
|
27
|
+
| typeof MathNode.ONE_MINUS
|
|
28
28
|
| typeof MathNode.DFDX
|
|
29
29
|
| typeof MathNode.DFDY
|
|
30
30
|
| typeof MathNode.ROUND;
|
|
@@ -76,7 +76,7 @@ export default class MathNode extends TempNode {
|
|
|
76
76
|
static SIGN: 'sign';
|
|
77
77
|
static LENGTH: 'length';
|
|
78
78
|
static NEGATE: 'negate';
|
|
79
|
-
static
|
|
79
|
+
static ONE_MINUS: 'oneMinus';
|
|
80
80
|
static DFDX: 'dFdx';
|
|
81
81
|
static DFDY: 'dFdy';
|
|
82
82
|
static ROUND: 'round';
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
UserDataNode,
|
|
51
51
|
UVNode,
|
|
52
52
|
VarNode,
|
|
53
|
-
|
|
53
|
+
VaryingNode,
|
|
54
54
|
} from '../Nodes';
|
|
55
55
|
import StorageBufferNode from '../accessors/StorageBufferNode';
|
|
56
56
|
import NodeCache from '../core/NodeCache';
|
|
@@ -130,7 +130,7 @@ export function fn<P extends FunctionNodeArguments>(
|
|
|
130
130
|
export const instanceIndex: Swizzable<InstanceIndexNode>;
|
|
131
131
|
export function label(node: NodeRepresentation, name?: string): Swizzable<VarNode>;
|
|
132
132
|
export function temp(node: NodeRepresentation, name?: string): Swizzable<VarNode>;
|
|
133
|
-
export function vary(node: NodeRepresentation, name?: string): Swizzable<
|
|
133
|
+
export function vary(node: NodeRepresentation, name?: string): Swizzable<VaryingNode>;
|
|
134
134
|
|
|
135
135
|
// accesors
|
|
136
136
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Mesh, IcosahedronGeometry, ShaderMaterial, Texture } from '../../../src/Three';
|
|
2
2
|
|
|
3
|
-
export class
|
|
3
|
+
export class GroundProjectedSkybox extends Mesh<IcosahedronGeometry, ShaderMaterial> {
|
|
4
4
|
constructor(texture: Texture, options?: { height?: number; radius?: number });
|
|
5
5
|
|
|
6
6
|
set radius(radius: number);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Object3D, Scene, Camera } from '../../../src/Three';
|
|
1
|
+
import { Object3D, Scene, Camera, Vector2 } from '../../../src/Three';
|
|
2
2
|
|
|
3
3
|
export class CSS2DObject extends Object3D {
|
|
4
4
|
constructor(element: HTMLElement);
|
|
5
5
|
element: HTMLElement;
|
|
6
|
+
center: Vector2;
|
|
6
7
|
|
|
7
8
|
onBeforeRender: (renderer: unknown, scene: Scene, camera: Camera) => void;
|
|
8
9
|
onAfterRender: (renderer: unknown, scene: Scene, camera: Camera) => void;
|
|
@@ -12,7 +12,6 @@ export class WebGLNodeBuilder extends NodeBuilder {
|
|
|
12
12
|
);
|
|
13
13
|
|
|
14
14
|
addSlot(shaderStage: NodeShaderStageOption, slotNode: SlotNode): Node;
|
|
15
|
-
addFlowCode(code: string): string;
|
|
16
15
|
|
|
17
16
|
getTexture(textureProperty: string, uvSnippet: string): string;
|
|
18
17
|
getTextureBias(textureProperty: string, uvSnippet: string, biasSnippet: string): string;
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
} from '../../../src/Three';
|
|
12
12
|
|
|
13
13
|
export function deepCloneAttribute(attribute: BufferAttribute): BufferAttribute;
|
|
14
|
-
export function
|
|
15
|
-
export function
|
|
14
|
+
export function mergeGeometries(geometries: BufferGeometry[], useGroups?: boolean): BufferGeometry;
|
|
15
|
+
export function mergeAttributes(attributes: BufferAttribute[]): BufferAttribute;
|
|
16
16
|
export function interleaveAttributes(attributes: BufferAttribute[]): InterleavedBufferAttribute;
|
|
17
17
|
export function estimateBytesUsed(geometry: BufferGeometry): number;
|
|
18
18
|
export function mergeVertices(geometry: BufferGeometry, tolerance?: number): BufferGeometry;
|
|
@@ -34,3 +34,13 @@ export function deinterleaveGeometry(geometry: BufferGeometry): void;
|
|
|
34
34
|
* @param creaseAngle The crease angle.
|
|
35
35
|
*/
|
|
36
36
|
export function toCreasedNormals(geometry: BufferGeometry, creaseAngle?: number): BufferGeometry;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use mergeGeometries instead.
|
|
40
|
+
*/
|
|
41
|
+
export function mergeBufferGeometries(geometries: BufferGeometry[], useGroups?: boolean): BufferGeometry;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Use mergeAttributes instead.
|
|
45
|
+
*/
|
|
46
|
+
export function mergeBufferAttributes(attributes: BufferAttribute[]): BufferAttribute;
|
three/index.d.ts
CHANGED
three/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/three",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.151.0",
|
|
4
4
|
"description": "TypeScript definitions for three",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"fflate": "~0.6.9",
|
|
31
31
|
"lil-gui": "~0.17.0"
|
|
32
32
|
},
|
|
33
|
-
"typesPublisherContentHash": "
|
|
33
|
+
"typesPublisherContentHash": "d8fac10d09ead80aa5112cb6407ef75e354363f34bdd002bfb12b3c5d40cb691",
|
|
34
34
|
"typeScriptVersion": "4.4",
|
|
35
35
|
"exports": {
|
|
36
36
|
".": {
|
three/src/Three.d.ts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export * from './constants';
|
|
5
5
|
export * from './Three.Legacy';
|
|
6
|
-
export * from './utils';
|
|
7
6
|
/**
|
|
8
7
|
* Animation
|
|
9
8
|
*/
|
|
@@ -66,6 +65,7 @@ export * from './extras/core/Path';
|
|
|
66
65
|
export * from './extras/core/ShapePath';
|
|
67
66
|
export * from './extras/core/CurvePath';
|
|
68
67
|
export * from './extras/core/Curve';
|
|
68
|
+
export * from './extras/core/Interpolations';
|
|
69
69
|
export * as DataUtils from './extras/DataUtils';
|
|
70
70
|
export * from './extras/ImageUtils';
|
|
71
71
|
export * from './extras/ShapeUtils';
|
three/src/core/Raycaster.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export interface Intersection<TIntersected extends Object3D = Object3D> {
|
|
|
28
28
|
object: TIntersected;
|
|
29
29
|
uv?: Vector2 | undefined;
|
|
30
30
|
uv2?: Vector2 | undefined;
|
|
31
|
+
normal?: Vector3;
|
|
31
32
|
/** The index number of the instance where the ray intersects the {@link THREE.InstancedMesh | InstancedMesh } */
|
|
32
33
|
instanceId?: number | undefined;
|
|
33
34
|
}
|
three/src/extras/DataUtils.d.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a half precision floating point value from the given single precision floating point value.
|
|
3
|
+
* @param val A single precision floating point value.
|
|
4
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/DataUtils | Official Documentation}
|
|
5
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/DataUtils.js | Source}
|
|
6
|
+
*/
|
|
1
7
|
export function toHalfFloat(val: number): number;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Returns a single precision floating point value from the given half precision floating point value.
|
|
11
|
+
* @param val A half precision floating point value.
|
|
12
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/DataUtils | Official Documentation}
|
|
13
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/DataUtils.js | Source}
|
|
14
|
+
*/
|
|
2
15
|
export function fromHalfFloat(val: number): number;
|
three/src/extras/Earcut.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An implementation of the {@link Earcut} polygon triangulation algorithm
|
|
3
|
+
* @remarks
|
|
4
|
+
* The code is a port of {@link https://github.com/mapbox/earcut | mapbox/earcut}.
|
|
5
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/Earcut | Official Documentation}
|
|
6
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/Earcut.js | Source}
|
|
7
|
+
*/
|
|
1
8
|
export const Earcut: {
|
|
9
|
+
/**
|
|
10
|
+
* Triangulates the given shape definition by returning an array of triangles
|
|
11
|
+
* @remarks
|
|
12
|
+
* A triangle is defined by three consecutive integers representing vertex indices.
|
|
13
|
+
*/
|
|
2
14
|
triangulate(data: number[], holeIndices?: number[], dim?: number): number[];
|
|
3
15
|
};
|
three/src/extras/ImageUtils.d.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { Mapping } from '../constants';
|
|
2
2
|
import { Texture } from '../textures/Texture';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A class containing utility functions for images.
|
|
6
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/ImageUtils | Official Documentation}
|
|
7
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/ImageUtils.js | Source}
|
|
8
|
+
*/
|
|
4
9
|
export namespace ImageUtils {
|
|
5
|
-
function getDataURL(image: any): string;
|
|
6
|
-
|
|
7
10
|
/**
|
|
8
|
-
*
|
|
11
|
+
* Returns a data URI containing a representation of the given image.
|
|
12
|
+
* @param image The image object.
|
|
9
13
|
*/
|
|
10
|
-
|
|
14
|
+
function getDataURL(
|
|
15
|
+
image: HTMLImageElement | HTMLCanvasElement | CanvasImageSource | ImageBitmap | ImageData,
|
|
16
|
+
): string;
|
|
11
17
|
|
|
12
18
|
/**
|
|
13
|
-
*
|
|
19
|
+
* Converts the given sRGB image data to linear color space.
|
|
20
|
+
* @param image
|
|
14
21
|
*/
|
|
15
|
-
function
|
|
16
|
-
url: string,
|
|
17
|
-
mapping?: Mapping,
|
|
18
|
-
onLoad?: (texture: Texture) => void,
|
|
19
|
-
onError?: (message: string) => void,
|
|
20
|
-
): Texture;
|
|
22
|
+
function sRGBToLinear(image: HTMLImageElement | HTMLCanvasElement | ImageBitmap): HTMLCanvasElement;
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
|
-
*
|
|
25
|
+
* Converts the given sRGB image data to linear color space.
|
|
26
|
+
* @param image
|
|
24
27
|
*/
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
): Texture;
|
|
31
|
-
|
|
32
|
-
function sRGBToLinear(image: any): HTMLCanvasElement | { data: number[]; width: number; height: number };
|
|
28
|
+
function sRGBToLinear(image: ImageData): {
|
|
29
|
+
data: ImageData['data'];
|
|
30
|
+
width: ImageData['width'];
|
|
31
|
+
height: ImageData['height'];
|
|
32
|
+
};
|
|
33
33
|
}
|
|
@@ -4,12 +4,78 @@ import { Texture } from '../textures/Texture';
|
|
|
4
4
|
import { CubeTexture } from '../textures/CubeTexture';
|
|
5
5
|
import { Scene } from '../scenes/Scene';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* This class generates a Prefiltered, Mipmapped Radiance Environment Map (PMREM) from a cubeMap environment texture.
|
|
9
|
+
* @remarks
|
|
10
|
+
* This allows different levels of blur to be quickly accessed based on material roughness
|
|
11
|
+
* Unlike a traditional mipmap chain, it only goes down to the LOD_MIN level (above), and then creates extra even more filtered 'mips' at the same LOD_MIN resolution,
|
|
12
|
+
* associated with higher roughness levels
|
|
13
|
+
* In this way we maintain resolution to smoothly interpolate diffuse lighting while limiting sampling computation.
|
|
14
|
+
* @remarks
|
|
15
|
+
* Note: The minimum {@link THREE.MeshStandardMaterial | MeshStandardMaterial}'s roughness depends on the size of the provided texture
|
|
16
|
+
* If your render has small dimensions or the shiny parts have a lot of curvature, you may still be able to get away with a smaller texture size.
|
|
17
|
+
*
|
|
18
|
+
* | texture size | minimum roughness |
|
|
19
|
+
* |--------------|--------------------|
|
|
20
|
+
* | 16 | 0.21 |
|
|
21
|
+
* | 32 | 0.15 |
|
|
22
|
+
* | 64 | 0.11 |
|
|
23
|
+
* | 128 | 0.076 |
|
|
24
|
+
* | 256 | 0.054 |
|
|
25
|
+
* | 512 | 0.038 |
|
|
26
|
+
* | 1024 | 0.027 |
|
|
27
|
+
*
|
|
28
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/PMREMGenerator | Official Documentation}
|
|
29
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/PMREMGenerator.js | Source}
|
|
30
|
+
*/
|
|
7
31
|
export class PMREMGenerator {
|
|
32
|
+
/**
|
|
33
|
+
* This constructor creates a new PMREMGenerator.
|
|
34
|
+
* @param renderer
|
|
35
|
+
*/
|
|
8
36
|
constructor(renderer: WebGLRenderer);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Generates a PMREM from a supplied Scene, which can be faster than using an image if networking bandwidth is low
|
|
40
|
+
* @remarks
|
|
41
|
+
* Optional near and far planes ensure the scene is rendered in its entirety (the cubeCamera is placed at the origin).
|
|
42
|
+
* @param scene The given scene.
|
|
43
|
+
* @param sigma Specifies a blur radius in radians to be applied to the scene before PMREM generation. Default `0`.
|
|
44
|
+
* @param near The near plane value. Default `0.1`.
|
|
45
|
+
* @param far The far plane value. Default `100`.
|
|
46
|
+
*/
|
|
9
47
|
fromScene(scene: Scene, sigma?: number, near?: number, far?: number): WebGLRenderTarget;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Generates a PMREM from an equirectangular texture.
|
|
51
|
+
* @param equirectangular The equirectangular texture.
|
|
52
|
+
*/
|
|
10
53
|
fromEquirectangular(equirectangular: Texture, renderTarget?: WebGLRenderTarget | null): WebGLRenderTarget;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Generates a PMREM from an cubemap texture.
|
|
57
|
+
* @param cubemap The cubemap texture.
|
|
58
|
+
*/
|
|
11
59
|
fromCubemap(cubemap: CubeTexture, renderTarget?: WebGLRenderTarget | null): WebGLRenderTarget;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Pre-compiles the cubemap shader
|
|
63
|
+
* @remarks
|
|
64
|
+
* You can get faster start-up by invoking this method during your texture's network fetch for increased concurrency.
|
|
65
|
+
*/
|
|
12
66
|
compileCubemapShader(): void;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Pre-compiles the equirectangular shader
|
|
70
|
+
* @remarks
|
|
71
|
+
* You can get faster start-up by invoking this method during your texture's network fetch for increased concurrency.
|
|
72
|
+
*/
|
|
13
73
|
compileEquirectangularShader(): void;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Frees the GPU-related resources allocated by this instance
|
|
77
|
+
* @remarks
|
|
78
|
+
* Call this method whenever this instance is no longer used in your app.
|
|
79
|
+
*/
|
|
14
80
|
dispose(): void;
|
|
15
81
|
}
|
three/src/extras/ShapeUtils.d.ts
CHANGED
|
@@ -3,8 +3,26 @@ export interface Vec2 {
|
|
|
3
3
|
y: number;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* A class containing utility functions for shapes.
|
|
8
|
+
* @remarks Note that these are all linear functions so it is necessary to calculate separately for x, y (and z, w if present) components of a vector.
|
|
9
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/ShapeUtils | Official Documentation}
|
|
10
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/ShapeUtils.js | Source}
|
|
11
|
+
*/
|
|
6
12
|
export namespace ShapeUtils {
|
|
13
|
+
/**
|
|
14
|
+
* Calculate area of a ( 2D ) contour polygon.
|
|
15
|
+
*/
|
|
7
16
|
function area(contour: Vec2[]): number;
|
|
8
|
-
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Note that this is a linear function so it is necessary to calculate separately for x, y components of a polygon.
|
|
20
|
+
* @remarks Used internally by {@link THREE.Path | Path}, {@link THREE.ExtrudeGeometry | ExtrudeGeometry} and {@link THREE.ShapeGeometry | ShapeGeometry}.
|
|
21
|
+
*/
|
|
9
22
|
function isClockWise(pts: Vec2[]): boolean;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Used internally by {@link THREE.ExtrudeGeometry | ExtrudeGeometry} and {@link THREE.ShapeGeometry | ShapeGeometry} to calculate faces in shapes with holes.
|
|
26
|
+
*/
|
|
27
|
+
function triangulateShape(contour: Vec2[], holes: Vec2[][]): number[][];
|
|
10
28
|
}
|
three/src/extras/core/Curve.d.ts
CHANGED
|
@@ -1,84 +1,128 @@
|
|
|
1
1
|
import { Vector } from './../../math/Vector2';
|
|
2
2
|
import { Vector3 } from './../../math/Vector3';
|
|
3
3
|
|
|
4
|
-
// Extras / Core /////////////////////////////////////////////////////////////////////
|
|
5
|
-
|
|
6
4
|
/**
|
|
7
|
-
* An
|
|
8
|
-
*
|
|
5
|
+
* An abstract base class for creating a {@link Curve} object that contains methods for interpolation
|
|
6
|
+
* @remarks
|
|
7
|
+
* For an array of Curves see {@link THREE.CurvePath | CurvePath}.
|
|
8
|
+
* @remarks
|
|
9
|
+
* This following curves inherit from THREE.Curve:
|
|
10
|
+
*
|
|
11
|
+
* **2D curves**
|
|
12
|
+
* - {@link THREE.ArcCurve}
|
|
13
|
+
* - {@link THREE.CubicBezierCurve}
|
|
14
|
+
* - {@link THREE.EllipseCurve}
|
|
15
|
+
* - {@link THREE.LineCurve}
|
|
16
|
+
* - {@link THREE.QuadraticBezierCurve}
|
|
17
|
+
* - {@link THREE.SplineCurve}
|
|
18
|
+
*
|
|
19
|
+
* **3D curves**
|
|
20
|
+
* - {@link THREE.CatmullRomCurve3}
|
|
21
|
+
* - {@link THREE.CubicBezierCurve3}
|
|
22
|
+
* - {@link THREE.LineCurve3}
|
|
23
|
+
* - {@link THREE.QuadraticBezierCurve3}
|
|
24
|
+
*
|
|
25
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/core/Curve | Official Documentation}
|
|
26
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/core/Curve.js | Source}
|
|
9
27
|
*/
|
|
10
|
-
export class Curve<T extends Vector> {
|
|
28
|
+
export abstract class Curve<T extends Vector> {
|
|
29
|
+
protected constructor();
|
|
30
|
+
|
|
11
31
|
/**
|
|
12
|
-
*
|
|
32
|
+
* A Read-only _string_ to check if `this` object type.
|
|
33
|
+
* @remarks Sub-classes will update this value.
|
|
34
|
+
* @defaultValue `Curve`
|
|
13
35
|
*/
|
|
14
|
-
type: string;
|
|
36
|
+
readonly type: string | 'Curve';
|
|
15
37
|
|
|
16
38
|
/**
|
|
17
|
-
* This value determines the amount of divisions when calculating the cumulative segment lengths of a
|
|
18
|
-
*
|
|
19
|
-
* @
|
|
39
|
+
* This value determines the amount of divisions when calculating the cumulative segment lengths of a {@link Curve}
|
|
40
|
+
* via {@link .getLengths}.
|
|
41
|
+
* To ensure precision when using methods like {@link .getSpacedPoints}, it is recommended to increase {@link .arcLengthDivisions} if the {@link Curve} is very large.
|
|
42
|
+
* @defaultValue `200`
|
|
43
|
+
* @remarks Expects a `Integer`
|
|
20
44
|
*/
|
|
21
45
|
arcLengthDivisions: number;
|
|
22
46
|
|
|
23
47
|
/**
|
|
24
|
-
* Returns a vector for
|
|
25
|
-
*
|
|
48
|
+
* Returns a vector for a given position on the curve.
|
|
49
|
+
* @param t A position on the curve. Must be in the range `[ 0, 1 ]`. Expects a `Float`
|
|
50
|
+
* @param optionalTarget If specified, the result will be copied into this Vector, otherwise a new Vector will be created. Default `new T`.
|
|
26
51
|
*/
|
|
27
52
|
getPoint(t: number, optionalTarget?: T): T;
|
|
28
53
|
|
|
29
54
|
/**
|
|
30
|
-
* Returns a vector for
|
|
31
|
-
*
|
|
55
|
+
* Returns a vector for a given position on the {@link Curve} according to the arc length.
|
|
56
|
+
* @param u A position on the {@link Curve} according to the arc length. Must be in the range `[ 0, 1 ]`. Expects a `Float`
|
|
57
|
+
* @param optionalTarget If specified, the result will be copied into this Vector, otherwise a new Vector will be created. Default `new T`.
|
|
32
58
|
*/
|
|
33
59
|
getPointAt(u: number, optionalTarget?: T): T;
|
|
34
60
|
|
|
35
61
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
62
|
+
* Returns a set of divisions `+1` points using {@link .getPoint | getPoint(t)}.
|
|
63
|
+
* @param divisions Number of pieces to divide the {@link Curve} into. Expects a `Integer`. Default `5`
|
|
38
64
|
*/
|
|
39
65
|
getPoints(divisions?: number): T[];
|
|
40
66
|
|
|
41
67
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
68
|
+
* Returns a set of divisions `+1` equi-spaced points using {@link .getPointAt | getPointAt(u)}.
|
|
69
|
+
* @param divisions Number of pieces to divide the {@link Curve} into. Expects a `Integer`. Default `5`
|
|
44
70
|
*/
|
|
45
71
|
getSpacedPoints(divisions?: number): T[];
|
|
46
72
|
|
|
47
73
|
/**
|
|
48
|
-
* Get total
|
|
74
|
+
* Get total {@link Curve} arc length.
|
|
49
75
|
*/
|
|
50
76
|
getLength(): number;
|
|
51
77
|
|
|
52
78
|
/**
|
|
53
|
-
* Get list of cumulative segment lengths
|
|
79
|
+
* Get list of cumulative segment lengths.
|
|
80
|
+
* @param divisions Expects a `Integer`
|
|
54
81
|
*/
|
|
55
82
|
getLengths(divisions?: number): number[];
|
|
56
83
|
|
|
57
84
|
/**
|
|
58
85
|
* Update the cumlative segment distance cache
|
|
86
|
+
* @remarks
|
|
87
|
+
* The method must be called every time {@link Curve} parameters are changed
|
|
88
|
+
* If an updated {@link Curve} is part of a composed {@link Curve} like {@link THREE.CurvePath | CurvePath},
|
|
89
|
+
* {@link .updateArcLengths}() must be called on the composed curve, too.
|
|
59
90
|
*/
|
|
60
91
|
updateArcLengths(): void;
|
|
61
92
|
|
|
62
93
|
/**
|
|
63
|
-
* Given u
|
|
94
|
+
* Given u in the range `[ 0, 1 ]`,
|
|
95
|
+
* @remarks
|
|
96
|
+
* `u` and `t` can then be used to give you points which are equidistant from the ends of the curve, using {@link .getPoint}.
|
|
97
|
+
* @param u Expects a `Float`
|
|
98
|
+
* @param distance Expects a `Float`
|
|
99
|
+
* @returns `t` also in the range `[ 0, 1 ]`. Expects a `Float`.
|
|
64
100
|
*/
|
|
65
101
|
getUtoTmapping(u: number, distance: number): number;
|
|
66
102
|
|
|
67
103
|
/**
|
|
68
|
-
* Returns a unit vector tangent at t
|
|
69
|
-
*
|
|
70
|
-
*
|
|
104
|
+
* Returns a unit vector tangent at t
|
|
105
|
+
* @remarks
|
|
106
|
+
* If the derived {@link Curve} does not implement its tangent derivation, two points a small delta apart will be used to find its gradient which seems to give a reasonable approximation.
|
|
107
|
+
* @param t A position on the curve. Must be in the range `[ 0, 1 ]`. Expects a `Float`
|
|
108
|
+
* @param optionalTarget If specified, the result will be copied into this Vector, otherwise a new Vector will be created.
|
|
71
109
|
*/
|
|
72
110
|
getTangent(t: number, optionalTarget?: T): T;
|
|
73
111
|
|
|
74
112
|
/**
|
|
75
|
-
* Returns tangent at
|
|
76
|
-
*
|
|
113
|
+
* Returns tangent at a point which is equidistant to the ends of the {@link Curve} from the point given in {@link .getTangent}.
|
|
114
|
+
* @param u A position on the {@link Curve} according to the arc length. Must be in the range `[ 0, 1 ]`. Expects a `Float`
|
|
115
|
+
* @param optionalTarget If specified, the result will be copied into this Vector, otherwise a new Vector will be created.
|
|
77
116
|
*/
|
|
78
117
|
getTangentAt(u: number, optionalTarget?: T): T;
|
|
79
118
|
|
|
80
119
|
/**
|
|
81
|
-
*
|
|
120
|
+
* Generates the Frenet Frames
|
|
121
|
+
* @remarks
|
|
122
|
+
* Requires a {@link Curve} definition in 3D space
|
|
123
|
+
* Used in geometries like {@link THREE.TubeGeometry | TubeGeometry} or {@link THREE.ExtrudeGeometry | ExtrudeGeometry}.
|
|
124
|
+
* @param segments Expects a `Integer`
|
|
125
|
+
* @param closed
|
|
82
126
|
*/
|
|
83
127
|
computeFrenetFrames(
|
|
84
128
|
segments: number,
|
|
@@ -89,13 +133,24 @@ export class Curve<T extends Vector> {
|
|
|
89
133
|
binormals: Vector3[];
|
|
90
134
|
};
|
|
91
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Creates a clone of this instance.
|
|
138
|
+
*/
|
|
92
139
|
clone(): this;
|
|
140
|
+
/**
|
|
141
|
+
* Copies another {@link Curve} object to this instance.
|
|
142
|
+
* @param source
|
|
143
|
+
*/
|
|
93
144
|
copy(source: Curve<T>): this;
|
|
94
|
-
toJSON(): object;
|
|
95
|
-
fromJSON(json: object): this;
|
|
96
145
|
|
|
97
146
|
/**
|
|
98
|
-
*
|
|
147
|
+
* Returns a JSON object representation of this instance.
|
|
148
|
+
*/
|
|
149
|
+
toJSON(): {};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Copies the data from the given JSON object to this instance.
|
|
153
|
+
* @param json
|
|
99
154
|
*/
|
|
100
|
-
|
|
155
|
+
fromJSON(json: {}): this;
|
|
101
156
|
}
|
|
@@ -1,26 +1,68 @@
|
|
|
1
1
|
import { Curve } from './Curve';
|
|
2
2
|
import { Vector } from './../../math/Vector2';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Curved Path - a curve path is simply a array of connected curves, but retains the api of a curve.
|
|
6
|
+
* @remarks
|
|
7
|
+
* A {@link CurvePath} is simply an array of connected curves, but retains the api of a curve.
|
|
8
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/extras/core/CurvePath | Official Documentation}
|
|
9
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/core/CurvePath.js | Source}
|
|
10
|
+
*/
|
|
4
11
|
export class CurvePath<T extends Vector> extends Curve<T> {
|
|
12
|
+
/**
|
|
13
|
+
* The constructor take no parameters.
|
|
14
|
+
*/
|
|
5
15
|
constructor();
|
|
6
16
|
|
|
7
17
|
/**
|
|
8
|
-
*
|
|
18
|
+
* A Read-only _string_ to check if `this` object type.
|
|
19
|
+
* @remarks Sub-classes will update this value.
|
|
20
|
+
* @defaultValue `CurvePath`
|
|
9
21
|
*/
|
|
10
|
-
type: string;
|
|
22
|
+
override readonly type: string | 'CurvePath';
|
|
11
23
|
|
|
12
24
|
/**
|
|
13
|
-
* @
|
|
25
|
+
* The array of {@link Curve | Curves}.
|
|
26
|
+
* @defaultValue `[]`
|
|
14
27
|
*/
|
|
15
28
|
curves: Array<Curve<T>>;
|
|
16
29
|
|
|
17
30
|
/**
|
|
18
|
-
*
|
|
31
|
+
* Whether or not to automatically close the path.
|
|
32
|
+
* @defaultValue false
|
|
19
33
|
*/
|
|
20
34
|
autoClose: boolean;
|
|
21
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Add a curve to the {@link .curves} array.
|
|
38
|
+
* @param curve
|
|
39
|
+
*/
|
|
22
40
|
add(curve: Curve<T>): void;
|
|
41
|
+
/**
|
|
42
|
+
* Adds a {@link LineCurve | lineCurve} to close the path.
|
|
43
|
+
*/
|
|
23
44
|
closePath(): void;
|
|
45
|
+
|
|
24
46
|
getPoint(t: number, optionalTarget?: T): T;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get list of cumulative curve lengths of the curves in the {@link .curves} array.
|
|
50
|
+
*/
|
|
25
51
|
getCurveLengths(): number[];
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Returns an array of points representing a sequence of curves
|
|
55
|
+
* @remarks
|
|
56
|
+
* The `division` parameter defines the number of pieces each curve is divided into
|
|
57
|
+
* However, for optimization and quality purposes, the actual sampling resolution for each curve depends on its type
|
|
58
|
+
* For example, for a {@link THREE.LineCurve | LineCurve}, the returned number of points is always just 2.
|
|
59
|
+
* @param divisions Number of pieces to divide the curve into. Expects a `Integer`. Default `12`
|
|
60
|
+
*/
|
|
61
|
+
override getPoints(divisions?: number): T[];
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Returns a set of divisions `+1` equi-spaced points using {@link .getPointAt | getPointAt(u)}.
|
|
65
|
+
* @param divisions Number of pieces to divide the curve into. Expects a `Integer`. Default `40`
|
|
66
|
+
*/
|
|
67
|
+
override getSpacedPoints(divisions?: number): T[];
|
|
26
68
|
}
|