Explorar o código

use texture red for gradient Y input

ncannasse %!s(int64=8) %!d(string=hai) anos
pai
achega
1c788cfdb1
Modificáronse 1 ficheiros con 2 adicións e 3 borrados
  1. 2 3
      h2d/Particles.hx

+ 2 - 3
h2d/Particles.hx

@@ -40,7 +40,7 @@ private class ParticleShader extends hxsl.Shader {
 		function fragment() {
 			pixelColor = textureColor;
 			pixelColor.a *= input.color.a;
-			if( hasGradient ) pixelColor *= gradient.get(input.color.rg);
+			if( hasGradient ) pixelColor *= gradient.get(vec2(input.color.r,textureColor.r));
 		}
 
 	}
@@ -100,8 +100,7 @@ private class Particle extends h2d.SpriteBatch.BatchElement {
 		else
 			alpha = 1;
 
-		r = t;
-		g = 0;
+		r = t; // pass to pshader for colorGradient
 
 		if( group.animationRepeat > 0 )
 			this.t = group.tiles[Std.int(t * group.tiles.length * group.animationRepeat) % group.tiles.length];