Added sphere, updated to use Material class

This commit is contained in:
Paul Graffam 2016-10-07 14:54:45 -04:00
parent 29a2f7393d
commit 2837909a17
1 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,7 @@
import * as THREE from 'three'; import * as THREE from 'three';
import Material from './material';
import Config from '../../data/config'; import Config from '../../data/config';
// This helper class can be used to create and then place geometry in the scene // 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); 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) { 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); const mesh = new THREE.Mesh(this.geo, material);
// Use ES6 spread to set position and rotation from passed in array // Use ES6 spread to set position and rotation from passed in array