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',
|
2018-09-19 01:10:11 +02:00
|
|
|
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 () {
|
2018-10-13 17:26:03 -07:00
|
|
|
this.el.object3D.traverse(o => {
|
|
|
|
|
o.material = this.system[this.data]
|
|
|
|
|
});
|
2018-09-12 14:08:11 -07:00
|
|
|
}
|
|
|
|
|
});
|