Created
July 15, 2017 06:36
-
-
Save Nehon/687890630061f7aafa471ce3d96d7875 to your computer and use it in GitHub Desktop.
This file contains 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 sampler2D m_ColorMap; | |
varying vec2 texCoord; | |
void main(){ | |
gl_FragColor = texture2D(m_ColorMap, texCoord); | |
} |
This file contains 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
MaterialDef Anim { | |
MaterialParameters { | |
Texture2D ColorMap | |
Float InvSizeX : 1 | |
Float InvSizeY : 1 | |
Float Speed | |
} | |
Technique { | |
VertexShader GLSL100: MatDefs/Anim.vert | |
FragmentShader GLSL100: MatDefs/Anim.frag | |
WorldParameters { | |
WorldViewProjectionMatrix | |
Time | |
} | |
Defines { | |
} | |
} | |
} |
This file contains 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 mat4 g_WorldViewProjectionMatrix; | |
uniform float g_Time; | |
uniform float m_InvSizeX; | |
uniform float m_InvSizeY; | |
uniform float m_Speed; | |
attribute vec3 inPosition; | |
attribute vec2 inTexCoord; | |
varying vec2 texCoord; | |
void main(){ | |
float t = fract(g_Time) * m_Speed; | |
texCoord.x = inTexCoord.x * m_InvSizeX + floor(t / m_InvSizeX) * m_InvSizeX; | |
float adjust = step(1.0,inTexCoord.x) * step(texCoord.x,floor(texCoord.x )); | |
texCoord.y = (1.0 - inTexCoord.y) * m_InvSizeY + floor(texCoord.x - adjust) * m_InvSizeY ; | |
gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment