summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/engine/rooms/grouper.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/rectangles/engine/rooms/grouper.js')
-rw-r--r--public/assets/javascripts/rectangles/engine/rooms/grouper.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/public/assets/javascripts/rectangles/engine/rooms/grouper.js b/public/assets/javascripts/rectangles/engine/rooms/grouper.js
index ba081e3..4ad3bd8 100644
--- a/public/assets/javascripts/rectangles/engine/rooms/grouper.js
+++ b/public/assets/javascripts/rectangles/engine/rooms/grouper.js
@@ -1,9 +1,10 @@
(function(){
- var vec2, Rect, Rooms, UidGenerator, Wall, sort
+ var vec2, Rect, Rooms, UidGenerator, Wall, Surface, sort
if ('window' in this) {
vec2 = window.vec2
Rect = window.Rect
+ Surface = window.Surface
Rooms = window.Rooms
UidGenerator = window.UidGenerator
Wall = window.Wall
@@ -15,6 +16,7 @@
vec2 = require('../../models/vec2')
Rect = require('../../models/rect')
Wall = require('../../models/wall')
+ Surface = require('../../models/surface')
sort = require('../../util/sort')
FRONT = 0x1, BACK = 0x2, LEFT = 0x4, RIGHT = 0x8, FLOOR = 0x10, CEILING = 0x20
PI = Math.PI
@@ -115,23 +117,23 @@
if (useX && wall.vec.b == mx.rect.x.a) {
wall.vec.b = mx.rect.x.b
wall.mx.push(mx)
- wall.faces.push(mx.face)
+ wall.surface.add(mx.face)
return
}
else if (! useX && wall.vec.b == mx.rect.y.a) {
wall.vec.b = mx.rect.y.b
wall.mx.push(mx)
- wall.faces.push(mx.face)
+ wall.surface.add(mx.face)
return
}
}
wall = new Wall ({
- id: base.uid(),
- side: side,
- mx: [ mx ],
- faces: [ mx.face ],
- vec: mx.rect[ useX ? 'x' : 'y' ].clone(),
- edge: mx.rect[ useX ? 'y' : 'x' ][ useA ? 'a' : 'b' ],
+ id: base.uid(),
+ side: side,
+ mx: [ mx ],
+ surface: new Surface( mx.face ),
+ vec: mx.rect[ useX ? 'x' : 'y' ].clone(),
+ edge: mx.rect[ useX ? 'y' : 'x' ][ useA ? 'a' : 'b' ],
})
walls.push(wall)
})