@types/three 0.147.1 → 0.148.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.
Files changed (39) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/loaders/GLTFLoader.d.ts +1 -0
  3. three/examples/jsm/math/Capsule.d.ts +1 -1
  4. three/examples/jsm/nodes/Nodes.d.ts +10 -0
  5. three/examples/jsm/nodes/accessors/CubeTextureNode.d.ts +2 -0
  6. three/examples/jsm/nodes/accessors/TextureNode.d.ts +2 -0
  7. three/examples/jsm/nodes/core/CacheNode.d.ts +10 -0
  8. three/examples/jsm/nodes/core/Node.d.ts +1 -1
  9. three/examples/jsm/nodes/core/NodeBuilder.d.ts +9 -0
  10. three/examples/jsm/nodes/core/NodeCache.d.ts +9 -0
  11. three/examples/jsm/nodes/core/StackNode.d.ts +11 -0
  12. three/examples/jsm/nodes/core/TempNode.d.ts +3 -0
  13. three/examples/jsm/nodes/fog/FogExp2Node.d.ts +9 -0
  14. three/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.d.ts +7 -2
  15. three/examples/jsm/nodes/shadernode/ShaderNodeElements.d.ts +4 -2
  16. three/examples/jsm/nodes/utils/MaxMipLevelNode.d.ts +6 -2
  17. three/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts +8 -0
  18. three/examples/jsm/utils/SceneUtils.d.ts +11 -0
  19. three/index.d.ts +1 -1
  20. three/package.json +2 -2
  21. three/src/animation/KeyframeTrack.d.ts +3 -1
  22. three/src/animation/tracks/BooleanKeyframeTrack.d.ts +1 -1
  23. three/src/animation/tracks/ColorKeyframeTrack.d.ts +1 -1
  24. three/src/animation/tracks/NumberKeyframeTrack.d.ts +1 -1
  25. three/src/animation/tracks/QuaternionKeyframeTrack.d.ts +1 -1
  26. three/src/animation/tracks/StringKeyframeTrack.d.ts +1 -1
  27. three/src/animation/tracks/VectorKeyframeTrack.d.ts +1 -1
  28. three/src/constants.d.ts +7 -0
  29. three/src/core/BufferAttribute.d.ts +18 -0
  30. three/src/core/Object3D.d.ts +16 -0
  31. three/src/geometries/CircleGeometry.d.ts +4 -4
  32. three/src/geometries/ConeGeometry.d.ts +7 -7
  33. three/src/geometries/CylinderGeometry.d.ts +8 -8
  34. three/src/geometries/RingGeometry.d.ts +6 -6
  35. three/src/geometries/SphereGeometry.d.ts +13 -7
  36. three/src/geometries/TorusGeometry.d.ts +5 -5
  37. three/src/lights/PointLight.d.ts +8 -0
  38. three/src/loaders/ObjectLoader.d.ts +9 -9
  39. three/src/objects/Mesh.d.ts +8 -0
