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