UNPKG

1.3 kBJavaScriptView Raw
1/**
2 * @author timothypratley / https://github.com/timothypratley
3 * @author Mugen87 / https://github.com/Mugen87
4 */
5
6import { Geometry } from '../core/Geometry.js';
7import { PolyhedronBufferGeometry } from './PolyhedronGeometry.js';
8
9// TetrahedronGeometry
10
11function TetrahedronGeometry( radius, detail ) {
12
13 Geometry.call( this );
14
15 this.type = 'TetrahedronGeometry';
16
17 this.parameters = {
18 radius: radius,
19 detail: detail
20 };
21
22 this.fromBufferGeometry( new TetrahedronBufferGeometry( radius, detail ) );
23 this.mergeVertices();
24
25}
26
27TetrahedronGeometry.prototype = Object.create( Geometry.prototype );
28TetrahedronGeometry.prototype.constructor = TetrahedronGeometry;
29
30// TetrahedronBufferGeometry
31
32function TetrahedronBufferGeometry( radius, detail ) {
33
34 var vertices = [
35 1, 1, 1, - 1, - 1, 1, - 1, 1, - 1, 1, - 1, - 1
36 ];
37
38 var indices = [
39 2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1
40 ];
41
42 PolyhedronBufferGeometry.call( this, vertices, indices, radius, detail );
43
44 this.type = 'TetrahedronBufferGeometry';
45
46 this.parameters = {
47 radius: radius,
48 detail: detail
49 };
50
51}
52
53TetrahedronBufferGeometry.prototype = Object.create( PolyhedronBufferGeometry.prototype );
54TetrahedronBufferGeometry.prototype.constructor = TetrahedronBufferGeometry;
55
56
57export { TetrahedronGeometry, TetrahedronBufferGeometry };