TetrahedronGeometry.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /**
  2. * @author timothypratley / https://github.com/timothypratley
  3. * @author Mugen87 / https://github.com/Mugen87
  4. */
  5. import { Geometry } from '../core/Geometry.js';
  6. import { PolyhedronBufferGeometry } from './PolyhedronGeometry.js';
  7. // TetrahedronGeometry
  8. function TetrahedronGeometry( radius, detail ) {
  9. Geometry.call( this );
  10. this.type = 'TetrahedronGeometry';
  11. this.parameters = {
  12. radius: radius,
  13. detail: detail
  14. };
  15. this.fromBufferGeometry( new TetrahedronBufferGeometry( radius, detail ) );
  16. this.mergeVertices();
  17. }
  18. TetrahedronGeometry.prototype = Object.create( Geometry.prototype );
  19. TetrahedronGeometry.prototype.constructor = TetrahedronGeometry;
  20. // TetrahedronBufferGeometry
  21. function TetrahedronBufferGeometry( radius, detail ) {
  22. var vertices = [
  23. 1, 1, 1, - 1, - 1, 1, - 1, 1, - 1, 1, - 1, - 1
  24. ];
  25. var indices = [
  26. 2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1
  27. ];
  28. PolyhedronBufferGeometry.call( this, vertices, indices, radius, detail );
  29. this.type = 'TetrahedronBufferGeometry';
  30. this.parameters = {
  31. radius: radius,
  32. detail: detail
  33. };
  34. }
  35. TetrahedronBufferGeometry.prototype = Object.create( PolyhedronBufferGeometry.prototype );
  36. TetrahedronBufferGeometry.prototype.constructor = TetrahedronBufferGeometry;
  37. export { TetrahedronGeometry, TetrahedronBufferGeometry };