From 2837909a17189b11ddf09296c64b12133ac9727a Mon Sep 17 00:00:00 2001 From: Paul Graffam Date: Fri, 7 Oct 2016 14:54:45 -0400 Subject: [PATCH] Added sphere, updated to use Material class --- src/js/app/helpers/geometry.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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