diff webGL/dandy/dandy4.html @ 14:a2b31fe50d9d

upload
author NOBUYASU Oshiro
date Sat, 17 Jul 2010 08:11:20 +0900
parents 4684e849866c
children 527eac9a7d0b
line wrap: on
line diff
--- a/webGL/dandy/dandy4.html	Sat Jul 17 01:26:32 2010 +0900
+++ b/webGL/dandy/dandy4.html	Sat Jul 17 08:11:20 2010 +0900
@@ -67,7 +67,7 @@
 				v_texCoord = vTexCoord.st;
 				vec4 transNormal = u_normalMatrix * vec4(vNormal,1);
 				v_Dot = max(dot(transNormal.xyz, lightDir), 0.0);
-//				v_Dot = min(dot(transNormal.xyz, lightDir), 1.0);
+				//				v_Dot = min(dot(transNormal.xyz, lightDir), 1.0);
 			}
 			</script> 
 		
@@ -80,25 +80,25 @@
 			void main()
 			{
 				vec4 color = texture2D(sampler2d,v_texCoord);
-//				color += vec4(0.1,0.1,0.1,1);
-//		        if(color.a == 1)color=vec4(1,0,0,1);
-//		        else color=vec4(0,1,1,1);
+				//				color += vec4(0.1,0.1,0.1,1);
+				//		        if(color.a == 1)color=vec4(1,0,0,1);
+				//		        else color=vec4(0,1,1,1);
 				gl_FragColor = vec4(color.xyz * v_Dot, color.a);
-//				gl_FragColor = vec4(color.xyz * v_Dot, 0.5);
+				//				gl_FragColor = vec4(color.xyz * v_Dot, 0.5);
 			}
 			</script> 
 		
 		<script> 
-		        //audioの試運転
+			//audioの試運転
 			var audio = window.Audio && new Audio("sound/sample.wav");
 			var audioShoot = window.Audio && new Audio("sound/shota.wav");
-
+			
 			//画面(canvas)の大きさ
 			var w = 1024;
-		        var h = 640;
-
-
-
+			var h = 640;
+			
+			
+			
 			function init()
 			{
 				var gl = initWebGL("example", "vshader", "fshader", 
@@ -109,11 +109,11 @@
 				gl.uniform1i(gl.getUniformLocation(gl.program, "sampler2d"), 0);
 				
 				gl.enable(gl.TEXTURE_2D);
-
-			        sankakuf();//mycos,mysinの作成 sankaku.js
-
-               		        parseXml(gl);//parse.js
-
+				
+				sankakuf();//mycos,mysinの作成 sankaku.js
+				
+				parseXml(gl);//parse.js
+				
 				return gl;
 			}
 			
@@ -125,7 +125,7 @@
 				var canvas = document.getElementById('example');
 				if (canvas.width == width && canvas.width == height)
 				return;
-
+				
 				
 				width = canvas.width;
 				height = canvas.height;
@@ -133,86 +133,86 @@
 				ctx.viewport(0, 0, width, height);
 				
 				ctx.perspectiveMatrix = new CanvasMatrix4();
-			        ctx.perspectiveMatrix.lookat(0,0,-60, 0, 0, 0, 0, 1, 0);
+				ctx.perspectiveMatrix.lookat(0,0,-60, 0, 0, 0, 0, 1, 0);
 				ctx.perspectiveMatrix.ortho(ortho.left, ortho.right, ortho.top, -ortho.bottom, 0, 10000);
-//				ctx.perspectiveMatrix.ortho(-600, 600, 600, -600, 0, 10000);
+				//				ctx.perspectiveMatrix.ortho(-600, 600, 600, -600, 0, 10000);
 			}
 			
-
-
+			
+			
 			function loop(ctx, ortho)
 			{
 				reshape(ctx, ortho);
 				ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT);
-			
-
-
-			        Player(ctx, jiki, pad, ortho);
-
-			        obj_draw(ctx);
-			
-			        PutBom(ctx);
-			        pause();
-
-
+				
+				
+				
+				Player(ctx, jiki, pad, ortho);
+				
+				obj_draw(ctx);
+				
+				PutBom(ctx);
+				pause();
+				
+				
 				ctx.flush();
-
+				
 				filpcount++;
-			        schedule();
-
-		                state_update();
-
-			        collision_detect();
-			        delete_obj( ctx )
-
+				schedule();
+				
+				state_update();
+				
+				collision_detect();
+				delete_obj( ctx )
+				
 				framerate.snapshot();
 			}
-
+			
 			function opening(ctx, ortho)
 			{
 				reshape(ctx, ortho);
 				ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT);
-
-           			PutSpriteF(ctx, 100, 70, 1, font[10]);
-		        	PutSpriteF(ctx, 170, 50, 1, font[11]);
-          			PutSpriteF(ctx, 40, 120, 1, font[12]);	
-
-
-			        ctx.flush();
-
-			        if(pad.start == 0) {setTimeout(o, 100);}
-			        if(pad.start != 0) {
-          		               jiki.bf = true;
-                                       pad.st = 1;
-			               gameflage = 1;
-                                       audio && audio.play();
-      	                               setInterval(f, 10);
-			         }
+				
+				PutSpriteF(ctx, 100, 70, 1, font[10]);
+				PutSpriteF(ctx, 170, 50, 1, font[11]);
+				PutSpriteF(ctx, 40, 120, 1, font[12]);	
+				
+				
+				ctx.flush();
+				
+				if(pad.start == 0) {setTimeout(o, 100);}
+				if(pad.start != 0) {
+					jiki.bf = true;
+					pad.st = 1;
+					gameflage = 1;
+					audio && audio.play();
+					setInterval(f, 10);
+				}
 			}
 			function start()
 			{
-//			        event.onkeydown = keydown;
-//			        event.onkeypress = keypress;
-//			        event.onkeyup = keyup;
-
-               			var ortho = makeOrthoPara(0,200,140,0);
-
+				//			        event.onkeydown = keydown;
+				//			        event.onkeypress = keypress;
+				//			        event.onkeyup = keyup;
+				
+				var ortho = makeOrthoPara(0,200,140,0);
+				
 				var c = document.getElementById("example");
-
-
-			        //画面の大きさ
+				
+				
+				//画面の大きさ
 				c.width = w;
 				c.height = h;
-
+				
 				var ctx = init();
-
+				
 				currentAngle = 0;
-//				var f = function() { loop(ctx, ortho) };
+				//				var f = function() { loop(ctx, ortho) };
 				f = function() { loop(ctx, ortho) };
-			        o = function() {opening(ctx, ortho)}
-			        setTimeout(o, 10);
-//			        if(pad.start != 0) setInterval(f, 10);
-//			         setInterval(f, 10);
+				o = function() {opening(ctx, ortho)}
+				setTimeout(o, 10);
+				//			        if(pad.start != 0) setInterval(f, 10);
+				//			         setInterval(f, 10);
 				framerate = new Framerate("framerate");
 			}
 			</script> 
@@ -223,7 +223,7 @@
 			</style> 
 	</head> 
 	<body onload="start()" onkeydown="keybordDown()" onkeypress="keybordPress()" onkeyup="keybordUp()" style='overflow:hidden'>
-<!--<body onload = "start()" style='overflow:hidden'> -->
+		<!--<body onload = "start()" style='overflow:hidden'> -->
 		<canvas id="example"> 
 			There is supposed to be an example drawing here, but it's not important.
 		</canvas>