diff options
Diffstat (limited to 'src/ru/olamedia/asset/shader')
-rw-r--r-- | src/ru/olamedia/asset/shader/block.fp | 28 | ||||
-rw-r--r-- | src/ru/olamedia/asset/shader/block.vp | 25 |
2 files changed, 53 insertions, 0 deletions
diff --git a/src/ru/olamedia/asset/shader/block.fp b/src/ru/olamedia/asset/shader/block.fp new file mode 100644 index 0000000..291e975 --- /dev/null +++ b/src/ru/olamedia/asset/shader/block.fp @@ -0,0 +1,28 @@ + + +smooth in vec2 texCoord; +//vec4 frontColor; + +uniform sampler2D mesh_ActiveTexture; + +vec4 frontColor = vec4(1.0); +const vec4 texEnvColor = vec4(0.0); + +const vec4 zerov4 = vec4(0.0); +const vec4 onev4 = vec4(1.0); + +vec4 calcTexColor(in vec4 color, in vec4 texColor) { + color.rgb = mix(color.rgb, texEnvColor.rgb, texColor.rgb); + color.a *= texColor.a; + color = clamp(color, zerov4, onev4); + return color; +} + +void main (void) +{ + vec4 texColor; + texColor = texture2D(mesh_ActiveTexture, texCoord.st); + if (texColor.a < 0.1f) discard; + vec4 color = calcTexColor(frontColor, texColor); + gl_FragColor = vec4(gl_FragColor.a) * gl_FragColor + vec4(1.0 - gl_FragColor.a) * texColor; +}
\ No newline at end of file diff --git a/src/ru/olamedia/asset/shader/block.vp b/src/ru/olamedia/asset/shader/block.vp new file mode 100644 index 0000000..989d182 --- /dev/null +++ b/src/ru/olamedia/asset/shader/block.vp @@ -0,0 +1,25 @@ +//precision lowp float; +//precision lowp int; +uniform mat4 pmvMatrix[4]; // P, Mv, Mvi and Mvit +uniform vec4 sunColor; +uniform sampler2D mesh_ActiveTexture; + +attribute vec4 mesh_vertices; +attribute vec4 mesh_colors; + +attribute vec2 mesh_texCoord; + +invariant out vec4 position; +vec4 color; +smooth out vec2 texCoord; + +void main(void) +{ + // Transforming The Vertex Position To ModelView-Space + position = pmvMatrix[1] * mesh_vertices; // vertex eye position + texCoord = mesh_texCoord; + + gl_Position = pmvMatrix[0] * position; + + color = mesh_colors * sunColor; +} |