1. Philipp Tiefenbacher
  2. WebEvoCell

Commits

Philipp Tiefenbacher  committed 5ae7149 Draft

fixed recursive zoom bug in reactor

  • Participants
  • Parent commits d22057f
  • Branches default

Comments (0)

Files changed (2)

File src/game/CellSpace.js

View file
  • Ignore whitespace
 				if (shipX < 0 || shipX > gameW || shipY < 0 || shipY > gameH)
 					shipX = gameW/2, shipY = gameH/2;
 			}
-			// ist das hier Ist auch rekursiv
-			reactor.mixDish(drawRectShader, shipDish, {rectPos: [shipX+1, shipY+1], rectSize: [8, 8], state: (shipRule.nrStates-1)/255});
-			
-			// das IST REKURSIV
-			/*
-			reactor.mixDish(copyShader, copyDish, {
+	
+			// copy paste stuff
+			if (keyboard.isPressed(65+2))
+			{
+				reactor.mixDish(copyShader, copyDish, {
 					texSource: enemy2Dish, sourcePos: [0, 0], sourceRes: [gameW, gameH], 
 					destinationPos: [20, 20], destinationSize: [80, 40], destinationRes: [gameW, gameH]
 					}); 
-			//*/
+			}
+			if (keyboard.isPressed(27))
+			{
+				copyDish.setAll(0);
+			}
 
-			var gl = reactor.gl;
 			// ENEMIES //////////////////////////////////////
 			if (cnt % 3 == 0)
 				reactor.step(enemyRule, enemyDish);
 			reactor.mixDish(drawRectShader, shipDish, {rectPos: [shipX+1, shipY+1], rectSize: [8, 8], state: (shipRule.nrStates-1)/255});
 			reactor.mixDish(drawRectShader, enemyDish, {rectPos: [shipX+1, shipY+1], rectSize: [3, 3], state: 0});
 
-
-			if (keyboard.isPressed(65+2))
-			{
-				/*
-				uniform sampler2D texFrame;
-				uniform vec2 destinationPos;
-				uniform vec2 destinationSize;
-				uniform vec2 destinationRes;
-
-				uniform sampler2D texSource;
-				uniform vec2 sourcePos;
-				uniform vec2 sourceRes; 
-				*/
-
-				reactor.mixDish(copyShader, copyDish, {
-					texSource: enemy2Dish, sourcePos: [0, 0], sourceRes: [gameW, gameH], 
-					destinationPos: [20, 20], destinationSize: [80, 40], destinationRes: [gameW, gameH]
-					}); 
-				
-
-				//reactor.mixDish(drawRectShader, copyDish, {rectPos: [10, 10], rectSize: [5, 10], state: 3/255.});
-		/*
-				reactor.mixDish(copyShader, copyDish, {
-					texSource: shipDish, sourcePos: [0, 0], sourceRes: [gameW, gameH], 
-					destinationPos: [0, 0], destinationSize: [20, 20], destinationRes: [gameW, gameH],
-					}); 
-		*/
-			}
-			if (keyboard.isPressed(27))
-			{
-				copyDish.setAll(0);
-				copyDish.randomize(4, 0.1);
-			}
-
-			//reactor.mixDish(drawRectShader, shipDish, {rectPos: [10, 10], rectSize: [5, 10], state: 3/255.});
-
 			// Dish INTERACTION ///////////////////////////////////
 			reactor.mixDish(intersectSpawnShader, shipExplosionDish, {tex1: shipDish, tex2: enemyDish, state: (shipExplosionRule.nrStates-1)/255.});
 			reactor.mixDish(intersectSpawnShader, enemyDish, {tex1: enemyDish, tex2: shipExplosionDish, state: 1./255.});
 			
 			reactor.mixDish(mixShader, renderDish, {texNew: copyDish, texPalette: copyColors.getTexture()});		
 
-			//RENDER
+			//RENDER			
 			reactor.paintDish(paintShader, renderDish, function(gl, shader) {
 				gl.uniform1f(gl.getUniformLocation(shader, "scale"), zoom);
 			});

File src/game/gl/Reactor.js

View file
  • Ignore whitespace
 
 	Reactor.prototype.mixDish = function(mixShader, mainDish, parameters, callback)
 	{
+		this.gl.viewport(0,0, mainDish.width, mainDish.height);
 		var framebuffer = mainDish.getNextFramebuffer();
 		var bindCallback = function(gl, progCA)
 		{
 
 	Reactor.prototype.applyShaderOnDish = function(shader, dish, bindCallbackUser)
 	{
-
 		this.gl.viewport(0,0, dish.width, dish.height);
 
 		var framebuffer = dish.getNextFramebuffer();