Passed in color to material constructor
This commit is contained in:
parent
2837909a17
commit
c2f4f1741b
|
@ -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});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue