2169eb6064c2a15180071e229e1113fc618ab560
[tar-legacy.git] / MCDV_Web / dynview.html
1 <head>
2 <script type="text/javascript" src="gl-matrix.js"></script>
3 <script type="text/javascript" src="webgl-utils.js"></script>
4
5 <script id="shader-fs" type="x-shader/x-fragment">
6 precision mediump float;
7 varying vec2 vTextureCoord;
8 varying vec3 vLightWeighting;
9 uniform sampler2D uSampler;
10 void main(void) {
11 vec4 textureColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
12
13 float z = (gl_FragCoord.z / gl_FragCoord.w) * 0.003;
14 //gl_FragColor = vec4(z, z, z, 255);
15 gl_FragColor = vec4(textureColor.rgb * vLightWeighting, textureColor.a) + z;
16 }
17 </script>
18
19 <script id="shader-vs" type="x-shader/x-vertex">
20 attribute vec3 aVertexPosition;
21 attribute vec3 aVertexNormal;
22 attribute vec2 aTextureCoord;
23 uniform mat4 uMVMatrix;
24 uniform mat4 uPMatrix;
25 uniform mat4 viewMatrix;
26 uniform mat3 uNMatrix;
27 uniform vec3 uAmbientColor;
28 uniform vec3 uLightingDirection;
29 uniform vec3 uDirectionalColor;
30 varying vec2 vTextureCoord;
31 varying vec3 vLightWeighting;
32 void main(void) {
33 gl_Position = uPMatrix * viewMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
34 vTextureCoord = aTextureCoord;
35
36 vec3 transformedNormal = uNMatrix * aVertexNormal;
37 float directionalLightWeighting = max(dot(transformedNormal, uLightingDirection), 0.0);
38 vLightWeighting = uAmbientColor + uDirectionalColor * directionalLightWeighting;
39 }
40 </script>
41
42 <script src="dynview.js"></script>
43
44 </head>
45
46 <body>
47
48 <script>
49 var data = load_binary_resource("output.terri");
50 var reader = new binaryReader(data);
51
52
53 var kills_ct = [];
54 var kills_t = [];
55
56 var count = reader.readUint32();
57
58 for(var x = 0; x < count; x++){
59 var team = reader.readUint32();
60 console.log(team);
61 for(var i = 0; i < 6; i++){
62 kills_t.push(reader.readFloat());
63 }
64 }
65
66 console.log(kills_t);
67
68
69 //var level = new tbsp_level(map_data);
70 </script>
71
72 </body>