forked from pyalot/WebGL-City-SSAO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
52 lines (43 loc) · 1.42 KB
/
main.js
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
/*
:copyright: 2011 by Florian Boesch <[email protected]>.
:license: GNU AGPL3, see LICENSE for more details.
*/
$(function(){
var canvas = $('canvas')[0];
var glee = new Glee(canvas, handlers).load({
graph: graph,
onload: function(gl){
var self = this;
glee.resize(canvas.width, canvas.height);
var statistic = new Statistic();
var cube = new glee.Cube(0.15);
var sphere = new glee.Sphere(1.0);
var keys = new glee.Keys();
var view = new glee.Viewpoint({
position: new glee.Vec3(0.0, 5.0, 2.0),
keys: keys,
speed: 0.2,
});
var proj = new glee.Perspective({
width: canvas.width,
height: canvas.height,
fov: 75,
near: 0.001,
far: 40,
});
this.graph.init(glee, {
view: view,
proj: proj,
});
glee.schedule(function(delta, current){
view.step(delta);
self.graph.render();
glee.gl.finish();
var now = (new Date()).getTime();
var render_time = now - current;
statistic.tick(render_time);
//statistic.tick(delta*1000);
});
}
});
});