0
|
1 <html>
|
|
2 <head>
|
|
3 <title>Earth and Mars</title>
|
|
4 <script src="resources/render/SceneGraphRoot.js" type="text/javascript"></script>
|
|
5 <script src="resources/render/SceneGraph.js" type="text/javascript"></script>
|
|
6 <script src="resources/render/jkl-parsexml.js" type="text/javascript"></script>
|
|
7 <script src="resources/render/Image_xml.js" type="text/javascript"></script>
|
|
8 <script src="resources/render/keybord.js" type="text/javascript"></script>
|
|
9 <script src="resources/render/DrawObject.js" type="text/javascript"></script>
|
|
10 <script src="resources/render/init.js" type="text/javascript"> </script>
|
|
11 <script src="resources/render/camera.js" type="text/javascript"> </script>
|
|
12 <script src="resources/render/J3DI.js" type="text/javascript"> </script>
|
|
13 <script src="resources/render/J3DIMath.js" type="text/javascript"> </script>
|
|
14 <script src="resources/render/webgl-utils.js" type="text/javascript"></script>
|
|
15
|
|
16 <script src="resources/main.js" type="text/javascript"></script>
|
|
17 <script src="resources/bullet.js" type="text/javascript"></script>
|
|
18 <script src="resources/pants.js" type="text/javascript"></script>
|
|
19 <script src="resources/human.js" type="text/javascript"></script>
|
|
20 <script src="resources/combat_plane.js" type="text/javascript"></script>
|
|
21
|
|
22 <script id="vshader" type="x-shader/x-vertex">
|
|
23 uniform mat4 u_modelViewProjMatrix;
|
|
24 uniform mat4 u_normalMatrix;
|
|
25 uniform vec3 lightDir;
|
|
26 attribute vec3 vNormal;
|
|
27 attribute vec4 vTexCoord;
|
|
28 attribute vec4 vPosition;
|
|
29 varying float v_Dot;
|
|
30 varying vec2 v_texCoord;
|
|
31 void main(){
|
|
32 gl_Position = u_modelViewProjMatrix * vPosition;
|
|
33 v_texCoord = vTexCoord.st;
|
|
34 vec4 transNormal = u_normalMatrix * vec4(vNormal,1);
|
|
35 v_Dot = max(min(dot(transNormal.xyz, lightDir),1.0), 0.8);
|
|
36 }
|
|
37 </script>
|
|
38 <script id="fshader" type="x-shader/x-fragment">
|
|
39 #ifdef GL_ES
|
|
40 precision mediump float;
|
|
41 #endif
|
|
42 uniform sampler2D sampler2d;
|
|
43 varying float v_Dot;
|
|
44 varying vec2 v_texCoord;
|
|
45 void main(){
|
|
46 vec4 color = texture2D(sampler2d,v_texCoord);
|
|
47 color += vec4(0.1,0.1,0.1,1);
|
|
48 gl_FragColor = vec4(color.xyz * v_Dot, color.a);
|
|
49 }
|
|
50 </script>
|
|
51
|
|
52 <style type="text/css">
|
|
53 canvas {
|
|
54 border: 2px solid black;
|
|
55 }
|
|
56 </style>
|
|
57 </head>
|
|
58 <body onload="start()">
|
|
59 <canvas id="screen"></canvas>
|
|
60 <div id="framerate"></div>
|
|
61 <div id="console"></div>
|
|
62 </body>
|
|
63 </html>
|