2 <script type=
"text/javascript" src=
"gl-matrix.js"></script>
3 <script type=
"text/javascript" src=
"webgl-utils.js"></script>
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;
11 vec4 textureColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
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;
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;
33 gl_Position = uPMatrix * viewMatrix * uMVMatrix * vec4(aVertexPosition,
1.0);
34 vTextureCoord = aTextureCoord;
36 vec3 transformedNormal = uNMatrix * aVertexNormal;
37 float directionalLightWeighting = max(dot(transformedNormal, uLightingDirection),
0.0);
38 vLightWeighting = uAmbientColor + uDirectionalColor * directionalLightWeighting;
42 <script src=
"dynview.js"></script>
49 var data = load_binary_resource(
"output.terri");
50 var reader = new binaryReader(data);
56 var count = reader.readUint32();
58 for(var x =
0; x < count; x++){
59 var team = reader.readUint32();
61 for(var i =
0; i <
6; i++){
62 kills_t.push(reader.readFloat());
69 //var level = new tbsp_level(map_data);