beat & mines colors moved to constants

This commit is contained in:
Diego F. Goberna
2018-12-06 00:20:48 +01:00
committed by Diego Marcos
parent 2f56286d91
commit c4e9366a32
3 changed files with 33 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
import {BEAT_WARMUP_OFFSET, BEAT_WARMUP_SPEED, BEAT_WARMUP_TIME} from '../constants/beat';
const COLORS = require('../constants/colors.js');
const auxObj3D = new THREE.Object3D();
const collisionZThreshold = -1.65;
@@ -33,13 +34,13 @@ AFRAME.registerComponent('beat', {
},
materialColor: {
blue: '#08083E',
red: '#290404'
blue: COLORS.BEAT_BLUE,
red: COLORS.BEAT_RED
},
cutColor: {
blue: '#b3dcff',
red: '#ffb3ca'
blue: '#fff',
red: '#fff'
},
models: {
@@ -267,10 +268,10 @@ AFRAME.registerComponent('beat', {
if (this.data.type === 'mine') {
const model = blockEl.getObject3D('mesh');
if (model) {
model.material = this.el.sceneEl.components['stage-colors'].mineMaterial;
model.material = this.el.sceneEl.systems.materials['mineMaterial' + this.data.color];
} else {
blockEl.addEventListener('model-loaded', () => {
model.material = this.el.sceneEl.components['stage-colors'].mineMaterial;
model.material = this.el.sceneEl.systems.materials['mineMaterial' + this.data.color];
}, ONCE);
}
} else {
@@ -332,7 +333,7 @@ AFRAME.registerComponent('beat', {
initMineFragments: function () {
var fragment;
var fragments = this.el.sceneEl.systems['mine-fragments-loader'].fragments.children;
var material = this.el.sceneEl.components['stage-colors'].mineMaterial;
var material = this.el.sceneEl.systems.materials['mineMaterial' + this.data.color];
this.randVec = new THREE.Vector3(
Math.random() * Math.PI,

View File

@@ -54,6 +54,23 @@ AFRAME.registerSystem('materials', {
fog: false,
transparent: true
});
this.mineMaterialred = new THREE.MeshStandardMaterial({
roughness: 0.38,
metalness: 0.48,
color: new THREE.Color(COLORS.MINE_RED),
emissive: new THREE.Color(COLORS.MINE_RED_EMISSION),
envMap: new THREE.TextureLoader().load('assets/img/mineenviro-red.jpg')
});
this.mineMaterialblue = new THREE.MeshStandardMaterial({
roughness: 0.38,
metalness: 0.48,
color: new THREE.Color(COLORS.MINE_BLUE),
emissive: new THREE.Color(COLORS.MINE_BLUE_EMISSION),
envMap: new THREE.TextureLoader().load('assets/img/mineenviro-blue.jpg')
});
}
});

View File

@@ -18,4 +18,12 @@ module.exports = {
TEXT_OFF: '#000',
TEXT_NORMAL: '#444',
TEXT_BOLD: '#888',
BEAT_RED: '#290404',
BEAT_BLUE: '#08083E',
MINE_RED: '#070304',
MINE_RED_EMISSION: '#090707',
MINE_BLUE: '#030407',
MINE_BLUE_EMISSION: '#070709',
};