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