summaryrefslogtreecommitdiff
path: root/assets/javascripts/rectangles/rect.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/javascripts/rectangles/rect.js')
-rw-r--r--assets/javascripts/rectangles/rect.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/assets/javascripts/rectangles/rect.js b/assets/javascripts/rectangles/rect.js
index 866727f..67abdee 100644
--- a/assets/javascripts/rectangles/rect.js
+++ b/assets/javascripts/rectangles/rect.js
@@ -181,6 +181,64 @@ window.rect = (function(){
return splits
}
+ rect.prototype.walls = function(){
+ var list = [], el = null
+
+ var width = this.x.length()
+ var depth = this.y.length()
+ var height = 800
+
+ if (this.sides & FRONT) {
+ el = wall('.face.front')
+ el.scaleX = width
+ el.scaleY = height
+ el.z = this.y.a - depth/2
+ el.x = this.x.a
+ el.y = height/2
+ list.push(el)
+ }
+ if (this.sides & LEFT) {
+ el = wall('.face.left')
+ el.rotationY = -HALF_PI
+ el.scaleY = height
+ el.scaleZ = depth
+ el.x = this.x.a - width/2
+ el.z = this.y.a
+ el.y = height/2
+ list.push(el)
+ }
+ if (this.sides & RIGHT) {
+ el = wall('.face.right')
+ el.rotationY = HALF_PI
+ el.scaleY = height
+ el.scaleZ = depth
+ el.x = this.x.a + width/2
+ el.y = height/2
+ el.z = this.y.a
+ list.push(el)
+ }
+ if (this.sides & BACK) {
+ var el = wall('.face.back')
+ el.scaleX = width
+ el.scaleY = height
+ el.rotationY = PI
+ el.z = this.y.a + depth/2
+ el.y = height/2
+ el.x = this.x.a
+ list.push(el)
+ }
+
+ function wall(klass){
+ var el = new MX.Object3D(klass || ".face")
+ el.width = el.height = el.scaleX = el.scaleY = el.scaleZ = 1
+ el.z = el.y = el.x = 0
+ el.type = "Face"
+ return el
+ }
+
+ return list
+ }
+
return rect
})()