Files
junisaber/src/components/materials.js

18 lines
542 B
JavaScript
Raw Normal View History

2018-09-12 14:08:11 -07:00
AFRAME.registerSystem('materials', {
init: function () {
this.black = new THREE.MeshLambertMaterial({color: 0x000000, flatShading: true});
this.default = new THREE.MeshLambertMaterial({color: 0xff0000, flatShading: true});
this.neon = new THREE.MeshBasicMaterial({color: 0x9999ff, fog: false});
}
});
AFRAME.registerComponent('materials', {
schema: {
default: 'black',
oneOf: ['black', 'red', 'blueneon']
},
update: function () {
this.el.object3D.traverse(o => o.material = this.system[this.data]);
}
});