From 5e0c67b5d70d90ea12b207e3c442378559f8f219 Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Wed, 23 Jul 2014 18:51:51 -0400 Subject: basic culling tests --- public/assets/javascripts/rectangles/models/room.js | 6 ++++-- public/assets/javascripts/rectangles/models/vec2.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'public/assets/javascripts/rectangles/models') diff --git a/public/assets/javascripts/rectangles/models/room.js b/public/assets/javascripts/rectangles/models/room.js index 748b244..e5f42fe 100644 --- a/public/assets/javascripts/rectangles/models/room.js +++ b/public/assets/javascripts/rectangles/models/room.js @@ -1,14 +1,16 @@ (function(){ - var vec2, Rect, sort + var vec2, Rect, UidGenerator, sort if ('window' in this) { vec2 = window.vec2 Rect = window.Rect + UidGenerator = window.UidGenerator sort = window.sort } else { vec2 = require('./vec2') Rect = require('./rect') + UidGenerator = require('../util/uid') sort = require('../util/sort') FRONT = 0x1, BACK = 0x2, LEFT = 0x4, RIGHT = 0x8, FLOOR = 0x10, CEILING = 0x20 TOP = CEILING, BOTTOM = FLOOR @@ -25,7 +27,7 @@ } var Room = function(opt){ - this.id = opt.id || Rooms.uid("room_") + this.id = opt.id || UidGenerator("room_") this.rect = opt.rect this.regions = [] this.walls = [] diff --git a/public/assets/javascripts/rectangles/models/vec2.js b/public/assets/javascripts/rectangles/models/vec2.js index 5c2b519..b0c88c1 100644 --- a/public/assets/javascripts/rectangles/models/vec2.js +++ b/public/assets/javascripts/rectangles/models/vec2.js @@ -7,7 +7,7 @@ return this.b-this.a } vec2.prototype.length = function(){ - return abs(this.b-this.a) + return Math.abs(this.b-this.a) } vec2.prototype.dist = function(){ return dist(0,this.a,0,this.b) -- cgit v1.2.3-70-g09d2