summaryrefslogtreecommitdiff
path: root/assets/javascripts/rectangles/builder.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-04-16 18:32:32 -0400
committerJules Laplace <jules@okfoc.us>2014-04-16 18:32:32 -0400
commitd3602a9259e3be57eafca37d399d10b12f460f74 (patch)
tree5e668e96f3b13eb0f3cab74024f5510a94854b23 /assets/javascripts/rectangles/builder.js
parent3412cc42a9fa5e42d47073a2fa05a39712ad40f7 (diff)
ceiling, floor
Diffstat (limited to 'assets/javascripts/rectangles/builder.js')
-rw-r--r--assets/javascripts/rectangles/builder.js32
1 files changed, 28 insertions, 4 deletions
diff --git a/assets/javascripts/rectangles/builder.js b/assets/javascripts/rectangles/builder.js
index 09040a8..edca2ed 100644
--- a/assets/javascripts/rectangles/builder.js
+++ b/assets/javascripts/rectangles/builder.js
@@ -45,12 +45,13 @@ var builder = new function(){
var width = r.x.length()
var depth = r.y.length()
- var height = 500
+ var height = clipper.rooms[r.id].height
if (r.sides & FRONT) {
el = wall('.front')
el.width = width
el.height = height
+ el.rotationY = PI
el.x = r.x.a + width/2
el.z = r.y.a
list.push(el)
@@ -59,14 +60,14 @@ var builder = new function(){
var el = wall('.back')
el.width = width
el.height = height
- el.rotationY = PI
+ el.rotationY = 0
el.x = r.x.b - width/2
el.z = r.y.b
list.push(el)
}
if (r.sides & LEFT) {
el = wall('.left')
- el.rotationY = -HALF_PI
+ el.rotationY = HALF_PI
el.height = height
el.width = depth
el.x = r.x.a
@@ -75,7 +76,7 @@ var builder = new function(){
}
if (r.sides & RIGHT) {
el = wall('.right')
- el.rotationY = HALF_PI
+ el.rotationY = -HALF_PI
el.height = height
el.width = depth
el.x = r.x.b
@@ -83,12 +84,35 @@ var builder = new function(){
list.push(el)
}
+ el = wall('.bottom')
+ el.height = depth
+ el.width = width
+ el.x = r.x.a + width/2
+ el.y = 0
+ el.z = r.y.a + depth/2
+ el.rotationX = PI/2
+ el.el.style.backgroundColor = "#f00"
+ list.push(el)
+
+ if (r.sides != 0) {
+ el = wall('.top')
+ el.height = depth
+ el.width = width
+ el.x = r.x.a + width/2
+ el.y = height
+ el.z = r.y.a + depth/2
+ el.rotationX = -PI/2
+ el.el.style.backgroundColor = "#00f"
+ list.push(el)
+ }
+
function wall(klass){
var el = new MX.Object3D(".face" + (klass || ""))
el.width = el.height = el.scaleX = el.scaleY = el.scaleZ = 1
el.z = el.y = el.x = 0
el.y = height/2
el.type = "Face"
+ el.el.style.opacity = 1.0
return el
}