what done?
This commit is contained in:
@ -0,0 +1,29 @@
|
||||
precision mediump float;
|
||||
|
||||
uniform sampler2D texture;
|
||||
uniform float alpha;
|
||||
uniform vec2 texAtlasSize;
|
||||
uniform float texAtlasIndex;
|
||||
|
||||
varying vec2 pass_TexCoords;
|
||||
|
||||
vec2 getTexCoordsInAtlas(in float atlasIndex);
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 texAtlasCoords = getTexCoordsInAtlas(texAtlasIndex);
|
||||
gl_FragColor = texture2D(texture, texAtlasCoords);
|
||||
gl_FragColor.a = min(gl_FragColor.a, alpha);
|
||||
|
||||
}
|
||||
|
||||
vec2 getTexCoordsInAtlas(in float atlasIndex){
|
||||
|
||||
vec2 texAtlasCoords = vec2(0.0, 0.0);
|
||||
texAtlasCoords.x = mod(pass_TexCoords.x, 1.0) / texAtlasSize.x;
|
||||
texAtlasCoords.x += mod(atlasIndex, texAtlasSize.x) / texAtlasSize.x;
|
||||
texAtlasCoords.y = mod(pass_TexCoords.y, 1.0) / texAtlasSize.y;
|
||||
texAtlasCoords.y += floor(atlasIndex / texAtlasSize.y) / texAtlasSize.y;
|
||||
return texAtlasCoords;
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
uniform mat4 mvpMatrix;
|
||||
uniform mat4 transformationMatrix;
|
||||
|
||||
attribute vec4 position;
|
||||
attribute vec2 texCoords;
|
||||
|
||||
varying vec2 pass_TexCoords;
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 transformatedPosition = transformationMatrix * position;
|
||||
gl_Position = mvpMatrix * transformatedPosition;
|
||||
pass_TexCoords = texCoords;
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
precision mediump float;
|
||||
|
||||
uniform sampler2D texture;
|
||||
uniform vec3 color;
|
||||
|
||||
varying vec2 pass_TexCoords;
|
||||
|
||||
void main() {
|
||||
|
||||
gl_FragColor.a = texture2D(texture, pass_TexCoords).a;
|
||||
gl_FragColor.rgb = color;
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
precision mediump float;
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
varying vec2 pass_TexCoords;
|
||||
|
||||
void main() {
|
||||
|
||||
gl_FragColor = texture2D(texture, pass_TexCoords);
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
attribute vec4 position;
|
||||
attribute vec2 texCoords;
|
||||
|
||||
varying vec2 pass_TexCoords;
|
||||
|
||||
void main() {
|
||||
|
||||
gl_Position = position;
|
||||
pass_TexCoords.x = texCoords.x;
|
||||
pass_TexCoords.y = -texCoords.y;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
uniform mat4 mvpMatrix;
|
||||
uniform mat4 transformationMatrix;
|
||||
|
||||
attribute vec4 position;
|
||||
attribute vec2 texCoords;
|
||||
|
||||
varying vec2 pass_TexCoords;
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 transformatedPosition = transformationMatrix * position;
|
||||
gl_Position = mvpMatrix * transformatedPosition;
|
||||
|
||||
pass_TexCoords = (transformationMatrix * vec4(texCoords, 0.0, 0.0)).xy;
|
||||
pass_TexCoords *= vec2(3.0, 3.0);
|
||||
pass_TexCoords.y = clamp(pass_TexCoords.y, 0.0, 1.0) + 0.01;
|
||||
|
||||
}
|
Reference in New Issue
Block a user