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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
var environment = new function(){}
environment.init = function(){
scene = new MX.Scene().addTo('#scene')
scene.width = window.innerWidth
scene.height = window.innerHeight
scene.perspective = window.innerHeight
cam = scene.camera
cam.y = viewHeight
if (is_mobile) {
app.movements = new MX.MobileMovements(cam, viewHeight)
}
else {
app.movements = new MX.Movements(cam, viewHeight)
}
app.movements.init()
map = new Map ()
if (window.scene) {
scene.camera.move({
"x": 0,
"y": 0,
"z": 0,
"rotationX": 0, // PI/2,
"rotationY": PI/2, // PI
// "rotationX": 0,
// "rotationY": PI
})
scene.camera.radius = 20
}
window.onresize = function () {
scene.width = window.innerWidth
scene.height = window.innerHeight
scene.perspective = window.innerHeight
scene.update()
}
Rooms.init()
Walls.init()
Scenery.init()
Sculpture.init()
scene.update()
environment.update()
app.movements.gravity(true)
var minimap_el = document.querySelector("#minimap .el")
if (minimap_el) {
window.minimap = new Map ({
type: "minimap",
el: document.querySelector("#minimap .el"),
width: 130,
height: 130,
zoom: -4.8
})
}
keys.on("z", function(e){
e.preventDefault()
if (e.ctrlKey || e.metaKey) {
if (e.shiftKey) {
var canRedo = UndoStack.redo()
console.log("can redo", canRedo)
}
else {
var canUndo = UndoStack.undo()
console.log("can undo", canUndo)
}
}
})
}
environment.minimal = function(){
environment.update = function(t){}
}
environment.update = function(t, dt){
app.movements.update(dt || 0)
scene.update()
map.update()
window.minimap && minimap.update && minimap.update()
z = false
}
|