diff --git a/src/js/app/helpers/geometry.js b/src/js/app/helpers/geometry.js index 664579d..2c514b9 100644 --- a/src/js/app/helpers/geometry.js +++ b/src/js/app/helpers/geometry.js @@ -1,5 +1,7 @@ import * as THREE from 'three'; +import Material from './material'; + import Config from '../../data/config'; // This helper class can be used to create and then place geometry in the scene @@ -15,10 +17,16 @@ export default class Geometry { this.geo = new THREE.PlaneGeometry(width, height, widthSegments, heightSegments); }; } + + if(type == 'sphere') { + return (radius, widthSegments = 32, heightSegments = 32) => { + this.geo = new THREE.SphereGeometry(radius, widthSegments, heightSegments); + }; + } } place(position, rotation) { - const material = new THREE.MeshStandardMaterial({ color: 0xCCCCCC, side: THREE.DoubleSide }); + const material = new Material(0xeeeeee).standard; const mesh = new THREE.Mesh(this.geo, material); // Use ES6 spread to set position and rotation from passed in array