BufferGeometry.d.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. import { BufferAttribute } from './BufferAttribute';
  2. import { Box3 } from './../math/Box3';
  3. import { Sphere } from './../math/Sphere';
  4. import { Matrix4 } from './../math/Matrix4';
  5. import { Vector2 } from './../math/Vector2';
  6. import { Vector3 } from './../math/Vector3';
  7. import { Object3D } from './Object3D';
  8. import { Geometry } from './Geometry';
  9. import { DirectGeometry } from './DirectGeometry';
  10. import { EventDispatcher } from './EventDispatcher';
  11. import { InterleavedBufferAttribute } from './InterleavedBufferAttribute';
  12. /**
  13. * @deprecated Use {@link BufferAttribute#setDynamic THREE.BufferAttribute().setDynamic( true )} instead.
  14. */
  15. /**
  16. * This is a superefficent class for geometries because it saves all data in buffers.
  17. * It reduces memory costs and cpu cycles. But it is not as easy to work with because of all the nessecary buffer calculations.
  18. * It is mainly interesting when working with static objects.
  19. *
  20. * @see <a href="https://github.com/mrdoob/three.js/blob/master/src/core/BufferGeometry.js">src/core/BufferGeometry.js</a>
  21. */
  22. export class BufferGeometry extends EventDispatcher {
  23. /**
  24. * This creates a new BufferGeometry. It also sets several properties to an default value.
  25. */
  26. constructor();
  27. static MaxIndex: number;
  28. /**
  29. * Unique number of this buffergeometry instance
  30. */
  31. id: number;
  32. uuid: string;
  33. name: string;
  34. type: string;
  35. index: BufferAttribute;
  36. attributes: {
  37. [name: string]: BufferAttribute | InterleavedBufferAttribute;
  38. };
  39. morphAttributes: any;
  40. groups: { start: number; count: number; materialIndex?: number }[];
  41. boundingBox: Box3;
  42. boundingSphere: Sphere;
  43. drawRange: { start: number; count: number };
  44. userData: {[key: string]: any};
  45. getIndex(): BufferAttribute;
  46. setIndex(index: BufferAttribute | number[]): void;
  47. addAttribute(
  48. name: string,
  49. attribute: BufferAttribute | InterleavedBufferAttribute
  50. ): BufferGeometry;
  51. getAttribute(name: string): BufferAttribute | InterleavedBufferAttribute;
  52. removeAttribute(name: string): BufferGeometry;
  53. addGroup(start: number, count: number, materialIndex?: number): void;
  54. clearGroups(): void;
  55. setDrawRange(start: number, count: number): void;
  56. /**
  57. * Bakes matrix transform directly into vertex coordinates.
  58. */
  59. applyMatrix(matrix: Matrix4): BufferGeometry;
  60. rotateX(angle: number): BufferGeometry;
  61. rotateY(angle: number): BufferGeometry;
  62. rotateZ(angle: number): BufferGeometry;
  63. translate(x: number, y: number, z: number): BufferGeometry;
  64. scale(x: number, y: number, z: number): BufferGeometry;
  65. lookAt(v: Vector3): void;
  66. center(): BufferGeometry;
  67. setFromObject(object: Object3D): BufferGeometry;
  68. setFromPoints(points: Vector3[] | Vector2[]): BufferGeometry;
  69. updateFromObject(object: Object3D): void;
  70. fromGeometry(geometry: Geometry, settings?: any): BufferGeometry;
  71. fromDirectGeometry(geometry: DirectGeometry): BufferGeometry;
  72. /**
  73. * Computes bounding box of the geometry, updating Geometry.boundingBox attribute.
  74. * Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are null.
  75. */
  76. computeBoundingBox(): void;
  77. /**
  78. * Computes bounding sphere of the geometry, updating Geometry.boundingSphere attribute.
  79. * Bounding spheres aren't' computed by default. They need to be explicitly computed, otherwise they are null.
  80. */
  81. computeBoundingSphere(): void;
  82. /**
  83. * Computes vertex normals by averaging face normals.
  84. */
  85. computeVertexNormals(): void;
  86. merge(geometry: BufferGeometry, offset: number): BufferGeometry;
  87. normalizeNormals(): void;
  88. toNonIndexed(): BufferGeometry;
  89. toJSON(): any;
  90. clone(): this;
  91. copy(source: BufferGeometry): this;
  92. /**
  93. * Disposes the object from memory.
  94. * You need to call this when you want the bufferGeometry removed while the application is running.
  95. */
  96. dispose(): void;
  97. /**
  98. * @deprecated Use {@link BufferGeometry#groups .groups} instead.
  99. */
  100. drawcalls: any;
  101. /**
  102. * @deprecated Use {@link BufferGeometry#groups .groups} instead.
  103. */
  104. offsets: any;
  105. /**
  106. * @deprecated Use {@link BufferGeometry#setIndex .setIndex()} instead.
  107. */
  108. addIndex(index: any): void;
  109. /**
  110. * @deprecated Use {@link BufferGeometry#addGroup .addGroup()} instead.
  111. */
  112. addDrawCall(start: any, count: any, indexOffset?: any): void;
  113. /**
  114. * @deprecated Use {@link BufferGeometry#clearGroups .clearGroups()} instead.
  115. */
  116. clearDrawCalls(): void;
  117. addAttribute(name: any, array: any, itemSize: any): any;
  118. }