BufferAttribute.d.ts 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. import { Usage } from '../constants';
  2. import { Matrix3 } from './../math/Matrix3';
  3. import { Matrix4 } from './../math/Matrix4';
  4. /**
  5. * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js|src/core/BufferAttribute.js}
  6. */
  7. export class BufferAttribute {
  8. constructor( array: ArrayLike<number>, itemSize: number, normalized?: boolean ); // array parameter should be TypedArray.
  9. /**
  10. * @default ''
  11. */
  12. name: string;
  13. array: ArrayLike<number>;
  14. itemSize: number;
  15. /**
  16. * @default THREE.StaticDrawUsage
  17. */
  18. usage: Usage;
  19. /**
  20. * @default { offset: number; count: number }
  21. */
  22. updateRange: { offset: number; count: number };
  23. /**
  24. * @default 0
  25. */
  26. version: number;
  27. /**
  28. * @default false
  29. */
  30. normalized: boolean;
  31. /**
  32. * @default 0
  33. */
  34. count: number;
  35. set needsUpdate( value: boolean );
  36. readonly isBufferAttribute: true;
  37. onUploadCallback: () => void;
  38. onUpload( callback: () => void ): this;
  39. setUsage( usage: Usage ): this;
  40. clone(): BufferAttribute;
  41. copy( source: BufferAttribute ): this;
  42. copyAt(
  43. index1: number,
  44. attribute: BufferAttribute,
  45. index2: number
  46. ): this;
  47. copyArray( array: ArrayLike<number> ): this;
  48. copyColorsArray(
  49. colors: { r: number; g: number; b: number }[]
  50. ): this;
  51. copyVector2sArray( vectors: { x: number; y: number }[] ): this;
  52. copyVector3sArray(
  53. vectors: { x: number; y: number; z: number }[]
  54. ): this;
  55. copyVector4sArray(
  56. vectors: { x: number; y: number; z: number; w: number }[]
  57. ): this;
  58. applyMatrix3( m: Matrix3 ): this;
  59. applyMatrix4( m: Matrix4 ): this;
  60. applyNormalMatrix( m: Matrix3 ): this;
  61. transformDirection( m: Matrix4 ): this;
  62. set(
  63. value: ArrayLike<number> | ArrayBufferView,
  64. offset?: number
  65. ): this;
  66. getX( index: number ): number;
  67. setX( index: number, x: number ): this;
  68. getY( index: number ): number;
  69. setY( index: number, y: number ): this;
  70. getZ( index: number ): number;
  71. setZ( index: number, z: number ): this;
  72. getW( index: number ): number;
  73. setW( index: number, z: number ): this;
  74. setXY( index: number, x: number, y: number ): this;
  75. setXYZ( index: number, x: number, y: number, z: number ): this;
  76. setXYZW(
  77. index: number,
  78. x: number,
  79. y: number,
  80. z: number,
  81. w: number
  82. ): this;
  83. toJSON(): {
  84. itemSize: number,
  85. type: string,
  86. array: number[],
  87. normalized: boolean
  88. };
  89. }
  90. /**
  91. * @deprecated THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.
  92. */
  93. export class Int8Attribute extends BufferAttribute {
  94. constructor( array: any, itemSize: number );
  95. }
  96. /**
  97. * @deprecated THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.
  98. */
  99. export class Uint8Attribute extends BufferAttribute {
  100. constructor( array: any, itemSize: number );
  101. }
  102. /**
  103. * @deprecated THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.
  104. */
  105. export class Uint8ClampedAttribute extends BufferAttribute {
  106. constructor( array: any, itemSize: number );
  107. }
  108. /**
  109. * @deprecated THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.
  110. */
  111. export class Int16Attribute extends BufferAttribute {
  112. constructor( array: any, itemSize: number );
  113. }
  114. /**
  115. * @deprecated THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.
  116. */
  117. export class Uint16Attribute extends BufferAttribute {
  118. constructor( array: any, itemSize: number );
  119. }
  120. /**
  121. * @deprecated THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.
  122. */
  123. export class Int32Attribute extends BufferAttribute {
  124. constructor( array: any, itemSize: number );
  125. }
  126. /**
  127. * @deprecated THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.
  128. */
  129. export class Uint32Attribute extends BufferAttribute {
  130. constructor( array: any, itemSize: number );
  131. }
  132. /**
  133. * @deprecated THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.
  134. */
  135. export class Float32Attribute extends BufferAttribute {
  136. constructor( array: any, itemSize: number );
  137. }
  138. /**
  139. * @deprecated THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.
  140. */
  141. export class Float64Attribute extends BufferAttribute {
  142. constructor( array: any, itemSize: number );
  143. }
  144. export class Int8BufferAttribute extends BufferAttribute {
  145. constructor(
  146. array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
  147. itemSize: number,
  148. normalized?: boolean
  149. );
  150. }
  151. export class Uint8BufferAttribute extends BufferAttribute {
  152. constructor(
  153. array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
  154. itemSize: number,
  155. normalized?: boolean
  156. );
  157. }
  158. export class Uint8ClampedBufferAttribute extends BufferAttribute {
  159. constructor(
  160. array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
  161. itemSize: number,
  162. normalized?: boolean
  163. );
  164. }
  165. export class Int16BufferAttribute extends BufferAttribute {
  166. constructor(
  167. array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
  168. itemSize: number,
  169. normalized?: boolean
  170. );
  171. }
  172. export class Uint16BufferAttribute extends BufferAttribute {
  173. constructor(
  174. array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
  175. itemSize: number,
  176. normalized?: boolean
  177. );
  178. }
  179. export class Int32BufferAttribute extends BufferAttribute {
  180. constructor(
  181. array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
  182. itemSize: number,
  183. normalized?: boolean
  184. );
  185. }
  186. export class Uint32BufferAttribute extends BufferAttribute {
  187. constructor(
  188. array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
  189. itemSize: number,
  190. normalized?: boolean
  191. );
  192. }
  193. export class Float32BufferAttribute extends BufferAttribute {
  194. constructor(
  195. array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
  196. itemSize: number,
  197. normalized?: boolean
  198. );
  199. }
  200. export class Float64BufferAttribute extends BufferAttribute {
  201. constructor(
  202. array: Iterable<number> | ArrayLike<number> | ArrayBuffer | number,
  203. itemSize: number,
  204. normalized?: boolean
  205. );
  206. }