From c2f4f1741b4075939343540e1e680175f20cdc7d Mon Sep 17 00:00:00 2001 From: Paul Graffam Date: Fri, 7 Oct 2016 14:55:13 -0400 Subject: [PATCH] Passed in color to material constructor --- src/js/app/helpers/material.js | 13 +++++-------- src/js/app/model/model.js | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/js/app/helpers/material.js b/src/js/app/helpers/material.js index 19c1382..3e57d55 100644 --- a/src/js/app/helpers/material.js +++ b/src/js/app/helpers/material.js @@ -2,25 +2,22 @@ import * as THREE from 'three'; import Config from '../../data/config'; -// USe this class as a Helper to set up some default materials +// USe this class as a helper to set up some default materials export default class Material { - constructor() { - this.emissive = new THREE.MeshBasicMaterial({ - color: 0xeeeeee, + constructor(color) { + this.basic = new THREE.MeshBasicMaterial({ + color, side: THREE.DoubleSide }); this.standard = new THREE.MeshStandardMaterial({ + color, shading: THREE.FlatShading, roughness: 1, metalness: 0, side: THREE.DoubleSide }); - this.phong = new THREE.MeshPhongMaterial({ - - }); - this.wire = new THREE.MeshBasicMaterial({wireframe: true}); } } diff --git a/src/js/app/model/model.js b/src/js/app/model/model.js index 7faa809..248284c 100644 --- a/src/js/app/model/model.js +++ b/src/js/app/model/model.js @@ -21,8 +21,8 @@ export default class Model { this.loader.load(Config.model.path, obj => { obj.traverse(child => { if(child instanceof THREE.Mesh) { - // Create material for mesh and grab texture by name from preloaded textures - const material = new Material().standard; + // Create material for mesh and set its map to texture by name from preloaded textures + const material = new Material(0xffffff).standard; material.map = this.textures.UV; child.material = material;