diff options
Diffstat (limited to 'assets/javascripts/rectangles/engine')
| -rw-r--r-- | assets/javascripts/rectangles/engine/builder.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/assets/javascripts/rectangles/engine/builder.js b/assets/javascripts/rectangles/engine/builder.js index d5caeee..748e8c5 100644 --- a/assets/javascripts/rectangles/engine/builder.js +++ b/assets/javascripts/rectangles/engine/builder.js @@ -42,13 +42,15 @@ var builder = new function(){ function bind (){ clipper.rooms.forEach(function(room){ - room.bind() + var walls = room.group_walls() + walls.forEach(function(wall){ wall.bind() }) }) } function clear (){ els.forEach(function(el){ scene.remove(el) + el.destroy && el.destroy() }) els = [] } @@ -70,6 +72,7 @@ var builder = new function(){ el.x = region.x.a + width/2 el.y = height/2 el.z = region.y.a + el.rect = region el.side = FRONT room.walls.push(el) list.push(el) @@ -82,6 +85,7 @@ var builder = new function(){ el.x = region.x.b - width/2 el.y = height/2 el.z = region.y.b + el.rect = region el.side = BACK room.walls.push(el) list.push(el) @@ -94,6 +98,7 @@ var builder = new function(){ el.x = region.x.a el.y = height/2 el.z = region.y.a + depth/2 + el.rect = region el.side = LEFT room.walls.push(el) list.push(el) @@ -106,6 +111,7 @@ var builder = new function(){ el.x = region.x.b el.y = height/2 el.z = region.y.b - depth/2 + el.rect = region el.side = RIGHT room.walls.push(el) list.push(el) @@ -180,6 +186,7 @@ var builder = new function(){ el.x = region.x.a el.y = lo.height + height/2 el.z = region.y.a + depth/2 + el.rect = region list.push(el) hi.walls.push(el) region.half_sides |= LEFT @@ -193,6 +200,7 @@ var builder = new function(){ el.x = region.x.b el.y = lo.height + height/2 el.z = region.y.b - depth/2 + el.rect = region list.push(el) hi.walls.push(el) region.half_sides |= RIGHT @@ -206,6 +214,7 @@ var builder = new function(){ el.x = region.x.a + width/2 el.y = lo.height + height/2 el.z = region.y.a + el.rect = region list.push(el) hi.walls.push(el) region.half_sides |= FRONT @@ -219,6 +228,7 @@ var builder = new function(){ el.x = region.x.b - width/2 el.y = lo.height + height/2 el.z = region.y.b + el.rect = region list.push(el) hi.walls.push(el) region.half_sides |= BACK @@ -237,6 +247,7 @@ var builder = new function(){ el.y = 0 el.z = region.y.a + depth/2 el.rotationX = PI/2 + el.rect = region el.side = FLOOR return el } @@ -252,6 +263,7 @@ var builder = new function(){ el.y = height el.z = region.y.a + depth/2 el.rotationX = -PI/2 + el.rect = region el.side = CEILING return el } @@ -264,6 +276,10 @@ var builder = new function(){ el.type = "Face" el.el.style.opacity = 1.0 el.side = 0 + el.rect = null + el.destroy = function(){ + this.el = this.rect = null + } return el } |
