BufferGeometry.d.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. getIndex(): BufferAttribute;
  45. setIndex(index: BufferAttribute | number[]): void;
  46. addAttribute(
  47. name: string,
  48. attribute: BufferAttribute | InterleavedBufferAttribute
  49. ): BufferGeometry;
  50. getAttribute(name: string): BufferAttribute | InterleavedBufferAttribute;
  51. removeAttribute(name: string): BufferGeometry;
  52. addGroup(start: number, count: number, materialIndex?: number): void;
  53. clearGroups(): void;
  54. setDrawRange(start: number, count: number): void;
  55. /**
  56. * Bakes matrix transform directly into vertex coordinates.
  57. */
  58. applyMatrix(matrix: Matrix4): BufferGeometry;
  59. rotateX(angle: number): BufferGeometry;
  60. rotateY(angle: number): BufferGeometry;
  61. rotateZ(angle: number): BufferGeometry;
  62. translate(x: number, y: number, z: number): BufferGeometry;
  63. scale(x: number, y: number, z: number): BufferGeometry;
  64. lookAt(v: Vector3): void;
  65. center(): BufferGeometry;
  66. setFromObject(object: Object3D): BufferGeometry;
  67. setFromPoints(points: Vector3[] | Vector2[]): BufferGeometry;
  68. updateFromObject(object: Object3D): void;
  69. fromGeometry(geometry: Geometry, settings?: any): BufferGeometry;
  70. fromDirectGeometry(geometry: DirectGeometry): BufferGeometry;
  71. /**
  72. * Computes bounding box of the geometry, updating Geometry.boundingBox attribute.
  73. * Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are null.
  74. */
  75. computeBoundingBox(): void;
  76. /**
  77. * Computes bounding sphere of the geometry, updating Geometry.boundingSphere attribute.
  78. * Bounding spheres aren't' computed by default. They need to be explicitly computed, otherwise they are null.
  79. */
  80. computeBoundingSphere(): void;
  81. /**
  82. * Computes vertex normals by averaging face normals.
  83. */
  84. computeVertexNormals(): void;
  85. merge(geometry: BufferGeometry, offset: number): BufferGeometry;
  86. normalizeNormals(): void;
  87. toNonIndexed(): BufferGeometry;
  88. toJSON(): any;
  89. clone(): this;
  90. copy(source: BufferGeometry): this;
  91. /**
  92. * Disposes the object from memory.
  93. * You need to call this when you want the bufferGeometry removed while the application is running.
  94. */
  95. dispose(): void;
  96. /**
  97. * @deprecated Use {@link BufferGeometry#groups .groups} instead.
  98. */
  99. drawcalls: any;
  100. /**
  101. * @deprecated Use {@link BufferGeometry#groups .groups} instead.
  102. */
  103. offsets: any;
  104. /**
  105. * @deprecated Use {@link BufferGeometry#setIndex .setIndex()} instead.
  106. */
  107. addIndex(index: any): void;
  108. /**
  109. * @deprecated Use {@link BufferGeometry#addGroup .addGroup()} instead.
  110. */
  111. addDrawCall(start: any, count: any, indexOffset?: any): void;
  112. /**
  113. * @deprecated Use {@link BufferGeometry#clearGroups .clearGroups()} instead.
  114. */
  115. clearDrawCalls(): void;
  116. addAttribute(name: any, array: any, itemSize: any): any;
  117. }