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
88
89
90
91
92
|
var is_iphone = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i));
var is_ipad = (navigator.userAgent.match(/iPad/i));
var is_android = (navigator.userAgent.match(/Android/i))
var is_mobile = is_iphone || is_ipad || is_android;
if (is_mobile) {
// window.location.href = "mobile.html"
}
else if ($.browser.msie || ! has3d()) {
// window.location.href = "error.html"
}
var scene, cam, map;
var viewHeight = window.viewHeight || 150
var app = new function(){}
app.init = function () {
app.tube = new Tube ()
app.router = new Router ()
}
app.launch = function () {
var mainbox,
coords,
box, size,
floor,
movements
scene = new MX.Scene().addTo('#scene')
scene.width = window.innerWidth
scene.height = window.innerHeight
scene.perspective = window.innerHeight
window.onresize = function () {
scene.width = window.innerWidth
scene.height = window.innerHeight
scene.perspective = window.innerHeight
scene.update()
}
cam = scene.camera
cam.y = viewHeight
if (MX.Map) map = app.map = new MX.Map()
movements = app.movements = new MX.Movements(cam, viewHeight)
movements.init()
function animate (t) {
requestAnimationFrame(animate)
environment.update(t)
window.path && path.update(t)
movements.update()
scene.update()
}
window.inAnimation = true
var loader = new Loader(function(){
$("#loader").hide()
window.environment && window.environment.init()
window.editor && window.editor.init()
window.path && window.path.init()
animate()
})
// loader.preloadImages([])
loader.ready()
}
app.on = function(){
app.tube.on.apply(app.tube, arguments)
}
app.off = function(){
app.tube.off.apply(app.tube, arguments)
}
app.position = function(obj){
return {
x: obj.x,
y: obj.y,
z: obj.z,
rotationX: obj.rotationX,
rotationY: obj.rotationY
}
}
document.addEventListener('DOMContentLoaded', app.init)
|