summaryrefslogtreecommitdiff
path: root/assets/javascripts/rectangles/builder.js
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-04-17 02:32:53 -0400
committerJulie Lala <jules@okfoc.us>2014-04-17 02:32:53 -0400
commit1af8f41cc88e3c57bfabe6d4a5dcd83fc4a0e1bc (patch)
treee10fd06cd40c21a7375f626ac130b438613b8abe /assets/javascripts/rectangles/builder.js
parent3b7c327b6502ef6e510a0a0e77c6b6facf0be723 (diff)
further code bath, fix minimap orientation/translation
Diffstat (limited to 'assets/javascripts/rectangles/builder.js')
-rw-r--r--assets/javascripts/rectangles/builder.js123
1 files changed, 0 insertions, 123 deletions
diff --git a/assets/javascripts/rectangles/builder.js b/assets/javascripts/rectangles/builder.js
deleted file mode 100644
index edca2ed..0000000
--- a/assets/javascripts/rectangles/builder.js
+++ /dev/null
@@ -1,123 +0,0 @@
-var builder = new function(){
- var base = this
- base.tube = new Tube ()
-
- var els = []
-
- base.init = function(){
- base.bind()
- }
-
- base.bind = function(){
- base.tube.on("clipper:update", rebuild)
- }
-
- base.wheel = new wheel({
- el: document.querySelector("#map"),
- update: function(e, val, delta){
- console.log(e.clientX, e.clientY, delta)
- }
- })
-
- function rebuild(){
- if (window.scene) {
- clear()
- build()
- }
- }
- function build (){
- clipper.regions.forEach(function(r){
- walls(r).forEach(function(el){
- els.push(el)
- scene.add(el)
- })
- })
- }
- function clear (){
- els.forEach(function(el){
- scene.remove(el)
- })
- els = []
- }
-
- function walls (r){
- var list = [], el = null
-
- var width = r.x.length()
- var depth = r.y.length()
- 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)
- }
- if (r.sides & BACK) {
- var el = wall('.back')
- el.width = width
- el.height = height
- 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.height = height
- el.width = depth
- el.x = r.x.a
- el.z = r.y.a + depth/2
- list.push(el)
- }
- if (r.sides & RIGHT) {
- el = wall('.right')
- el.rotationY = -HALF_PI
- el.height = height
- el.width = depth
- el.x = r.x.b
- el.z = r.y.b - depth/2
- 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
- }
-
- return list
- }
-
-}
-