summaryrefslogtreecommitdiff
path: root/assets/javascripts/rectangles/_env.js
blob: f014a8ea459960367a7f9e563bc7cbbc41c2a97a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
var environment = new function(){}
environment.init = function(){
	window.scene && scene.camera.move({
		"x": 1000,
		"y": 1500,
		"z": 250,
		"rotationX": 0, // PI/2,
		"rotationY": PI/2, // PI
	})
	
// 	map.center.a = scene.camera.x
// 	map.center.b = scene.camera.z
	map.center.a = 0
	map.center.b = 0

	clipper.rooms.push( new room ({
		rect: new rect(0,0, 500,500),
		height: 500,
	}))
	clipper.rooms.push( new room ({
		rect: new rect(600,0, 1100,500),
		height: 500,
	}))
	clipper.rooms.push( new room ({
		rect: new rect(450,150, 650,350),
		height: 300,
	}))
	app.movements.gravity(true)
	
	if (window.location.href.match(/stone/)) {
		app.on("clip", function(){
			$(".face").css({
				"background-image": "url(http://i.asdf.us/im/4a/_1398144847_frankhats.gif)"
			})
		})
		$("#map").hide()
	}
	
	builder.init()
	clipper.init()
	mover.init()
	window.scene && scene.update()
	environment.update()

}
environment.update = function(t){
	if (window.scene && scene.camera) {
// 		map.center.a = scene.camera.x
// 		map.center.b = -scene.camera.z
	}
	else {
		requestAnimationFrame(environment.update)
	}
	map.update()
	z = false
}