custom shader for building gradian

This commit is contained in:
2020-09-11 11:40:39 +02:00
parent 2c673bef63
commit f73d3cceb7
5 changed files with 248 additions and 76 deletions
+35 -18
View File
@@ -117,7 +117,7 @@ export default {
}
},
created () {
console.log('ContentBlock created', this.data)
// console.log('ContentBlock created', this.data)
let txtcolor = '#000000'
// switch (this.type) {
// case 'visible':
@@ -138,44 +138,61 @@ export default {
this.size.y = this.label_size.y + 0.2
let y = 0
let top = this.prtPosition.y + this.prtSize.y / 2
let floor = this.prtPosition.y - this.prtSize.y / 2
switch (this.type) {
case 'visible':
y = (this.prtPosition.y + this.prtSize.y / 2) * Math.random()
y = top * Math.random()
break
case 'context':
y = (this.prtPosition.y - this.prtSize.y / 2) * Math.random()
y = floor / 3 * Math.random()
break
case 'process':
y = (this.prtPosition.y - this.prtSize.y / 2) * Math.random()
y = floor / 3 + floor / 3 * Math.random()
break
case 'concept':
y = (floor / 3) * 2 + floor / 3 * Math.random()
break
default:
}
this.position.y = y
let face = Math.random()
if (face < 0.25) {
// if (face < 0.25) {
// // gauche
// this.face = 'left'
// this.position.x = this.prtPosition.x - this.prtSize.x / 2 + 0.1
// this.position.z = this.prtPosition.z - this.prtSize.z / 2 + this.size.x / 2 + Math.random() * (this.prtSize.z - this.size.x / 2)
// this.rotation.y = 90
// } else if (face >= 0.25 && face < 0.5) {
// // fond
// this.face = 'back'
// this.position.z = this.prtPosition.z - this.prtSize.z / 2 + 0.1
// this.position.x = this.prtPosition.x - this.prtSize.x / 2 + this.size.x / 2 + Math.random() * (this.prtSize.x - this.size.x / 2)
// } else if (face >= 0.5 && face < 0.75) {
// // droite
// this.face = 'right'
// this.position.x = this.prtPosition.x + this.prtSize.x / 2 - 0.1
// this.position.z = this.prtPosition.z - this.prtSize.z / 2 + this.size.x / 2 + Math.random() * (this.prtSize.z - this.size.x / 2)
// this.rotation.y = -90
// } else {
// // face
// this.face = 'front'
// this.position.z = this.prtPosition.z + this.prtSize.z / 2 - 0.1
// this.position.x = this.prtPosition.x - this.prtSize.x / 2 + this.size.x / 2 + Math.random() * (this.prtSize.x - this.size.x / 2)
// this.rotation.y = 180
// }
if (face < 0.5) {
// gauche
this.face = 'left'
this.position.x = this.prtPosition.x - this.prtSize.x / 2 + 0.1
this.position.z = this.prtPosition.z - this.prtSize.z / 2 + this.size.x / 2 + Math.random() * (this.prtSize.z - this.size.x / 2)
this.rotation.y = 90
} else if (face >= 0.25 && face < 0.5) {
// fond
this.face = 'back'
this.position.z = this.prtPosition.z - this.prtSize.z / 2 + 0.1
this.position.x = this.prtPosition.x - this.prtSize.x / 2 + this.size.x / 2 + Math.random() * (this.prtSize.x - this.size.x / 2)
} else if (face >= 0.5 && face < 0.75) {
} else {
// droite
this.face = 'right'
this.position.x = this.prtPosition.x + this.prtSize.x / 2 - 0.1
this.position.z = this.prtPosition.z - this.prtSize.z / 2 + this.size.x / 2 + Math.random() * (this.prtSize.z - this.size.x / 2)
this.rotation.y = -90
} else {
// face
this.face = 'front'
this.position.z = this.prtPosition.z + this.prtSize.z / 2 - 0.1
this.position.x = this.prtPosition.x - this.prtSize.x / 2 + this.size.x / 2 + Math.random() * (this.prtSize.x - this.size.x / 2)
this.rotation.y = 180
}
// this.label_position.x = this.position.x - this.size.x / 2 + this.label_size.x / 2 + 0.1
// this.label_position.y = this.position.y + this.size.y / 2 - this.label_size.y / 2 - 0.1