forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
three.d.ts
5844 lines (4845 loc) · 182 KB
/
three.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for three.js r71
// Project: http://mrdoob.github.com/three.js/
// Definitions by: Kon <http://phyzkit.net/>, Satoru Kimura <https://github.com/gyohk>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="../webaudioapi/waa.d.ts"/>
interface WebGLRenderingContext {}
declare module THREE {
export var REVISION: string;
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.button
export enum MOUSE { }
export var LEFT: MOUSE;
export var MIDDLE: MOUSE;
export var RIGHT: MOUSE;
// GL STATE CONSTANTS
export enum CullFace { }
export var CullFaceNone: CullFace;
export var CullFaceBack: CullFace;
export var CullFaceFront: CullFace;
export var CullFaceFrontBack: CullFace;
export enum FrontFaceDirection { }
export var FrontFaceDirectionCW: FrontFaceDirection;
export var FrontFaceDirectionCCW: FrontFaceDirection;
// Shadowing Type
export enum ShadowMapType { }
export var BasicShadowMap: ShadowMapType;
export var PCFShadowMap: ShadowMapType;
export var PCFSoftShadowMap: ShadowMapType;
// MATERIAL CONSTANTS
// side
export enum Side { }
export var FrontSide: Side;
export var BackSide: Side;
export var DoubleSide: Side;
// shading
export enum Shading { }
export var NoShading: Shading;
export var FlatShading: Shading;
export var SmoothShading: Shading;
// colors
export enum Colors { }
export var NoColors: Colors;
export var FaceColors: Colors;
export var VertexColors: Colors;
// blending modes
export enum Blending { }
export var NoBlending: Blending;
export var NormalBlending: Blending;
export var AdditiveBlending: Blending;
export var SubtractiveBlending: Blending;
export var MultiplyBlending: Blending;
export var CustomBlending: Blending;
// custom blending equations
// (numbers start from 100 not to clash with other
// mappings to OpenGL constants defined in Texture.js)
export enum BlendingEquation { }
export var AddEquation: BlendingEquation;
export var SubtractEquation: BlendingEquation;
export var ReverseSubtractEquation: BlendingEquation;
export var MinEquation: BlendingEquation;
export var MaxEquation: BlendingEquation;
// custom blending destination factors
export enum BlendingDstFactor { }
export var ZeroFactor: BlendingDstFactor;
export var OneFactor: BlendingDstFactor;
export var SrcColorFactor: BlendingDstFactor;
export var OneMinusSrcColorFactor: BlendingDstFactor;
export var SrcAlphaFactor: BlendingDstFactor;
export var OneMinusSrcAlphaFactor: BlendingDstFactor;
export var DstAlphaFactor: BlendingDstFactor;
export var OneMinusDstAlphaFactor: BlendingDstFactor;
// custom blending src factors
export enum BlendingSrcFactor { }
export var DstColorFactor: BlendingSrcFactor;
export var OneMinusDstColorFactor: BlendingSrcFactor;
export var SrcAlphaSaturateFactor: BlendingSrcFactor;
// TEXTURE CONSTANTS
// Operations
export enum Combine { }
export var MultiplyOperation: Combine;
export var MixOperation: Combine;
export var AddOperation: Combine;
// Mapping modes
export enum Mapping { }
export var UVMapping: Mapping;
export var CubeReflectionMapping: Mapping;
export var CubeRefractionMapping: Mapping;
export var EquirectangularReflectionMapping: Mapping;
export var EquirectangularRefractionMapping: Mapping;
export var SphericalReflectionMapping: Mapping;
// Wrapping modes
export enum Wrapping { }
export var RepeatWrapping: Wrapping;
export var ClampToEdgeWrapping: Wrapping;
export var MirroredRepeatWrapping: Wrapping;
// Filters
export enum TextureFilter { }
export var NearestFilter: TextureFilter;
export var NearestMipMapNearestFilter: TextureFilter;
export var NearestMipMapLinearFilter: TextureFilter;
export var LinearFilter: TextureFilter;
export var LinearMipMapNearestFilter: TextureFilter;
export var LinearMipMapLinearFilter: TextureFilter;
// Data types
export enum TextureDataType { }
export var UnsignedByteType: TextureDataType;
export var ByteType: TextureDataType;
export var ShortType: TextureDataType;
export var UnsignedShortType: TextureDataType;
export var IntType: TextureDataType;
export var UnsignedIntType: TextureDataType;
export var FloatType: TextureDataType;
export var HalfFloatType: TextureDataType;
// Pixel types
export enum PixelType { }
export var UnsignedShort4444Type: PixelType;
export var UnsignedShort5551Type: PixelType;
export var UnsignedShort565Type: PixelType;
// Pixel formats
export enum PixelFormat { }
export var AlphaFormat: PixelFormat;
export var RGBFormat: PixelFormat;
export var RGBAFormat: PixelFormat;
export var LuminanceFormat: PixelFormat;
export var LuminanceAlphaFormat: PixelFormat;
export var RGBEFormat: PixelFormat;
// Compressed texture formats
// DDS / ST3C Compressed texture formats
export enum CompressedPixelFormat { }
export var RGB_S3TC_DXT1_Format: CompressedPixelFormat;
export var RGBA_S3TC_DXT1_Format: CompressedPixelFormat;
export var RGBA_S3TC_DXT3_Format: CompressedPixelFormat;
export var RGBA_S3TC_DXT5_Format: CompressedPixelFormat;
// PVRTC compressed texture formats
export var RGB_PVRTC_4BPPV1_Format: CompressedPixelFormat;
export var RGB_PVRTC_2BPPV1_Format: CompressedPixelFormat;
export var RGBA_PVRTC_4BPPV1_Format: CompressedPixelFormat;
export var RGBA_PVRTC_2BPPV1_Format: CompressedPixelFormat;
// log handlers
export function warn(message?: any, ...optionalParams: any[]): void;
export function error(message?: any, ...optionalParams: any[]): void;
export function log(message?: any, ...optionalParams: any[]): void;
// Cameras ////////////////////////////////////////////////////////////////////////////////////////
/**
* Abstract base class for cameras. This class should always be inherited when you build a new camera.
*/
export class Camera extends Object3D {
/**
* This constructor sets following properties to the correct type: matrixWorldInverse, projectionMatrix and projectionMatrixInverse.
*/
constructor();
/**
* This is the inverse of matrixWorld. MatrixWorld contains the Matrix which has the world transform of the Camera.
*/
matrixWorldInverse: Matrix4;
/**
* This is the matrix which contains the projection.
*/
projectionMatrix: Matrix4;
getWorldDirection(optionalTarget?: Vector3): Vector3;
/**
* This make the camera look at the vector position in local space.
* @param vector point to look at
*/
lookAt(vector: Vector3): void;
clone(camera?: Camera): Camera;
}
export class CubeCamera extends Object3D {
constructor( near?: number, far?: number, cubeResolution?: number);
renderTarget: WebGLRenderTargetCube;
updateCubeMap( renderer: Renderer, scene: Scene ): void;
}
/**
* Camera with orthographic projection
*
* @example
* var camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 );
* scene.add( camera );
*
* @see <a href="https://github.com/mrdoob/three.js/blob/master/src/cameras/OrthographicCamera.js">src/cameras/OrthographicCamera.js</a>
*/
export class OrthographicCamera extends Camera {
/**
* @param left Camera frustum left plane.
* @param right Camera frustum right plane.
* @param top Camera frustum top plane.
* @param bottom Camera frustum bottom plane.
* @param near Camera frustum near plane.
* @param far Camera frustum far plane.
*/
constructor(left: number, right: number, top: number, bottom: number, near?: number, far?: number);
zoom: number;
/**
* Camera frustum left plane.
*/
left: number;
/**
* Camera frustum right plane.
*/
right: number;
/**
* Camera frustum top plane.
*/
top: number;
/**
* Camera frustum bottom plane.
*/
bottom: number;
/**
* Camera frustum near plane.
*/
near: number;
/**
* Camera frustum far plane.
*/
far: number;
/**
* Updates the camera projection matrix. Must be called after change of parameters.
*/
updateProjectionMatrix(): void;
clone(): OrthographicCamera;
}
/**
* Camera with perspective projection.
*
* # example
* var camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 );
* scene.add( camera );
*
* @source https://github.com/mrdoob/three.js/blob/master/src/cameras/PerspectiveCamera.js
*/
export class PerspectiveCamera extends Camera {
/**
* @param fov Camera frustum vertical field of view. Default value is 50.
* @param aspect Camera frustum aspect ratio. Default value is 1.
* @param near Camera frustum near plane. Default value is 0.1.
* @param far Camera frustum far plane. Default value is 2000.
*/
constructor(fov?: number, aspect?: number, near?: number, far?: number);
zoom: number;
/**
* Camera frustum vertical field of view, from bottom to top of view, in degrees.
*/
fov: number;
/**
* Camera frustum aspect ratio, window width divided by window height.
*/
aspect: number;
/**
* Camera frustum near plane.
*/
near: number;
/**
* Camera frustum far plane.
*/
far: number;
/**
* Uses focal length (in mm) to estimate and set FOV 35mm (fullframe) camera is used if frame size is not specified.
* Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html
* @param focalLength focal length
* @param frameHeight frame size. Default value is 24.
*/
setLens(focalLength: number, frameHeight?: number): void;
/**
* Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups.
* For example, if you have 3x2 monitors and each monitor is 1920x1080 and the monitors are in grid like this:
*
* +---+---+---+
* | A | B | C |
* +---+---+---+
* | D | E | F |
* +---+---+---+
*
* then for each monitor you would call it like this:
*
* var w = 1920;
* var h = 1080;
* var fullWidth = w * 3;
* var fullHeight = h * 2;
*
* // A
* camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
* // B
* camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
* // C
* camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
* // D
* camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
* // E
* camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
* // F
* camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); Note there is no reason monitors have to be the same size or in a grid.
*
* @param fullWidth full width of multiview setup
* @param fullHeight full height of multiview setup
* @param x horizontal offset of subcamera
* @param y vertical offset of subcamera
* @param width width of subcamera
* @param height height of subcamera
*/
setViewOffset(fullWidth: number, fullHeight: number, x: number, y: number, width: number, height: number): void;
/**
* Updates the camera projection matrix. Must be called after change of parameters.
*/
updateProjectionMatrix(): void;
clone(): PerspectiveCamera;
}
// Core ///////////////////////////////////////////////////////////////////////////////////////////////
export class BufferAttribute {
constructor(array: any, itemSize: number); // array parameter should be TypedArray.
array: number[];
itemSize: number;
needsUpdate: boolean;
length: number;
copyAt(index1: number, attribute: BufferAttribute, index2: number): void;
set(value: number, offset?: number): BufferAttribute;
setX(index: number, x: number): BufferAttribute;
setY(index: number, y: number): BufferAttribute;
setZ(index: number, z: number): BufferAttribute;
setXY(index: number, x: number, y: number): BufferAttribute;
setXYZ(index: number, x: number, y: number, z: number): BufferAttribute;
setXYZW(index: number, x: number, y: number, z: number, w: number): BufferAttribute;
clone(): BufferAttribute;
}
// deprecated
export class Int8Attribute extends BufferAttribute{
constructor(data: any, itemSize: number);
}
// deprecated
export class Uint8Attribute extends BufferAttribute {
constructor(data: any, itemSize: number);
}
// deprecated
export class Uint8ClampedAttribute extends BufferAttribute {
constructor(data: any, itemSize: number);
}
// deprecated
export class Int16Attribute extends BufferAttribute {
constructor(data: any, itemSize: number);
}
// deprecated
export class Uint16Attribute extends BufferAttribute {
constructor(data: any, itemSize: number);
}
// deprecated
export class Int32Attribute extends BufferAttribute {
constructor(data: any, itemSize: number);
}
// deprecated
export class Uint32Attribute extends BufferAttribute {
constructor(data: any, itemSize: number);
}
// deprecated
export class Float32Attribute extends BufferAttribute {
constructor(data: any, itemSize: number);
}
// deprecated
export class Float64Attribute extends BufferAttribute {
constructor(data: any, itemSize: number);
}
/**
* 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 nessecary buffer calculations.
* It is mainly interesting when working with static objects.
*
* @see <a href="https://github.com/mrdoob/three.js/blob/master/src/core/BufferGeometry.js">src/core/BufferGeometry.js</a>
*/
export class BufferGeometry {
/**
* This creates a new BufferGeometry. It also sets several properties to an default value.
*/
constructor();
/**
* Unique number of this buffergeometry instance
*/
id: number;
uuid: string;
name: string;
type: string;
attributes: BufferAttribute[];
attributesKeys: string[];
drawcalls: { start: number; count: number; index: number; }[];
offsets: { start: number; count: number; index: number; }[];
boundingBox: Box3;
boundingSphere: BoundingSphere;
addAttribute(name: string, attribute: BufferAttribute): any;
addAttribute(name: string, array: any, itemSize: number): any;
getAttribute(name: string): any;
addDrawCall(start: number, count: number, index: number): void;
/**
* Bakes matrix transform directly into vertex coordinates.
*/
applyMatrix(matrix: Matrix4): void;
center(): Vector3;
fromGeometry( geometry: Geometry, settings?: any ): BufferGeometry;
/**
* 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.
*/
computeBoundingBox(): void;
/**
* 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.
*/
computeBoundingSphere(): void;
// deprecated
computeFaceNormals(): void;
/**
* Computes vertex normals by averaging face normals.
*/
computeVertexNormals(): void;
/**
* Computes vertex tangents.
* Based on http://www.terathon.com/code/tangent.html
* Geometry must have vertex UVs (layer 0 will be used).
*/
computeTangents(): void;
computeOffsets(size: number): void;
merge(geometry: BufferGeometry, offset: number): BufferGeometry;
normalizeNormals(): void;
reorderBuffers(indexBuffer: number, indexMap: number[], vertexCount: number): void;
toJSON(): any;
clone(): BufferGeometry;
/**
* Disposes the object from memory.
* You need to call this when you want the bufferGeometry removed while the application is running.
*/
dispose(): void;
// EventDispatcher mixins
addEventListener(type: string, listener: (event: any) => void ): void;
hasEventListener(type: string, listener: (event: any) => void): void;
removeEventListener(type: string, listener: (event: any) => void): void;
dispatchEvent(event: { type: string; target: any; }): void;
}
/**
* Object for keeping track of time.
*
* @see <a href="https://github.com/mrdoob/three.js/blob/master/src/core/Clock.js">src/core/Clock.js</a>
*/
export class Clock {
/**
* @param autoStart Automatically start the clock.
*/
constructor(autoStart?: boolean);
/**
* If set, starts the clock automatically when the first update is called.
*/
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.
*/
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.
*/
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.
*/
elapsedTime: number;
/**
* This property keeps track whether the clock is running or not.
*/
running: boolean;
/**
* Starts clock.
*/
start(): void;
/**
* Stops clock.
*/
stop(): void;
/**
* Get the seconds passed since the clock started.
*/
getElapsedTime(): number;
/**
* Get the seconds passed since the last call to this method.
*/
getDelta(): number;
}
export class DynamicBufferAttribute extends BufferAttribute{
constructor(array: any, itemSize: number);
updateRange: {
offset: number;
count: number;
}
clone(): DynamicBufferAttribute;
}
/**
* JavaScript events for custom objects
*
* # Example
* var Car = function () {
*
* EventDispatcher.call( this );
* this.start = function () {
*
* this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } );
*
* };
*
* };
*
* var car = new Car();
* car.addEventListener( 'start', function ( event ) {
*
* alert( event.message );
*
* } );
* car.start();
*
* @source src/core/EventDispatcher.js
*/
export class EventDispatcher {
/**
* Creates eventDispatcher object. It needs to be call with '.call' to add the functionality to an object.
*/
constructor();
/**
* Adds a listener to an event type.
* @param type The type of the listener that gets removed.
* @param listener The listener function that gets removed.
*/
addEventListener(type: string, listener: (event: any) => void ): void;
/**
* Adds a listener to an event type.
* @param type The type of the listener that gets removed.
* @param listener The listener function that gets removed.
*/
hasEventListener(type: string, listener: (event: any) => void): void;
/**
* Removes a listener from an event type.
* @param type The type of the listener that gets removed.
* @param listener The listener function that gets removed.
*/
removeEventListener(type: string, listener: (event: any) => void): void;
/**
* Fire an event type.
* @param type The type of event that gets fired.
*/
dispatchEvent(event: { type: string; target: any; }): void;
}
/**
* Triangle face.
*
* # Example
* var normal = new THREE.Vector3( 0, 1, 0 );
* var color = new THREE.Color( 0xffaa00 );
* var face = new THREE.Face3( 0, 1, 2, normal, color, 0 );
*
* @source https://github.com/mrdoob/three.js/blob/master/src/core/Face3.js
*/
export class Face3 {
/**
* @param a Vertex A index.
* @param b Vertex B index.
* @param c Vertex C index.
* @param normal Face normal or array of vertex normals.
* @param color Face color or array of vertex colors.
* @param materialIndex Material index.
*/
constructor(a: number, b: number, c: number, normal?: Vector3, color?: Color, materialIndex?: number);
constructor(a: number, b: number, c: number, normal?: Vector3, vertexColors?: Color[], materialIndex?: number);
constructor(a: number, b: number, c: number, vertexNormals?: Vector3[], color?: Color, materialIndex?: number);
constructor(a: number, b: number, c: number, vertexNormals?: Vector3[], vertexColors?: Color[], materialIndex?: number);
/**
* Vertex A index.
*/
a: number;
/**
* Vertex B index.
*/
b: number;
/**
* Vertex C index.
*/
c: number;
/**
* Face normal.
*/
normal: Vector3;
/**
* Array of 4 vertex normals.
*/
vertexNormals: Vector3[];
/**
* Face color.
*/
color: Color;
/**
* Array of 4 vertex normals.
*/
vertexColors: Color[];
/**
* Array of 4 vertex tangets.
*/
vertexTangents: number[];
/**
* Material index (points to {@link Geometry.materials}).
*/
materialIndex: number;
clone(): Face3;
}
export interface MorphTarget {
name: string;
vertices: Vector3[];
}
export interface MorphColor {
name: string;
colors: Color[];
}
export interface MorphNormals {
name: string;
normals: Vector3[];
}
export interface BoundingSphere {
radius: number;
}
/**
* Base class for geometries
*
* # Example
* var geometry = new THREE.Geometry();
* geometry.vertices.push( new THREE.Vector3( -10, 10, 0 ) );
* geometry.vertices.push( new THREE.Vector3( -10, -10, 0 ) );
* geometry.vertices.push( new THREE.Vector3( 10, -10, 0 ) );
* geometry.faces.push( new THREE.Face3( 0, 1, 2 ) );
* geometry.computeBoundingSphere();
*
* @see https://github.com/mrdoob/three.js/blob/master/src/core/Geometry.js
*/
export class Geometry {
constructor();
/**
* Unique number of this geometry instance
*/
id: number;
uuid: string;
/**
* Name for this geometry. Default is an empty string.
*/
name: string;
type: string;
/**
* The array of vertices hold every position of points of the model.
* To signal an update in this array, Geometry.verticesNeedUpdate needs to be set to true.
*/
vertices: Vector3[];
/**
* Array of vertex colors, matching number and order of vertices.
* Used in ParticleSystem, Line and Ribbon.
* Meshes use per-face-use-of-vertex colors embedded directly in faces.
* To signal an update in this array, Geometry.colorsNeedUpdate needs to be set to true.
*/
colors: Color[];
/**
* Array of triangles or/and quads.
* The array of faces describe how each vertex in the model is connected with each other.
* To signal an update in this array, Geometry.elementsNeedUpdate needs to be set to true.
*/
faces: Face3[];
/**
* Array of face UV layers.
* Each UV layer is an array of UV matching order and number of vertices in faces.
* To signal an update in this array, Geometry.uvsNeedUpdate needs to be set to true.
*/
faceVertexUvs: Vector2[][][];
/**
* Array of morph targets. Each morph target is a Javascript object:
*
* { name: "targetName", vertices: [ new THREE.Vector3(), ... ] }
*
* Morph vertices match number and order of primary vertices.
*/
morphTargets: MorphTarget[];
/**
* Array of morph colors. Morph colors have similar structure as morph targets, each color set is a Javascript object:
*
* morphColor = { name: "colorName", colors: [ new THREE.Color(), ... ] }
*/
morphColors: MorphColor[];
/**
* Array of morph normals. Morph normals have similar structure as morph targets, each normal set is a Javascript object:
*
* morphNormal = { name: "NormalName", normals: [ new THREE.Vector3(), ... ] }
*/
morphNormals: MorphNormals[];
/**
* Array of skinning weights, matching number and order of vertices.
*/
skinWeights: number[];
/**
* Array of skinning indices, matching number and order of vertices.
*/
skinIndices: number[];
/**
*
*/
lineDistances: number[];
/**
* Bounding box.
*/
boundingBox: Box3;
/**
* Bounding sphere.
*/
boundingSphere: BoundingSphere;
/**
* True if geometry has tangents. Set in Geometry.computeTangents.
*/
hasTangents: boolean;
/**
* Set to true if attribute buffers will need to change in runtime (using "dirty" flags).
* Unless set to true internal typed arrays corresponding to buffers will be deleted once sent to GPU.
* Defaults to true.
*/
dynamic: boolean;
/**
* Set to true if the vertices array has been updated.
*/
verticesNeedUpdate: boolean;
/**
* Set to true if the faces array has been updated.
*/
elementsNeedUpdate: boolean;
/**
* Set to true if the uvs array has been updated.
*/
uvsNeedUpdate: boolean;
/**
* Set to true if the normals array has been updated.
*/
normalsNeedUpdate: boolean;
/**
* Set to true if the tangents in the faces has been updated.
*/
tangentsNeedUpdate: boolean;
/**
* Set to true if the colors array has been updated.
*/
colorsNeedUpdate: boolean;
/**
* Set to true if the linedistances array has been updated.
*/
lineDistancesNeedUpdate: boolean;
/**
*
*/
groupsNeedUpdate: boolean;
/**
* Bakes matrix transform directly into vertex coordinates.
*/
applyMatrix(matrix: Matrix4): void;
fromBufferGeometry(geometry: BufferGeometry): Geometry;
/**
*
*/
center(): Vector3;
/**
* Computes face normals.
*/
computeFaceNormals(): void;
/**
* Computes vertex normals by averaging face normals.
* Face normals must be existing / computed beforehand.
*/
computeVertexNormals(areaWeighted?: boolean): void;
/**
* Computes morph normals.
*/
computeMorphNormals(): void;
/**
* Computes vertex tangents.
* Based on <a href="http://www.terathon.com/code/tangent.html">http://www.terathon.com/code/tangent.html</a>
* Geometry must have vertex UVs (layer 0 will be used).
*/
computeTangents(): void;
computeLineDistances(): void;
/**
* Computes bounding box of the geometry, updating {@link Geometry.boundingBox} attribute.
*/
computeBoundingBox(): void;
/**
* Computes bounding sphere of the geometry, updating Geometry.boundingSphere attribute.
* Neither bounding boxes or bounding spheres are computed by default. They need to be explicitly computed, otherwise they are null.
*/
computeBoundingSphere(): void;
merge( geometry: Geometry, matrix: Matrix, materialIndexOffset: number): void;
mergeMesh( mesh: Mesh ): void;
/**
* Checks for duplicate vertices using hashmap.
* Duplicated vertices are removed and faces' vertices are updated.
*/
mergeVertices(): number;
toJSON(): any;
/**
* Creates a new clone of the Geometry.
*/
clone(): Geometry;
/**
* Removes The object from memory.
* Don't forget to call this method when you remove an geometry because it can cuase meomory leaks.
*/
dispose(): void;
//These properties do not exist in a normal Geometry class, but if you use the instance that was passed by JSONLoader, it will be added.
bones: Bone[];
animation: AnimationData;
animations: AnimationData[];
// EventDispatcher mixins
addEventListener(type: string, listener: (event: any) => void ): void;
hasEventListener(type: string, listener: (event: any) => void): void;
removeEventListener(type: string, listener: (event: any) => void): void;
dispatchEvent(event: { type: string; target: any; }): void;
}
/**
* Base class for scene graph objects
*/
export class Object3D {
constructor();
/**
* Unique number of this object instance.
*/
id: number;
/**
*
*/
uuid: string;
/**
* Optional name of the object (doesn't need to be unique).
*/