three/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for three (https://threejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Fri, 30 Dec 2022 23:03:50 GMT
11
+ * Last updated: Tue, 03 Jan 2023 22:32:45 GMT
12
12
  * Dependencies: [@types/webxr](https://npmjs.com/package/@types/webxr)
13
13
  * Global values: `THREE`
14
14
 
@@ -143,6 +143,7 @@ export class GLTFParser {
143
143
  export interface GLTFLoaderPlugin {
144
144
  beforeRoot?: (() => Promise<void> | null) | undefined;
145
145
  afterRoot?: ((result: GLTF) => Promise<void> | null) | undefined;
146
+ loadNode?: ((nodeIndex: number) => Promise<Object3D> | null) | undefined;
146
147
  loadMesh?: ((meshIndex: number) => Promise<Group | Mesh | SkinnedMesh> | null) | undefined;
147
148
  loadBufferView?: ((bufferViewIndex: number) => Promise<ArrayBuffer> | null) | undefined;
148
149
  loadMaterial?: ((materialIndex: number) => Promise<Material> | null) | undefined;
@@ -9,7 +9,7 @@ export class Capsule {
9
9
  set(start: Vector3, end: Vector3, radius: number): this;
10
10
  clone(): Capsule;
11
11
  copy(capsule: Capsule): this;
12
- getCenter(target: number): Vector3;
12
+ getCenter(target: Vector3): Vector3;
13
13
  translate(v: Vector3): this;
14
14
  checkAABBAxis(
15
15
  p1x: number,
@@ -2,6 +2,7 @@
2
2
  import ArrayUniformNode from './core/ArrayUniformNode';
3
3
  import AttributeNode from './core/AttributeNode';
4
4
  import BypassNode from './core/BypassNode';
5
+ import CacheNode from './core/CacheNode';
5
6
  import CodeNode, { CodeNodeInclude } from './core/CodeNode';
6
7
  import ConstNode from './core/ConstNode';
7
8
  import ContextNode from './core/ContextNode';
@@ -12,6 +13,7 @@ import InstanceIndexNode from './core/InstanceIndexNode';
12
13
  import Node from './core/Node';
13
14
  import NodeAttribute from './core/NodeAttribute';
14
15
  import NodeBuilder from './core/NodeBuilder';
16
+ import NodeCache from './core/NodeCache';
15
17
  import NodeCode from './core/NodeCode';
16
18
  import NodeFrame from './core/NodeFrame';
17
19
  import NodeFunctionInput from './core/NodeFunctionInput';
@@ -20,6 +22,7 @@ import NodeUniform from './core/NodeUniform';
20
22
  import NodeVar from './core/NodeVar';
21
23
  import NodeVarying from './core/NodeVarying';
22
24
  import PropertyNode from './core/PropertyNode';
25
+ import StackNode from './core/StackNode';
23
26
  import TempNode from './core/TempNode';
24
27
  import UniformNode from './core/UniformNode';
25
28
  import VarNode from './core/VarNode';
@@ -89,6 +92,7 @@ import MaxMipLevelNode from './utils/MaxMipLevelNode';
89
92
  import OscNode, { OscNodeMethod } from './utils/OscNode';
90
93
  import RemapNode from './utils/RemapNode';
91
94
  import RotateUVNode from './utils/RotateUVNode';
95
+ import SpecularMIPLevelNode from './utils/SpecularMIPLevelNode';
92
96
  import SplitNode from './utils/SplitNode';
93
97
  import SpriteSheetUVNode from './utils/SpriteSheetUVNode';
94
98
  import TimerNode, { TimerNodeScope } from './utils/TimerNode';
@@ -104,6 +108,7 @@ import CheckerNode from './procedural/CheckerNode';
104
108
  // fog
105
109
  import FogNode from './fog/FogNode';
106
110
  import FogRangeNode from './fog/FogRangeNode';
111
+ import FogExp2Node from './fog/FogExp2Node';
107
112
 
108
113
  // core
109
114
  export * from './core/constants';
@@ -119,6 +124,7 @@ export {
119
124
  ArrayUniformNode,
120
125
  AttributeNode,
121
126
  BypassNode,
127
+ CacheNode,
122
128
  CodeNode,
123
129
  CodeNodeInclude,
124
130
  ContextNode,
@@ -131,6 +137,7 @@ export {
131
137
  Node,
132
138
  NodeAttribute,
133
139
  NodeBuilder,
140
+ NodeCache,
134
141
  NodeCode,
135
142
  NodeFrame,
136
143
  NodeFunctionInput,
@@ -139,6 +146,7 @@ export {
139
146
  NodeVar,
140
147
  NodeVarying,
141
148
  PropertyNode,
149
+ StackNode,
142
150
  TempNode,
143
151
  UniformNode,
144
152
  VarNode,
@@ -218,6 +226,7 @@ export {
218
226
  OscNodeMethod,
219
227
  RemapNode,
220
228
  RotateUVNode,
229
+ SpecularMIPLevelNode,
221
230
  SplitNode,
222
231
  SpriteSheetUVNode,
223
232
  TimerNode,
@@ -228,6 +237,7 @@ export {
228
237
  // fog
229
238
  FogNode,
230
239
  FogRangeNode,
240
+ FogExp2Node,
231
241
  // loaders
232
242
  NodeLoader,
233
243
  NodeObjectLoader,
@@ -8,4 +8,6 @@ export default class CubeTextureNode extends TextureNode {
8
8
  levelNode: Node | null;
9
9
 
10
10
  constructor(value: CubeTexture, uvNode?: Node | null, levelNode?: Node | null);
11
+
12
+ getDefaultUV(): Node;
11
13
  }
@@ -9,4 +9,6 @@ export default class TextureNode extends UniformNode {
9
9
  levelNode: Node | null;
10
10
 
11
11
  constructor(value: Texture, uvNode?: Node, levelNode?: Node | null);
12
+
13
+ getDefaultUV(): Node;
12
14
  }
@@ -0,0 +1,10 @@
1
+ import Node from './Node';
2
+ import NodeCache from './NodeCache';
3
+
4
+ export default class CacheNode extends Node {
5
+ isCacheNode: true;
6
+ node: Node;
7
+ cache: NodeCache;
8
+
9
+ constructor(node: Node, cache?: NodeCache);
10
+ }
@@ -12,11 +12,11 @@ export default abstract class Node {
12
12
 
13
13
  constructor(nodeType?: NodeTypeOption | null);
14
14
 
15
+ isGlobal(builder: NodeBuilder): boolean;
15
16
  getChildren(): Node[];
16
17
  getHash(builder: NodeBuilder): string;
17
18
  getUpdateType(builder: NodeBuilder): NodeUpdateTypeOption;
18
19
  getNodeType(builder: NodeBuilder, output?: string | null): NodeTypeOption | null;
19
- getConstructHash(builder: NodeBuilder): string;
20
20
  getReference(builder: NodeBuilder): Node;
21
21
  construct(builder: NodeBuilder): Node | null;
22
22
  analyze(builder: NodeBuilder): void;
@@ -14,6 +14,7 @@ import { nodeObject } from '../Nodes';
14
14
  import { AnyObject, NodeShaderStageOption, NodeTypeOption } from './constants';
15
15
  import Node from './Node';
16
16
  import NodeAttribute from './NodeAttribute';
17
+ import NodeCache from './NodeCache';
17
18
  import NodeParser from './NodeParser';
18
19
  import NodeUniform from './NodeUniform';
19
20
  import NodeVar from './NodeVar';
@@ -52,6 +53,14 @@ export default abstract class NodeBuilder {
52
53
  fragmentShader: string;
53
54
  computeShader: string;
54
55
 
56
+ cache: NodeCache;
57
+ globalCache: NodeCache;
58
+
59
+ /**
60
+ * @TODO used to be missing. check the actual type later
61
+ */
62
+ flowsData: any;
63
+
55
64
  shaderStage: NodeShaderStageOption | null;
56
65
  buildStage: BuildStageOption | null;
57
66
  stack: Node[];
@@ -0,0 +1,9 @@
1
+ import Node from './Node';
2
+ import { NodeData } from './NodeBuilder';
3
+
4
+ export default class NodeCache {
5
+ id: number;
6
+ nodesData: WeakMap<Node, NodeData>;
7
+
8
+ constructor();
9
+ }
@@ -0,0 +1,11 @@
1
+ import Node from './Node';
2
+
3
+ export default class StackNode extends Node {
4
+ isStackNode: true;
5
+ nodes: Node[];
6
+ outputNode: Node | null;
7
+
8
+ constructor();
9
+
10
+ assign(targetNode: Node, sourceValue: Node): this;
11
+ }
@@ -1,8 +1,11 @@
1
1
  import { NodeTypeOption } from './constants';
2
2
  import Node from './Node';
3
+ import NodeBuilder from './NodeBuilder';
3
4
 
4
5
  export default class TempNode extends Node {
5
6
  isTempNode: true;
6
7
 
7
8
  constructor(type: NodeTypeOption | null);
9
+
10
+ hasDependencies(builder: NodeBuilder): void;
8
11
  }
@@ -0,0 +1,9 @@
1
+ import Node from '../core/Node';
2
+ import FogNode from './FogNode';
3
+
4
+ export default class FogExp2Node extends FogNode {
5
+ isFogExp2Node: true;
6
+ densityNode: Node;
7
+
8
+ constructor(colorNode: Node, densityNode: Node);
9
+ }
@@ -23,6 +23,7 @@ import {
23
23
  BitangentNode,
24
24
  BufferNode,
25
25
  BypassNode,
26
+ CacheNode,
26
27
  CameraNode,
27
28
  CodeNode,
28
29
  CodeNodeInclude,
@@ -37,6 +38,7 @@ import {
37
38
  MaterialNode,
38
39
  MaterialReferenceNode,
39
40
  MathNode,
41
+ MaxMipLevelNode,
40
42
  ModelNode,
41
43
  ModelViewProjectionNode,
42
44
  NormalNode,
@@ -51,6 +53,7 @@ import {
51
53
  VaryNode,
52
54
  } from '../Nodes';
53
55
  import StorageBufferNode from '../accessors/StorageBufferNode';
56
+ import NodeCache from '../core/NodeCache';
54
57
 
55
58
  // shader node base
56
59
 
@@ -94,8 +97,10 @@ export function attribute(attributeName: string, nodeType: NodeTypeOption): Swiz
94
97
  export function property(name: string, nodeOrType: Node | NodeTypeOption): Swizzable;
95
98
 
96
99
  export function convert(node: NodeRepresentation, types: NodeTypeOption): Swizzable;
100
+ export function maxMipLevel(texture: Texture): Swizzable<MaxMipLevelNode>;
97
101
 
98
102
  export function bypass(returnNode: NodeRepresentation, callNode: NodeRepresentation): Swizzable<BypassNode>;
103
+ export function cache(node: Node, cache?: NodeCache): Swizzable<CacheNode>;
99
104
  export function code(code: string, nodeType?: NodeTypeOption): Swizzable<CodeNode>;
100
105
  export function context(node: NodeRepresentation, context: NodeBuilderContext): Swizzable<ContextNode>;
101
106
  export function expression(snipped?: string, nodeType?: NodeTypeOption): Swizzable<ExpressionNode>;
@@ -110,17 +115,17 @@ export type Fn<P extends FunctionNodeArguments> = P extends readonly [...unknown
110
115
  ? ProxiedTuple<P>
111
116
  : readonly [ProxiedObject<P>];
112
117
 
113
- /* eslint-disable no-unnecessary-generics */
114
118
  export function func<P extends FunctionNodeArguments>(
115
119
  code: string,
116
120
  includes?: CodeNodeInclude[],
121
+ // eslint-disable-next-line no-unnecessary-generics
117
122
  ): { call: (...params: Fn<P>) => Swizzable };
118
123
 
119
124
  export function fn<P extends FunctionNodeArguments>(
120
125
  code: string,
121
126
  includes?: CodeNodeInclude[],
127
+ // eslint-disable-next-line no-unnecessary-generics
122
128
  ): (...params: Fn<P>) => Swizzable;
123
- /* eslint-enable no-unnecessary-generics */
124
129
 
125
130
  export const instanceIndex: Swizzable<InstanceIndexNode>;
126
131
  export function label(node: NodeRepresentation, name?: string): Swizzable<VarNode>;
@@ -20,10 +20,10 @@ import {
20
20
  EquirectUVNode,
21
21
  FogNode,
22
22
  FogRangeNode,
23
+ FogExp2Node,
23
24
  InstanceNode,
24
25
  LightsNode,
25
26
  MatcapUVNode,
26
- MaxMipLevelNode,
27
27
  NormalMapNode,
28
28
  OscNode,
29
29
  PosterizeNode,
@@ -35,6 +35,7 @@ import {
35
35
  TimerNode,
36
36
  ToneMappingNode,
37
37
  TriplanarTexturesNode,
38
+ SpecularMIPLevelNode,
38
39
  ViewportNode,
39
40
  } from '../Nodes';
40
41
 
@@ -117,7 +118,7 @@ export function lightingContext(node: Node, lightingModelNode?: LightingModelNod
117
118
  export const matcapUV: Swizzable<MatcapUVNode>;
118
119
  export const equirectUV: Swizzable<EquirectUVNode>;
119
120
 
120
- export function maxMipLevel(texture: Texture): Swizzable<MaxMipLevelNode>;
121
+ export function specularMIPLevel(): Swizzable<SpecularMIPLevelNode>;
121
122
 
122
123
  export function oscSine(timeNode?: NodeRepresentation): Swizzable<OscNode>;
123
124
  export function oscSquare(timeNode?: NodeRepresentation): Swizzable<OscNode>;
@@ -164,3 +165,4 @@ export function checker(uvNode?: NodeRepresentation): Swizzable<CheckerNode>;
164
165
 
165
166
  export function fog(colorNode: NodeRepresentation, factorNode: NodeRepresentation): Swizzable<FogNode>;
166
167
  export function rangeFog(colorNode: Node, nearNode: Node, farNode: Node): Swizzable<FogRangeNode>;
168
+ export function exp2Fog(colorNode: Node, densityNode: Node): Swizzable<FogExp2Node>;
@@ -1,7 +1,11 @@
1
1
  import UniformNode from '../core/UniformNode';
2
2
  import { Texture } from '../../../../src/Three';
3
+ import { TextureNode } from '../Nodes';
3
4
 
4
5
  export default class MaxMipLevelNode extends UniformNode {
5
- texture: Texture;
6
- constructor(texture: Texture);
6
+ textureNode: TextureNode;
7
+
8
+ constructor(textureNode: TextureNode);
9
+
10
+ get texture(): Texture;
7
11
  }
@@ -0,0 +1,8 @@
1
+ import { Node, TextureNode } from '../Nodes';
2
+
3
+ export default class SpecularMIPLevelNode extends Node {
4
+ textureNode: TextureNode;
5
+ roughnessNode: Node | null;
6
+
7
+ constructor(textureNode: TextureNode, roughnessNode?: Node | null);
8
+ }
@@ -15,6 +15,17 @@ export function createMeshesFromMultiMaterialMesh(mesh: Mesh): Group;
15
15
 
16
16
  export function sortInstancedMesh(mesh: InstancedMesh, compareFn: (a: number, b: number) => number): void;
17
17
 
18
+ /**
19
+ * Akin to Array.prototype.reduce(), but operating on the vertices of all the visible descendant objects, in world space.
20
+ * Additionally, it can operate as a transform-reduce, returning a different type T than the Vector3 input.
21
+ * This can be useful for e.g. fitting a viewing frustum to the scene.
22
+ *
23
+ * @param object - The object to traverse (uses traverseVisible internally).
24
+ * @param func - The binary function applied for the reduction.
25
+ * Must have the signature: (value: T, vertex: Vector3): T.
26
+ * @param initialValue - The value to initialize the reduction with.
27
+ * This is required as it also sets the reduction type, which is not required to be Vector3.
28
+ */
18
29
  export function reduceVertices<TValue>(
19
30
  object: Object3D,
20
31
  func: (value: TValue, vertex: Vector3) => TValue,
three/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for three 0.147
1
+ // Type definitions for three 0.148
2
2
  // Project: https://threejs.org/
3
3
  // Definitions by: Josh Ellis <https://github.com/joshuaellis>
4
4
  // Nathan Bierema <https://github.com/Methuselah96>
three/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/three",
3
- "version": "0.147.1",
3
+ "version": "0.148.0",
4
4
  "description": "TypeScript definitions for three",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three",
6
6
  "license": "MIT",
@@ -27,6 +27,6 @@
27
27
  "dependencies": {
28
28
  "@types/webxr": "*"
29
29
  },
30
- "typesPublisherContentHash": "817382c65c940c6161d82bd35bba71b745760fd0e4d06c8cc05eb3b2953c438c",
30
+ "typesPublisherContentHash": "04304766d975fb3b4535f738695662f357aebd92f1bfaf6d66a40f3d6919b08e",
31
31
  "typeScriptVersion": "4.2"
32
32
  }
@@ -1,6 +1,7 @@
1
1
  import { DiscreteInterpolant } from './../math/interpolants/DiscreteInterpolant';
2
2
  import { LinearInterpolant } from './../math/interpolants/LinearInterpolant';
3
3
  import { CubicInterpolant } from './../math/interpolants/CubicInterpolant';
4
+ import { Interpolant } from '../math/Interpolant';
4
5
  import { InterpolationModes } from '../constants';
5
6
 
6
7
  export class KeyframeTrack {
@@ -10,7 +11,7 @@ export class KeyframeTrack {
10
11
  * @param values
11
12
  * @param [interpolation=THREE.InterpolateLinear]
12
13
  */
13
- constructor(name: string, times: ArrayLike<any>, values: ArrayLike<any>, interpolation?: InterpolationModes);
14
+ constructor(name: string, times: ArrayLike<number>, values: ArrayLike<any>, interpolation?: InterpolationModes);
14
15
 
15
16
  name: string;
16
17
  times: Float32Array;
@@ -31,6 +32,7 @@ export class KeyframeTrack {
31
32
 
32
33
  setInterpolation(interpolation: InterpolationModes): KeyframeTrack;
33
34
  getInterpolation(): InterpolationModes;
35
+ createInterpolant(): Interpolant;
34
36
 
35
37
  getValueSize(): number;
36
38
 
@@ -1,7 +1,7 @@
1
1
  import { KeyframeTrack } from './../KeyframeTrack';
2
2
 
3
3
  export class BooleanKeyframeTrack extends KeyframeTrack {
4
- constructor(name: string, times: any[], values: any[]);
4
+ constructor(name: string, times: ArrayLike<number>, values: ArrayLike<any>);
5
5
 
6
6
  /**
7
7
  * @default 'bool'
@@ -2,7 +2,7 @@ import { KeyframeTrack } from './../KeyframeTrack';
2
2
  import { InterpolationModes } from '../../constants';
3
3
 
4
4
  export class ColorKeyframeTrack extends KeyframeTrack {
5
- constructor(name: string, times: any[], values: any[], interpolation?: InterpolationModes);
5
+ constructor(name: string, times: ArrayLike<number>, values: ArrayLike<number>, interpolation?: InterpolationModes);
6
6
 
7
7
  /**
8
8
  * @default 'color'
@@ -2,7 +2,7 @@ import { KeyframeTrack } from './../KeyframeTrack';
2
2
  import { InterpolationModes } from '../../constants';
3
3
 
4
4
  export class NumberKeyframeTrack extends KeyframeTrack {
5
- constructor(name: string, times: any[], values: any[], interpolation?: InterpolationModes);
5
+ constructor(name: string, times: ArrayLike<number>, values: ArrayLike<number>, interpolation?: InterpolationModes);
6
6
 
7
7
  /**
8
8
  * @default 'number'
@@ -2,7 +2,7 @@ import { KeyframeTrack } from './../KeyframeTrack';
2
2
  import { InterpolationModes } from '../../constants';
3
3
 
4
4
  export class QuaternionKeyframeTrack extends KeyframeTrack {
5
- constructor(name: string, times: any[], values: any[], interpolation?: InterpolationModes);
5
+ constructor(name: string, times: ArrayLike<number>, values: ArrayLike<number>, interpolation?: InterpolationModes);
6
6
 
7
7
  /**
8
8
  * @default 'quaternion'
@@ -2,7 +2,7 @@ import { KeyframeTrack } from './../KeyframeTrack';
2
2
  import { InterpolationModes } from '../../constants';
3
3
 
4
4
  export class StringKeyframeTrack extends KeyframeTrack {
5
- constructor(name: string, times: any[], values: any[], interpolation?: InterpolationModes);
5
+ constructor(name: string, times: ArrayLike<number>, values: ArrayLike<any>, interpolation?: InterpolationModes);
6
6
 
7
7
  /**
8
8
  * @default 'string'
@@ -2,7 +2,7 @@ import { KeyframeTrack } from './../KeyframeTrack';
2
2
  import { InterpolationModes } from '../../constants';
3
3
 
4
4
  export class VectorKeyframeTrack extends KeyframeTrack {
5
- constructor(name: string, times: any[], values: any[], interpolation?: InterpolationModes);
5
+ constructor(name: string, times: ArrayLike<number>, values: ArrayLike<number>, interpolation?: InterpolationModes);
6
6
 
7
7
  /**
8
8
  * @default 'vector'
three/src/constants.d.ts CHANGED
@@ -34,10 +34,17 @@ export const VSMShadowMap: ShadowMapType;
34
34
  // MATERIAL CONSTANTS
35
35
 
36
36
  // side
37
+ /**
38
+ * Defines which side of faces will be rendered - front, back or both.
39
+ * Default is FrontSide.
40
+ *
41
+ * TwoPassDoubleSide will renderer double-sided transparent materials in two passes in back-front order to mitigate transparency artifacts.
42
+ */
37
43
  export enum Side {}
38
44
  export const FrontSide: Side;
39
45
  export const BackSide: Side;
40
46
  export const DoubleSide: Side;
47
+ export const TwoPassDoubleSide: Side;
41
48
 
42
49
  // blending modes
43
50
  export enum Blending {}
@@ -6,6 +6,24 @@ import { Matrix4 } from './../math/Matrix4';
6
6
  * see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js|src/core/BufferAttribute.js}
7
7
  */
8
8
  export class BufferAttribute {
9
+ /**
10
+ * @param array - Must be a TypedArray. Used to instantiate the buffer.
11
+ * This array should have
12
+ * ```
13
+ * itemSize * numVertices
14
+ * ```
15
+ * elements, where numVertices is the number of vertices in the associated BufferGeometry.
16
+ * @param itemSize - the number of values of the array that should be associated with a particular vertex.
17
+ * For instance, if this attribute is storing a 3-component vector (such as a position, normal, or color),
18
+ * then itemSize should be 3.
19
+ * @param normalized - (optional) Applies to integer data only.
20
+ * Indicates how the underlying data in the buffer maps to the values in the GLSL code.
21
+ * For instance, if array is an instance of UInt16Array, and normalized is true,
22
+ * the values 0 - +65535 in the array data will be mapped to 0.0f - +1.0f in the GLSL attribute.
23
+ * An Int16Array (signed) would map from -32768 - +32767 to -1.0f - +1.0f.
24
+ * If normalized is false, the values will be converted to floats unmodified,
25
+ * i.e. 32767 becomes 32767.0f.
26
+ */
9
27
  constructor(array: ArrayLike<number>, itemSize: number, normalized?: boolean); // array parameter should be TypedArray.
10
28
 
11
29
  /**
@@ -372,8 +372,24 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
372
372
  */
373
373
  getObjectByName(name: string): Object3D | undefined;
374
374
 
375
+ /**
376
+ * Searches through an object and its children, starting with the object itself,
377
+ * and returns the first with a property that matches the value given.
378
+ *
379
+ * @param name - the property name to search for.
380
+ * @param value - value of the given property.
381
+ */
375
382
  getObjectByProperty(name: string, value: any): Object3D | undefined;
376
383
 
384
+ /**
385
+ * Searches through an object and its children, starting with the object itself,
386
+ * and returns all the objects with a property that matches the value given.
387
+ *
388
+ * @param name - the property name to search for.
389
+ * @param value - value of the given property.
390
+ */
391
+ getObjectsByProperty(name: string, value: any): Object3D[];
392
+
377
393
  getWorldPosition(target: Vector3): Vector3;
378
394
  getWorldQuaternion(target: Quaternion): Quaternion;
379
395
  getWorldScale(target: Vector3): Vector3;
@@ -2,10 +2,10 @@ import { BufferGeometry } from '../core/BufferGeometry';
2
2
 
3
3
  export class CircleGeometry extends BufferGeometry {
4
4
  /**
5
- * @param [radius=1]
6
- * @param [segments=8]
7
- * @param [thetaStart=0]
8
- * @param [thetaLength=Math.PI * 2]
5
+ * @param radius - Radius of the circle, default = 1.
6
+ * @param segments - Number of segments (triangles), minimum = 3, default = 32.
7
+ * @param thetaStart - Start angle for first segment, default = 0 (three o'clock position).
8
+ * @param thetaLength - The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete circle.
9
9
  */
10
10
  constructor(radius?: number, segments?: number, thetaStart?: number, thetaLength?: number);
11
11
 
@@ -2,13 +2,13 @@ import { CylinderGeometry } from './CylinderGeometry';
2
2
 
3
3
  export class ConeGeometry extends CylinderGeometry {
4
4
  /**
5
- * @param [radius=1] Radius of the cone base.
6
- * @param [height=1] Height of the cone.
7
- * @param [radialSegments=8] Number of segmented faces around the circumference of the cone.
8
- * @param [heightSegments=1] Number of rows of faces along the height of the cone.
9
- * @param [openEnded=false] A Boolean indicating whether the base of the cone is open or capped.
10
- * @param [thetaStart=0]
11
- * @param [thetaLength=Math.PI * 2]
5
+ * @param radius - Radius of the cone base. Default is 1.
6
+ * @param height - Height of the cone. Default is 1.
7
+ * @param radialSegments - Number of segmented faces around the circumference of the cone. Default is 32
8
+ * @param heightSegments - Number of rows of faces along the height of the cone. Default is 1.
9
+ * @param openEnded - A Boolean indicating whether the base of the cone is open or capped. Default is false, meaning capped.
10
+ * @param thetaStart - Start angle for first segment, default = 0 (three o'clock position).
11
+ * @param thetaLength - The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete cone.
12
12
  */
13
13
  constructor(
14
14
  radius?: number,
@@ -2,14 +2,14 @@ import { BufferGeometry } from '../core/BufferGeometry';
2
2
 
3
3
  export class CylinderGeometry extends BufferGeometry {
4
4
  /**
5
- * @param [radiusTop=1] Radius of the cylinder at the top.
6
- * @param [radiusBottom=1] Radius of the cylinder at the bottom.
7
- * @param [height=1] Height of the cylinder.
8
- * @param [radialSegments=8] Number of segmented faces around the circumference of the cylinder.
9
- * @param [heightSegments=1] Number of rows of faces along the height of the cylinder.
10
- * @param [openEnded=false] - A Boolean indicating whether or not to cap the ends of the cylinder.
11
- * @param [thetaStart=0]
12
- * @param [thetaLength=Math.PI * 2]
5
+ * @param radiusTop - Radius of the cylinder at the top. Default is 1.
6
+ * @param radiusBottom - Radius of the cylinder at the bottom. Default is 1.
7
+ * @param height - Height of the cylinder. Default is 1.
8
+ * @param radialSegments - Number of segmented faces around the circumference of the cylinder. Default is 32
9
+ * @param heightSegments - Number of rows of faces along the height of the cylinder. Default is 1.
10
+ * @param openEnded - A Boolean indicating whether the ends of the cylinder are open or capped. Default is false, meaning capped.
11
+ * @param thetaStart - Start angle for first segment, default = 0 (three o'clock position).
12
+ * @param thetaLength - The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete cylinder.
13
13
  */
14
14
  constructor(
15
15
  radiusTop?: number,
@@ -2,12 +2,12 @@ import { BufferGeometry } from './../core/BufferGeometry';
2
2
 
3
3
  export class RingGeometry extends BufferGeometry {
4
4
  /**
5
- * @param [innerRadius=0.5]
6
- * @param [outerRadius=1]
7
- * @param [thetaSegments=8]
8
- * @param [phiSegments=1]
9
- * @param [thetaStart=0]
10
- * @param [thetaLength=Math.PI * 2]
5
+ * @param innerRadius - Default is 0.5.
6
+ * @param outerRadius - Default is 1.
7
+ * @param thetaSegments - Number of segments. A higher number means the ring will be more round. Minimum is 3. Default is 32.
8
+ * @param phiSegments - Minimum is 1. Default is 1.
9
+ * @param thetaStart - Starting angle. Default is 0.
10
+ * @param thetaLength - Central angle. Default is Math.PI * 2.
11
11
  */
12
12
  constructor(
13
13
  innerRadius?: number,
@@ -2,13 +2,19 @@ import { BufferGeometry } from './../core/BufferGeometry';
2
2
 
3
3
  export class SphereGeometry extends BufferGeometry {
4
4
  /**
5
- * @param [radius=50] sphere radius. Default is 50.
6
- * @param [widthSegments=8] number of horizontal segments. Minimum value is 3, and the default is 8.
7
- * @param [heightSegments=6] number of vertical segments. Minimum value is 2, and the default is 6.
8
- * @param [phiStart=0] specify horizontal starting angle. Default is 0.
9
- * @param [phiLength=Math.PI * 2] specify horizontal sweep angle size. Default is Math.PI * 2.
10
- * @param [thetaStart=0] — specify vertical starting angle. Default is 0.
11
- * @param [thetaLength=Math.PI * 2] specify vertical sweep angle size. Default is Math.PI.
5
+ * The geometry is created by sweeping and calculating vertexes
6
+ * around the Y axis (horizontal sweep) and the Z axis (vertical sweep).
7
+ * Thus, incomplete spheres (akin to `'sphere slices'`) can be created
8
+ * through the use of different values of phiStart, phiLength, thetaStart and thetaLength,
9
+ * in order to define the points in which we start (or end) calculating those vertices.
10
+ *
11
+ * @param [radius=50] - sphere radius. Default is 50.
12
+ * @param [widthSegments=8] - number of horizontal segments. Minimum value is 3, and the default is 32.
13
+ * @param [heightSegments=6] - number of vertical segments. Minimum value is 2, and the default is 16.
14
+ * @param [phiStart=0] - specify horizontal starting angle. Default is 0.
15
+ * @param [phiLength=Math.PI * 2] - specify horizontal sweep angle size. Default is Math.PI * 2.
16
+ * @param [thetaStart=0] - specify vertical starting angle. Default is 0.
17
+ * @param [thetaLength=Math.PI * 2] - specify vertical sweep angle size. Default is Math.PI.
12
18
  */
13
19
  constructor(
14
20
  radius?: number,
@@ -2,11 +2,11 @@ import { BufferGeometry } from './../core/BufferGeometry';
2
2
 
3
3
  export class TorusGeometry extends BufferGeometry {
4
4
  /**
5
- * @param [radius=1]
6
- * @param [tube=0.4]
7
- * @param [radialSegments=8]
8
- * @param [tubularSegments=6]
9
- * @param [arc=Math.PI * 2]
5
+ * @param radius - Radius of the torus, from the center of the torus to the center of the tube. Default is 1.
6
+ * @param tube - Radius of the tube. Default is 0.4.
7
+ * @param radialSegments - Default is 12
8
+ * @param tubularSegments - Default is 48.
9
+ * @param arc - Central angle. Default is Math.PI * 2.
10
10
  */
11
11
  constructor(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number);
12
12
 
@@ -28,6 +28,14 @@ export class PointLight extends Light {
28
28
  */
29
29
  distance: number;
30
30
 
31
+ /**
32
+ * If set to `true` light will cast dynamic shadows.
33
+ * **Warning**: This is expensive and requires tweaking to get shadows looking right.
34
+ * See the {@link PointLightShadow} for details.
35
+ * The default is `false`.
36
+ */
37
+ castShadow: boolean;
38
+
31
39
  /**
32
40
  * @default 1
33
41
  */
@@ -6,37 +6,37 @@ import { Material } from './../materials/Material';
6
6
  import { AnimationClip } from './../animation/AnimationClip';
7
7
  import { InstancedBufferGeometry } from '../core/InstancedBufferGeometry';
8
8
  import { BufferGeometry } from '../core/BufferGeometry';
9
+ import { Source } from '../textures/Source';
9
10
 
10
11
  export class ObjectLoader extends Loader {
11
12
  constructor(manager?: LoadingManager);
12
13
 
13
14
  load(
14
15
  url: string,
15
- // eslint-disable-next-line no-unnecessary-generics
16
- onLoad?: <ObjectType extends Object3D>(object: ObjectType) => void,
16
+ onLoad?: (object: Object3D) => void,
17
17
  onProgress?: (event: ProgressEvent) => void,
18
18
  onError?: (event: Error | ErrorEvent) => void,
19
19
  ): void;
20
20
  loadAsync<ObjectType extends Object3D>(
21
21
  url: string,
22
22
  onProgress?: (event: ProgressEvent) => void,
23
- ): // eslint-disable-next-line no-unnecessary-generics
23
+ ): // tslint:disable-next-line:no-unnecessary-generics
24
24
  Promise<ObjectType>;
25
- // eslint-disable-next-line no-unnecessary-generics
25
+ // tslint:disable-next-line:no-unnecessary-generics
26
26
  parse<T extends Object3D>(json: any, onLoad?: (object: Object3D) => void): T;
27
- // eslint-disable-next-line no-unnecessary-generics
27
+ // tslint:disable-next-line:no-unnecessary-generics
28
28
  parseAsync<T extends Object3D>(json: any): Promise<T>;
29
29
  parseGeometries(json: any): { [key: string]: InstancedBufferGeometry | BufferGeometry }; // Array of BufferGeometry or Geometry or Geometry2.
30
- parseMaterials(json: any, textures: Texture[]): Material[]; // Array of Classes that inherits from Matrial.
30
+ parseMaterials(json: any, textures: { [key: string]: Texture }): Material[]; // Array of Classes that inherits from Matrial.
31
31
  parseAnimations(json: any): AnimationClip[];
32
- parseImages(json: any, onLoad: () => void): { [key: string]: HTMLImageElement };
33
- parseImagesAsync(json: any): Promise<{ [key: string]: HTMLImageElement }>;
32
+ parseImages(json: any, onLoad?: () => void): { [key: string]: Source };
33
+ parseImagesAsync(json: any): Promise<{ [key: string]: Source }>;
34
34
  parseTextures(json: any, images: any): Texture[];
35
35
  parseObject<T extends Object3D>(
36
36
  data: any,
37
37
  geometries: any[],
38
38
  materials: Material[],
39
39
  animations: AnimationClip[],
40
- ): // eslint-disable-next-line no-unnecessary-generics
40
+ ): // tslint:disable-next-line:no-unnecessary-generics
41
41
  T;
42
42
  }
@@ -3,6 +3,7 @@ import { Raycaster } from './../core/Raycaster';
3
3
  import { Object3D } from './../core/Object3D';
4
4
  import { BufferGeometry } from '../core/BufferGeometry';
5
5
  import { Intersection } from '../core/Raycaster';
6
+ import { Vector3 } from '../math/Vector3';
6
7
 
7
8
  export class Mesh<
8
9
  TGeometry extends BufferGeometry = BufferGeometry,
@@ -18,5 +19,12 @@ export class Mesh<
18
19
  type: string;
19
20
 
20
21
  updateMorphTargets(): void;
22
+
23
+ /**
24
+ * Get the current position of the indicated vertex in local space,
25
+ * taking into account the current animation state of both morph targets and skinning.
26
+ */
27
+ getVertexPosition(vert: number, target: Vector3): Vector3;
28
+
21
29
  raycast(raycaster: Raycaster, intersects: Intersection[]): void;
22
30
  }