Files
junisaber/src/components/materials.js

21 lines
557 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', 'default', 'neon']
2018-09-12 14:08:11 -07:00
},
2018-10-05 00:26:52 -07:00
2018-09-12 14:08:11 -07:00
update: function () {
this.el.object3D.traverse(o => {
o.material = this.system[this.data]
});
2018-09-12 14:08:11 -07:00
}
});