@types/three
Advanced tools
Comparing version 0.149.0 to 0.150.0
@@ -1,2 +0,2 @@ | ||
import { Camera, MOUSE, TOUCH, Vector3 } from '../../../src/Three'; | ||
import { Camera, MOUSE, MouseButton, TOUCH, TouchCount, Vector3 } from '../../../src/Three'; | ||
@@ -196,3 +196,3 @@ /** | ||
*/ | ||
mouseButtons: Partial<{ LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE }>; | ||
mouseButtons: Partial<{ LEFT: MouseButton; MIDDLE: MouseButton; RIGHT: MouseButton }>; | ||
@@ -203,3 +203,3 @@ /** | ||
*/ | ||
touches: Partial<{ ONE: TOUCH; TWO: TOUCH }>; | ||
touches: Partial<{ ONE: TouchCount; TWO: TouchCount }>; | ||
@@ -236,2 +236,7 @@ /** | ||
/** | ||
* Removes the key event listener previously defined with {@link listenToKeyEvents}. | ||
*/ | ||
stopListenToKeyEvents(): void; | ||
/** | ||
* Save the current state of the controls. This can later be | ||
@@ -238,0 +243,0 @@ * recovered with .reset. |
@@ -1,2 +0,2 @@ | ||
import { Camera, EventDispatcher, MOUSE, Vector3 } from '../../../src/Three'; | ||
import { Camera, EventDispatcher, MOUSE, MouseButton, Vector3 } from '../../../src/Three'; | ||
@@ -24,3 +24,3 @@ export class TrackballControls extends EventDispatcher { | ||
keys: string[]; | ||
mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE }; | ||
mouseButtons: { LEFT: MouseButton; MIDDLE: MouseButton; RIGHT: MouseButton }; | ||
@@ -27,0 +27,0 @@ target: Vector3; |
@@ -1,2 +0,2 @@ | ||
import { Object3D, Camera, MOUSE, Raycaster, Mesh, Vector3, Quaternion } from '../../../src/Three'; | ||
import { Object3D, Camera, MOUSE, Raycaster, Mesh, Vector3, Quaternion, MouseButton } from '../../../src/Three'; | ||
@@ -25,5 +25,5 @@ export class TransformControls extends Object3D { | ||
mouseButtons: { | ||
LEFT: MOUSE; | ||
MIDDLE: MOUSE; | ||
RIGHT: MOUSE; | ||
LEFT: MouseButton; | ||
MIDDLE: MouseButton; | ||
RIGHT: MouseButton; | ||
}; | ||
@@ -30,0 +30,0 @@ |
@@ -5,3 +5,3 @@ import { ColorRepresentation, LineSegments } from '../../../src/Three'; | ||
export class OctreeHelper extends LineSegments { | ||
constructor(octree: Octree, color: ColorRepresentation); | ||
constructor(octree: Octree, color?: ColorRepresentation); | ||
@@ -8,0 +8,0 @@ octree: Octree; |
@@ -1,24 +0,3 @@ | ||
interface Stats { | ||
REVISION: number; | ||
dom: HTMLDivElement; | ||
addPanel(panel: Stats.Panel): Stats.Panel; | ||
showPanel(id: number): void; | ||
begin(): void; | ||
end(): number; | ||
update(): void; | ||
domElement: HTMLDivElement; | ||
setMode(id: number): void; | ||
} | ||
import Stats = require('stats.js'); | ||
declare function Stats(): Stats; | ||
declare namespace Stats { | ||
interface Panel { | ||
dom: HTMLCanvasElement; | ||
update(value: number, maxValue: number): void; | ||
} | ||
function Panel(name?: string, fg?: string, bg?: string): Panel; | ||
} | ||
export default Stats; | ||
export = Stats; |
import { ConstNode, Node, NodeBuilder, NodeTypeOption, SwizzleOption } from '../Nodes'; | ||
// lot of private typescript magic here | ||
export {}; | ||
export type Swizzable<T extends Node = Node> = T & | ||
{ | ||
[key in SwizzleOption | number]: Swizzable; | ||
}; | ||
export type Swizzable<T extends Node = Node> = T & { | ||
[key in SwizzleOption | number]: Swizzable; | ||
}; | ||
@@ -9,0 +8,0 @@ /** anything that can be passed to {@link nodeObject} and returns a proxy */ |
@@ -69,2 +69,3 @@ import { BufferGeometry, Material, Mesh, Color } from '../../../src/Three'; | ||
reset(): void; | ||
update(): void; | ||
render(renderCallback: any): void; | ||
@@ -71,0 +72,0 @@ generateGeometry(): BufferGeometry; |
import { IUniform, UniformsLib } from '../../../src/Three'; | ||
export const VelocityShader: { | ||
uniforms: typeof UniformsLib['common'] & | ||
typeof UniformsLib['displacementmap'] & { | ||
uniforms: (typeof UniformsLib)['common'] & | ||
(typeof UniformsLib)['displacementmap'] & { | ||
modelMatrixPrev: IUniform; | ||
@@ -7,0 +7,0 @@ currentProjectionViewMatrix: IUniform; |
@@ -1,2 +0,2 @@ | ||
// Type definitions for three 0.149 | ||
// Type definitions for three 0.150 | ||
// Project: https://threejs.org/ | ||
@@ -3,0 +3,0 @@ // Definitions by: Josh Ellis <https://github.com/joshuaellis> |
{ | ||
"name": "@types/three", | ||
"version": "0.149.0", | ||
"version": "0.150.0", | ||
"description": "TypeScript definitions for three", | ||
@@ -28,6 +28,21 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three", | ||
"dependencies": { | ||
"@types/webxr": "*" | ||
"@types/stats.js": "*", | ||
"@types/webxr": "*", | ||
"fflate": "~0.6.9", | ||
"lil-gui": "~0.17.0" | ||
}, | ||
"typesPublisherContentHash": "26b43856591e0e71a44773611c3705a12a8926b63542851ba0c85e160758d30b", | ||
"typeScriptVersion": "4.4" | ||
"typesPublisherContentHash": "05e4984f22e82431c725369b78c3643e5b4e94508994b1904e74a77e269b9617", | ||
"typeScriptVersion": "4.4", | ||
"exports": { | ||
".": { | ||
"import": "./build/three.module.js", | ||
"require": "./build/three.cjs" | ||
}, | ||
"./examples/fonts/*": "./examples/fonts/*", | ||
"./examples/jsm/*": "./examples/jsm/*", | ||
"./addons/*": "./examples/jsm/*", | ||
"./src/*": "./src/*", | ||
"./nodes": "./examples/jsm/nodes/Nodes.js", | ||
"./package.json": "./package.json" | ||
} | ||
} |
@@ -11,4 +11,4 @@ # Installation | ||
### Additional Details | ||
* Last updated: Mon, 30 Jan 2023 20:02:38 GMT | ||
* Dependencies: [@types/webxr](https://npmjs.com/package/@types/webxr) | ||
* Last updated: Mon, 27 Mar 2023 18:33:59 GMT | ||
* Dependencies: [@types/fflate](https://npmjs.com/package/@types/fflate), [@types/lil-gui](https://npmjs.com/package/@types/lil-gui), [@types/stats.js](https://npmjs.com/package/@types/stats.js), [@types/webxr](https://npmjs.com/package/@types/webxr) | ||
* Global values: `THREE` | ||
@@ -15,0 +15,0 @@ |
export const REVISION: string; | ||
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.button | ||
export enum MOUSE { | ||
LEFT = 0, | ||
MIDDLE = 1, | ||
RIGHT = 2, | ||
ROTATE = 0, | ||
DOLLY = 1, | ||
PAN = 2, | ||
} | ||
export const MOUSE: { | ||
LEFT: 0; | ||
MIDDLE: 1; | ||
RIGHT: 2; | ||
ROTATE: 0; | ||
DOLLY: 1; | ||
PAN: 2; | ||
}; | ||
export enum TOUCH { | ||
ROTATE, | ||
PAN, | ||
DOLLY_PAN, | ||
DOLLY_ROTATE, | ||
} | ||
export type MouseButton = 0 | 1 | 2; | ||
export const TOUCH: { | ||
ROTATE: 0; | ||
PAN: 1; | ||
DOLLY_PAN: 2; | ||
DOLLY_ROTATE: 3; | ||
}; | ||
export type TouchCount = 0 | 1 | 2 | 3; | ||
// GL STATE CONSTANTS | ||
export enum CullFace {} | ||
export const CullFaceNone: CullFace; | ||
export const CullFaceBack: CullFace; | ||
export const CullFaceFront: CullFace; | ||
export const CullFaceFrontBack: CullFace; | ||
export const CullFaceNone: 0; | ||
export const CullFaceBack: 1; | ||
export const CullFaceFront: 2; | ||
export const CullFaceFrontBack: 3; | ||
export type CullFace = typeof CullFaceNone | typeof CullFaceBack | typeof CullFaceFront | typeof CullFaceFrontBack; | ||
// Shadowing Type | ||
export enum ShadowMapType {} | ||
export const BasicShadowMap: ShadowMapType; | ||
export const PCFShadowMap: ShadowMapType; | ||
export const PCFSoftShadowMap: ShadowMapType; | ||
export const VSMShadowMap: ShadowMapType; | ||
export const BasicShadowMap: 0; | ||
export const PCFShadowMap: 1; | ||
export const PCFSoftShadowMap: 2; | ||
export const VSMShadowMap: 3; | ||
export type ShadowMapType = typeof BasicShadowMap | typeof PCFShadowMap | typeof PCFSoftShadowMap | typeof VSMShadowMap; | ||
@@ -37,2 +41,6 @@ // MATERIAL CONSTANTS | ||
// side | ||
export const FrontSide: 0; | ||
export const BackSide: 1; | ||
export const DoubleSide: 2; | ||
export const TwoPassDoubleSide: 2; | ||
/** | ||
@@ -42,15 +50,18 @@ * Defines which side of faces will be rendered - front, back or both. | ||
*/ | ||
export enum Side {} | ||
export const FrontSide: Side; | ||
export const BackSide: Side; | ||
export const DoubleSide: Side; | ||
export type Side = typeof FrontSide | typeof BackSide | typeof DoubleSide | typeof TwoPassDoubleSide; | ||
// blending modes | ||
export enum Blending {} | ||
export const NoBlending: Blending; | ||
export const NormalBlending: Blending; | ||
export const AdditiveBlending: Blending; | ||
export const SubtractiveBlending: Blending; | ||
export const MultiplyBlending: Blending; | ||
export const CustomBlending: Blending; | ||
export const NoBlending: 0; | ||
export const NormalBlending: 1; | ||
export const AdditiveBlending: 2; | ||
export const SubtractiveBlending: 3; | ||
export const MultiplyBlending: 4; | ||
export const CustomBlending: 5; | ||
export type Blending = | ||
| typeof NoBlending | ||
| typeof NormalBlending | ||
| typeof AdditiveBlending | ||
| typeof SubtractiveBlending | ||
| typeof MultiplyBlending | ||
| typeof CustomBlending; | ||
@@ -60,111 +71,371 @@ // custom blending equations | ||
// mappings to OpenGL constants defined in Texture.js) | ||
export enum BlendingEquation {} | ||
export const AddEquation: BlendingEquation; | ||
export const SubtractEquation: BlendingEquation; | ||
export const ReverseSubtractEquation: BlendingEquation; | ||
export const MinEquation: BlendingEquation; | ||
export const MaxEquation: BlendingEquation; | ||
export const AddEquation: 100; | ||
export const SubtractEquation: 101; | ||
export const ReverseSubtractEquation: 102; | ||
export const MinEquation: 103; | ||
export const MaxEquation: 104; | ||
export type BlendingEquation = | ||
| typeof AddEquation | ||
| typeof SubtractEquation | ||
| typeof ReverseSubtractEquation | ||
| typeof MinEquation | ||
| typeof MaxEquation; | ||
// custom blending destination factors | ||
export enum BlendingDstFactor {} | ||
export const ZeroFactor: BlendingDstFactor; | ||
export const OneFactor: BlendingDstFactor; | ||
export const SrcColorFactor: BlendingDstFactor; | ||
export const OneMinusSrcColorFactor: BlendingDstFactor; | ||
export const SrcAlphaFactor: BlendingDstFactor; | ||
export const OneMinusSrcAlphaFactor: BlendingDstFactor; | ||
export const DstAlphaFactor: BlendingDstFactor; | ||
export const OneMinusDstAlphaFactor: BlendingDstFactor; | ||
export const DstColorFactor: BlendingDstFactor; | ||
export const OneMinusDstColorFactor: BlendingDstFactor; | ||
export const ZeroFactor: 200; | ||
export const OneFactor: 201; | ||
export const SrcColorFactor: 202; | ||
export const OneMinusSrcColorFactor: 203; | ||
export const SrcAlphaFactor: 204; | ||
export const OneMinusSrcAlphaFactor: 205; | ||
export const DstAlphaFactor: 206; | ||
export const OneMinusDstAlphaFactor: 207; | ||
export const DstColorFactor: 208; | ||
export const OneMinusDstColorFactor: 209; | ||
export type BlendingDstFactor = | ||
| typeof ZeroFactor | ||
| typeof OneFactor | ||
| typeof SrcColorFactor | ||
| typeof OneMinusSrcColorFactor | ||
| typeof SrcAlphaFactor | ||
| typeof OneMinusSrcAlphaFactor | ||
| typeof DstAlphaFactor | ||
| typeof OneMinusDstAlphaFactor | ||
| typeof DstColorFactor | ||
| typeof OneMinusDstColorFactor; | ||
// custom blending src factors | ||
export enum BlendingSrcFactor {} | ||
export const SrcAlphaSaturateFactor: BlendingSrcFactor; | ||
export const SrcAlphaSaturateFactor: 210; | ||
export type BlendingSrcFactor = typeof SrcAlphaSaturateFactor; | ||
// depth modes | ||
export enum DepthModes {} | ||
export const NeverDepth: DepthModes; | ||
export const AlwaysDepth: DepthModes; | ||
export const LessDepth: DepthModes; | ||
export const LessEqualDepth: DepthModes; | ||
export const EqualDepth: DepthModes; | ||
export const GreaterEqualDepth: DepthModes; | ||
export const GreaterDepth: DepthModes; | ||
export const NotEqualDepth: DepthModes; | ||
export const NeverDepth: 0; | ||
export const AlwaysDepth: 1; | ||
export const LessDepth: 2; | ||
export const LessEqualDepth: 3; | ||
export const EqualDepth: 4; | ||
export const GreaterEqualDepth: 5; | ||
export const GreaterDepth: 6; | ||
export const NotEqualDepth: 7; | ||
export type DepthModes = | ||
| typeof NeverDepth | ||
| typeof AlwaysDepth | ||
| typeof LessDepth | ||
| typeof LessEqualDepth | ||
| typeof EqualDepth | ||
| typeof GreaterEqualDepth | ||
| typeof GreaterDepth | ||
| typeof NotEqualDepth; | ||
// TEXTURE CONSTANTS | ||
// Operations | ||
export enum Combine {} | ||
export const MultiplyOperation: Combine; | ||
export const MixOperation: Combine; | ||
export const AddOperation: Combine; | ||
export const MultiplyOperation: 0; | ||
export const MixOperation: 1; | ||
export const AddOperation: 2; | ||
export type Combine = typeof MultiplyOperation | typeof MixOperation | typeof AddOperation; | ||
// Tone Mapping modes | ||
export enum ToneMapping {} | ||
export const NoToneMapping: ToneMapping; | ||
export const LinearToneMapping: ToneMapping; | ||
export const ReinhardToneMapping: ToneMapping; | ||
export const CineonToneMapping: ToneMapping; | ||
export const ACESFilmicToneMapping: ToneMapping; | ||
export const CustomToneMapping: ToneMapping; | ||
export const NoToneMapping: 0; | ||
export const LinearToneMapping: 1; | ||
export const ReinhardToneMapping: 2; | ||
export const CineonToneMapping: 3; | ||
export const ACESFilmicToneMapping: 4; | ||
export const CustomToneMapping: 5; | ||
export type ToneMapping = | ||
| typeof NoToneMapping | ||
| typeof LinearToneMapping | ||
| typeof ReinhardToneMapping | ||
| typeof CineonToneMapping | ||
| typeof ACESFilmicToneMapping | ||
| typeof CustomToneMapping; | ||
// Mapping modes | ||
export enum Mapping {} | ||
export const UVMapping: Mapping; | ||
export const CubeReflectionMapping: Mapping; | ||
export const CubeRefractionMapping: Mapping; | ||
export const EquirectangularReflectionMapping: Mapping; | ||
export const EquirectangularRefractionMapping: Mapping; | ||
export const CubeUVReflectionMapping: Mapping; | ||
export const UVMapping: 300; | ||
export const CubeReflectionMapping: 301; | ||
export const CubeRefractionMapping: 302; | ||
export const EquirectangularReflectionMapping: 303; | ||
export const EquirectangularRefractionMapping: 304; | ||
export const CubeUVReflectionMapping: 306; | ||
export type Mapping = | ||
| typeof UVMapping | ||
| typeof CubeReflectionMapping | ||
| typeof CubeRefractionMapping | ||
| typeof EquirectangularReflectionMapping | ||
| typeof EquirectangularRefractionMapping | ||
| typeof CubeUVReflectionMapping; | ||
// Wrapping modes | ||
export enum Wrapping {} | ||
export const RepeatWrapping: Wrapping; | ||
export const ClampToEdgeWrapping: Wrapping; | ||
export const MirroredRepeatWrapping: Wrapping; | ||
export const RepeatWrapping: 1000; | ||
export const ClampToEdgeWrapping: 1001; | ||
export const MirroredRepeatWrapping: 1002; | ||
export type Wrapping = typeof RepeatWrapping | typeof ClampToEdgeWrapping | typeof MirroredRepeatWrapping; | ||
// Filters | ||
export enum TextureFilter {} | ||
export const NearestFilter: TextureFilter; | ||
export const NearestMipmapNearestFilter: TextureFilter; | ||
export const NearestMipMapNearestFilter: TextureFilter; | ||
export const NearestMipmapLinearFilter: TextureFilter; | ||
export const NearestMipMapLinearFilter: TextureFilter; | ||
export const LinearFilter: TextureFilter; | ||
export const LinearMipmapNearestFilter: TextureFilter; | ||
export const LinearMipMapNearestFilter: TextureFilter; | ||
export const LinearMipmapLinearFilter: TextureFilter; | ||
export const LinearMipMapLinearFilter: TextureFilter; | ||
export const NearestFilter: 1003; | ||
export const NearestMipmapNearestFilter: 1004; | ||
export const NearestMipMapNearestFilter: 1004; | ||
export const NearestMipmapLinearFilter: 1005; | ||
export const NearestMipMapLinearFilter: 1005; | ||
export const LinearFilter: 1006; | ||
export const LinearMipmapNearestFilter: 1007; | ||
export const LinearMipMapNearestFilter: 1007; | ||
export const LinearMipmapLinearFilter: 1008; | ||
export const LinearMipMapLinearFilter: 1008; | ||
export type TextureFilter = | ||
| typeof NearestFilter | ||
| typeof NearestMipmapNearestFilter | ||
| typeof NearestMipMapNearestFilter | ||
| typeof NearestMipmapLinearFilter | ||
| typeof NearestMipMapLinearFilter | ||
| typeof LinearFilter | ||
| typeof LinearMipmapNearestFilter | ||
| typeof LinearMipMapNearestFilter | ||
| typeof LinearMipmapLinearFilter | ||
| typeof LinearMipMapLinearFilter; | ||
// Data types | ||
export enum TextureDataType {} | ||
export const UnsignedByteType: TextureDataType; | ||
export const ByteType: TextureDataType; | ||
export const ShortType: TextureDataType; | ||
export const UnsignedShortType: TextureDataType; | ||
export const IntType: TextureDataType; | ||
export const UnsignedIntType: TextureDataType; | ||
export const FloatType: TextureDataType; | ||
export const HalfFloatType: TextureDataType; | ||
export const UnsignedShort4444Type: TextureDataType; | ||
export const UnsignedShort5551Type: TextureDataType; | ||
export const UnsignedInt248Type: TextureDataType; | ||
export const UnsignedByteType: 1009; | ||
export const ByteType: 1010; | ||
export const ShortType: 1011; | ||
export const UnsignedShortType: 1012; | ||
export const IntType: 1013; | ||
export const UnsignedIntType: 1014; | ||
export const FloatType: 1015; | ||
export const HalfFloatType: 1016; | ||
export const UnsignedShort4444Type: 1017; | ||
export const UnsignedShort5551Type: 1018; | ||
export const UnsignedInt248Type: 1020; | ||
export type TextureDataType = | ||
| typeof UnsignedByteType | ||
| typeof ByteType | ||
| typeof ShortType | ||
| typeof UnsignedShortType | ||
| typeof IntType | ||
| typeof UnsignedIntType | ||
| typeof FloatType | ||
| typeof HalfFloatType | ||
| typeof UnsignedShort4444Type | ||
| typeof UnsignedShort5551Type | ||
| typeof UnsignedInt248Type; | ||
// Pixel formats | ||
export enum PixelFormat {} | ||
export const AlphaFormat: PixelFormat; | ||
export const RGBAFormat: PixelFormat; | ||
export const LuminanceFormat: PixelFormat; | ||
export const LuminanceAlphaFormat: PixelFormat; | ||
export const DepthFormat: PixelFormat; | ||
export const DepthStencilFormat: PixelFormat; | ||
export const RedFormat: PixelFormat; | ||
export const RedIntegerFormat: PixelFormat; | ||
export const RGFormat: PixelFormat; | ||
export const RGIntegerFormat: PixelFormat; | ||
export const RGBAIntegerFormat: PixelFormat; | ||
export const _SRGBFormat: PixelFormat; // fallback for WebGL 1 | ||
export const _SRGBAFormat: PixelFormat; // fallback for WebGL 1 | ||
export const AlphaFormat: 1021; | ||
export const RGBAFormat: 1023; | ||
export const LuminanceFormat: 1024; | ||
export const LuminanceAlphaFormat: 1025; | ||
export const DepthFormat: 1026; | ||
export const DepthStencilFormat: 1027; | ||
export const RedFormat: 1028; | ||
export const RedIntegerFormat: 1029; | ||
export const RGFormat: 1030; | ||
export const RGIntegerFormat: 1031; | ||
export const RGBAIntegerFormat: 1033; | ||
export type PixelFormat = | ||
| typeof AlphaFormat | ||
| typeof RGBAFormat | ||
| typeof LuminanceFormat | ||
| typeof LuminanceAlphaFormat | ||
| typeof DepthFormat | ||
| typeof DepthStencilFormat | ||
| typeof RedFormat | ||
| typeof RedIntegerFormat | ||
| typeof RGFormat | ||
| typeof RGIntegerFormat | ||
| typeof RGBAIntegerFormat | ||
| typeof _SRGBAFormat; | ||
// Compressed texture formats | ||
// DDS / ST3C Compressed texture formats | ||
export const RGB_S3TC_DXT1_Format: 33776; | ||
export const RGBA_S3TC_DXT1_Format: 33777; | ||
export const RGBA_S3TC_DXT3_Format: 33778; | ||
export const RGBA_S3TC_DXT5_Format: 33779; | ||
// PVRTC compressed './texture formats | ||
export const RGB_PVRTC_4BPPV1_Format: 35840; | ||
export const RGB_PVRTC_2BPPV1_Format: 35841; | ||
export const RGBA_PVRTC_4BPPV1_Format: 35842; | ||
export const RGBA_PVRTC_2BPPV1_Format: 35843; | ||
// ETC compressed texture formats | ||
export const RGB_ETC1_Format: 36196; | ||
export const RGB_ETC2_Format: 37492; | ||
export const RGBA_ETC2_EAC_Format: 37496; | ||
// ASTC compressed texture formats | ||
export const RGBA_ASTC_4x4_Format: 37808; | ||
export const RGBA_ASTC_5x4_Format: 37809; | ||
export const RGBA_ASTC_5x5_Format: 37810; | ||
export const RGBA_ASTC_6x5_Format: 37811; | ||
export const RGBA_ASTC_6x6_Format: 37812; | ||
export const RGBA_ASTC_8x5_Format: 37813; | ||
export const RGBA_ASTC_8x6_Format: 37814; | ||
export const RGBA_ASTC_8x8_Format: 37815; | ||
export const RGBA_ASTC_10x5_Format: 37816; | ||
export const RGBA_ASTC_10x6_Format: 37817; | ||
export const RGBA_ASTC_10x8_Format: 37818; | ||
export const RGBA_ASTC_10x10_Format: 37819; | ||
export const RGBA_ASTC_12x10_Format: 37820; | ||
export const RGBA_ASTC_12x12_Format: 37821; | ||
// BPTC compressed texture formats | ||
export const RGBA_BPTC_Format: 36492; | ||
// RGTC compressed texture formats | ||
export const RED_RGTC1_Format: 36283; | ||
export const SIGNED_RED_RGTC1_Format: 36284; | ||
export const RED_GREEN_RGTC2_Format: 36285; | ||
export const SIGNED_RED_GREEN_RGTC2_Format: 36286; | ||
export type CompressedPixelFormat = | ||
| typeof RGB_S3TC_DXT1_Format | ||
| typeof RGBA_S3TC_DXT1_Format | ||
| typeof RGBA_S3TC_DXT3_Format | ||
| typeof RGBA_S3TC_DXT5_Format | ||
| typeof RGB_PVRTC_4BPPV1_Format | ||
| typeof RGB_PVRTC_2BPPV1_Format | ||
| typeof RGBA_PVRTC_4BPPV1_Format | ||
| typeof RGBA_PVRTC_2BPPV1_Format | ||
| typeof RGB_ETC1_Format | ||
| typeof RGB_ETC2_Format | ||
| typeof RGBA_ETC2_EAC_Format | ||
| typeof RGBA_ASTC_4x4_Format | ||
| typeof RGBA_ASTC_5x4_Format | ||
| typeof RGBA_ASTC_5x5_Format | ||
| typeof RGBA_ASTC_6x5_Format | ||
| typeof RGBA_ASTC_6x6_Format | ||
| typeof RGBA_ASTC_8x5_Format | ||
| typeof RGBA_ASTC_8x6_Format | ||
| typeof RGBA_ASTC_8x8_Format | ||
| typeof RGBA_ASTC_10x5_Format | ||
| typeof RGBA_ASTC_10x6_Format | ||
| typeof RGBA_ASTC_10x8_Format | ||
| typeof RGBA_ASTC_10x10_Format | ||
| typeof RGBA_ASTC_12x10_Format | ||
| typeof RGBA_ASTC_12x12_Format | ||
| typeof RGBA_BPTC_Format | ||
| typeof RED_RGTC1_Format | ||
| typeof SIGNED_RED_RGTC1_Format | ||
| typeof RED_GREEN_RGTC2_Format | ||
| typeof SIGNED_RED_GREEN_RGTC2_Format; | ||
// Loop styles for AnimationAction | ||
export const LoopOnce: 2200; | ||
export const LoopRepeat: 2201; | ||
export const LoopPingPong: 2202; | ||
export type AnimationActionLoopStyles = typeof LoopOnce | typeof LoopRepeat | typeof LoopPingPong; | ||
// Interpolation | ||
export const InterpolateDiscrete: 2300; | ||
export const InterpolateLinear: 2301; | ||
export const InterpolateSmooth: 2302; | ||
export type InterpolationModes = typeof InterpolateDiscrete | typeof InterpolateLinear | typeof InterpolateSmooth; | ||
// Interpolant ending modes | ||
export const ZeroCurvatureEnding: 2400; | ||
export const ZeroSlopeEnding: 2401; | ||
export const WrapAroundEnding: 2402; | ||
export type InterpolationEndingModes = typeof ZeroCurvatureEnding | typeof ZeroSlopeEnding | typeof WrapAroundEnding; | ||
// Animation blending modes | ||
export const NormalAnimationBlendMode: 2500; | ||
export const AdditiveAnimationBlendMode: 2501; | ||
export type AnimationBlendMode = typeof NormalAnimationBlendMode | typeof AdditiveAnimationBlendMode; | ||
// Triangle Draw modes | ||
export const TrianglesDrawMode: 0; | ||
export const TriangleStripDrawMode: 1; | ||
export const TriangleFanDrawMode: 2; | ||
export type TrianglesDrawModes = typeof TrianglesDrawMode | typeof TriangleStripDrawMode | typeof TriangleFanDrawMode; | ||
// Texture Encodings | ||
export const LinearEncoding: 3000; | ||
export const sRGBEncoding: 3001; | ||
export type TextureEncoding = typeof LinearEncoding | typeof sRGBEncoding; | ||
// Depth packing strategies | ||
export const BasicDepthPacking: 3200; | ||
export const RGBADepthPacking: 3201; | ||
export type DepthPackingStrategies = typeof BasicDepthPacking | typeof RGBADepthPacking; | ||
// Normal Map types | ||
export const TangentSpaceNormalMap: 0; | ||
export const ObjectSpaceNormalMap: 1; | ||
export type NormalMapTypes = typeof TangentSpaceNormalMap | typeof ObjectSpaceNormalMap; | ||
export const NoColorSpace: ''; | ||
export const SRGBColorSpace: 'srgb'; | ||
export const LinearSRGBColorSpace: 'srgb-linear'; | ||
export const DisplayP3ColorSpace = 'display-p3'; | ||
export type ColorSpace = | ||
| typeof NoColorSpace | ||
| typeof SRGBColorSpace | ||
| typeof LinearSRGBColorSpace | ||
| typeof DisplayP3ColorSpace; | ||
// Stencil Op types | ||
export const ZeroStencilOp: 0; | ||
export const KeepStencilOp: 7680; | ||
export const ReplaceStencilOp: 7681; | ||
export const IncrementStencilOp: 7682; | ||
export const DecrementStencilOp: 7283; | ||
export const IncrementWrapStencilOp: 34055; | ||
export const DecrementWrapStencilOp: 34056; | ||
export const InvertStencilOp: 5386; | ||
export type StencilOp = | ||
| typeof ZeroStencilOp | ||
| typeof KeepStencilOp | ||
| typeof ReplaceStencilOp | ||
| typeof IncrementStencilOp | ||
| typeof DecrementStencilOp | ||
| typeof IncrementWrapStencilOp | ||
| typeof DecrementWrapStencilOp | ||
| typeof InvertStencilOp; | ||
// Stencil Func types | ||
export const NeverStencilFunc: 512; | ||
export const LessStencilFunc: 513; | ||
export const EqualStencilFunc: 514; | ||
export const LessEqualStencilFunc: 515; | ||
export const GreaterStencilFunc: 516; | ||
export const NotEqualStencilFunc: 517; | ||
export const GreaterEqualStencilFunc: 518; | ||
export const AlwaysStencilFunc: 519; | ||
export type StencilFunc = | ||
| typeof NeverStencilFunc | ||
| typeof LessStencilFunc | ||
| typeof EqualStencilFunc | ||
| typeof LessEqualStencilFunc | ||
| typeof GreaterStencilFunc | ||
| typeof NotEqualStencilFunc | ||
| typeof GreaterEqualStencilFunc | ||
| typeof AlwaysStencilFunc; | ||
// usage types | ||
export const StaticDrawUsage: 35044; | ||
export const DynamicDrawUsage: 35048; | ||
export const StreamDrawUsage: 35040; | ||
export const StaticReadUsage: 35045; | ||
export const DynamicReadUsage: 35049; | ||
export const StreamReadUsage: 35041; | ||
export const StaticCopyUsage: 35046; | ||
export const DynamicCopyUsage: 35050; | ||
export const StreamCopyUsage: 35042; | ||
export type Usage = | ||
| typeof StaticDrawUsage | ||
| typeof DynamicDrawUsage | ||
| typeof StreamDrawUsage | ||
| typeof StaticReadUsage | ||
| typeof DynamicReadUsage | ||
| typeof StreamReadUsage | ||
| typeof StaticCopyUsage | ||
| typeof DynamicCopyUsage | ||
| typeof StreamCopyUsage; | ||
export const GLSL1: '100'; | ||
export const GLSL3: '300 es'; | ||
export type GLSLVersion = typeof GLSL1 | typeof GLSL3; | ||
export const _SRGBAFormat = 1035; // fallback for WebGL 1 | ||
// Internal Pixel Formats | ||
@@ -234,133 +505,2 @@ export type PixelFormatGPU = | ||
// Compressed texture formats | ||
// DDS / ST3C Compressed texture formats | ||
export enum CompressedPixelFormat {} | ||
export const RGB_S3TC_DXT1_Format: CompressedPixelFormat; | ||
export const RGBA_S3TC_DXT1_Format: CompressedPixelFormat; | ||
export const RGBA_S3TC_DXT3_Format: CompressedPixelFormat; | ||
export const RGBA_S3TC_DXT5_Format: CompressedPixelFormat; | ||
// PVRTC compressed './texture formats | ||
export const RGB_PVRTC_4BPPV1_Format: CompressedPixelFormat; | ||
export const RGB_PVRTC_2BPPV1_Format: CompressedPixelFormat; | ||
export const RGBA_PVRTC_4BPPV1_Format: CompressedPixelFormat; | ||
export const RGBA_PVRTC_2BPPV1_Format: CompressedPixelFormat; | ||
// ETC compressed texture formats | ||
export const RGB_ETC1_Format: CompressedPixelFormat; | ||
export const RGB_ETC2_Format: CompressedPixelFormat; | ||
export const RGBA_ETC2_EAC_Format: CompressedPixelFormat; | ||
// ASTC compressed texture formats | ||
export const RGBA_ASTC_4x4_Format: CompressedPixelFormat; | ||
export const RGBA_ASTC_5x4_Format: CompressedPixelFormat; | ||
export const RGBA_ASTC_5x5_Format: CompressedPixelFormat; | ||
export const RGBA_ASTC_6x5_Format: CompressedPixelFormat; | ||
export const RGBA_ASTC_6x6_Format: CompressedPixelFormat; | ||
export const RGBA_ASTC_8x5_Format: CompressedPixelFormat; | ||
export const RGBA_ASTC_8x6_Format: CompressedPixelFormat; | ||
export const RGBA_ASTC_8x8_Format: CompressedPixelFormat; | ||
export const RGBA_ASTC_10x5_Format: CompressedPixelFormat; | ||
export const RGBA_ASTC_10x6_Format: CompressedPixelFormat; | ||
export const RGBA_ASTC_10x8_Format: CompressedPixelFormat; | ||
export const RGBA_ASTC_10x10_Format: CompressedPixelFormat; | ||
export const RGBA_ASTC_12x10_Format: CompressedPixelFormat; | ||
export const RGBA_ASTC_12x12_Format: CompressedPixelFormat; | ||
// BPTC compressed texture formats | ||
export const RGBA_BPTC_Format: CompressedPixelFormat; | ||
// RGTC compressed texture formats | ||
export const RED_RGTC1_Format: CompressedPixelFormat; | ||
export const SIGNED_RED_RGTC1_Format: CompressedPixelFormat; | ||
export const RED_GREEN_RGTC2_Format: CompressedPixelFormat; | ||
export const SIGNED_RED_GREEN_RGTC2_Format: CompressedPixelFormat; | ||
// Loop styles for AnimationAction | ||
export enum AnimationActionLoopStyles {} | ||
export const LoopOnce: AnimationActionLoopStyles; | ||
export const LoopRepeat: AnimationActionLoopStyles; | ||
export const LoopPingPong: AnimationActionLoopStyles; | ||
// Interpolation | ||
export enum InterpolationModes {} | ||
export const InterpolateDiscrete: InterpolationModes; | ||
export const InterpolateLinear: InterpolationModes; | ||
export const InterpolateSmooth: InterpolationModes; | ||
// Interpolant ending modes | ||
export enum InterpolationEndingModes {} | ||
export const ZeroCurvatureEnding: InterpolationEndingModes; | ||
export const ZeroSlopeEnding: InterpolationEndingModes; | ||
export const WrapAroundEnding: InterpolationEndingModes; | ||
// Animation blending modes | ||
export enum AnimationBlendMode {} | ||
export const NormalAnimationBlendMode: AnimationBlendMode; | ||
export const AdditiveAnimationBlendMode: AnimationBlendMode; | ||
// Triangle Draw modes | ||
export enum TrianglesDrawModes {} | ||
export const TrianglesDrawMode: TrianglesDrawModes; | ||
export const TriangleStripDrawMode: TrianglesDrawModes; | ||
export const TriangleFanDrawMode: TrianglesDrawModes; | ||
// Texture Encodings | ||
export enum TextureEncoding {} | ||
export const LinearEncoding: TextureEncoding; | ||
export const sRGBEncoding: TextureEncoding; | ||
// Depth packing strategies | ||
export enum DepthPackingStrategies {} | ||
export const BasicDepthPacking: DepthPackingStrategies; | ||
export const RGBADepthPacking: DepthPackingStrategies; | ||
// Normal Map types | ||
export enum NormalMapTypes {} | ||
export const TangentSpaceNormalMap: NormalMapTypes; | ||
export const ObjectSpaceNormalMap: NormalMapTypes; | ||
export type ColorSpace = NoColorSpace | SRGBColorSpace | LinearSRGBColorSpace; | ||
export type NoColorSpace = ''; | ||
export type SRGBColorSpace = 'srgb'; | ||
export type LinearSRGBColorSpace = 'srgb-linear'; | ||
// Stencil Op types | ||
export enum StencilOp {} | ||
export const ZeroStencilOp: StencilOp; | ||
export const KeepStencilOp: StencilOp; | ||
export const ReplaceStencilOp: StencilOp; | ||
export const IncrementStencilOp: StencilOp; | ||
export const DecrementStencilOp: StencilOp; | ||
export const IncrementWrapStencilOp: StencilOp; | ||
export const DecrementWrapStencilOp: StencilOp; | ||
export const InvertStencilOp: StencilOp; | ||
// Stencil Func types | ||
export enum StencilFunc {} | ||
export const NeverStencilFunc: StencilFunc; | ||
export const LessStencilFunc: StencilFunc; | ||
export const EqualStencilFunc: StencilFunc; | ||
export const LessEqualStencilFunc: StencilFunc; | ||
export const GreaterStencilFunc: StencilFunc; | ||
export const NotEqualStencilFunc: StencilFunc; | ||
export const GreaterEqualStencilFunc: StencilFunc; | ||
export const AlwaysStencilFunc: StencilFunc; | ||
// usage types | ||
export enum Usage {} | ||
export const StaticDrawUsage: Usage; | ||
export const DynamicDrawUsage: Usage; | ||
export const StreamDrawUsage: Usage; | ||
export const StaticReadUsage: Usage; | ||
export const DynamicReadUsage: Usage; | ||
export const StreamReadUsage: Usage; | ||
export const StaticCopyUsage: Usage; | ||
export const DynamicCopyUsage: Usage; | ||
export const StreamCopyUsage: Usage; | ||
export enum GLSLVersion {} | ||
export const GLSL1: GLSLVersion; | ||
export const GLSL3: GLSLVersion; | ||
export type BuiltinShaderAttributeName = | ||
@@ -367,0 +507,0 @@ | 'position' |
@@ -6,34 +6,62 @@ import { Usage } from '../constants'; | ||
/** | ||
* see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js|src/core/BufferAttribute.js} | ||
* This class stores data for an attribute (such as vertex positions, face indices, normals, colors, UVs, and any custom attributes ) | ||
* associated with a {@link THREE.BufferGeometry | BufferGeometry}, which allows for more efficient passing of data to the GPU | ||
* @remarks | ||
* When working with _vector-like_ data, the _`.fromBufferAttribute( attribute, index )`_ helper methods on | ||
* {@link THREE.Vector2.fromBufferAttribute | Vector2}, | ||
* {@link THREE.Vector3.fromBufferAttribute | Vector3}, | ||
* {@link THREE.Vector4.fromBufferAttribute | Vector4}, and | ||
* {@link THREE.Color.fromBufferAttribute | Color} classes may be helpful. | ||
* @see {@link THREE.BufferGeometry | BufferGeometry} for details and a usage examples. | ||
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry | WebGL / BufferGeometry - Clean up Memory} | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/BufferAttribute | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js | Source} | ||
*/ | ||
export class BufferAttribute { | ||
/** | ||
* @param array - Must be a TypedArray. Used to instantiate the buffer. | ||
* This array should have | ||
* ``` | ||
* itemSize * numVertices | ||
* ``` | ||
* elements, where numVertices is the number of vertices in the associated BufferGeometry. | ||
* @param itemSize - the number of values of the array that should be associated with a particular vertex. | ||
* For instance, if this attribute is storing a 3-component vector (such as a position, normal, or color), | ||
* then itemSize should be 3. | ||
* @param normalized - (optional) Applies to integer data only. | ||
* This creates a new {@link THREE.GLBufferAttribute | GLBufferAttribute} object. | ||
* @param array Must be a `TypedArray`. Used to instantiate the buffer. | ||
* This array should have `itemSize * numVertices` elements, where numVertices is the number of vertices in the associated {@link THREE.BufferGeometry | BufferGeometry}. | ||
* @param itemSize the number of values of the {@link array} that should be associated with a particular vertex. | ||
* For instance, if this attribute is storing a 3-component vector (such as a _position_, _normal_, or _color_), | ||
* then itemSize should be `3`. | ||
* @param normalized Applies to integer data only. | ||
* Indicates how the underlying data in the buffer maps to the values in the GLSL code. | ||
* For instance, if array is an instance of UInt16Array, and normalized is true, | ||
* the values 0 - +65535 in the array data will be mapped to 0.0f - +1.0f in the GLSL attribute. | ||
* An Int16Array (signed) would map from -32768 - +32767 to -1.0f - +1.0f. | ||
* For instance, if {@link array} is an instance of `UInt16Array`, and {@link normalized} is true, | ||
* the values `0` - `+65535` in the array data will be mapped to `0.0f` - `+1.0f` in the GLSL attribute. | ||
* An `Int16Array` (signed) would map from `-32768` - `+32767` to `-1.0f` - `+1.0f`. | ||
* If normalized is false, the values will be converted to floats unmodified, | ||
* i.e. 32767 becomes 32767.0f. | ||
* i.e. `32767` becomes `32767.0f`. | ||
* Default `false`. | ||
* @throws `TypeError` When the {@link array} is not a `TypedArray`; | ||
*/ | ||
constructor(array: ArrayLike<number>, itemSize: number, normalized?: boolean); // array parameter should be TypedArray. | ||
constructor(array: ArrayLike<number>, itemSize: number, normalized?: boolean); // array parameter should be `TypedArray`. | ||
/** | ||
* @default '' | ||
* Optional name for this attribute instance. | ||
* @defaultValue '' | ||
*/ | ||
name: string; | ||
/** | ||
* The {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray | TypedArray} holding data stored in the buffer. | ||
* @returns `TypedArray` | ||
*/ | ||
array: ArrayLike<number>; | ||
/** | ||
* The length of vectors that are being stored in the {@link BufferAttribute.array | array}. | ||
* @remarks Expects a `Integer` | ||
*/ | ||
itemSize: number; | ||
/** | ||
* @default THREE.StaticDrawUsage | ||
* Defines the intended usage pattern of the data store for optimization purposes. | ||
* Corresponds to the {@link BufferAttribute.usage | usage} parameter of | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData | WebGLRenderingContext.bufferData}. | ||
* @remarks | ||
* After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/constants/BufferAttributeUsage | Buffer Attribute Usage Constants} for all possible values. | ||
* @see {@link BufferAttribute.setUsage | setUsage} | ||
* @defaultValue {@link THREE.StaticDrawUsage | THREE.StaticDrawUsage}. | ||
*/ | ||
@@ -43,8 +71,19 @@ usage: Usage; | ||
/** | ||
* @default { offset: number; count: number } | ||
* This can be used to only update some components of stored vectors (for example, just the component related to color). | ||
* @defaultValue `{ offset: number = 0; count: number = -1 }` | ||
*/ | ||
updateRange: { offset: number; count: number }; | ||
updateRange: { | ||
/** | ||
* Position at which to start update. | ||
* @defaultValue `0` | ||
*/ | ||
offset: number; | ||
/** @defaultValue `-1`, which means don't use update ranges. */ | ||
count: number; | ||
}; | ||
/** | ||
* @default 0 | ||
* A version number, incremented every time the {@link BufferAttribute.needsUpdate | needsUpdate} property is set to true. | ||
* @remarks Expects a `Integer` | ||
* @defaultValue `0` | ||
*/ | ||
@@ -54,3 +93,5 @@ version: number; | ||
/** | ||
* @default false | ||
* Indicates how the underlying data in the buffer maps to the values in the GLSL shader code. | ||
* @see `constructor` above for details. | ||
* @defaultValue `false` | ||
*/ | ||
@@ -60,33 +101,187 @@ normalized: boolean; | ||
/** | ||
* @default 0 | ||
* Stores the {@link BufferAttribute.array | array}'s length divided by the {@link BufferAttribute.itemSize | itemSize}. | ||
* @remarks If the buffer is storing a 3-component vector (such as a position, normal, or color), then this will count the number of such vectors stored. | ||
* @remarks Expects a `Integer` | ||
*/ | ||
count: number; | ||
/** | ||
* Flag to indicate that this attribute has changed and should be re-sent to the GPU. | ||
* Set this to true when you modify the value of the array. | ||
* @remarks Setting this to true also increments the {@link BufferAttribute.version | version}. | ||
* @remarks _set-only property_. | ||
*/ | ||
set needsUpdate(value: boolean); | ||
/** | ||
* Read-only flag to check if a given object is of type {@link BufferAttribute}. | ||
* @remarks This is a _constant_ value | ||
* @defaultValue `true` | ||
*/ | ||
readonly isBufferAttribute: true; | ||
/** | ||
* A callback function that is executed after the Renderer has transferred the attribute array data to the GPU. | ||
*/ | ||
onUploadCallback: () => void; | ||
/** | ||
* Sets the value of the {@link onUploadCallback} property. | ||
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry | WebGL / BufferGeometry} this is used to free memory after the buffer has been transferred to the GPU. | ||
* @see {@link onUploadCallback} | ||
* @param callback function that is executed after the Renderer has transferred the attribute array data to the GPU. | ||
*/ | ||
onUpload(callback: () => void): this; | ||
/** | ||
* Set {@link BufferAttribute.usage | usage} | ||
* @remarks | ||
* After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/constants/BufferAttributeUsage | Buffer Attribute Usage Constants} for all possible values. | ||
* @see {@link BufferAttribute.usage | usage} | ||
* @param value Corresponds to the {@link BufferAttribute.usage | usage} parameter of | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData | WebGLRenderingContext.bufferData}. | ||
*/ | ||
setUsage(usage: Usage): this; | ||
clone(): this; | ||
/** | ||
* @returns a copy of this {@link BufferAttribute}. | ||
*/ | ||
clone(): BufferAttribute; | ||
/** | ||
* Copies another {@link BufferAttribute} to this {@link BufferAttribute}. | ||
* @param bufferAttribute | ||
*/ | ||
copy(source: BufferAttribute): this; | ||
/** | ||
* Copy a vector from bufferAttribute[index2] to {@link BufferAttribute.array | array}[index1]. | ||
* @param index1 | ||
* @param bufferAttribute | ||
* @param index2 | ||
*/ | ||
copyAt(index1: number, attribute: BufferAttribute, index2: number): this; | ||
/** | ||
* Copy the array given here (which can be a normal array or `TypedArray`) into {@link BufferAttribute.array | array}. | ||
* @See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set | TypedArray.set} for notes on requirements if copying a `TypedArray`. | ||
*/ | ||
copyArray(array: ArrayLike<number>): this; | ||
/** | ||
* Applies matrix {@link Matrix3 | m} to every Vector3 element of this {@link BufferAttribute}. | ||
* @param m | ||
*/ | ||
applyMatrix3(m: Matrix3): this; | ||
/** | ||
* Applies matrix {@link Matrix4 | m} to every Vector3 element of this {@link BufferAttribute}. | ||
* @param m | ||
*/ | ||
applyMatrix4(m: Matrix4): this; | ||
/** | ||
* Applies normal matrix {@link Matrix3 | m} to every Vector3 element of this {@link BufferAttribute}. | ||
* @param m | ||
*/ | ||
applyNormalMatrix(m: Matrix3): this; | ||
/** | ||
* Applies matrix {@link Matrix4 | m} to every Vector3 element of this {@link BufferAttribute}, interpreting the elements as a direction vectors. | ||
* @param m | ||
*/ | ||
transformDirection(m: Matrix4): this; | ||
/** | ||
* Calls {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set | TypedArray.set}( {@link value}, {@link offset} ) | ||
* on the {@link BufferAttribute.array | array}. | ||
* @param value {@link Array | Array} or `TypedArray` from which to copy values. | ||
* @param offset index of the {@link BufferAttribute.array | array} at which to start copying. Expects a `Integer`. Default `0`. | ||
* @throws `RangeError` When {@link offset} is negative or is too large. | ||
*/ | ||
set(value: ArrayLike<number> | ArrayBufferView, offset?: number): this; | ||
/** | ||
* Returns the x component of the vector at the given index. | ||
* @param index Expects a `Integer` | ||
*/ | ||
getX(index: number): number; | ||
/** | ||
* Sets the x component of the vector at the given index. | ||
* @param index Expects a `Integer` | ||
* @param x | ||
*/ | ||
setX(index: number, x: number): this; | ||
/** | ||
* Returns the y component of the vector at the given index. | ||
* @param index Expects a `Integer` | ||
*/ | ||
getY(index: number): number; | ||
/** | ||
* Sets the y component of the vector at the given index. | ||
* @param index Expects a `Integer` | ||
* @param y | ||
*/ | ||
setY(index: number, y: number): this; | ||
/** | ||
* Returns the z component of the vector at the given index. | ||
* @param index Expects a `Integer` | ||
*/ | ||
getZ(index: number): number; | ||
/** | ||
* Sets the z component of the vector at the given index. | ||
* @param index Expects a `Integer` | ||
* @param z | ||
*/ | ||
setZ(index: number, z: number): this; | ||
/** | ||
* Returns the w component of the vector at the given index. | ||
* @param index Expects a `Integer` | ||
*/ | ||
getW(index: number): number; | ||
/** | ||
* Sets the w component of the vector at the given index. | ||
* @param index Expects a `Integer` | ||
* @param w | ||
*/ | ||
setW(index: number, z: number): this; | ||
/** | ||
* Sets the x and y components of the vector at the given index. | ||
* @param index Expects a `Integer` | ||
* @param x | ||
* @param y | ||
*/ | ||
setXY(index: number, x: number, y: number): this; | ||
/** | ||
* Sets the x, y and z components of the vector at the given index. | ||
* @param index Expects a `Integer` | ||
* @param x | ||
* @param y | ||
* @param z | ||
*/ | ||
setXYZ(index: number, x: number, y: number, z: number): this; | ||
/** | ||
* Sets the x, y, z and w components of the vector at the given index. | ||
* @param index Expects a `Integer` | ||
* @param x | ||
* @param y | ||
* @param z | ||
* @param w | ||
*/ | ||
setXYZW(index: number, x: number, y: number, z: number, w: number): this; | ||
/** | ||
* Convert this object to three.js to the `data.attributes` part of {@link https://github.com/mrdoob/three.js/wiki/JSON-Geometry-format-4 | JSON Geometry format v4}, | ||
*/ | ||
toJSON(): { | ||
@@ -101,65 +296,25 @@ itemSize: number; | ||
/** | ||
* @deprecated THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead. | ||
* A {@link THREE.BufferAttribute | BufferAttribute} for {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array: Int8Array} | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects | TypedArray} | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} for details and for inherited methods and properties. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/bufferAttributeTypes/BufferAttributeTypes | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js | Source} | ||
*/ | ||
export class Int8Attribute extends BufferAttribute { | ||
constructor(array: any, itemSize: number); | ||
} | ||
/** | ||
* @deprecated THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead. | ||
*/ | ||
export class Uint8Attribute extends BufferAttribute { | ||
constructor(array: any, itemSize: number); | ||
} | ||
/** | ||
* @deprecated THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead. | ||
*/ | ||
export class Uint8ClampedAttribute extends BufferAttribute { | ||
constructor(array: any, itemSize: number); | ||
} | ||
/** | ||
* @deprecated THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead. | ||
*/ | ||
export class Int16Attribute extends BufferAttribute { | ||
constructor(array: any, itemSize: number); | ||
} | ||
/** | ||
* @deprecated THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead. | ||
*/ | ||
export class Uint16Attribute extends BufferAttribute { | ||
constructor(array: any, itemSize: number); | ||
} | ||
/** | ||
* @deprecated THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead. | ||
*/ | ||
export class Int32Attribute extends BufferAttribute { | ||
constructor(array: any, itemSize: number); | ||
} | ||
/** | ||
* @deprecated THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead. | ||
*/ | ||
export class Uint32Attribute extends BufferAttribute { | ||
constructor(array: any, itemSize: number); | ||
} | ||
/** | ||
* @deprecated THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead. | ||
*/ | ||
export class Float32Attribute extends BufferAttribute { | ||
constructor(array: any, itemSize: number); | ||
} | ||
/** | ||
* @deprecated THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead. | ||
*/ | ||
export class Float64Attribute extends BufferAttribute { | ||
constructor(array: any, itemSize: number); | ||
} | ||
export class Int8BufferAttribute extends BufferAttribute { | ||
/** | ||
* This creates a new {@link THREE.Int8BufferAttribute | Int8BufferAttribute} object. | ||
* @param array This can be a typed or untyped (normal) array or an integer length. An array value will be converted to `Int8Array`. | ||
* If a length is given a new `TypedArray` will created, initialized with all elements set to zero. | ||
* @param itemSize the number of values of the {@link array} that should be associated with a particular vertex. | ||
* For instance, if this attribute is storing a 3-component vector (such as a _position_, _normal_, or _color_), | ||
* then itemSize should be `3`. | ||
* @param normalized Applies to integer data only. | ||
* Indicates how the underlying data in the buffer maps to the values in the GLSL code. | ||
* For instance, if {@link array} is an instance of `UInt16Array`, and {@link normalized} is true, | ||
* the values `0` - `+65535` in the array data will be mapped to `0.0f` - `+1.0f` in the GLSL attribute. | ||
* An `Int16Array` (signed) would map from `-32768` - `+32767` to `-1.0f` - `+1.0f`. | ||
* If normalized is false, the values will be converted to floats unmodified, | ||
* i.e. `32767` becomes `32767.0f`. | ||
* Default `false`. | ||
*/ | ||
constructor( | ||
@@ -172,3 +327,27 @@ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number, | ||
/** | ||
* A {@link THREE.BufferAttribute | BufferAttribute} for {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array: Uint8Array} | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects | TypedArray} | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} for details and for inherited methods and properties. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/bufferAttributeTypes/BufferAttributeTypes | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js | Source} | ||
*/ | ||
export class Uint8BufferAttribute extends BufferAttribute { | ||
/** | ||
* This creates a new {@link THREE.Uint8BufferAttribute | Uint8BufferAttribute} object. | ||
* @param array This can be a typed or untyped (normal) array or an integer length. An array value will be converted to `Uint8Array`. | ||
* If a length is given a new `TypedArray` will created, initialized with all elements set to zero. | ||
* @param itemSize the number of values of the {@link array} that should be associated with a particular vertex. | ||
* For instance, if this attribute is storing a 3-component vector (such as a _position_, _normal_, or _color_), | ||
* then itemSize should be `3`. | ||
* @param normalized Applies to integer data only. | ||
* Indicates how the underlying data in the buffer maps to the values in the GLSL code. | ||
* For instance, if {@link array} is an instance of `UInt16Array`, and {@link normalized} is true, | ||
* the values `0` - `+65535` in the array data will be mapped to `0.0f` - `+1.0f` in the GLSL attribute. | ||
* An `Int16Array` (signed) would map from `-32768` - `+32767` to `-1.0f` - `+1.0f`. | ||
* If normalized is false, the values will be converted to floats unmodified, | ||
* i.e. `32767` becomes `32767.0f`. | ||
* Default `false`. | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} | ||
*/ | ||
constructor( | ||
@@ -181,3 +360,27 @@ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number, | ||
/** | ||
* A {@link THREE.BufferAttribute | BufferAttribute} for {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray: Uint8ClampedArray} | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects | TypedArray} | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} for details and for inherited methods and properties. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/bufferAttributeTypes/BufferAttributeTypes | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js | Source} | ||
*/ | ||
export class Uint8ClampedBufferAttribute extends BufferAttribute { | ||
/** | ||
* This creates a new {@link THREE.Uint8ClampedBufferAttribute | Uint8ClampedBufferAttribute} object. | ||
* @param array This can be a typed or untyped (normal) array or an integer length. An array value will be converted to `Uint8ClampedArray`. | ||
* If a length is given a new `TypedArray` will created, initialized with all elements set to zero. | ||
* @param itemSize the number of values of the {@link array} that should be associated with a particular vertex. | ||
* For instance, if this attribute is storing a 3-component vector (such as a _position_, _normal_, or _color_), | ||
* then itemSize should be `3`. | ||
* @param normalized Applies to integer data only. | ||
* Indicates how the underlying data in the buffer maps to the values in the GLSL code. | ||
* For instance, if {@link array} is an instance of `UInt16Array`, and {@link normalized} is true, | ||
* the values `0` - `+65535` in the array data will be mapped to `0.0f` - `+1.0f` in the GLSL attribute. | ||
* An `Int16Array` (signed) would map from `-32768` - `+32767` to `-1.0f` - `+1.0f`. | ||
* If normalized is false, the values will be converted to floats unmodified, | ||
* i.e. `32767` becomes `32767.0f`. | ||
* Default `false`. | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} | ||
*/ | ||
constructor( | ||
@@ -190,3 +393,27 @@ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number, | ||
/** | ||
* A {@link THREE.BufferAttribute | BufferAttribute} for {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array: Int16Array} | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects | TypedArray} | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} for details and for inherited methods and properties. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/bufferAttributeTypes/BufferAttributeTypes | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js | Source} | ||
*/ | ||
export class Int16BufferAttribute extends BufferAttribute { | ||
/** | ||
* This creates a new {@link THREE.Int16BufferAttribute | Int16BufferAttribute} object. | ||
* @param array This can be a typed or untyped (normal) array or an integer length. An array value will be converted to `Int16Array`. | ||
* If a length is given a new `TypedArray` will created, initialized with all elements set to zero. | ||
* @param itemSize the number of values of the {@link array} that should be associated with a particular vertex. | ||
* For instance, if this attribute is storing a 3-component vector (such as a _position_, _normal_, or _color_), | ||
* then itemSize should be `3`. | ||
* @param normalized Applies to integer data only. | ||
* Indicates how the underlying data in the buffer maps to the values in the GLSL code. | ||
* For instance, if {@link array} is an instance of `UInt16Array`, and {@link normalized} is true, | ||
* the values `0` - `+65535` in the array data will be mapped to `0.0f` - `+1.0f` in the GLSL attribute. | ||
* An `Int16Array` (signed) would map from `-32768` - `+32767` to `-1.0f` - `+1.0f`. | ||
* If normalized is false, the values will be converted to floats unmodified, | ||
* i.e. `32767` becomes `32767.0f`. | ||
* Default `false`. | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} | ||
*/ | ||
constructor( | ||
@@ -199,3 +426,27 @@ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number, | ||
/** | ||
* A {@link THREE.BufferAttribute | BufferAttribute} for {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array: Uint16Array} | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects | TypedArray} | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} for details and for inherited methods and properties. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/bufferAttributeTypes/BufferAttributeTypes | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js | Source} | ||
*/ | ||
export class Uint16BufferAttribute extends BufferAttribute { | ||
/** | ||
* This creates a new {@link THREE.Uint16BufferAttribute | Uint16BufferAttribute} object. | ||
* @param array This can be a typed or untyped (normal) array or an integer length. An array value will be converted to `Uint16Array`. | ||
* If a length is given a new `TypedArray` will created, initialized with all elements set to zero. | ||
* @param itemSize the number of values of the {@link array} that should be associated with a particular vertex. | ||
* For instance, if this attribute is storing a 3-component vector (such as a _position_, _normal_, or _color_), | ||
* then itemSize should be `3`. | ||
* @param normalized Applies to integer data only. | ||
* Indicates how the underlying data in the buffer maps to the values in the GLSL code. | ||
* For instance, if {@link array} is an instance of `UInt16Array`, and {@link normalized} is true, | ||
* the values `0` - `+65535` in the array data will be mapped to `0.0f` - `+1.0f` in the GLSL attribute. | ||
* An `Int16Array` (signed) would map from `-32768` - `+32767` to `-1.0f` - `+1.0f`. | ||
* If normalized is false, the values will be converted to floats unmodified, | ||
* i.e. `32767` becomes `32767.0f`. | ||
* Default `false`. | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} | ||
*/ | ||
constructor( | ||
@@ -208,3 +459,27 @@ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number, | ||
/** | ||
* A {@link THREE.BufferAttribute | BufferAttribute} for {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array: Int32Array} | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects | TypedArray} | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} for details and for inherited methods and properties. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/bufferAttributeTypes/BufferAttributeTypes | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js | Source} | ||
*/ | ||
export class Int32BufferAttribute extends BufferAttribute { | ||
/** | ||
* This creates a new {@link THREE.Int32BufferAttribute | Int32BufferAttribute} object. | ||
* @param array This can be a typed or untyped (normal) array or an integer length. An array value will be converted to `Int32Array`. | ||
* If a length is given a new `TypedArray` will created, initialized with all elements set to zero. | ||
* @param itemSize the number of values of the {@link array} that should be associated with a particular vertex. | ||
* For instance, if this attribute is storing a 3-component vector (such as a _position_, _normal_, or _color_), | ||
* then itemSize should be `3`. | ||
* @param normalized Applies to integer data only. | ||
* Indicates how the underlying data in the buffer maps to the values in the GLSL code. | ||
* For instance, if {@link array} is an instance of `UInt16Array`, and {@link normalized} is true, | ||
* the values `0` - `+65535` in the array data will be mapped to `0.0f` - `+1.0f` in the GLSL attribute. | ||
* An `Int16Array` (signed) would map from `-32768` - `+32767` to `-1.0f` - `+1.0f`. | ||
* If normalized is false, the values will be converted to floats unmodified, | ||
* i.e. `32767` becomes `32767.0f`. | ||
* Default `false`. | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} | ||
*/ | ||
constructor( | ||
@@ -217,3 +492,27 @@ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number, | ||
/** | ||
* A {@link THREE.BufferAttribute | BufferAttribute} for {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array: Uint32Array} | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects | TypedArray} | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} for details and for inherited methods and properties. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/bufferAttributeTypes/BufferAttributeTypes | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js | Source} | ||
*/ | ||
export class Uint32BufferAttribute extends BufferAttribute { | ||
/** | ||
* This creates a new {@link THREE.Uint32BufferAttribute | Uint32BufferAttribute} object. | ||
* @param array This can be a typed or untyped (normal) array or an integer length. An array value will be converted to `Uint32Array`. | ||
* If a length is given a new `TypedArray` will created, initialized with all elements set to zero. | ||
* @param itemSize the number of values of the {@link array} that should be associated with a particular vertex. | ||
* For instance, if this attribute is storing a 3-component vector (such as a _position_, _normal_, or _color_), | ||
* then itemSize should be `3`. | ||
* @param normalized Applies to integer data only. | ||
* Indicates how the underlying data in the buffer maps to the values in the GLSL code. | ||
* For instance, if {@link array} is an instance of `UInt16Array`, and {@link normalized} is true, | ||
* the values `0` - `+65535` in the array data will be mapped to `0.0f` - `+1.0f` in the GLSL attribute. | ||
* An `Int16Array` (signed) would map from `-32768` - `+32767` to `-1.0f` - `+1.0f`. | ||
* If normalized is false, the values will be converted to floats unmodified, | ||
* i.e. `32767` becomes `32767.0f`. | ||
* Default `false`. | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} | ||
*/ | ||
constructor( | ||
@@ -226,3 +525,27 @@ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number, | ||
/** | ||
* A {@link THREE.BufferAttribute | BufferAttribute} for {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array: Uint16Array} | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects | TypedArray} | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} for details and for inherited methods and properties. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/bufferAttributeTypes/BufferAttributeTypes | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js | Source} | ||
*/ | ||
export class Float16BufferAttribute extends BufferAttribute { | ||
/** | ||
* This creates a new {@link THREE.Float16BufferAttribute | Float16BufferAttribute} object. | ||
* @param array This can be a typed or untyped (normal) array or an integer length. An array value will be converted to `Uint16Array`. | ||
* If a length is given a new `TypedArray` will created, initialized with all elements set to zero. | ||
* @param itemSize the number of values of the {@link array} that should be associated with a particular vertex. | ||
* For instance, if this attribute is storing a 3-component vector (such as a _position_, _normal_, or _color_), | ||
* then itemSize should be `3`. | ||
* @param normalized Applies to integer data only. | ||
* Indicates how the underlying data in the buffer maps to the values in the GLSL code. | ||
* For instance, if {@link array} is an instance of `UInt16Array`, and {@link normalized} is true, | ||
* the values `0` - `+65535` in the array data will be mapped to `0.0f` - `+1.0f` in the GLSL attribute. | ||
* An `Int16Array` (signed) would map from `-32768` - `+32767` to `-1.0f` - `+1.0f`. | ||
* If normalized is false, the values will be converted to floats unmodified, | ||
* i.e. `32767` becomes `32767.0f`. | ||
* Default `false`. | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} | ||
*/ | ||
constructor( | ||
@@ -235,3 +558,27 @@ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number, | ||
/** | ||
* A {@link THREE.BufferAttribute | BufferAttribute} for {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array: Float32Array} | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects | TypedArray} | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} for details and for inherited methods and properties. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/bufferAttributeTypes/BufferAttributeTypes | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js | Source} | ||
*/ | ||
export class Float32BufferAttribute extends BufferAttribute { | ||
/** | ||
* This creates a new {@link THREE.Float32BufferAttribute | Float32BufferAttribute} object. | ||
* @param array This can be a typed or untyped (normal) array or an integer length. An array value will be converted to `Float32Array`. | ||
* If a length is given a new `TypedArray` will created, initialized with all elements set to zero. | ||
* @param itemSize the number of values of the {@link array} that should be associated with a particular vertex. | ||
* For instance, if this attribute is storing a 3-component vector (such as a _position_, _normal_, or _color_), | ||
* then itemSize should be `3`. | ||
* @param normalized Applies to integer data only. | ||
* Indicates how the underlying data in the buffer maps to the values in the GLSL code. | ||
* For instance, if {@link array} is an instance of `UInt16Array`, and {@link normalized} is true, | ||
* the values `0` - `+65535` in the array data will be mapped to `0.0f` - `+1.0f` in the GLSL attribute. | ||
* An `Int16Array` (signed) would map from `-32768` - `+32767` to `-1.0f` - `+1.0f`. | ||
* If normalized is false, the values will be converted to floats unmodified, | ||
* i.e. `32767` becomes `32767.0f`. | ||
* Default `false`. | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} | ||
*/ | ||
constructor( | ||
@@ -244,3 +591,27 @@ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number, | ||
/** | ||
* A {@link THREE.BufferAttribute | BufferAttribute} for {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array: Float64Array} | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects | TypedArray} | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} for details and for inherited methods and properties. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/bufferAttributeTypes/BufferAttributeTypes | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js | Source} | ||
*/ | ||
export class Float64BufferAttribute extends BufferAttribute { | ||
/** | ||
* This creates a new {@link THREE.Float64BufferAttribute | Float64BufferAttribute} object. | ||
* @param array This can be a typed or untyped (normal) array or an integer length. An array value will be converted to `Float64Array`. | ||
* If a length is given a new `TypedArray` will created, initialized with all elements set to zero. | ||
* @param itemSize the number of values of the {@link array} that should be associated with a particular vertex. | ||
* For instance, if this attribute is storing a 3-component vector (such as a _position_, _normal_, or _color_), | ||
* then itemSize should be `3`. | ||
* @param normalized Applies to integer data only. | ||
* Indicates how the underlying data in the buffer maps to the values in the GLSL code. | ||
* For instance, if {@link array} is an instance of `UInt16Array`, and {@link normalized} is true, | ||
* the values `0` - `+65535` in the array data will be mapped to `0.0f` - `+1.0f` in the GLSL attribute. | ||
* An `Int16Array` (signed) would map from `-32768` - `+32767` to `-1.0f` - `+1.0f`. | ||
* If normalized is false, the values will be converted to floats unmodified, | ||
* i.e. `32767` becomes `32767.0f`. | ||
* Default `false`. | ||
* @see {@link THREE.BufferAttribute | BufferAttribute} | ||
*/ | ||
constructor( | ||
@@ -247,0 +618,0 @@ array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number, |
@@ -12,13 +12,39 @@ import { BufferAttribute } from './BufferAttribute'; | ||
import { BuiltinShaderAttributeName } from '../constants'; | ||
import * as BufferGeometryUtils from '../../examples/jsm/utils/BufferGeometryUtils'; | ||
/** | ||
* This is a superefficent class for geometries because it saves all data in buffers. | ||
* It reduces memory costs and cpu cycles. But it is not as easy to work with because of all the necessary buffer calculations. | ||
* It is mainly interesting when working with static objects. | ||
* A representation of mesh, line, or point geometry | ||
* Includes vertex positions, face indices, normals, colors, UVs, and custom attributes within buffers, reducing the cost of passing all this data to the GPU. | ||
* @remarks | ||
* To read and edit data in BufferGeometry attributes, see {@link THREE.BufferAttribute | BufferAttribute} documentation. | ||
* @example | ||
* ```typescript | ||
* const geometry = new THREE.BufferGeometry(); | ||
* // create a simple square shape. We duplicate the top left and bottom right | ||
* // vertices because each vertex needs to appear once per triangle. | ||
* const vertices = new Float32Array([ | ||
* -1.0, -1.0, 1.0, | ||
* 1.0, -1.0, 1.0, | ||
* 1.0, 1.0, 1.0, | ||
* | ||
* see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferGeometry.js|src/core/BufferGeometry.js} | ||
* 1.0, 1.0, 1.0, | ||
* -1.0, 1.0, 1.0, | ||
* -1.0, -1.0, 1.0]); | ||
* // itemSize = 3 because there are 3 values (components) per vertex | ||
* geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3)); | ||
* const material = new THREE.MeshBasicMaterial({ color: 0xff0000 }); | ||
* const mesh = new THREE.Mesh(geometry, material); | ||
* ``` | ||
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry | Mesh with non-indexed faces} | ||
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_indexed | Mesh with indexed faces} | ||
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_lines | Lines} | ||
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_lines_indexed | Indexed Lines} | ||
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_custom_attributes_particles | Particles} | ||
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_rawshader | Raw Shaders} | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/BufferGeometry | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferGeometry.js | Source} | ||
*/ | ||
export class BufferGeometry extends EventDispatcher { | ||
/** | ||
* This creates a new BufferGeometry. It also sets several properties to an default value. | ||
* This creates a new {@link THREE.BufferGeometry | BufferGeometry} object. | ||
*/ | ||
@@ -28,9 +54,16 @@ constructor(); | ||
/** | ||
* Unique number of this buffergeometry instance | ||
* Unique number for this {@link THREE.BufferGeometry | BufferGeometry} instance. | ||
* @remarks Expects a `Integer` | ||
*/ | ||
id: number; | ||
/** | ||
* {@link http://en.wikipedia.org/wiki/Universally_unique_identifier | UUID} of this object instance. | ||
* @remarks This gets automatically assigned and shouldn't be edited. | ||
*/ | ||
uuid: string; | ||
/** | ||
* @default '' | ||
* Optional name for this {@link THREE.BufferGeometry | BufferGeometry} instance. | ||
* @defaultValue `''` | ||
*/ | ||
@@ -40,8 +73,11 @@ name: string; | ||
/** | ||
* @default 'BufferGeometry' | ||
* @defaultValue `BufferGeometry` | ||
*/ | ||
type: string; | ||
type: string; // TODO Replace for "BufferGeometry" // TODO add readonly | ||
/** | ||
* @default null | ||
* Allows for vertices to be re-used across multiple triangles; this is called using "indexed triangles". | ||
* Each triangle is associated with the indices of three vertices. This attribute therefore stores the index of each vertex for each triangular face. | ||
* If this attribute is not set, the {@link THREE.WebGLRenderer | renderer} assumes that each three contiguous positions represent a single triangle. | ||
* @defaultValue `null` | ||
*/ | ||
@@ -51,17 +87,24 @@ index: BufferAttribute | null; | ||
/** | ||
* @default {} | ||
* This hashmap has as id the name of the attribute to be set and as value the {@link THREE.BufferAttribute | buffer} to set it to. Rather than accessing this property directly, | ||
* use {@link setAttribute | .setAttribute} and {@link getAttribute | .getAttribute} to access attributes of this geometry. | ||
* @defaultValue `{}` | ||
*/ | ||
attributes: { | ||
[name: string]: BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute; | ||
[name: string]: BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute; // TODO Replace for 'Record<>' | ||
}; | ||
/** | ||
* @default {} | ||
* Hashmap of {@link THREE.BufferAttribute | BufferAttributes} holding details of the geometry's morph targets. | ||
* @remarks | ||
* Once the geometry has been rendered, the morph attribute data cannot be changed. | ||
* You will have to call {@link dispose | .dispose}(), and create a new instance of {@link THREE.BufferGeometry | BufferGeometry}. | ||
* @defaultValue `{}` | ||
*/ | ||
morphAttributes: { | ||
[name: string]: Array<BufferAttribute | InterleavedBufferAttribute>; | ||
[name: string]: Array<BufferAttribute | InterleavedBufferAttribute>; // TODO Replace for 'Record<>' | ||
}; | ||
/** | ||
* @default false | ||
* Used to control the morph target behavior; when set to true, the morph target data is treated as relative offsets, rather than as absolute positions/normals. | ||
* @defaultValue `false` | ||
*/ | ||
@@ -71,8 +114,29 @@ morphTargetsRelative: boolean; | ||
/** | ||
* @default [] | ||
* Split the geometry into groups, each of which will be rendered in a separate WebGL draw call. This allows an array of materials to be used with the geometry. | ||
* @remarks Every vertex and index must belong to exactly one group — groups must not share vertices or indices, and must not leave vertices or indices unused. | ||
* @remarks Use {@link addGroup | .addGroup} to add groups, rather than modifying this array directly. | ||
* @defaultValue `[]` | ||
*/ | ||
groups: Array<{ start: number; count: number; materialIndex?: number | undefined }>; | ||
groups: Array<{ | ||
/** | ||
* Specifies the first element in this draw call – the first vertex for non-indexed geometry, otherwise the first triangle index. | ||
* @remarks Expects a `Integer` | ||
*/ | ||
start: number; | ||
/** | ||
* Specifies how many vertices (or indices) are included. | ||
* @remarks Expects a `Integer` | ||
*/ | ||
count: number; | ||
/** | ||
* Specifies the material array index to use. | ||
* @remarks Expects a `Integer` | ||
*/ | ||
materialIndex?: number | undefined; | ||
}>; | ||
/** | ||
* @default null | ||
* Bounding box for the bufferGeometry, which can be calculated with {@link computeBoundingBox | .computeBoundingBox()}. | ||
* @remarks Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`. | ||
* @defaultValue `null` | ||
*/ | ||
@@ -82,3 +146,5 @@ boundingBox: Box3 | null; | ||
/** | ||
* @default null | ||
* Bounding sphere for the {@link THREE.BufferGeometry | BufferGeometry}, which can be calculated with {@link computeBoundingSphere | .computeBoundingSphere()}. | ||
* @remarks bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are `null`. | ||
* @defaultValue `null` | ||
*/ | ||
@@ -88,3 +154,6 @@ boundingSphere: Sphere | null; | ||
/** | ||
* @default { start: 0, count: Infinity } | ||
* Determines the part of the geometry to render. This should not be set directly, instead use {@link setDrawRange | .setDrawRange(...)}. | ||
* @remarks For non-indexed {@link THREE.BufferGeometry | BufferGeometry}, count is the number of vertices to render. | ||
* @remarks For indexed {@link THREE.BufferGeometry | BufferGeometry}, count is the number of indices to render. | ||
* @defaultValue `{ start: 0, count: Infinity }` | ||
*/ | ||
@@ -94,113 +163,212 @@ drawRange: { start: number; count: number }; | ||
/** | ||
* @default {} | ||
* An object that can be used to store custom data about the BufferGeometry. It should not hold references to functions as these will not be cloned. | ||
* @defaultValue `{}` | ||
*/ | ||
userData: { [key: string]: any }; | ||
/** | ||
* Read-only flag to check if a given object is of type {@link BufferGeometry}. | ||
* @remarks This is a _constant_ value | ||
* @defaultValue `true` | ||
*/ | ||
readonly isBufferGeometry: true; | ||
/** | ||
* Return the {@link index | .index} buffer. | ||
*/ | ||
getIndex(): BufferAttribute | null; | ||
setIndex(index: BufferAttribute | number[] | null): BufferGeometry; | ||
/** | ||
* Set the {@link THREE.BufferGeometry.index | .index} buffer. | ||
* @param index | ||
*/ | ||
setIndex(index: BufferAttribute | number[] | null): this; | ||
/** | ||
* Sets an {@link attributes | attribute} to this geometry with the specified name. | ||
* @remarks | ||
* Use this rather than the attributes property, because an internal hashmap of {@link attributes | .attributes} is maintained to speed up iterating over attributes. | ||
* @param name | ||
* @param attribute | ||
*/ | ||
setAttribute( | ||
name: BuiltinShaderAttributeName | (string & {}), | ||
attribute: BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute, | ||
): BufferGeometry; | ||
): this; | ||
/** | ||
* Returns the {@link attributes | attribute} with the specified name. | ||
* @param name | ||
*/ | ||
getAttribute( | ||
name: BuiltinShaderAttributeName | (string & {}), | ||
): BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute; | ||
/** | ||
* Deletes the {@link attributes | attribute} with the specified name. | ||
* @param name | ||
*/ | ||
deleteAttribute(name: BuiltinShaderAttributeName | (string & {})): BufferGeometry; | ||
/** | ||
* Returns true if the {@link attributes | attribute} with the specified name exists. | ||
* @param name | ||
*/ | ||
hasAttribute(name: BuiltinShaderAttributeName | (string & {})): boolean; | ||
/** | ||
* Adds a group to this geometry | ||
* @see the {@link BufferGeometry.groups | groups} property for details. | ||
* @param start | ||
* @param count | ||
* @param materialIndex | ||
*/ | ||
addGroup(start: number, count: number, materialIndex?: number): void; | ||
/** | ||
* Clears all groups. | ||
*/ | ||
clearGroups(): void; | ||
/** | ||
* Set the {@link drawRange | .drawRange} property | ||
* @remarks For non-indexed BufferGeometry, count is the number of vertices to render | ||
* @remarks For indexed BufferGeometry, count is the number of indices to render. | ||
* @param start | ||
* @param count is the number of vertices or indices to render. Expects a `Integer` | ||
*/ | ||
setDrawRange(start: number, count: number): void; | ||
/** | ||
* Bakes matrix transform directly into vertex coordinates. | ||
* Applies the matrix transform to the geometry. | ||
* @param matrix | ||
*/ | ||
applyMatrix4(matrix: Matrix4): BufferGeometry; | ||
applyQuaternion(q: Quaternion): BufferGeometry; | ||
applyMatrix4(matrix: Matrix4): this; | ||
rotateX(angle: number): BufferGeometry; | ||
rotateY(angle: number): BufferGeometry; | ||
rotateZ(angle: number): BufferGeometry; | ||
translate(x: number, y: number, z: number): BufferGeometry; | ||
scale(x: number, y: number, z: number): BufferGeometry; | ||
lookAt(v: Vector3): void; | ||
/** | ||
* Applies the rotation represented by the quaternion to the geometry. | ||
* @param quaternion | ||
*/ | ||
applyQuaternion(quaternion: Quaternion): this; | ||
center(): BufferGeometry; | ||
/** | ||
* Rotate the geometry about the X axis. This is typically done as a one time operation, and not during a loop. | ||
* @remarks Use {@link THREE.Object3D.rotation | Object3D.rotation} for typical real-time mesh rotation. | ||
* @param angle radians. Expects a `Float` | ||
*/ | ||
rotateX(angle: number): this; | ||
setFromPoints(points: Vector3[] | Vector2[]): BufferGeometry; | ||
/** | ||
* Rotate the geometry about the Y axis. | ||
* @remarks This is typically done as a one time operation, and not during a loop. | ||
* @remarks Use {@link THREE.Object3D.rotation | Object3D.rotation} for typical real-time mesh rotation. | ||
* @param angle radians. Expects a `Float` | ||
*/ | ||
rotateY(angle: number): this; | ||
/** | ||
* Computes bounding box of the geometry, updating Geometry.boundingBox attribute. | ||
* Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are null. | ||
* Rotate the geometry about the Z axis. | ||
* @remarks This is typically done as a one time operation, and not during a loop. | ||
* @remarks Use {@link THREE.Object3D.rotation | Object3D.rotation} for typical real-time mesh rotation. | ||
* @param angle radians. Expects a `Float` | ||
*/ | ||
computeBoundingBox(): void; | ||
rotateZ(angle: number): this; | ||
/** | ||
* Computes bounding sphere of the geometry, updating Geometry.boundingSphere attribute. | ||
* Bounding spheres aren't' computed by default. They need to be explicitly computed, otherwise they are null. | ||
* Translate the geometry. | ||
* @remarks This is typically done as a one time operation, and not during a loop. | ||
* @remarks Use {@link THREE.Object3D.position | Object3D.position} for typical real-time mesh rotation. | ||
* @param x Expects a `Float` | ||
* @param y Expects a `Float` | ||
* @param z Expects a `Float` | ||
*/ | ||
computeBoundingSphere(): void; | ||
translate(x: number, y: number, z: number): this; | ||
/** | ||
* Computes and adds tangent attribute to this geometry. | ||
* Scale the geometry data. | ||
* @remarks This is typically done as a one time operation, and not during a loop. | ||
* @remarks Use {@link THREE.Object3D.scale | Object3D.scale} for typical real-time mesh scaling. | ||
* @param x Expects a `Float` | ||
* @param y Expects a `Float` | ||
* @param z Expects a `Float` | ||
*/ | ||
computeTangents(): void; | ||
scale(x: number, y: number, z: number): this; | ||
/** | ||
* Computes vertex normals by averaging face normals. | ||
* Rotates the geometry to face a point in space. | ||
* @remarks This is typically done as a one time operation, and not during a loop. | ||
* @remarks Use {@link THREE.Object3D.lookAt | Object3D.lookAt} for typical real-time mesh usage. | ||
* @param vector A world vector to look at. | ||
*/ | ||
computeVertexNormals(): void; | ||
lookAt(vector: Vector3): this; | ||
normalizeNormals(): void; | ||
/** | ||
* Center the geometry based on the bounding box. | ||
*/ | ||
center(): this; | ||
toNonIndexed(): BufferGeometry; | ||
/** | ||
* Sets the attributes for this BufferGeometry from an array of points. | ||
* @param points | ||
*/ | ||
setFromPoints(points: Vector3[] | Vector2[]): this; | ||
toJSON(): any; | ||
clone(): BufferGeometry; | ||
copy(source: BufferGeometry): this; | ||
/** | ||
* Computes bounding box of the geometry, updating {@link boundingBox | .boundingBox} attribute. | ||
* @remarks Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`. | ||
*/ | ||
computeBoundingBox(): void; | ||
/** | ||
* Disposes the object from memory. | ||
* You need to call this when you want the bufferGeometry removed while the application is running. | ||
* Computes bounding sphere of the geometry, updating {@link boundingSphere | .boundingSphere} attribute. | ||
* @remarks bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are `null`. | ||
*/ | ||
dispose(): void; | ||
computeBoundingSphere(): void; | ||
/** | ||
* @deprecated Use {@link BufferGeometry#groups .groups} instead. | ||
* Calculates and adds a tangent attribute to this geometry. | ||
* The computation is only supported for indexed geometries and if position, normal, and uv attributes are defined | ||
* @remarks | ||
* When using a tangent space normal map, prefer the MikkTSpace algorithm provided by | ||
* {@link BufferGeometryUtils.computeMikkTSpaceTangents} instead. | ||
*/ | ||
drawcalls: any; | ||
computeTangents(): void; | ||
/** | ||
* @deprecated Use {@link BufferGeometry#groups .groups} instead. | ||
* Computes vertex normals by averaging face normals. | ||
*/ | ||
offsets: any; | ||
computeVertexNormals(): void; | ||
/** | ||
* @deprecated Use {@link BufferGeometry#setIndex .setIndex()} instead. | ||
* Every normal vector in a geometry will have a magnitude of 1 | ||
* @remarks This will correct lighting on the geometry surfaces. | ||
*/ | ||
addIndex(index: any): void; | ||
normalizeNormals(): void; | ||
/** | ||
* @deprecated Use {@link BufferGeometry#addGroup .addGroup()} instead. | ||
* Return a non-index version of an indexed BufferGeometry. | ||
*/ | ||
addDrawCall(start: any, count: any, indexOffset?: any): void; | ||
toNonIndexed(): BufferGeometry; | ||
/** | ||
* @deprecated Use {@link BufferGeometry#clearGroups .clearGroups()} instead. | ||
* Convert the buffer geometry to three.js {@link https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 | JSON Object/Scene format}. | ||
*/ | ||
clearDrawCalls(): void; | ||
toJSON(): {}; | ||
/** | ||
* @deprecated Use {@link BufferGeometry#setAttribute .setAttribute()} instead. | ||
* Creates a clone of this BufferGeometry | ||
*/ | ||
addAttribute(name: string, attribute: BufferAttribute | InterleavedBufferAttribute): BufferGeometry; | ||
addAttribute(name: any, array: any, itemSize: any): any; | ||
clone(): BufferGeometry; | ||
/** | ||
* @deprecated Use {@link BufferGeometry#deleteAttribute .deleteAttribute()} instead. | ||
* Copies another BufferGeometry to this BufferGeometry. | ||
* @param source | ||
*/ | ||
removeAttribute(name: string): BufferGeometry; | ||
copy(source: BufferGeometry): this; | ||
/** | ||
* Frees the GPU-related resources allocated by this instance. | ||
* @remarks Call this method whenever this instance is no longer used in your app. | ||
*/ | ||
dispose(): void; | ||
} |
/** | ||
* Object for keeping track of time. | ||
* | ||
* see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Clock.js|src/core/Clock.js} | ||
* Object for keeping track of time | ||
* @remarks | ||
* This uses {@link https://developer.mozilla.org/en-US/docs/Web/API/Performance/now | performance.now} if it is available, | ||
* otherwise it reverts to the less accurate {@link https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date/now | Date.now}. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/Clock | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Clock.js | Source} | ||
*/ | ||
export class Clock { | ||
/** | ||
* @param [autoStart=true] Automatically start the clock. | ||
* Create a new instance of {@link THREE.Clock | Clock} | ||
* @param autoStart - Whether to automatically start the clock when {@link getDelta | .getDelta()} is called for the first time. Default `true` | ||
*/ | ||
@@ -13,4 +17,4 @@ constructor(autoStart?: boolean); | ||
/** | ||
* If set, starts the clock automatically when the first update is called. | ||
* @default true | ||
* If set, starts the clock automatically when {@link getDelta | .getDelta()} is called for the first time. | ||
* @defaultValue `true` | ||
*/ | ||
@@ -20,5 +24,4 @@ autoStart: boolean; | ||
/** | ||
* When the clock is running, It holds the starttime of the clock. | ||
* This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC. | ||
* @default 0 | ||
* Holds the time at which the clock's {@link start | .start()} method was last called. | ||
* @defaultValue `0` | ||
*/ | ||
@@ -28,5 +31,4 @@ startTime: number; | ||
/** | ||
* When the clock is running, It holds the previous time from a update. | ||
* This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC. | ||
* @default 0 | ||
* Holds the time at which the clock's {@link start | .start()}, {@link getElapsedTime | .getElapsedTime()} or {@link getDelta | .getDelta()} methods were last called. | ||
* @defaultValue `0` | ||
*/ | ||
@@ -36,5 +38,4 @@ oldTime: number; | ||
/** | ||
* When the clock is running, It holds the time elapsed between the start of the clock to the previous update. | ||
* This parameter is in seconds of three decimal places. | ||
* @default 0 | ||
* Keeps track of the total time that the clock has been running. | ||
* @defaultValue `0` | ||
*/ | ||
@@ -44,4 +45,4 @@ elapsedTime: number; | ||
/** | ||
* This property keeps track whether the clock is running or not. | ||
* @default false | ||
* Whether the clock is running or not. | ||
* @defaultValue `false` | ||
*/ | ||
@@ -52,2 +53,5 @@ running: boolean; | ||
* Starts clock. | ||
* @remarks | ||
* Also sets the {@link startTime | .startTime} and {@link oldTime | .oldTime} to the current time, | ||
* sets {@link elapsedTime | .elapsedTime} to `0` and {@link running | .running} to `true`. | ||
*/ | ||
@@ -57,3 +61,3 @@ start(): void; | ||
/** | ||
* Stops clock. | ||
* Stops clock and sets {@link oldTime | oldTime} to the current time. | ||
*/ | ||
@@ -63,3 +67,5 @@ stop(): void; | ||
/** | ||
* Get the seconds passed since the clock started. | ||
* Get the seconds passed since the clock started and sets {@link oldTime | .oldTime} to the current time. | ||
* @remarks | ||
* If {@link autoStart | .autoStart} is `true` and the clock is not running, also starts the clock. | ||
*/ | ||
@@ -69,5 +75,7 @@ getElapsedTime(): number; | ||
/** | ||
* Get the seconds passed since the last call to this method. | ||
* Get the seconds passed since the time {@link oldTime | .oldTime} was set and sets {@link oldTime | .oldTime} to the current time. | ||
* @remarks | ||
* If {@link autoStart | .autoStart} is `true` and the clock is not running, also starts the clock. | ||
*/ | ||
getDelta(): number; | ||
} |
@@ -16,8 +16,24 @@ export interface BaseEvent { | ||
* JavaScript events for custom objects | ||
* | ||
* @source src/core/EventDispatcher.js | ||
* @example | ||
* ```typescript | ||
* // Adding events to a custom object | ||
* class Car extends EventDispatcher { | ||
* start() { | ||
* this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } ); | ||
* } | ||
* }; | ||
* // Using events with the custom object | ||
* const car = new Car(); | ||
* car.addEventListener( 'start', ( event ) => { | ||
* alert( event.message ); | ||
* } ); | ||
* car.start(); | ||
* ``` | ||
* @see {@link https://github.com/mrdoob/eventdispatcher.js | mrdoob EventDispatcher on GitHub} | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/EventDispatcher | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/EventDispatcher.js | Source} | ||
*/ | ||
export class EventDispatcher<E extends BaseEvent = Event> { | ||
/** | ||
* Creates eventDispatcher object. It needs to be call with '.call' to add the functionality to an object. | ||
* Creates {@link THREE.EventDispatcher | EventDispatcher} object. | ||
*/ | ||
@@ -49,5 +65,5 @@ constructor(); | ||
* Fire an event type. | ||
* @param type The type of event that gets fired. | ||
* @param event The event that gets fired. | ||
*/ | ||
dispatchEvent(event: E): void; | ||
} |
/** | ||
* see {@link https://github.com/mrdoob/three.js/blob/master/src/core/GLBufferAttribute.js|src/core/GLBufferAttribute.js} | ||
* This buffer attribute class does not construct a VBO. | ||
* Instead, it uses whatever VBO is passed in constructor and can later be altered via the {@link buffer | .buffer} property. | ||
* @remarks | ||
* It is required to pass additional params alongside the VBO | ||
* Those are: the GL context, the GL data type, the number of components per vertex, the number of bytes per component, and the number of vertices. | ||
* @remarks | ||
* The most common use case for this class is when some kind of GPGPU calculation interferes or even produces the VBOs in question. | ||
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_glbufferattribute | WebGL / buffergeometry / glbufferattribute} | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/GLBufferAttribute | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/GLBufferAttribute.js | Source} | ||
*/ | ||
export class GLBufferAttribute { | ||
constructor(buffer: WebGLBuffer, type: number, itemSize: number, elementSize: 1 | 2 | 4, count: number); | ||
/** | ||
* This creates a new GLBufferAttribute object. | ||
* @param buffer Must be a {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLBuffer | WebGLBuffer}. See {@link GLBufferAttribute.buffer | .buffer} | ||
* @param type One of {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Data_types | WebGL Data Types}. See {@link GLBufferAttribute.type | .type} | ||
* @param itemSize How many values make up each item (vertex). See {@link GLBufferAttribute.itemSize | .itemSize} | ||
* @param elementSize `1`, `2` or `4`. The corresponding size (in bytes) for the given {@link type} param. See {@link GLBufferAttribute.elementSize | .elementSize} | ||
* @param count The expected number of vertices in VBO. See {@link GLBufferAttribute.count | .count} | ||
*/ | ||
constructor(buffer: WebGLBuffer, type: GLenum, itemSize: number, elementSize: 1 | 2 | 4, count: number); | ||
/** | ||
* @default '' | ||
* Read-only flag to check if a given object is of type {@link GLBufferAttribute}. | ||
* @remarks This is a _constant_ value | ||
* @defaultValue `true` | ||
*/ | ||
readonly isGLBufferAttribute: true; | ||
/** | ||
* Optional name for this attribute instance. | ||
* @defaultValue `""` | ||
*/ | ||
name: string; | ||
/** | ||
* The current {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLBuffer | WebGLBuffer} instance. | ||
*/ | ||
buffer: WebGLBuffer; | ||
type: number; | ||
/** | ||
* A {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Data_types | WebGL Data Type} describing the underlying VBO contents. | ||
* | ||
* #### WebGL Data Type (`GLenum`) | ||
* - gl.BYTE: 0x1400 | ||
* - gl.UNSIGNED_BYTE: 0x1401 | ||
* - gl.SHORT: 0x1402 | ||
* - gl.UNSIGNED_SHORT: 0x1403 | ||
* - gl.INT: 0x1404 | ||
* - gl.UNSIGNED_INT: 0x1405 | ||
* - gl.FLOAT: 0x1406 | ||
* @remarks Set this property together with {@link elementSize | .elementSize}. The recommended way is using the {@link setType | .setType()} method. | ||
* @remarks Expects a `DataType` `GLenum` _possible values:_ `0x1400` `0x1401` `0x1402` `0x1403` `0x1404` `0x1405` `0x1406` | ||
*/ | ||
type: GLenum; | ||
/** | ||
* How many values make up each item (vertex). | ||
* @remarks The number of values of the array that should be associated with a particular vertex. | ||
* For instance, if this attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3. | ||
* @remarks Expects a `Integer` | ||
*/ | ||
itemSize: number; | ||
/** | ||
* Stores the corresponding size in bytes for the current {@link type | .type} property value. | ||
* | ||
* The corresponding size (_in bytes_) for the given "type" param. | ||
* #### WebGL Data Type (`GLenum`) | ||
* - gl.BYTE: 1 | ||
* - gl.UNSIGNED_BYTE: 1 | ||
* - gl.SHORT: 2 | ||
* - gl.UNSIGNED_SHORT: 2 | ||
* - gl.INT: 4 | ||
* - gl.UNSIGNED_INT: 4 | ||
* - gl.FLOAT: 4 | ||
* @remarks Set this property together with {@link type | .type}. The recommended way is using the {@link setType | .setType} method. | ||
* @see `constructor`` for a list of known type sizes. | ||
* @remarks Expects a `1`, `2` or `4` | ||
*/ | ||
elementSize: 1 | 2 | 4; | ||
/** | ||
* The expected number of vertices in VBO. | ||
* @remarks Expects a `Integer` | ||
*/ | ||
count: number; | ||
/** | ||
* A version number, incremented every time the needsUpdate property is set to true. | ||
* @remarks Expects a `Integer` | ||
*/ | ||
version: number; | ||
readonly isGLBufferAttribute: true; | ||
/** | ||
* Setting this to true increments {@link version | .version}. | ||
* @remarks _set-only property_. | ||
*/ | ||
set needsUpdate(value: boolean); | ||
/** | ||
* Sets the {@link buffer | .buffer} property. | ||
*/ | ||
setBuffer(buffer: WebGLBuffer): this; | ||
setType(type: number, elementSize: 1 | 2 | 4): this; | ||
/** | ||
* Sets the both {@link GLBufferAttribute.type | type} and {@link GLBufferAttribute.elementSize | elementSize} properties. | ||
*/ | ||
setType(type: GLenum, elementSize: 1 | 2 | 4): this; | ||
/** | ||
* Sets the {@link GLBufferAttribute.itemSize | itemSize} property. | ||
*/ | ||
setItemSize(itemSize: number): this; | ||
/** | ||
* Sets the {@link GLBufferAttribute.count | count} property. | ||
*/ | ||
setCount(count: number): this; | ||
} |
@@ -5,34 +5,23 @@ import { BufferGeometry } from './BufferGeometry'; | ||
/** | ||
* see {@link https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/BufferGeometryUtils.js|examples/jsm/utils/BufferGeometryUtils.js} | ||
* An instanced version of {@link THREE.InstancedBufferAttributeBufferAttribute | BufferAttribute}. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/InstancedBufferAttribute | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InstancedBufferAttribute.js | Source} | ||
*/ | ||
export namespace BufferGeometryUtils { | ||
function mergeBufferGeometries(geometries: BufferGeometry[]): BufferGeometry; | ||
function computeTangents(geometry: BufferGeometry): null; | ||
function mergeBufferAttributes(attributes: BufferAttribute[]): BufferAttribute; | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
export namespace GeometryUtils { | ||
export class InstancedBufferAttribute extends BufferAttribute { | ||
/** | ||
* @deprecated Use {@link Geometry#merge geometry.merge( geometry2, matrix, materialIndexOffset )} instead. | ||
* Create a new instance of {@link THREE.InstancedBufferAttribute | InstancedBufferAttribute} | ||
* @param array | ||
* @param itemSize | ||
* @param normalized | ||
* @param meshPerAttribute | ||
*/ | ||
function merge(geometry1: any, geometry2: any, materialIndexOffset?: any): any; | ||
/** | ||
* @deprecated Use {@link Geometry#center geometry.center()} instead. | ||
*/ | ||
function center(geometry: any): any; | ||
} | ||
/** | ||
* see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InstancedBufferAttribute.js|src/core/InstancedBufferAttribute.js} | ||
*/ | ||
export class InstancedBufferAttribute extends BufferAttribute { | ||
constructor(array: ArrayLike<number>, itemSize: number, normalized?: boolean, meshPerAttribute?: number); | ||
/** | ||
* @default 1 | ||
* Defines how often a value of this buffer attribute should be repeated. | ||
* A value of one means that each value of the instanced attribute is used for a single instance. | ||
* A value of two means that each value is used for two consecutive instances (and so on). | ||
* @defaultValue `1` | ||
*/ | ||
meshPerAttribute: number; | ||
} |
import { BufferGeometry } from './BufferGeometry'; | ||
/** | ||
* see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InstancedBufferGeometry.js|src/core/InstancedBufferGeometry.js} | ||
* An instanced version of {@link THREE.BufferGeometry | BufferGeometry}. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/InstancedBufferGeometry | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InstancedBufferGeometry.js | Source} | ||
*/ | ||
export class InstancedBufferGeometry extends BufferGeometry { | ||
/** | ||
* Create a new instance of {@link InstancedBufferGeometry} | ||
*/ | ||
constructor(); | ||
/** | ||
* @default 'InstancedBufferGeometry | ||
* @defaultValue `InstancedBufferGeometry` | ||
*/ | ||
type: string; | ||
isInstancedBufferGeometry: boolean; | ||
/** | ||
* Read-only flag to check if a given object is of type {@link InstancedBufferGeometry}. | ||
* @remarks This is a _constant_ value | ||
* @defaultValue `true` | ||
*/ | ||
readonly isInstancedBufferGeometry: true; | ||
/** | ||
* @default Infinity | ||
* | ||
* @defaultValue `Infinity` | ||
*/ | ||
instanceCount: number; | ||
/** | ||
* Copies the given {@link InstancedBufferGeometry} to this instance. | ||
* @param source | ||
* @override | ||
*/ | ||
copy(source: InstancedBufferGeometry): this; | ||
} |
import { InterleavedBuffer } from './InterleavedBuffer'; | ||
/** | ||
* see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InstancedInterleavedBuffer.js|src/core/InstancedInterleavedBuffer.js} | ||
* An instanced version of {@link THREE.InterleavedBuffer | InterleavedBuffer}. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/InstancedInterleavedBuffer | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InstancedInterleavedBuffer.js | Source} | ||
*/ | ||
export class InstancedInterleavedBuffer extends InterleavedBuffer { | ||
/** | ||
* Create a new instance of {@link InstancedInterleavedBuffer} | ||
* @param array | ||
* @param itemSize | ||
* @param meshPerAttribute | ||
*/ | ||
constructor(array: ArrayLike<number>, stride: number, meshPerAttribute?: number); | ||
/** | ||
* @default 1 | ||
* @defaultValue `1` | ||
*/ | ||
meshPerAttribute: number; | ||
} |
@@ -5,12 +5,36 @@ import { InterleavedBufferAttribute } from './InterleavedBufferAttribute'; | ||
/** | ||
* see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InterleavedBuffer.js|src/core/InterleavedBuffer.js} | ||
* **"Interleaved"** means that multiple attributes, possibly of different types, (e.g., _position, normal, uv, color_) are packed into a single array buffer. | ||
* An introduction into interleaved arrays can be found here: {@link https://blog.tojicode.com/2011/05/interleaved-array-basics.html | Interleaved array basics} | ||
* @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_points_interleaved | webgl / buffergeometry / points / interleaved} | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/InterleavedBuffer | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InterleavedBuffer.js | Source} | ||
*/ | ||
export class InterleavedBuffer { | ||
/** | ||
* Create a new instance of {@link InterleavedBuffer} | ||
* @param array A {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray | TypedArray} with a shared buffer. Stores the geometry data. | ||
* @param stride The number of typed-array elements per vertex. Expects a `Integer` | ||
*/ | ||
constructor(array: ArrayLike<number>, stride: number); | ||
/** | ||
* A {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray | TypedArray} with a shared buffer. Stores the geometry data. | ||
*/ | ||
array: ArrayLike<number>; | ||
/** | ||
* The number of {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray | TypedArray} elements per vertex. | ||
* @remarks Expects a `Integer` | ||
*/ | ||
stride: number; | ||
/** | ||
* @default THREE.StaticDrawUsage | ||
* Defines the intended usage pattern of the data store for optimization purposes. | ||
* Corresponds to the {@link BufferAttribute.usage | usage} parameter of | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData | WebGLRenderingContext.bufferData}. | ||
* @remarks | ||
* After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/constants/BufferAttributeUsage | Buffer Attribute Usage Constants} for all possible values. | ||
* @see {@link BufferAttribute.setUsage | setUsage} | ||
* @defaultValue {@link THREE.StaticDrawUsage | THREE.StaticDrawUsage}. | ||
*/ | ||
@@ -20,26 +44,86 @@ usage: Usage; | ||
/** | ||
* @default { offset: number; count: number } | ||
* Object containing offset and count. | ||
* @defaultValue `{ offset: number = 0; count: number = -1 }` | ||
*/ | ||
updateRange: { offset: number; count: number }; | ||
updateRange: { | ||
/** @defaultValue `0` */ | ||
offset: number; | ||
/** @defaultValue `-1` */ | ||
count: number; | ||
}; | ||
/** | ||
* @default 0 | ||
* A version number, incremented every time the {@link BufferAttribute.needsUpdate | needsUpdate} property is set to true. | ||
* @remarks Expects a `Integer` | ||
* @defaultValue `0` | ||
*/ | ||
version: number; | ||
length: number; | ||
/** | ||
* Gives the total number of elements in the array. | ||
* @remarks Expects a `Integer` | ||
* @defaultValue 0 | ||
*/ | ||
count: number; | ||
/** | ||
* @default 0 | ||
* Flag to indicate that this attribute has changed and should be re-sent to the GPU. | ||
* Set this to true when you modify the value of the array. | ||
* @remarks Setting this to true also increments the {@link BufferAttribute.version | version}. | ||
* @remarks _set-only property_. | ||
*/ | ||
count: number; | ||
needsUpdate: boolean; | ||
set needsUpdate(value: boolean); | ||
/** | ||
* {@link http://en.wikipedia.org/wiki/Universally_unique_identifier | UUID} of this object instance. | ||
* @remarks This gets automatically assigned and shouldn't be edited. | ||
*/ | ||
uuid: string; | ||
setUsage(usage: Usage): InterleavedBuffer; | ||
clone(data: object): InterleavedBuffer; | ||
/** | ||
* Calls {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set | TypedArray.set}( {@link value}, {@link offset} ) | ||
* on the {@link BufferAttribute.array | array}. | ||
* @param value The source `TypedArray`. | ||
* @param offset index of the {@link BufferAttribute.array | array} at which to start copying. Expects a `Integer`. Default `0`. | ||
* @throws `RangeError` When {@link offset} is negative or is too large. | ||
*/ | ||
set(value: ArrayLike<number>, offset: number): this; | ||
/** | ||
* Set {@link BufferAttribute.usage | usage} | ||
* @remarks | ||
* After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/constants/BufferAttributeUsage | Buffer Attribute Usage Constants} for all possible values. | ||
* @see {@link BufferAttribute.usage | usage} | ||
* @param value Corresponds to the {@link BufferAttribute.usage | usage} parameter of | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData | WebGLRenderingContext.bufferData}. | ||
*/ | ||
setUsage(value: Usage): this; | ||
/** | ||
* Copies another {@link InterleavedBuffer} to this {@link InterleavedBuffer} instance. | ||
* @param source | ||
*/ | ||
copy(source: InterleavedBuffer): this; | ||
copyAt(index1: number, attribute: InterleavedBufferAttribute, index2: number): InterleavedBuffer; | ||
set(value: ArrayLike<number>, index: number): InterleavedBuffer; | ||
toJSON(data: object): { | ||
/** | ||
* Copies data from {@link attribute}[{@link index2}] to {@link InterleavedBuffer.array | array}[{@link index1}]. | ||
* @param index1 Expects a `Integer` | ||
* @param attribute | ||
* @param index2 Expects a `Integer` | ||
*/ | ||
copyAt(index1: number, attribute: InterleavedBufferAttribute, index2: number): this; | ||
/** | ||
* Creates a clone of this {@link InterleavedBuffer}. | ||
* @param data This object holds shared array buffers required for properly cloning geometries with interleaved attributes. | ||
*/ | ||
clone(data: {}): InterleavedBuffer; | ||
/** | ||
* Serializes this {@link InterleavedBuffer}. | ||
* Converting to {@link https://github.com/mrdoob/three.js/wiki/JSON-Geometry-format-4 | JSON Geometry format v4}, | ||
* @param data This object holds shared array buffers required for properly serializing geometries with interleaved attributes. | ||
*/ | ||
toJSON(data: {}): { | ||
uuid: string; | ||
@@ -46,0 +130,0 @@ buffer: string; |
@@ -5,41 +5,182 @@ import { BufferAttribute } from './BufferAttribute'; | ||
import { Matrix } from './../math/Matrix3'; | ||
/** | ||
* see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InterleavedBufferAttribute.js|src/core/InterleavedBufferAttribute.js} | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/InterleavedBufferAttribute | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/InterleavedBufferAttribute.js | Source} | ||
*/ | ||
export class InterleavedBufferAttribute { | ||
/** | ||
* Create a new instance of {@link THREE.InterleavedBufferAttribute | InterleavedBufferAttribute}. | ||
* @param interleavedBuffer | ||
* @param itemSize | ||
* @param offset | ||
* @param normalized Default `false`. | ||
*/ | ||
constructor(interleavedBuffer: InterleavedBuffer, itemSize: number, offset: number, normalized?: boolean); | ||
/** | ||
* @default '' | ||
* Optional name for this attribute instance. | ||
* @defaultValue `''` | ||
*/ | ||
name: string; | ||
/** | ||
* The {@link InterleavedBuffer | InterleavedBuffer} instance passed in the constructor. | ||
*/ | ||
data: InterleavedBuffer; | ||
/** | ||
* How many values make up each item. | ||
* @remarks Expects a `Integer` | ||
*/ | ||
itemSize: number; | ||
/** | ||
* The offset in the underlying array buffer where an item starts. | ||
* @remarks Expects a `Integer` | ||
*/ | ||
offset: number; | ||
/** | ||
* @default false | ||
* @defaultValue `false` | ||
*/ | ||
normalized: boolean; | ||
/** | ||
* The value of {@link data | .data}.{@link InterleavedBuffer.count | count}. | ||
* If the buffer is storing a 3-component item (such as a _position, normal, or color_), then this will count the number of such items stored. | ||
* @remarks _get-only property_. | ||
* @remarks Expects a `Integer` | ||
*/ | ||
get count(): number; | ||
/** | ||
* The value of {@link InterleavedBufferAttribute.data | data}.{@link InterleavedBuffer.array | array}. | ||
* @remarks _get-only property_. | ||
*/ | ||
get array(): ArrayLike<number>; | ||
/** | ||
* Flag to indicate that the {@link data | .data} ({@link InterleavedBuffer}) attribute has changed and should be re-sent to the GPU. | ||
* @remarks Setting this to have the same result of setting true also increments the {@link InterleavedBuffer.needsUpdate | InterleavedBuffer.needsUpdate} of {@link data | .data}. | ||
* @remarks Setting this to true also increments the {@link InterleavedBuffer.version | InterleavedBuffer.version}. | ||
* @remarks _set-only property_. | ||
*/ | ||
set needsUpdate(value: boolean); | ||
/** | ||
* Read-only flag to check if a given object is of type {@link InterleavedBufferAttribute}. | ||
* @remarks This is a _constant_ value | ||
* @defaultValue `true` | ||
*/ | ||
readonly isInterleavedBufferAttribute: true; | ||
/** | ||
* Applies matrix {@link Matrix4 | m} to every Vector3 element of this InterleavedBufferAttribute. | ||
* @param m | ||
*/ | ||
applyMatrix4(m: Matrix4): this; | ||
clone(data?: object): BufferAttribute; | ||
/** | ||
* Applies normal matrix {@link Matrix3 | m} to every Vector3 element of this InterleavedBufferAttribute. | ||
* @param m | ||
*/ | ||
applyNormalMatrix(matrix: Matrix): this; | ||
/** | ||
* Applies matrix {@link Matrix4 | m} to every Vector3 element of this InterleavedBufferAttribute, interpreting the elements as a direction vectors. | ||
* @param m | ||
*/ | ||
transformDirection(matrix: Matrix): this; | ||
/** | ||
* Returns the x component of the item at the given index. | ||
* @param index Expects a `Integer` | ||
*/ | ||
getX(index: number): number; | ||
/** | ||
* Sets the x component of the item at the given index. | ||
* @param index Expects a `Integer` | ||
* @param x Expects a `Float` | ||
*/ | ||
setX(index: number, x: number): this; | ||
/** | ||
* Returns the y component of the item at the given index. | ||
* @param index Expects a `Integer` | ||
*/ | ||
getY(index: number): number; | ||
/** | ||
* Sets the y component of the item at the given index. | ||
* @param index Expects a `Integer` | ||
* @param y Expects a `Float` | ||
*/ | ||
setY(index: number, y: number): this; | ||
/** | ||
* Returns the z component of the item at the given index. | ||
* @param index Expects a `Integer` | ||
*/ | ||
getZ(index: number): number; | ||
/** | ||
* Sets the z component of the item at the given index. | ||
* @param index Expects a `Integer` | ||
* @param z Expects a `Float` | ||
*/ | ||
setZ(index: number, z: number): this; | ||
/** | ||
* Returns the w component of the item at the given index. | ||
* @param index Expects a `Integer` | ||
*/ | ||
getW(index: number): number; | ||
/** | ||
* Sets the w component of the item at the given index. | ||
* @param index Expects a `Integer` | ||
* @param w Expects a `Float` | ||
*/ | ||
setW(index: number, z: number): this; | ||
/** | ||
* Sets the x and y components of the item at the given index. | ||
* @param index Expects a `Integer` | ||
* @param x Expects a `Float` | ||
* @param y Expects a `Float` | ||
*/ | ||
setXY(index: number, x: number, y: number): this; | ||
/** | ||
* Sets the x, y and z components of the item at the given index. | ||
* @param index Expects a `Integer` | ||
* @param x Expects a `Float` | ||
* @param y Expects a `Float` | ||
* @param z Expects a `Float` | ||
*/ | ||
setXYZ(index: number, x: number, y: number, z: number): this; | ||
/** | ||
* Sets the x, y, z and w components of the item at the given index. | ||
* @param index Expects a `Integer` | ||
* @param x Expects a `Float` | ||
* @param y Expects a `Float` | ||
* @param z Expects a `Float` | ||
* @param w Expects a `Float` | ||
*/ | ||
setXYZW(index: number, x: number, y: number, z: number, w: number): this; | ||
toJSON(data?: object): { | ||
/** | ||
* Creates a clone of this {@link InterleavedBufferAttribute}. | ||
* @param data This object holds shared array buffers required for properly cloning geometries with interleaved attributes. | ||
*/ | ||
clone(data?: {}): BufferAttribute; | ||
/** | ||
* Serializes this {@link InterleavedBufferAttribute}. | ||
* Converting to {@link https://github.com/mrdoob/three.js/wiki/JSON-Geometry-format-4 | JSON Geometry format v4}, | ||
* @param data This object holds shared array buffers required for properly serializing geometries with interleaved attributes. | ||
*/ | ||
toJSON(data?: {}): { | ||
isInterleavedBufferAttribute: true; | ||
@@ -51,4 +192,2 @@ itemSize: number; | ||
}; | ||
applyNormalMatrix(matrix: Matrix): this; | ||
transformDirection(matrix: Matrix): this; | ||
} |
@@ -0,17 +1,72 @@ | ||
/** | ||
* A {@link THREE.Layers | Layers} object assigns an {@link THREE.Object3D | Object3D} to 1 or more of 32 layers numbered `0` to `31` - internally the | ||
* layers are stored as a {@link https://en.wikipedia.org/wiki/Mask_(computing) | bit mask}, and | ||
* by default all Object3Ds are a member of layer `0`. | ||
* @remarks | ||
* This can be used to control visibility - an object must share a layer with a {@link Camera | camera} to be visible when that camera's view is rendered. | ||
* @remarks | ||
* All classes that inherit from {@link THREE.Object3D | Object3D} have an {@link THREE.Object3D.layers | Object3D.layers} property which is an instance of this class. | ||
* @see Example: {@link https://threejs.org/examples/#webgl_layers | WebGL / layers} | ||
* @see Example: {@link https://threejs.org/examples/#webxr_vr_layers | Webxr / vr / layers} | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/Layers | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Layers.js | Source} | ||
*/ | ||
export class Layers { | ||
/** | ||
* Create a new Layers object, with membership initially set to layer 0. | ||
*/ | ||
constructor(); | ||
/** | ||
* @default 1 | 0 | ||
* A bit mask storing which of the 32 layers this layers object is currently a member of. | ||
* @defaultValue `1 | 0` | ||
* @remarks Expects a `Integer` | ||
*/ | ||
mask: number; | ||
set(channel: number): void; | ||
enable(channel: number): void; | ||
/** | ||
* Set membership to `layer`, and remove membership all other layers. | ||
* @param layer An integer from 0 to 31. | ||
*/ | ||
set(layer: number): void; | ||
/** | ||
* Add membership of this `layer`. | ||
* @param layer An integer from 0 to 31. | ||
*/ | ||
enable(layer: number): void; | ||
/** | ||
* Add membership to all layers. | ||
*/ | ||
enableAll(): void; | ||
toggle(channel: number): void; | ||
disable(channel: number): void; | ||
/** | ||
* Toggle membership of `layer`. | ||
* @param layer An integer from 0 to 31. | ||
*/ | ||
toggle(layer: number): void; | ||
/** | ||
* Remove membership of this `layer`. | ||
* @param layer An integer from 0 to 31. | ||
*/ | ||
disable(layer: number): void; | ||
/** | ||
* Remove membership from all layers. | ||
*/ | ||
disableAll(): void; | ||
/** | ||
* Returns true if this and the passed `layers` object have at least one layer in common. | ||
* @param layers A Layers object | ||
*/ | ||
test(layers: Layers): boolean; | ||
isEnabled(channel: number): boolean; | ||
/** | ||
* Returns true if the given layer is enabled. | ||
* @param layer An integer from 0 to 31. | ||
*/ | ||
isEnabled(layer: number): boolean; | ||
} |
@@ -18,12 +18,25 @@ import { Vector3 } from './../math/Vector3'; | ||
/** | ||
* Base class for scene graph objects | ||
* This is the base class for most objects in three.js and provides a set of properties and methods for manipulating objects in 3D space. | ||
* @remarks Note that this can be used for grouping objects via the {@link THREE.Object3D.add | .add()} method which adds the object as a child, | ||
* however it is better to use {@link THREE.Group | Group} for this. | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/Object3D | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Object3D.js | Source} | ||
*/ | ||
export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> { | ||
/** | ||
* This creates a new {@link Object3D} object. | ||
*/ | ||
constructor(); | ||
/** | ||
* Unique number of this object instance. | ||
* Unique number for this object instance. | ||
* @remarks Note that ids are assigned in chronological order: 1, 2, 3, ..., incrementing by one for each new object. | ||
* @remarks Expects a `Integer` | ||
*/ | ||
id: number; | ||
readonly id: number; | ||
/** | ||
* {@link http://en.wikipedia.org/wiki/Universally_unique_identifier | UUID} of this object instance. | ||
* @remarks This gets automatically assigned and shouldn't be edited. | ||
*/ | ||
uuid: string; | ||
@@ -33,3 +46,3 @@ | ||
* Optional name of the object (doesn't need to be unique). | ||
* @default '' | ||
* @defaultValue `''` | ||
*/ | ||
@@ -39,9 +52,10 @@ name: string; | ||
/** | ||
* @default 'Object3D' | ||
* @defaultValue `Object3D` | ||
*/ | ||
type: string; | ||
type: string; // TODO Replace for "Object3D" // TODO add readonly | ||
/** | ||
* Object's parent in the scene graph. | ||
* @default null | ||
* Object's parent in the {@link https://en.wikipedia.org/wiki/Scene_graph | scene graph}. | ||
* @remarks An object can have at most one parent. | ||
* @defaultValue `null` | ||
*/ | ||
@@ -52,12 +66,11 @@ parent: Object3D | null; | ||
* Array with object's children. | ||
* @default [] | ||
* @see {@link THREE.Object3DGroup | Group} for info on manually grouping objects. | ||
* @defaultValue `[]` | ||
*/ | ||
children: Object3D[]; | ||
/** | ||
* This is used by the {@link lookAt} method, for example, to determine the orientation of the result. | ||
* | ||
* Default is {@link Object3D.DEFAULT_UP} - that is, `( 0, 1, 0 )`. | ||
* | ||
* @default {@link Object3D.DEFAULT_UP} | ||
* This is used by the {@link lookAt | lookAt} method, for example, to determine the orientation of the result. | ||
* @defaultValue {@link DEFAULT_UP | Object3D.DEFAULT_UP} - that is `(0, 1, 0)`. | ||
*/ | ||
@@ -68,3 +81,3 @@ up: Vector3; | ||
* Object's local position. | ||
* @default new THREE.Vector3() | ||
* @defaultValue `new THREE.Vector3()` - that is `(0, 0, 0)`. | ||
*/ | ||
@@ -74,4 +87,4 @@ readonly position: Vector3; | ||
/** | ||
* Object's local rotation (Euler angles), in radians. | ||
* @default new THREE.Euler() | ||
* Object's local rotation ({@link https://en.wikipedia.org/wiki/Euler_angles | Euler angles}), in radians. | ||
* @defaultValue `new THREE.Euler()` - that is `(0, 0, 0, Euler.DEFAULT_ORDER)`. | ||
*/ | ||
@@ -81,4 +94,4 @@ readonly rotation: Euler; | ||
/** | ||
* Object's local rotation as a Quaternion. | ||
* @default new THREE.Quaternion() | ||
* Object's local rotation as a {@link THREE.Quaternion | Quaternion}. | ||
* @defaultValue `new THREE.Quaternion()` - that is `(0, 0, 0, 1)`. | ||
*/ | ||
@@ -88,4 +101,4 @@ readonly quaternion: Quaternion; | ||
/** | ||
* Object's local scale. | ||
* @default new THREE.Vector3() | ||
* The object's local scale. | ||
* @defaultValue `new THREE.Vector3( 1, 1, 1 )` | ||
*/ | ||
@@ -95,3 +108,3 @@ readonly scale: Vector3; | ||
/** | ||
* @default new THREE.Matrix4() | ||
* @defaultValue `new THREE.Matrix4()` | ||
*/ | ||
@@ -101,3 +114,3 @@ readonly modelViewMatrix: Matrix4; | ||
/** | ||
* @default new THREE.Matrix3() | ||
* @defaultValue `new THREE.Matrix3()` | ||
*/ | ||
@@ -107,4 +120,4 @@ readonly normalMatrix: Matrix3; | ||
/** | ||
* Local transform. | ||
* @default new THREE.Matrix4() | ||
* The local transform matrix. | ||
* @defaultValue `new THREE.Matrix4()` | ||
*/ | ||
@@ -114,4 +127,5 @@ matrix: Matrix4; | ||
/** | ||
* The global transform of the object. If the Object3d has no parent, then it's identical to the local transform. | ||
* @default new THREE.Matrix4() | ||
* The global transform of the object. | ||
* @remarks If the {@link Object3D} has no parent, then it's identical to the local transform {@link THREE.Object3D.matrix | .matrix}. | ||
* @defaultValue `new THREE.Matrix4()` | ||
*/ | ||
@@ -122,3 +136,4 @@ matrixWorld: Matrix4; | ||
* When this is set, it calculates the matrix of position, (rotation or quaternion) and | ||
* scale every frame and also recalculates the matrixWorld property. Default is {@link Object3D.DEFAULT_MATRIX_AUTO_UPDATE} (true). | ||
* scale every frame and also recalculates the matrixWorld property. | ||
* @defaultValue {@link DEFAULT_MATRIX_AUTO_UPDATE} - that is `(true)`. | ||
*/ | ||
@@ -130,3 +145,3 @@ matrixAutoUpdate: boolean; | ||
* When it isn't, then you have to maintain all matrices in the object and its children yourself. | ||
* Default is {@link Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE} (true). | ||
* @defaultValue {@link DEFAULT_MATRIX_WORLD_AUTO_UPDATE} - that is `(true)`. | ||
*/ | ||
@@ -137,3 +152,3 @@ matrixWorldAutoUpdate: boolean; | ||
* When this is set, it calculates the matrixWorld in that frame and resets this property to false. | ||
* @default false | ||
* @defaultValue `false` | ||
*/ | ||
@@ -143,3 +158,6 @@ matrixWorldNeedsUpdate: boolean; | ||
/** | ||
* @default new THREE.Layers() | ||
* The layer membership of the object. | ||
* @remarks The object is only visible if it has at least one layer in common with the {@link THREE.Object3DCamera | Camera} in use. | ||
* @remarks This property can also be used to filter out unwanted objects in ray-intersection tests when using {@link THREE.Raycaster | Raycaster}. | ||
* @defaultValue `new THREE.Layers()` | ||
*/ | ||
@@ -149,4 +167,4 @@ layers: Layers; | ||
/** | ||
* Object gets rendered if true. | ||
* @default true | ||
* Object gets rendered if `true`. | ||
* @defaultValue `true` | ||
*/ | ||
@@ -156,4 +174,4 @@ visible: boolean; | ||
/** | ||
* Gets rendered into shadow map. | ||
* @default false | ||
* Whether the object gets rendered into shadow map. | ||
* @defaultValue `false` | ||
*/ | ||
@@ -163,4 +181,4 @@ castShadow: boolean; | ||
/** | ||
* Material gets baked in shadow receiving. | ||
* @default false | ||
* Whether the material receives shadows. | ||
* @defaultValue `false` | ||
*/ | ||
@@ -171,4 +189,4 @@ receiveShadow: boolean; | ||
* When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object. | ||
* If set to false the object gets rendered every frame even if it is not in the frustum of the camera. | ||
* @default true | ||
* If set to `false` the object gets rendered every frame even if it is not in the frustum of the camera. | ||
* @defaultValue `true` | ||
*/ | ||
@@ -178,6 +196,7 @@ frustumCulled: boolean; | ||
/** | ||
* Overrides the default rendering order of scene graph objects, from lowest to highest renderOrder. | ||
* Opaque and transparent objects remain sorted independently though. | ||
* When this property is set for an instance of Group, all descendants objects will be sorted and rendered together. | ||
* @default 0 | ||
* This value allows the default rendering order of {@link https://en.wikipedia.org/wiki/Scene_graph | scene graph} | ||
* objects to be overridden although opaque and transparent objects remain sorted independently. | ||
* @remarks When this property is set for an instance of {@link Group | Group}, all descendants objects will be sorted and rendered together. | ||
* @remarks Sorting is from lowest to highest renderOrder. | ||
* @defaultValue `0` | ||
*/ | ||
@@ -187,4 +206,4 @@ renderOrder: number; | ||
/** | ||
* Array with animation clips. | ||
* @default [] | ||
* Array with object's animation clips. | ||
* @defaultValue `[]` | ||
*/ | ||
@@ -194,23 +213,27 @@ animations: AnimationClip[]; | ||
/** | ||
* An object that can be used to store custom data about the Object3d. It should not hold references to functions as these will not be cloned. | ||
* @default {} | ||
* An object that can be used to store custom data about the {@link Object3D}. | ||
* @remarks It should not hold references to _functions_ as these **will not** be cloned. | ||
* @default `{}` | ||
*/ | ||
userData: { [key: string]: any }; | ||
userData: { [key: string]: any }; // TODO Replace this to a Record? | ||
/** | ||
* Custom depth material to be used when rendering to the depth map. Can only be used in context of meshes. | ||
* When shadow-casting with a DirectionalLight or SpotLight, if you are (a) modifying vertex positions in | ||
* the vertex shader, (b) using a displacement map, (c) using an alpha map with alphaTest, or (d) using a | ||
* transparent texture with alphaTest, you must specify a customDepthMaterial for proper shadows. | ||
* Custom depth material to be used when rendering to the depth map. | ||
* @remarks Can only be used in context of meshes. | ||
* @remarks When shadow-casting with a {@link THREE.DirectionalLight | DirectionalLight} or {@link THREE.SpotLight | SpotLight}, | ||
* if you are modifying vertex positions in the vertex shader you must specify a customDepthMaterial for proper shadows. | ||
* @defaultValue `undefined` | ||
*/ | ||
customDepthMaterial: Material; | ||
customDepthMaterial?: Material | undefined; | ||
/** | ||
* Same as customDepthMaterial, but used with PointLight. | ||
* Same as {@link customDepthMaterial}, but used with {@link THREE.Object3DPointLight | PointLight}. | ||
* @defaultValue `undefined` | ||
*/ | ||
customDistanceMaterial: Material; | ||
customDistanceMaterial?: Material | undefined; | ||
/** | ||
* Used to check whether this or derived classes are Object3Ds. Default is true. | ||
* You should not change this, as it is used internally for optimisation. | ||
* Flag to check if a given object is of type {@link Object3D}. | ||
* @remarks This is a _constant_ value | ||
* @defaultValue `true` | ||
*/ | ||
@@ -220,3 +243,10 @@ readonly isObject3D: true; | ||
/** | ||
* Calls before rendering object | ||
* An optional callback that is executed immediately before a 3D object is rendered. | ||
* @remarks This function is called with the following parameters: renderer, scene, camera, geometry, material, group. | ||
* @remarks Please notice that this callback is only executed for `renderable` 3D objects. | ||
* Meaning 3D objects which define their visual appearance with geometries and materials like | ||
* instances of {@link THREE.Object3DMesh | Mesh}, {@link THREE.Object3DLine | Line}, {@link THREE.Object3DPoints | Points} or {@link THREE.Object3DSprite | Sprite}. | ||
* Instances of {@link THREE.Object3DObject3D | Object3D}, {@link THREE.Object3DGroup | Group} or {@link THREE.Object3DBone | Bone} | ||
* are not renderable and thus this callback is not executed for such objects. | ||
* @defaultValue `() => {}` | ||
*/ | ||
@@ -233,3 +263,10 @@ onBeforeRender: ( | ||
/** | ||
* Calls after rendering object | ||
* An optional callback that is executed immediately after a 3D object is rendered. | ||
* @remarks This function is called with the following parameters: renderer, scene, camera, geometry, material, group. | ||
* @remarks Please notice that this callback is only executed for `renderable` 3D objects. | ||
* Meaning 3D objects which define their visual appearance with geometries and materials like | ||
* instances of {@link THREE.Object3DMesh | Mesh}, {@link THREE.Object3DLine | Line}, {@link THREE.Object3DPoints | Points} or {@link THREE.Object3DSprite | Sprite}. | ||
* Instances of {@link THREE.Object3DObject3D | Object3D}, {@link THREE.Object3DGroup | Group} or {@link THREE.Object3DBone | Bone} | ||
* are not renderable and thus this callback is not executed for such objects. | ||
* @defaultValue `() => {}` | ||
*/ | ||
@@ -246,6 +283,5 @@ onAfterRender: ( | ||
/** | ||
* The default {@link up} direction for objects, also used as the default position for {@link DirectionalLight}, | ||
* {@link HemisphereLight} and {@link Spotlight} (which creates lights shining from the top down). | ||
* | ||
* Set to ( 0, 1, 0 ) by default. | ||
* The default {@link up} direction for objects, also used as the default position for {@link THREE.DirectionalLight | DirectionalLight}, | ||
* {@link THREE.HemisphereLight | HemisphereLight} and {@link THREE.Spotlight | Spotlight} (which creates lights shining from the top down). | ||
* @defaultValue `new THREE.Vector3( 0, 1, 0)` | ||
*/ | ||
@@ -256,2 +292,3 @@ static DEFAULT_UP: Vector3; | ||
* The default setting for {@link matrixAutoUpdate} for newly created Object3Ds. | ||
* @defaultValue `true` | ||
*/ | ||
@@ -262,2 +299,3 @@ static DEFAULT_MATRIX_AUTO_UPDATE: boolean; | ||
* The default setting for {@link matrixWorldAutoUpdate} for newly created Object3Ds. | ||
* @defaultValue `true` | ||
*/ | ||
@@ -268,2 +306,3 @@ static DEFAULT_MATRIX_WORLD_AUTO_UPDATE: boolean; | ||
* Applies the matrix transform to the object and updates the object's position, rotation and scale. | ||
* @param matrix | ||
*/ | ||
@@ -274,2 +313,3 @@ applyMatrix4(matrix: Matrix4): void; | ||
* Applies the rotation represented by the quaternion to the object. | ||
* @param quaternion | ||
*/ | ||
@@ -279,6 +319,5 @@ applyQuaternion(quaternion: Quaternion): this; | ||
/** | ||
* axis -- A normalized vector in object space. | ||
* angle -- angle in radians | ||
* Calls {@link THREE.Quaternion.setFromAxisAngle | setFromAxisAngle}({@link axis}, {@link angle}) on the {@link quaternion | .quaternion}. | ||
* @param axis A normalized vector in object space. | ||
* @param angle angle in radians | ||
* @param angle Angle in radians. Expects a `Float` | ||
*/ | ||
@@ -288,3 +327,3 @@ setRotationFromAxisAngle(axis: Vector3, angle: number): void; | ||
/** | ||
* Calls setRotationFromEuler(euler) on the .quaternion. | ||
* Calls {@link THREE.Quaternion.setFromEuler | setFromEuler}({@link euler}) on the {@link quaternion | .quaternion}. | ||
* @param euler Euler angle specifying rotation amount. | ||
@@ -295,6 +334,5 @@ */ | ||
/** | ||
* Calls setFromRotationMatrix(m) on the .quaternion. | ||
* | ||
* Note that this assumes that the upper 3x3 of m is a pure rotation matrix (i.e, unscaled). | ||
* @param m rotate the quaternion by the rotation component of the matrix. | ||
* Calls {@link THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix}({@link m}) on the {@link quaternion | .quaternion}. | ||
* @remarks Note that this assumes that the upper 3x3 of m is a pure rotation matrix (i.e, unscaled). | ||
* @param m Rotate the quaternion by the rotation component of the matrix. | ||
*/ | ||
@@ -304,4 +342,4 @@ setRotationFromMatrix(m: Matrix4): void; | ||
/** | ||
* Copy the given quaternion into .quaternion. | ||
* @param q normalized Quaternion | ||
* Copy the given {@link THREE.Quaternion | Quaternion} into {@link quaternion | .quaternion}. | ||
* @param q Normalized Quaternion. | ||
*/ | ||
@@ -311,5 +349,6 @@ setRotationFromQuaternion(q: Quaternion): void; | ||
/** | ||
* Rotate an object along an axis in object space. The axis is assumed to be normalized. | ||
* @param axis A normalized vector in object space. | ||
* @param angle The angle in radians. | ||
* Rotate an object along an axis in object space. | ||
* @remarks The axis is assumed to be normalized. | ||
* @param axis A normalized vector in object space. | ||
* @param angle The angle in radians. Expects a `Float` | ||
*/ | ||
@@ -319,5 +358,7 @@ rotateOnAxis(axis: Vector3, angle: number): this; | ||
/** | ||
* Rotate an object along an axis in world space. The axis is assumed to be normalized. Method Assumes no rotated parent. | ||
* @param axis A normalized vector in object space. | ||
* @param angle The angle in radians. | ||
* Rotate an object along an axis in world space. | ||
* @remarks The axis is assumed to be normalized | ||
* @remarks Method Assumes no rotated parent. | ||
* @param axis A normalized vector in world space. | ||
* @param angle The angle in radians. Expects a `Float` | ||
*/ | ||
@@ -327,4 +368,4 @@ rotateOnWorldAxis(axis: Vector3, angle: number): this; | ||
/** | ||
* Rotates the object around x axis in local space. | ||
* @param angle the angle to rotate in radians. | ||
* Rotates the object around _x_ axis in local space. | ||
* @param rad The angle to rotate in radians. Expects a `Float` | ||
*/ | ||
@@ -334,4 +375,4 @@ rotateX(angle: number): this; | ||
/** | ||
* Rotates the object around y axis in local space. | ||
* @param angle the angle to rotate in radians. | ||
* Rotates the object around _y_ axis in local space. | ||
* @param rad The angle to rotate in radians. Expects a `Float` | ||
*/ | ||
@@ -341,4 +382,4 @@ rotateY(angle: number): this; | ||
/** | ||
* Rotates the object around z axis in local space. | ||
* @param angle the angle to rotate in radians. | ||
* Rotates the object around _z_ axis in local space. | ||
* @param rad The angle to rotate in radians. Expects a `Float` | ||
*/ | ||
@@ -348,5 +389,6 @@ rotateZ(angle: number): this; | ||
/** | ||
* Translate an object by distance along an axis in object space. The axis is assumed to be normalized. | ||
* @param axis A normalized vector in object space. | ||
* @param distance The distance to translate. | ||
* Translate an object by distance along an axis in object space | ||
* @remarks The axis is assumed to be normalized. | ||
* @param axis A normalized vector in object space. | ||
* @param distance The distance to translate. Expects a `Float` | ||
*/ | ||
@@ -356,4 +398,4 @@ translateOnAxis(axis: Vector3, distance: number): this; | ||
/** | ||
* Translates object along x axis by distance. | ||
* @param distance Distance. | ||
* Translates object along x axis in object space by {@link distance} units. | ||
* @param distance Expects a `Float` | ||
*/ | ||
@@ -363,4 +405,4 @@ translateX(distance: number): this; | ||
/** | ||
* Translates object along y axis by distance. | ||
* @param distance Distance. | ||
* Translates object along _y_ axis in object space by {@link distance} units. | ||
* @param distance Expects a `Float` | ||
*/ | ||
@@ -370,4 +412,4 @@ translateY(distance: number): this; | ||
/** | ||
* Translates object along z axis by distance. | ||
* @param distance Distance. | ||
* Translates object along _z_ axis in object space by {@link distance} units. | ||
* @param distance Expects a `Float` | ||
*/ | ||
@@ -377,4 +419,4 @@ translateZ(distance: number): this; | ||
/** | ||
* Updates the vector from local space to world space. | ||
* @param vector A local vector. | ||
* Converts the vector from this object's local space to world space. | ||
* @param vector A vector representing a position in this object's local space. | ||
*/ | ||
@@ -384,4 +426,4 @@ localToWorld(vector: Vector3): Vector3; | ||
/** | ||
* Updates the vector from world space to local space. | ||
* @param vector A world vector. | ||
* Converts the vector from world space to this object's local space. | ||
* @param vector A vector representing a position in world space. | ||
*/ | ||
@@ -391,12 +433,23 @@ worldToLocal(vector: Vector3): Vector3; | ||
/** | ||
* Optionally, the x, y and z components of the world space position. | ||
* Rotates the object to face a point in world space. | ||
* This method does not support objects having non-uniformly-scaled parent(s). | ||
* @param vector A world vector to look at. | ||
* @remarks This method does not support objects having non-uniformly-scaled parent(s). | ||
* @param vector A vector representing a position in world space to look at. | ||
*/ | ||
lookAt(vector: Vector3): void; | ||
/** | ||
* Rotates the object to face a point in world space. | ||
* @remarks This method does not support objects having non-uniformly-scaled parent(s). | ||
* @param x Expects a `Float` | ||
* @param y Expects a `Float` | ||
* @param z Expects a `Float` | ||
*/ | ||
lookAt(x: number, y: number, z: number): void; | ||
/** | ||
* Adds object as child of this object. | ||
* Adds another {@link Object3D} as child of this {@link Object3D}. | ||
* @remarks An arbitrary number of objects may be added | ||
* @remarks Any current parent on an {@link object} passed in here will be removed, since an {@link Object3D} can have at most one parent. | ||
* @see {@link attach} | ||
* @see {@link THREE.Group | Group} for info on manually grouping objects. | ||
* @param object | ||
*/ | ||
@@ -406,3 +459,6 @@ add(...object: Object3D[]): this; | ||
/** | ||
* Removes object as child of this object. | ||
* Removes a {@link Object3D} as child of this {@link Object3D}. | ||
* @remarks An arbitrary number of objects may be removed. | ||
* @see {@link THREE.Group | Group} for info on manually grouping objects. | ||
* @param object | ||
*/ | ||
@@ -422,3 +478,6 @@ remove(...object: Object3D[]): this; | ||
/** | ||
* Adds object as a child of this, while maintaining the object's world transform. | ||
* Adds a {@link Object3D} as a child of this, while maintaining the object's world transform. | ||
* @remarks Note: This method does not support scene graphs having non-uniformly-scaled nodes(s). | ||
* @see {@link add} | ||
* @param object | ||
*/ | ||
@@ -428,4 +487,6 @@ attach(object: Object3D): this; | ||
/** | ||
* Searches through the object's children and returns the first with a matching id. | ||
* @param id Unique number of the object instance | ||
* Searches through an object and its children, starting with the object itself, and returns the first with a matching id. | ||
* @remarks Note that ids are assigned in chronological order: 1, 2, 3, ..., incrementing by one for each new object. | ||
* @see {@link id} | ||
* @param id Unique number of the object instance. Expects a `Integer` | ||
*/ | ||
@@ -435,4 +496,6 @@ getObjectById(id: number): Object3D | undefined; | ||
/** | ||
* Searches through the object's children and returns the first with a matching name. | ||
* @param name String to match to the children's Object3d.name property. | ||
* Searches through an object and its children, starting with the object itself, and returns the first with a matching name. | ||
* @remarks Note that for most objects the name is an empty string by default | ||
* @remarks You will have to set it manually to make use of this method. | ||
* @param name String to match to the children's Object3D.name property. | ||
*/ | ||
@@ -452,20 +515,62 @@ getObjectByName(name: string): Object3D | undefined; | ||
* Searches through an object and its children, starting with the object itself, | ||
* and returns all the objects with a property that matches the value given. | ||
* | ||
* @param name - the property name to search for. | ||
* @param value - value of the given property. | ||
* and returns the first with a property that matches the value given. | ||
* @param name The property name to search for. | ||
* @param value Value of the given property. | ||
*/ | ||
getObjectsByProperty(name: string, value: any): Object3D[]; | ||
/** | ||
* Returns a vector representing the position of the object in world space. | ||
* @param target The result will be copied into this Vector3. | ||
*/ | ||
getWorldPosition(target: Vector3): Vector3; | ||
/** | ||
* Returns a quaternion representing the rotation of the object in world space. | ||
* @param target The result will be copied into this Quaternion. | ||
*/ | ||
getWorldQuaternion(target: Quaternion): Quaternion; | ||
/** | ||
* Returns a vector of the scaling factors applied to the object for each axis in world space. | ||
* @param target The result will be copied into this Vector3. | ||
*/ | ||
getWorldScale(target: Vector3): Vector3; | ||
/** | ||
* Returns a vector representing the direction of object's positive z-axis in world space. | ||
* @param target The result will be copied into this Vector3. | ||
*/ | ||
getWorldDirection(target: Vector3): Vector3; | ||
/** | ||
* Abstract (empty) method to get intersections between a casted ray and this object | ||
* @remarks Subclasses such as {@link THREE.Mesh | Mesh}, {@link THREE.Line | Line}, and {@link THREE.Points | Points} implement this method in order to use raycasting. | ||
* @see {@link THREE.Raycaster | Raycaster} | ||
* @param raycaster | ||
* @param intersects | ||
* @defaultValue `() => {}` | ||
*/ | ||
raycast(raycaster: Raycaster, intersects: Intersection[]): void; | ||
/** | ||
* Executes the callback on this object and all descendants. | ||
* @remarks Note: Modifying the scene graph inside the callback is discouraged. | ||
* @param callback A function with as first argument an {@link Object3D} object. | ||
*/ | ||
traverse(callback: (object: Object3D) => any): void; | ||
/** | ||
* Like traverse, but the callback will only be executed for visible objects | ||
* @remarks Descendants of invisible objects are not traversed. | ||
* @remarks Note: Modifying the scene graph inside the callback is discouraged. | ||
* @param callback A function with as first argument an {@link Object3D} object. | ||
*/ | ||
traverseVisible(callback: (object: Object3D) => any): void; | ||
/** | ||
* Executes the callback on all ancestors. | ||
* @remarks Note: Modifying the scene graph inside the callback is discouraged. | ||
* @param callback A function with as first argument an {@link Object3D} object. | ||
*/ | ||
traverseAncestors(callback: (object: Object3D) => any): void; | ||
@@ -479,3 +584,6 @@ | ||
/** | ||
* Updates global transform of the object and its children. | ||
* Updates the global transform of the object. | ||
* And will update the object descendants if {@link matrixWorldNeedsUpdate | .matrixWorldNeedsUpdate} is set to true or if the {@link force} parameter is set to `true`. | ||
* @param force A boolean that can be used to bypass {@link matrixWorldAutoUpdate | .matrixWorldAutoUpdate}, to recalculate the world matrix of the object and descendants on the current frame. | ||
* Useful if you cannot wait for the renderer to update it on the next frame, assuming {@link matrixWorldAutoUpdate | .matrixWorldAutoUpdate} set to `true`. | ||
*/ | ||
@@ -486,17 +594,26 @@ updateMatrixWorld(force?: boolean): void; | ||
* Updates the global transform of the object. | ||
* @param updateParents recursively updates global transform of ancestors. | ||
* @param updateChildren recursively updates global transform of descendants. | ||
* @param updateParents Recursively updates global transform of ancestors. | ||
* @param updateChildren Recursively updates global transform of descendants. | ||
*/ | ||
updateWorldMatrix(updateParents: boolean, updateChildren: boolean): void; | ||
/** | ||
* Convert the object to three.js {@link https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 | JSON Object/Scene format}. | ||
* @param meta Object containing metadata such as materials, textures or images for the object. | ||
*/ | ||
toJSON(meta?: { geometries: any; materials: any; textures: any; images: any }): any; | ||
/** | ||
* Returns a clone of this object and optionally all descendants. | ||
* @param recursive If true, descendants of the object are also cloned. Default `true` | ||
*/ | ||
clone(recursive?: boolean): this; | ||
/** | ||
* | ||
* @param object | ||
* @param recursive | ||
* Copy the given object into this object | ||
* @remarks Note: event listeners and user-defined callbacks ({@link onAfterRender | .onAfterRender} and {@link onBeforeRender | .onBeforeRender}) are not copied. | ||
* @param source | ||
* @param recursive If true, descendants of the object are also copied. Default `true` | ||
*/ | ||
copy(source: this, recursive?: boolean): this; | ||
copy(source: Object3D, recursive?: boolean): this; | ||
} |
@@ -17,11 +17,17 @@ import { Vector3 } from './../math/Vector3'; | ||
export interface Intersection<TIntersected extends Object3D = Object3D> { | ||
/** Distance between the origin of the ray and the intersection */ | ||
distance: number; | ||
distanceToRay?: number | undefined; | ||
/** Point of intersection, in world coordinates */ | ||
point: Vector3; | ||
index?: number | undefined; | ||
/** Intersected face */ | ||
face?: Face | null | undefined; | ||
/** Index of the intersected face */ | ||
faceIndex?: number | undefined; | ||
/** The intersected object */ | ||
object: TIntersected; | ||
uv?: Vector2 | undefined; | ||
uv2?: Vector2 | undefined; | ||
/** The index number of the instance where the ray intersects the {@link THREE.InstancedMesh | InstancedMesh } */ | ||
instanceId?: number | undefined; | ||
@@ -38,19 +44,62 @@ } | ||
/** | ||
* This class is designed to assist with {@link https://en.wikipedia.org/wiki/Ray_casting | raycasting} | ||
* @remarks | ||
* Raycasting is used for mouse picking (working out what objects in the 3d space the mouse is over) amongst other things. | ||
* @example | ||
* ```typescript | ||
* const raycaster = new THREE.Raycaster(); | ||
* const pointer = new THREE.Vector2(); | ||
* | ||
* function onPointerMove(event) { | ||
* // calculate pointer position in normalized device coordinates (-1 to +1) for both components | ||
* pointer.x = (event.clientX / window.innerWidth) * 2 - 1; | ||
* pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; | ||
* } | ||
* | ||
* function render() { | ||
* // update the picking ray with the camera and pointer position | ||
* raycaster.setFromCamera(pointer, camera); | ||
* // calculate objects intersecting the picking ray | ||
* const intersects = raycaster.intersectObjects(scene.children); | ||
* for (let i = 0; i & lt; intersects.length; i++) { | ||
* intersects[i].object.material.color.set(0xff0000); | ||
* } | ||
* renderer.render(scene, camera); | ||
* } | ||
* window.addEventListener('pointermove', onPointerMove); | ||
* window.requestAnimationFrame(render); | ||
* ``` | ||
* @see Example: {@link https://threejs.org/examples/#webgl_interactive_cubes | Raycasting to a Mesh} | ||
* @see Example: {@link https://threejs.org/examples/#webgl_interactive_cubes_ortho | Raycasting to a Mesh in using an OrthographicCamera} | ||
* @see Example: {@link https://threejs.org/examples/#webgl_interactive_buffergeometry | Raycasting to a Mesh with BufferGeometry} | ||
* @see Example: {@link https://threejs.org/examples/#webgl_instancing_raycast | Raycasting to a InstancedMesh} | ||
* @see Example: {@link https://threejs.org/examples/#webgl_interactive_lines | Raycasting to a Line} | ||
* @see Example: {@link https://threejs.org/examples/#webgl_interactive_raycasting_points | Raycasting to Points} | ||
* @see Example: {@link https://threejs.org/examples/#webgl_geometry_terrain_raycast | Terrain raycasting} | ||
* @see Example: {@link https://threejs.org/examples/#webgl_interactive_voxelpainter | Raycasting to paint voxels} | ||
* @see Example: {@link https://threejs.org/examples/#webgl_raycaster_texture | Raycast to a Texture} | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/Raycaster | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Raycaster.js | Source} | ||
*/ | ||
export class Raycaster { | ||
/** | ||
* This creates a new raycaster object. | ||
* @param origin The origin vector where the ray casts from. | ||
* @param direction The direction vector that gives direction to the ray. Should be normalized. | ||
* @param near All results returned are further away than near. Near can't be negative. Default value is 0. | ||
* @param far All results returned are closer then far. Far can't be lower then near . Default value is Infinity. | ||
* This creates a new {@link Raycaster} object. | ||
* @param origin The origin vector where the ray casts from. Default `new Vector3()` | ||
* @param direction The direction vector that gives direction to the ray. Should be normalized. Default `new Vector3(0, 0, -1)` | ||
* @param near All results returned are further away than near. Near can't be negative. Expects a `Float`. Default `0` | ||
* @param far All results returned are closer than far. Far can't be lower than near. Expects a `Float`. Default `Infinity` | ||
*/ | ||
constructor(origin?: Vector3, direction?: Vector3, near?: number, far?: number); | ||
/** The Ray used for the raycasting. */ | ||
/** | ||
* The {@link THREE.RaycasterRay | Ray} used for the raycasting. | ||
*/ | ||
ray: Ray; | ||
/** | ||
* The near factor of the raycaster. This value indicates which objects can be discarded based on the | ||
* distance. This value shouldn't be negative and should be smaller than the far property. | ||
* @default 0 | ||
* The near factor of the raycaster. This value indicates which objects can be discarded based on the distance. | ||
* This value shouldn't be negative and should be smaller than the far property. | ||
* @remarks Expects a `Float` | ||
* @defaultValue `0` | ||
*/ | ||
@@ -60,5 +109,6 @@ near: number; | ||
/** | ||
* The far factor of the raycaster. This value indicates which objects can be discarded based on the | ||
* distance. This value shouldn't be negative and should be larger than the near property. | ||
* @default Infinity | ||
* The far factor of the raycaster. This value indicates which objects can be discarded based on the distance. | ||
* This value shouldn't be negative and should be larger than the near property. | ||
* @remarks Expects a `Float` | ||
* @defaultValue `Infinity` | ||
*/ | ||
@@ -68,4 +118,5 @@ far: number; | ||
/** | ||
* The camera to use when raycasting against view-dependent objects such as billboarded objects like Sprites. This field | ||
* can be set manually or is set when calling "setFromCamera". | ||
* The camera to use when raycasting against view-dependent objects such as billboarded objects like {@link THREE.Sprites | Sprites}. | ||
* This field can be set manually or is set when calling {@link setFromCamera}. | ||
* @defaultValue `null` | ||
*/ | ||
@@ -75,4 +126,9 @@ camera: Camera; | ||
/** | ||
* Used by Raycaster to selectively ignore 3D objects when performing intersection tests. | ||
* @default new THREE.Layers() | ||
* Used by {@link Raycaster} to selectively ignore 3D objects when performing intersection tests. | ||
* The following code example ensures that only 3D objects on layer `1` will be honored by the instance of Raycaster. | ||
* ``` | ||
* raycaster.layers.set( 1 ); | ||
* object.layers.enable( 1 ); | ||
* ``` | ||
* @defaultValue `new THREE.Layers()` - See {@link THREE.Layers | Layers}. | ||
*/ | ||
@@ -82,3 +138,4 @@ layers: Layers; | ||
/** | ||
* @default { Mesh: {}, Line: { threshold: 1 }, LOD: {}, Points: { threshold: 1 }, Sprite: {} } | ||
* An data object where threshold is the precision of the {@link Raycaster} when intersecting objects, in world units. | ||
* @defaultValue `{ Mesh: {}, Line: { threshold: 1 }, LOD: {}, Points: { threshold: 1 }, Sprite: {} }` | ||
*/ | ||
@@ -88,3 +145,5 @@ params: RaycasterParameters; | ||
/** | ||
* Updates the ray with a new origin and direction. | ||
* Updates the ray with a new origin and direction | ||
* @remarks | ||
* Please note that this method only copies the values from the arguments. | ||
* @param origin The origin vector where the ray casts from. | ||
@@ -100,9 +159,18 @@ * @param direction The normalized direction vector that gives direction to the ray. | ||
*/ | ||
setFromCamera(coords: { x: number; y: number }, camera: Camera): void; | ||
setFromCamera(coords: Vector2, camera: Camera): void; | ||
/** | ||
* Checks all intersection between the ray and the object with or without the descendants. Intersections are returned sorted by distance, closest first. | ||
* Checks all intersection between the ray and the object with or without the descendants | ||
* @remarks Intersections are returned sorted by distance, closest first | ||
* @remarks {@link Raycaster} delegates to the {@link Object3D.raycast | raycast} method of the passed object, when evaluating whether the ray intersects the object or not | ||
* This allows {@link THREE.Mesh | meshes} to respond differently to ray casting than {@link THREE.Line | lines} and {@link THREE.Points | pointclouds}. | ||
* **Note** that for meshes, faces must be pointed towards the origin of the {@link Raycaster.ray | ray} in order to be detected; | ||
* intersections of the ray passing through the back of a face will not be detected | ||
* To raycast against both faces of an object, you'll want to set the {@link Mesh.material | material}'s {@link Material.side | side} property to `THREE.DoubleSide`. | ||
* @see {@link intersectObjects | .intersectObjects()}. | ||
* @param object The object to check for intersection with the ray. | ||
* @param recursive If true, it also checks all descendants. Otherwise it only checks intersecton with the object. Default is true. | ||
* @param optionalTarget (optional) target to set the result. Otherwise a new Array is instantiated. If set, you must clear this array prior to each call (i.e., array.length = 0;). | ||
* @param recursive If true, it also checks all descendants. Otherwise it only checks intersection with the object. Default `true` | ||
* @param optionalTarget Target to set the result. Otherwise a new {@link Array | Array} is instantiated. | ||
* If set, you must clear this array prior to each call (i.e., array.length = 0;). Default `[]` | ||
* @returns An array of intersections is returned. | ||
*/ | ||
@@ -116,8 +184,16 @@ intersectObject<TIntersected extends Object3D>( | ||
/** | ||
* Checks all intersection between the ray and the objects with or without the descendants. | ||
* Intersections are returned sorted by distance, closest first. | ||
* Intersections are of the same form as those returned by .intersectObject. | ||
* Checks all intersection between the ray and the objects with or without the descendants | ||
* @remarks Intersections are returned sorted by distance, closest first | ||
* @remarks Intersections are of the same form as those returned by {@link intersectObject | .intersectObject()}. | ||
* @remarks {@link Raycaster} delegates to the {@link Object3D.raycast | raycast} method of the passed object, when evaluating whether the ray intersects the object or not | ||
* This allows {@link THREE.Mesh | meshes} to respond differently to ray casting than {@link THREE.Line | lines} and {@link THREE.Points | pointclouds}. | ||
* **Note** that for meshes, faces must be pointed towards the origin of the {@link Raycaster.ray | ray} in order to be detected; | ||
* intersections of the ray passing through the back of a face will not be detected | ||
* To raycast against both faces of an object, you'll want to set the {@link Mesh.material | material}'s {@link Material.side | side} property to `THREE.DoubleSide`. | ||
* @see {@link intersectObject | .intersectObject()}. | ||
* @param objects The objects to check for intersection with the ray. | ||
* @param recursive If true, it also checks all descendants of the objects. Otherwise it only checks intersecton with the objects. Default is true. | ||
* @param optionalTarget (optional) target to set the result. Otherwise a new Array is instantiated. If set, you must clear this array prior to each call (i.e., array.length = 0;). | ||
* @param recursive If true, it also checks all descendants of the objects. Otherwise it only checks intersection with the objects. Default `true` | ||
* @param optionalTarget Target to set the result. Otherwise a new {@link Array | Array} is instantiated. | ||
* If set, you must clear this array prior to each call (i.e., array.length = 0;). Default `[]` | ||
* @returns An array of intersections is returned. | ||
*/ | ||
@@ -124,0 +200,0 @@ intersectObjects<TIntersected extends Object3D>( |
@@ -0,21 +1,38 @@ | ||
/** | ||
* Uniforms are global GLSL variables. | ||
* They are passed to shader programs. | ||
* @example | ||
* When declaring a uniform of a {@link THREE.ShaderMaterial | ShaderMaterial}, it is declared by value or by object. | ||
* ```typescript | ||
* uniforms: { | ||
* time: { | ||
* value: 1.0 | ||
* }, | ||
* resolution: new Uniform(new Vector2()) | ||
* }; | ||
* ``` | ||
* @see Example: {@link https://threejs.org/examples/#webgl_nodes_materials_instance_uniform | WebGL2 / nodes / materials / instance / uniform} | ||
* @see Example: {@link https://threejs.org/examples/#webgpu_instance_uniform| WebGPU / instance / uniform} | ||
* @see {@link https://threejs.org/docs/index.html#api/en/core/Uniform | Official Documentation} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Uniform.js | Source} | ||
*/ | ||
export class Uniform<T = any> { | ||
constructor(value: T); | ||
/** | ||
* @deprecated | ||
* Create a new instance of {@link THREE.Uniform | Uniform} | ||
* @param value An object containing the value to set up the uniform. It's type must be one of the Uniform Types described above. | ||
*/ | ||
constructor(type: string, value: T); | ||
constructor(value: T); | ||
/** | ||
* @deprecated | ||
* Current value of the uniform. | ||
*/ | ||
type: string; | ||
value: T; | ||
/** | ||
* @deprecated Use {@link Object3D#onBeforeRender object.onBeforeRender()} instead. | ||
*/ | ||
dynamic: boolean; | ||
/** | ||
* @deprecated Use {@link Object3D#onBeforeRender object.onBeforeRender()} instead. | ||
* Returns a clone of this uniform. | ||
* @remarks | ||
* If the uniform's {@link value} property is an {@link Object | Object} with a `clone()` method, this is used, | ||
* otherwise the value is copied by assignment Array values are **shared** between cloned {@link THREE.UniformUniform | Uniform}s. | ||
*/ | ||
onUpdate(callback: () => void): Uniform<T>; | ||
clone(): Uniform<T>; | ||
} |
import { EventDispatcher } from './EventDispatcher'; | ||
import { Uniform } from './Uniform'; | ||
import { Usage } from '../constants'; | ||
/** | ||
* @see Example: {@link https://threejs.org/examples/#webgl2_ubo | WebGL2 / UBO} | ||
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/UniformsGroup.js | Source} | ||
*/ | ||
export class UniformsGroup extends EventDispatcher { | ||
isUniformsGroup: true; | ||
constructor(); | ||
readonly isUniformsGroup: true; | ||
id: number; | ||
usage: Usage; | ||
uniforms: Uniform[]; | ||
constructor(); | ||
add(uniform: Uniform): this; | ||
@@ -15,0 +21,0 @@ |
@@ -1,4 +0,3 @@ | ||
import { Triangle } from '../Three'; | ||
export namespace Earcut { | ||
function triangulate(data: number[], holeIndices: number[], dim: number): Triangle[]; | ||
} | ||
export const Earcut: { | ||
triangulate(data: number[], holeIndices?: number[], dim?: number): number[]; | ||
}; |
@@ -19,6 +19,12 @@ import { Texture } from './../textures/Texture'; | ||
sheenColor?: Color | undefined; | ||
sheenColorMap?: Texture | null | undefined; | ||
sheenRoughness?: number | undefined; | ||
sheenRoughnessMap?: Texture | null | undefined; | ||
transmission?: number | undefined; | ||
transmissionMap?: Texture | null | undefined; | ||
thickness?: number | undefined; | ||
thicknessMap?: Texture | null | undefined; | ||
attenuationDistance?: number | undefined; | ||
@@ -31,2 +37,8 @@ attenuationColor?: Color | undefined; | ||
specularColorMap?: Texture | null | undefined; | ||
iridescenceMap?: Texture | null | undefined; | ||
iridescenceIOR?: number | undefined; | ||
iridescence?: number | undefined; | ||
iridescenceThicknessRange?: [number, number] | undefined; | ||
iridescenceThicknessMap?: Texture | null | undefined; | ||
} | ||
@@ -180,3 +192,3 @@ | ||
*/ | ||
iridescenceThicknessRange: number[]; | ||
iridescenceThicknessRange: [number, number]; | ||
@@ -183,0 +195,0 @@ /** |
@@ -5,5 +5,159 @@ import { ColorSpace } from '../constants'; | ||
import { BufferAttribute } from './../core/BufferAttribute'; | ||
import { InterleavedBufferAttribute } from './../core/InterleavedBufferAttribute'; | ||
export { SRGBToLinear } from './ColorManagement'; | ||
declare const _colorKeywords: { | ||
aliceblue: 0xf0f8ff; | ||
antiquewhite: 0xfaebd7; | ||
aqua: 0x00ffff; | ||
aquamarine: 0x7fffd4; | ||
azure: 0xf0ffff; | ||
beige: 0xf5f5dc; | ||
bisque: 0xffe4c4; | ||
black: 0x000000; | ||
blanchedalmond: 0xffebcd; | ||
blue: 0x0000ff; | ||
blueviolet: 0x8a2be2; | ||
brown: 0xa52a2a; | ||
burlywood: 0xdeb887; | ||
cadetblue: 0x5f9ea0; | ||
chartreuse: 0x7fff00; | ||
chocolate: 0xd2691e; | ||
coral: 0xff7f50; | ||
cornflowerblue: 0x6495ed; | ||
cornsilk: 0xfff8dc; | ||
crimson: 0xdc143c; | ||
cyan: 0x00ffff; | ||
darkblue: 0x00008b; | ||
darkcyan: 0x008b8b; | ||
darkgoldenrod: 0xb8860b; | ||
darkgray: 0xa9a9a9; | ||
darkgreen: 0x006400; | ||
darkgrey: 0xa9a9a9; | ||
darkkhaki: 0xbdb76b; | ||
darkmagenta: 0x8b008b; | ||
darkolivegreen: 0x556b2f; | ||
darkorange: 0xff8c00; | ||
darkorchid: 0x9932cc; | ||
darkred: 0x8b0000; | ||
darksalmon: 0xe9967a; | ||
darkseagreen: 0x8fbc8f; | ||
darkslateblue: 0x483d8b; | ||
darkslategray: 0x2f4f4f; | ||
darkslategrey: 0x2f4f4f; | ||
darkturquoise: 0x00ced1; | ||
darkviolet: 0x9400d3; | ||
deeppink: 0xff1493; | ||
deepskyblue: 0x00bfff; | ||
dimgray: 0x696969; | ||
dimgrey: 0x696969; | ||
dodgerblue: 0x1e90ff; | ||
firebrick: 0xb22222; | ||
floralwhite: 0xfffaf0; | ||
forestgreen: 0x228b22; | ||
fuchsia: 0xff00ff; | ||
gainsboro: 0xdcdcdc; | ||
ghostwhite: 0xf8f8ff; | ||
gold: 0xffd700; | ||
goldenrod: 0xdaa520; | ||
gray: 0x808080; | ||
green: 0x008000; | ||
greenyellow: 0xadff2f; | ||
grey: 0x808080; | ||
honeydew: 0xf0fff0; | ||
hotpink: 0xff69b4; | ||
indianred: 0xcd5c5c; | ||
indigo: 0x4b0082; | ||
ivory: 0xfffff0; | ||
khaki: 0xf0e68c; | ||
lavender: 0xe6e6fa; | ||
lavenderblush: 0xfff0f5; | ||
lawngreen: 0x7cfc00; | ||
lemonchiffon: 0xfffacd; | ||
lightblue: 0xadd8e6; | ||
lightcoral: 0xf08080; | ||
lightcyan: 0xe0ffff; | ||
lightgoldenrodyellow: 0xfafad2; | ||
lightgray: 0xd3d3d3; | ||
lightgreen: 0x90ee90; | ||
lightgrey: 0xd3d3d3; | ||
lightpink: 0xffb6c1; | ||
lightsalmon: 0xffa07a; | ||
lightseagreen: 0x20b2aa; | ||
lightskyblue: 0x87cefa; | ||
lightslategray: 0x778899; | ||
lightslategrey: 0x778899; | ||
lightsteelblue: 0xb0c4de; | ||
lightyellow: 0xffffe0; | ||
lime: 0x00ff00; | ||
limegreen: 0x32cd32; | ||
linen: 0xfaf0e6; | ||
magenta: 0xff00ff; | ||
maroon: 0x800000; | ||
mediumaquamarine: 0x66cdaa; | ||
mediumblue: 0x0000cd; | ||
mediumorchid: 0xba55d3; | ||
mediumpurple: 0x9370db; | ||
mediumseagreen: 0x3cb371; | ||
mediumslateblue: 0x7b68ee; | ||
mediumspringgreen: 0x00fa9a; | ||
mediumturquoise: 0x48d1cc; | ||
mediumvioletred: 0xc71585; | ||
midnightblue: 0x191970; | ||
mintcream: 0xf5fffa; | ||
mistyrose: 0xffe4e1; | ||
moccasin: 0xffe4b5; | ||
navajowhite: 0xffdead; | ||
navy: 0x000080; | ||
oldlace: 0xfdf5e6; | ||
olive: 0x808000; | ||
olivedrab: 0x6b8e23; | ||
orange: 0xffa500; | ||
orangered: 0xff4500; | ||
orchid: 0xda70d6; | ||
palegoldenrod: 0xeee8aa; | ||
palegreen: 0x98fb98; | ||
paleturquoise: 0xafeeee; | ||
palevioletred: 0xdb7093; | ||
papayawhip: 0xffefd5; | ||
peachpuff: 0xffdab9; | ||
peru: 0xcd853f; | ||
pink: 0xffc0cb; | ||
plum: 0xdda0dd; | ||
powderblue: 0xb0e0e6; | ||
purple: 0x800080; | ||
rebeccapurple: 0x663399; | ||
red: 0xff0000; | ||
rosybrown: 0xbc8f8f; | ||
royalblue: 0x4169e1; | ||
saddlebrown: 0x8b4513; | ||
salmon: 0xfa8072; | ||
sandybrown: 0xf4a460; | ||
seagreen: 0x2e8b57; | ||
seashell: 0xfff5ee; | ||
sienna: 0xa0522d; | ||
silver: 0xc0c0c0; | ||
skyblue: 0x87ceeb; | ||
slateblue: 0x6a5acd; | ||
slategray: 0x708090; | ||
slategrey: 0x708090; | ||
snow: 0xfffafa; | ||
springgreen: 0x00ff7f; | ||
steelblue: 0x4682b4; | ||
tan: 0xd2b48c; | ||
teal: 0x008080; | ||
thistle: 0xd8bfd8; | ||
tomato: 0xff6347; | ||
turquoise: 0x40e0d0; | ||
violet: 0xee82ee; | ||
wheat: 0xf5deb3; | ||
white: 0xffffff; | ||
whitesmoke: 0xf5f5f5; | ||
yellow: 0xffff00; | ||
yellowgreen: 0x9acd32; | ||
}; | ||
export type ColorKeyword = keyof typeof _colorKeywords; | ||
export interface HSL { | ||
@@ -86,3 +240,3 @@ h: number; | ||
*/ | ||
setColorName(style: string, colorSpace?: ColorSpace): Color; | ||
setColorName(style: ColorKeyword, colorSpace?: ColorSpace): Color; | ||
@@ -178,3 +332,3 @@ /** | ||
fromBufferAttribute(attribute: BufferAttribute, index: number): this; | ||
fromBufferAttribute(attribute: BufferAttribute | InterleavedBufferAttribute, index: number): this; | ||
@@ -186,3 +340,3 @@ [Symbol.iterator](): Generator<number, void>; | ||
*/ | ||
static NAMES: Record<string, number>; | ||
static NAMES: typeof _colorKeywords; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { ColorSpace, LinearSRGBColorSpace, SRGBColorSpace } from '../constants'; | ||
import { ColorSpace, DisplayP3ColorSpace, LinearSRGBColorSpace, SRGBColorSpace } from '../constants'; | ||
import { Color } from './Color'; | ||
@@ -10,5 +10,5 @@ | ||
/** | ||
* @default true | ||
* @default false | ||
*/ | ||
let legacyMode: boolean; | ||
let enabled: boolean; | ||
@@ -22,9 +22,15 @@ /** | ||
color: Color, | ||
sourceColorSpace: SRGBColorSpace | LinearSRGBColorSpace, | ||
targetColorSpace: SRGBColorSpace | LinearSRGBColorSpace, | ||
sourceColorSpace: typeof SRGBColorSpace | typeof LinearSRGBColorSpace | typeof DisplayP3ColorSpace, | ||
targetColorSpace: typeof SRGBColorSpace | typeof LinearSRGBColorSpace | typeof DisplayP3ColorSpace, | ||
): Color; | ||
function fromWorkingColorSpace(color: Color, targetColorSpace: SRGBColorSpace | LinearSRGBColorSpace): Color; | ||
function fromWorkingColorSpace( | ||
color: Color, | ||
targetColorSpace: typeof SRGBColorSpace | typeof LinearSRGBColorSpace, | ||
): Color; | ||
function toWorkingColorSpace(color: Color, sourceColorSpace: SRGBColorSpace | LinearSRGBColorSpace): Color; | ||
function toWorkingColorSpace( | ||
color: Color, | ||
sourceColorSpace: typeof SRGBColorSpace | typeof LinearSRGBColorSpace, | ||
): Color; | ||
} |
@@ -181,5 +181,5 @@ import { Scene } from './../scenes/Scene'; | ||
/** | ||
* @default false | ||
* @default true | ||
*/ | ||
physicallyCorrectLights: boolean; | ||
useLegacyLights: boolean; | ||
@@ -186,0 +186,0 @@ /** |
@@ -70,3 +70,2 @@ /** | ||
export * as DataUtils from './extras/DataUtils'; | ||
export * from './extras/Earcut'; | ||
export * from './extras/ImageUtils'; | ||
@@ -73,0 +72,0 @@ export * from './extras/ShapeUtils'; |
@@ -1,3 +0,6 @@ | ||
import { Color } from './math/Color'; | ||
import { Color, ColorKeyword } from './math/Color'; | ||
export type ColorRepresentation = Color | string | number; | ||
export type ColorModelString = `${'rgb' | 'hsl'}(${string})`; | ||
export type HexColorString = `#${string}`; | ||
export type ColorRepresentation = Color | ColorKeyword | ColorModelString | HexColorString | number; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
728625
631
20916
4
+ Added@types/stats.js@*
+ Addedfflate@~0.6.9
+ Addedlil-gui@~0.17.0
+ Added@types/stats.js@0.17.3(transitive)
+ Addedfflate@0.6.10(transitive)
+ Addedlil-gui@0.17.0(transitive)