diff --git a/threejs/three.d.ts b/threejs/three.d.ts index 65293da1ca..788dc26799 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -1,6 +1,6 @@ -// Type definitions for three.js r74 +// Type definitions for three.js r75 // Project: http://mrdoob.github.com/three.js/ -// Definitions by: Kon , Satoru Kimura , Florent Poujol +// Definitions by: Kon , Satoru Kimura , Florent Poujol , SereznoKot // Definitions: https://github.com/borisyankov/DefinitelyTyped declare namespace THREE { @@ -99,6 +99,14 @@ declare namespace THREE { export const MixOperation: Combine; export const AddOperation: Combine; + // Tone Mapping modes + export enum ToneMapping { } + export const NoToneMapping: ToneMapping; + export const LinearToneMapping: ToneMapping; + export const ReinhardToneMapping: ToneMapping; + export const Uncharted2ToneMapping: ToneMapping; + export const CineonToneMapping: ToneMapping; + // Mapping modes export enum Mapping { } export const UVMapping: Mapping; @@ -107,6 +115,8 @@ declare namespace THREE { export const EquirectangularReflectionMapping: Mapping; export const EquirectangularRefractionMapping: Mapping; export const SphericalReflectionMapping: Mapping; + export const CubeUVReflectionMapping: Mapping; + export const CubeUVRefractionMapping: Mapping; // Wrapping modes export enum Wrapping { } @@ -190,6 +200,17 @@ declare namespace THREE { export const TriangleStripDrawMode: TrianglesDrawModes; export const TriangleFanDrawMode: TrianglesDrawModes; + // Texture Encodings + export enum TextureEncoding { } + export const LinearEncoding: TextureEncoding; + export const sRGBEncoding: TextureEncoding; + export const GammaEncoding: TextureEncoding; + export const RGBEEncoding: TextureEncoding; + export const LogLuvEncoding: TextureEncoding; + export const RGBM7Encoding: TextureEncoding; + export const RGBM16Encoding: TextureEncoding; + export const RGBDEncoding: TextureEncoding; + // log handlers export function warn(message?: any, ...optionalParams: any[]): void; export function error(message?: any, ...optionalParams: any[]): void; @@ -702,7 +723,7 @@ declare namespace THREE { /** * Bakes matrix transform directly into vertex coordinates. */ - applyMatrix(matrix: Matrix4): void; + applyMatrix(matrix: Matrix4): BufferGeometry; rotateX(angle: number): BufferGeometry; rotateY(angle: number): BufferGeometry; @@ -1080,7 +1101,7 @@ declare namespace THREE { * Each UV layer is an array of UV matching order and number of vertices in faces. * To signal an update in this array, Geometry.uvsNeedUpdate needs to be set to true. */ - faceVertexUvs: Vector2[][]; + faceVertexUvs: Vector2[][][]; /** * Array of morph targets. Each morph target is a Javascript object: @@ -1161,7 +1182,7 @@ declare namespace THREE { /** * Bakes matrix transform directly into vertex coordinates. */ - applyMatrix(matrix: Matrix4): void; + applyMatrix(matrix: Matrix4): Geometry; rotateX(angle: number): Geometry; rotateY(angle: number): Geometry; @@ -1806,8 +1827,8 @@ declare namespace THREE { distance: number; decay: number; - shadow: LightShadow; + power: number; copy(source: PointLight): PointLight; clone(recursive?: boolean): PointLight; @@ -1850,8 +1871,8 @@ declare namespace THREE { exponent: number; decay: number; - shadow: LightShadow; + power: number; clone(recursive?: boolean): SpotLight; copy(source: PointLight): SpotLight; @@ -2129,6 +2150,7 @@ declare namespace THREE { polygonOffsetFactor?: number; polygonOffsetUnits?: number; alphaTest?: number; + premultipliedAlpha?: boolean; overdraw?: number; visible?: boolean; } @@ -2231,6 +2253,8 @@ declare namespace THREE { */ alphaTest: number; + premultipliedAlpha: boolean; + /** * Enables/disables overdraw. If greater than zero, polygons are drawn slightly bigger in order to fix antialiasing gaps when using the CanvasRenderer. Default is 0. */ @@ -2268,6 +2292,7 @@ declare namespace THREE { linewidth?: number; linecap?: string; linejoin?: string; + blending?: Blending; vertexColors?: Colors; fog?: boolean; } @@ -2279,6 +2304,7 @@ declare namespace THREE { linewidth: number; linecap: string; linejoin: string; + blending: Blending; vertexColors: Colors; fog: boolean; @@ -2293,6 +2319,7 @@ declare namespace THREE { scale?: number; dashSize?: number; gapSize?: number; + blending?: Blending; vertexColors?: Colors; fog?: boolean; } @@ -2305,6 +2332,7 @@ declare namespace THREE { scale: number; dashSize: number; gapSize: number; + blending: Blending; vertexColors: Colors; fog: boolean; @@ -2330,8 +2358,6 @@ declare namespace THREE { refractionRatio?: number; shading?: Shading; blending?: Blending; - depthTest?: boolean; - depthWrite?: boolean; wireframe?: boolean; wireframeLinewidth?: number; wireframeLinecap?: string; @@ -2357,6 +2383,7 @@ declare namespace THREE { refractionRatio: number; fog: boolean; shading: Shading; + blending: Blending; wireframe: boolean; wireframeLinewidth: number; wireframeLinecap: string; @@ -2403,6 +2430,7 @@ declare namespace THREE { reflectivity?: number; refractionRatio?: number; fog?: boolean; + blending?: Blending; wireframe?: boolean; wireframeLinewidth?: number; wireframeLinecap?: string; @@ -2432,6 +2460,7 @@ declare namespace THREE { reflectivity: number; refractionRatio: number; fog: boolean; + blending: Blending; wireframe: boolean; wireframeLinewidth: number; wireframeLinecap: string; @@ -2471,7 +2500,7 @@ declare namespace THREE { envMapIntensity?: number; refractionRatio?: number; shading?: Shading; - blending: Blending; + blending?: Blending; wireframe?: boolean; wireframeLinewidth?: number; vertexColors?: Colors; @@ -2572,8 +2601,6 @@ declare namespace THREE { refractionRatio?: number; shading?: Shading; blending?: Blending; - depthTest?: boolean; - depthWrite?: boolean; wireframe?: boolean; wireframeLinewidth?: number; wireframeLinecap?: string; @@ -2614,6 +2641,7 @@ declare namespace THREE { refractionRatio: number; fog: boolean; shading: Shading; + blending: Blending; wireframe: boolean; wireframeLinewidth: number; wireframeLinecap: string; @@ -2644,13 +2672,10 @@ declare namespace THREE { export interface PointsMaterialParameters extends MaterialParameters { color?: number|string; - opacity?: number; map?: Texture; size?: number; sizeAttenuation?: boolean; - blending?: Blending, - depthTest?: boolean; - depthWrite?: boolean; + blending?: Blending; vertexColors?: Colors; fog?: boolean; } @@ -2662,6 +2687,7 @@ declare namespace THREE { map: Texture; size: number; sizeAttenuation: boolean; + blending: Blending; vertexColors: boolean; fog: boolean; @@ -2677,21 +2703,18 @@ declare namespace THREE { export interface ShaderMaterialParameters extends MaterialParameters { defines?: any; uniforms?: any; - fragmentShader?: string; vertexShader?: string; + fragmentShader?: string; shading?: Shading; lineWidth?: number; - blending?: Blending; - depthTest?: boolean; - depthWrite?: boolean; wireframe?: boolean; wireframeLinewidth?: number; + fog?: boolean; lights?: boolean; vertexColors?: Colors; skinning?: boolean; morphTargets?: boolean; morphNormals?: boolean; - fog?: boolean; } export class ShaderMaterial extends Material { @@ -2728,13 +2751,8 @@ declare namespace THREE { export interface SpriteMaterialParameters extends MaterialParameters { color?: number|string; - opacity?: number; map?: Texture; - blending?: Blending; - depthTest?: boolean; - depthWrite?: boolean; - uvOffset?: Vector2; - uvScale?: Vector2; + rotation?: number; fog?: boolean; } @@ -3296,20 +3314,21 @@ declare namespace THREE { identity(): Matrix3; clone(): Matrix3; copy(m: Matrix3): Matrix3; + setFromMatix4(m: Matrix4): Matrix3; multiplyVector3Array(a: any): any; // deprecated, use applyToVector3Array() applyToVector3Array(array: number[], offset?: number, length?: number): number[]; applyToBuffer(buffer: BufferAttribute, offset?: number, length?: number): BufferAttribute; multiplyScalar(s: number): Matrix3; determinant(): number; getInverse(matrix: Matrix3, throwOnDegenerate?: boolean): Matrix3; - getInverse(matrix: Matrix4, throwOnDegenerate?: boolean): Matrix3; + getInverse(matrix: Matrix4, throwOnDegenerate?: boolean): Matrix3; // deprecated /** * Transposes this matrix in place. */ transpose(): Matrix3; flattenToArrayOffset(array: number[], offset: number): number[]; - getNormalMatrix(m: Matrix4): Matrix3; + getNormalMatrix(matrix4: Matrix4): Matrix3; /** * Transposes this matrix into the supplied array r, and returns itself. @@ -3424,7 +3443,7 @@ declare namespace THREE { * Sets this matrix to the inverse of matrix m. * Based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm. */ - getInverse(m: Matrix4, throwOnInvertible?: boolean): Matrix4; + getInverse(m: Matrix4, throwOnDegeneratee?: boolean): Matrix4; /** * Multiplies the columns of this matrix by vector v. @@ -3537,6 +3556,16 @@ declare namespace THREE { isIntersectionLine(l: any): any; // deprecated, use instersectsLine() } + export class Spherical { + constructor(radius?: number, phi?: number, theta?: number); + + set(radius: number, phi: number, theta: number): void; + clone(): Spherical; + copy(other: Spherical): Spherical; + makeSafe(): void; + setFromVector3(vec3: Vector3): Spherical; + } + /** * Implementation of a quaternion. This is used for rotating things without incurring in the dreaded gimbal lock issue, amongst other advantages. * @@ -4218,12 +4247,14 @@ declare namespace THREE { */ distanceToSquared(v: Vector3): number; + setFromSpherical(s: Spherical): Matrix3; getPositionFromMatrix(m: Matrix4): Vector3; // deprecated, use setFromMatrixPosition() setFromMatrixPosition(m: Matrix4): Vector3; getScaleFromMatrix(m: Matrix4): Vector3; // deprecated, use setFromMatrixScale() setFromMatrixScale(m: Matrix4): Vector3; getColumnFromMatrixColumn(index: number, matrix: Matrix4): Vector3; // deprecated, use setFromMatrixColumn() - setFromMatrixColumn(index: number, matrix: Matrix4): Vector3; + setFromMatrixColumn(matrix: Matrix4, index: number): Vector3; + setFromMatrixColumn(index: number, matrix: Matrix4): Vector3; // deprecated, now expects ( matrix, index ) /** * Checks for strict equality of this vector and v. @@ -4237,6 +4268,8 @@ declare namespace THREE { fromAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector3; } + export class Vertex extends Vector3 {} // deprecated, use Vector3 + /** * 4D vector. * @@ -4749,6 +4782,11 @@ declare namespace THREE { */ gammaOutput: boolean; + physicallyCorrectLights: boolean; + toneMapping: ToneMapping; + toneMappingExposure: number; + toneMappingWhitePoint: number; + /** * Default is false. */ @@ -4888,6 +4926,7 @@ declare namespace THREE { */ setFaceCulling(cullFace?: CullFace, frontFace?: FrontFaceDirection): void; setTexture(texture: Texture, slot: number): void; + getCurrentRenderTarget(): RenderTarget; setRenderTarget(renderTarget: RenderTarget): void; readRenderTargetPixels( renderTarget: RenderTarget, x: number, y: number, width: number, height: number, buffer: any ): void; @@ -4929,7 +4968,6 @@ declare namespace THREE { texture: Texture; depthBuffer: boolean; stencilBuffer: boolean; - shareDepthFrom: any; wrapS: any; // deprecated, use texture.wrapS wrapT: any; // deprecated, use texture.wrapT magFilter: any; // deprecated, use texture.magFilter @@ -4957,6 +4995,7 @@ declare namespace THREE { constructor(width: number, height: number, options?: WebGLRenderTargetOptions); activeCubeFace: number; // PX 0, NX 1, PY 2, NY 3, PZ 4, NZ 5 + activeMipMapLevel: number; } // Renderers / Shaders ///////////////////////////////////////////////////////////////////// @@ -4966,7 +5005,6 @@ declare namespace THREE { alphamap_fragment: string; alphamap_pars_fragment: string; alphatest_fragment: string; - ambient_pars: string; aomap_fragment: string; aomap_pars_fragment: string; begin_vertex: string; @@ -4978,17 +5016,32 @@ declare namespace THREE { color_pars_vertex: string; color_vertex: string; common: string; + cube_frag: string; + cube_vert: string; + cube_uv_reflection_fragment: string; defaultnormal_vertex: string; + depth_frag: string; + depth_vert: string; + depthRGBA_frag: string; + depthRGBA_vert: string; + distanceRGBA_frag: string; + distanceRGBA_vert: string; displacementmap_vertex: string; displacementmap_pars_vertex: string; emissivemap_fragment: string; emissivemap_pars_fragment: string; + encodings_pars_fragment: string; + encodings_fragment: string; envmap_fragment: string; envmap_pars_fragment: string; envmap_pars_vertex: string; envmap_vertex: string; + equirect_frag: string; + equirect_vert: string; fog_fragment: string; fog_pars_fragment: string; + linedashed_frag: string; + linedashed_vert: string; lightmap_fragment: string; lightmap_pars_fragment: string; lights_lambert_vertex: string; @@ -5000,7 +5053,6 @@ declare namespace THREE { lights_standard_fragment: string; lights_standard_pars_fragment: string; lights_template: string; - linear_to_gamma_fragment: string; logdepthbuf_fragment: string; logdepthbuf_pars_fragment: string; logdepthbuf_pars_vertex: string; @@ -5009,13 +5061,26 @@ declare namespace THREE { map_pars_fragment: string; map_particle_fragment: string; map_particle_pars_fragment: string; + meshbasic_frag: string; + meshbasic_vert: string; + meshlambert_frag: string; + meshlambert_vert: string; + meshphong_frag: string; + meshphong_vert: string; + meshstandard_frag: string; + meshstandard_vert: string; metalnessmap_fragment: string; metalnessmap_pars_fragment: string; morphnormal_vertex: string; morphtarget_pars_vertex: string; morphtarget_vertex: string; + normal_frag: string; normal_fragment: string; + normal_vert: string; normalmap_pars_fragment: string; + points_frag: string; + points_vert: string; + premultiplied_alpha_fragment: string; project_vertex: string; roughtnessmap_fragment: string; roughtnessmap_pars_fragment: string; @@ -5029,6 +5094,8 @@ declare namespace THREE { skinnormal_vertex: string; specularmap_fragment: string; specularmap_pars_fragment: string; + tonemapping_fragment: string; + tonemapping_pars_fragment: string; uv2_pars_fragment: string; uv2_pars_vertex: string; uv2_vertex: string; @@ -5108,18 +5175,66 @@ declare namespace THREE { fogFar: IUniform; fogColor: IUniform; }; - ambient: { ambientLightColor: IUniform }; lights: { - directionalLights: any; + ambientLightColor: IUniform + directionalLights: { + type: string; + value: any[]; + properties: { + direction: { type: string }; + color: { type: string }; + shadow: { type: string }; + shadowBias: { type: string }; + shadowRadius: { type: string }; + shadowMapSize: { type: string }; + }; + }; directionalShadowMap: IUniform; directionalShadowMatrix: IUniform; - spotLights: any; + spotLights: { + type: string; + value: any[]; + properties: { + color: { type: string }; + position: { type: string }; + direction: { type: string }; + distance: { type: string }; + coneCos: { type: string }; + penumbraCos: { type: string }; + decay: { type: string }; + shadow: { type: string }; + shadowBias: { type: string }; + shadowRadius: { type: string }; + shadowMapSize: { type: string }; + }; + }; spotShadowMap: IUniform; spotShadowMatrix: IUniform; - pointLights: any; + pointLights: { + type: string; + value: any[]; + properties: { + color: { type: string }; + position: { type: string }; + decay: { type: string }; + distance: { type: string }; + shadow: { type: string }; + shadowBias: { type: string }; + shadowRadius: { type: string }; + shadowMapSize: { type: string }; + }; + }; pointShadowMap: IUniform; pointShadowMatrix: IUniform; - hemisphereLigtts: any; + hemisphereLigtts: { + type: string; + value: any[]; + properties: { + direction: { type: string }; + skycolor: { type: string }; + groundColor: { type: string }; + }; + }; }; points: { diffuse: IUniform; @@ -5149,7 +5264,7 @@ declare namespace THREE { // Renderers / WebGL ///////////////////////////////////////////////////////////////////// export class WebGLBufferRenderer { - constructor(_gl: any, extensions: any, _infoRender: any); // WebGLRenderingContext + constructor(_gl: WebGLRenderingContext, extensions: any, _infoRender: any); setMode(value: any): void; render(start: any, count: any): void; @@ -5162,7 +5277,7 @@ declare namespace THREE { } export class WebGLCapabilities { - constructor(gl: any, extensions: any, parameters: WebGLCapabilitiesParameters); // WebGLRenderingContext + constructor(gl: WebGLRenderingContext, extensions: any, parameters: WebGLCapabilitiesParameters); precision: any; logarithmicDepthBuffer: any; @@ -5182,25 +5297,25 @@ declare namespace THREE { } export class WebGLExtensions { - constructor(gl: any); // WebGLRenderingContext + constructor(gl: WebGLRenderingContext); get(name: string): any; } export class WebGLGeometries { - constructor(_gl: any, extensions: any, _infoRender: any); + constructor(gl: WebGLRenderingContext, extensions: any, _infoRender: any); get(object: any): any; } export class WebGLLights { - constructor(gl: any, properties: any, info: any); + constructor(gl: WebGLRenderingContext, properties: any, info: any); get(light: any): any; } export class WebGLIndexedBufferRenderer { - constructor(gl: any, properties: any, info: any); + constructor(gl: WebGLRenderingContext, properties: any, info: any); setMode(value: any): void; setIndex(index: any): void; @@ -5209,7 +5324,7 @@ declare namespace THREE { } export class WebGLObjects { - constructor(gl: any, properties: any, info: any); + constructor(gl: WebGLRenderingContext, properties: any, info: any); getAttributeBuffer(attribute: any): any; getWireframeAttribute(geometry: any): any; @@ -5427,6 +5542,7 @@ declare namespace THREE { premultiplyAlpha: boolean; flipY: boolean; unpackAlignment: number; + encoding: TextureEncoding; version: number; needsUpdate: boolean; onUpdate: () => void; @@ -5465,7 +5581,7 @@ declare namespace THREE { export class CubeTexture extends Texture { constructor( - images: any[], // HTMLImageElement or HTMLCanvasElement + images?: any[], // HTMLImageElement or HTMLCanvasElement mapping?: Mapping, wrapS?: Wrapping, wrapT?: Wrapping, @@ -5476,7 +5592,7 @@ declare namespace THREE { anisotropy?: number ); - images: any[]; + images: any; // returns and sets the value of Texture.image in the codde ? copy(source: CubeTexture): CubeTexture; } @@ -5504,7 +5620,7 @@ declare namespace THREE { export class DataTexture extends Texture { constructor( - data: ImageData, + data: ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, width: number, height: number, format: PixelFormat, @@ -5886,6 +6002,19 @@ declare namespace THREE { // Extras / Geomerties ///////////////////////////////////////////////////////////////////// + export class BoxBufferGeometry extends BufferGeometry { + constructor(width: number, height: number, depth: number, widthSegments?: number, heightSegments?: number, depthSegments?: number); + + parameters: { + width: number; + height: number; + depth: number; + widthSegments: number; + heightSegments: number; + depthSegments: number; + }; + } + /** * BoxGeometry is the quadrilateral primitive geometry class. It is typically used for creating a cube or irregular quadrilateral of the dimensions provided within the (optional) 'width', 'height', & 'depth' constructor arguments. */ @@ -5908,15 +6037,23 @@ declare namespace THREE { heightSegments: number; depthSegments: number; }; - widthSegments: number - heightSegments: number; - depthSegments: number; clone(): BoxGeometry; } export class CubeGeometry extends BoxGeometry {} // deprecated, use BoxGeometry + export class CircleBufferGeometry extends BufferGeometry { + constructor(radius?: number, segments?: number, thetaStart?: number, thetaLength?: number); + + parameters: { + radius: number; + segments: number; + thetaStart: number; + thetaLength: number; + }; + } + export class CircleGeometry extends Geometry { constructor(radius?: number, segments?: number, thetaStart?: number, thetaLength?: number); @@ -5928,12 +6065,16 @@ declare namespace THREE { }; } - export class CircleBufferGeometry extends BufferGeometry { - constructor(radius?: number, segments?: number, thetaStart?: number, thetaLength?: number); + export class CylinderBufferGeometry extends BufferGeometry { + constructor(radiusTop?: number, radiusBottom?: number, height?: number, radialSegments?: number, heightSegments?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number); parameters: { - radius: number; - segments: number; + radiusTop: number; + radiusBottom: number; + height: number; + radialSegments: number; + heightSegments: number; + openEnded: boolean; thetaStart: number; thetaLength: number; }; @@ -5994,6 +6135,17 @@ declare namespace THREE { constructor(radius: number, detail: number); } + export class LatheBufferGeometry extends BufferGeometry { + constructor(points: Vector3[], segments?: number, phiStart?: number, phiLength?: number); + + parameters: { + points: Vector3[]; + segments: number; + phiStart: number; + phiLength: number; + }; + } + export class LatheGeometry extends Geometry { constructor(points: Vector3[], segments?: number, phiStart?: number, phiLength?: number); @@ -6053,6 +6205,19 @@ declare namespace THREE { boundingSphere: Sphere; } + export class RingBufferGeometry extends BufferGeometry { + constructor(innerRadius?: number, outerRadius?: number, thetaSegments?: number, phiSegments?: number, thetaStart?: number, thetaLength?: number); + + parameters: { + innerRadius: number; + outerRadius: number; + thetaSegments: number; + phiSegments: number; + thetaStart: number; + thetaLength: number; + }; + } + export class RingGeometry extends Geometry { constructor(innerRadius?: number, outerRadius?: number, thetaSegments?: number, phiSegments?: number, thetaStart?: number, thetaLength?: number); @@ -6144,6 +6309,18 @@ declare namespace THREE { } } + export class TorusBufferGeometry extends BufferGeometry { + constructor(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number); + + parameters: { + radius: number; + tube: number; + radialSegments: number; + tubularSegments: number; + arc: number; + }; + } + export class TorusGeometry extends Geometry { constructor(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number); @@ -6156,6 +6333,20 @@ declare namespace THREE { }; } + export class TorusKnotBufferGeometry extends BufferGeometry { + constructor(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, p?: number, q?: number, heightScale?: number); + + parameters: { + radius: number; + tube: number; + radialSegments: number; + tubularSegments: number; + p: number; + q: number; + heightScale: number; + }; + } + export class TorusKnotGeometry extends Geometry { constructor(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, p?: number, q?: number, heightScale?: number);