-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
63 lines (60 loc) · 2.01 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>water simulation</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="waterSim.css">
</head>
<body>
<script src="liquidfun.js"></script>
<script>
// liquidfun ask for global variable
var world = null;
var timeStep = 1.0 / 60.0;
var velocityIterations = 8;
var positionIterations = 3;
var mouseJoint = null;
var mouseTracing = false;
var mouseTracerPos = new b2Vec2(0,0);
var mouseTracerVel = new b2Vec2(0,0);
var mouseWorldPos = new b2Vec2(0,0);
var start = false;
Module['printErr'] = function(text) { console.log('stdout: ' + text) };
Module['onRuntimeInitialized'] = function() {
console.log("onRuntimeInitialized");
start = true;
};
</script>
<script src="viewer.js"></script>
<script>
(function myLoop (i) {
setTimeout(function () {
if(start){
viewer.initAll();
start = false;
}
if (--i)
myLoop(i); // decrement i and call myLoop again if i > 0
}, 100)
})(10);
</script>
</body>
<script id="debugVS" type="x-shader/x-vertex">
varying vec2 vUv;
void main()
{
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
</script>
<script id="debugFS" type="x-shader/x-fragment">
uniform sampler2D tex;
varying vec2 vUv;
void main()
{
vec4 color = texture2D(tex,vUv);
gl_FragColor = color;
}
</script>
</html>