Last active
April 2, 2016 12:04
-
-
Save yomotsu/1d4cbcabbe791a69a4f5c2d00dfa2577 to your computer and use it in GitHub Desktop.
spriteAnimation in particle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uniform vec2 spriteLength; | |
uniform sampler2D texture; | |
varying float progress; | |
void main() { | |
vec2 texCoord = vec2( | |
gl_PointCoord.x / spriteLength.x + 1. / spriteLength.x * floor( spriteLength.x * progress * spriteLength.y ), | |
1. - ( gl_PointCoord.y / spriteLength.y + 1. / spriteLength.y * floor( spriteLength.y * progress ) ) | |
); | |
gl_FragColor = texture2D( texture, vec2( texCoord ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment