Browse Source

add depth to rooms

master
Peter Hajas 3 years ago
parent
commit
c0287334b6
  1. 3
      data.json
  2. 2
      script.js

3
data.json

@ -6,6 +6,7 @@
"y" : 0, "y" : 0,
"w" : 5.385, "w" : 5.385,
"h" : 4.37, "h" : 4.37,
"d" : 6.096,
"color" : "yellow" "color" : "yellow"
}, },
{ {
@ -14,6 +15,7 @@
"y" : 4.6736, "y" : 4.6736,
"w" : 4.9774, "w" : 4.9774,
"h" : 3.7338, "h" : 3.7338,
"d" : 3.048,
"color" : "red" "color" : "red"
}, },
{ {
@ -22,6 +24,7 @@
"y" : 0.6096, "y" : 0.6096,
"w" : 4.9774, "w" : 4.9774,
"h" : 4.6736, "h" : 4.6736,
"d" : 3.048,
"color" : "green" "color" : "green"
} }
] ]

2
script.js

@ -30,7 +30,7 @@ animate();
function configureScene(data) { function configureScene(data) {
// Add geometry for the rooms // Add geometry for the rooms
for (var room of data.rooms) { for (var room of data.rooms) {
let roomGeo = new THREE.BoxGeometry(room.w, room.h, 2) let roomGeo = new THREE.BoxGeometry(room.w, room.h, room.d)
let roomColor = new THREE.Color(room.color) let roomColor = new THREE.Color(room.color)
let roomMaterial = new THREE.MeshPhysicalMaterial({ color: roomColor }) let roomMaterial = new THREE.MeshPhysicalMaterial({ color: roomColor })
let roomMesh = new THREE.Mesh(roomGeo, roomMaterial) let roomMesh = new THREE.Mesh(roomGeo, roomMaterial)

Loading…
Cancel
Save