graphics: Fix some variables in GLSL

This commit is contained in:
Hajime Hoshi 2017-12-03 19:07:12 +09:00
parent 71ca838193
commit 2e1e4adb84

View File

@ -32,15 +32,15 @@ attribute vec2 vertex;
attribute vec4 tex_coord;
attribute vec4 geo_matrix_body;
attribute vec2 geo_matrix_translation;
varying vec2 vertex_out_tex_coord;
varying vec2 vertex_out_tex_coord_min;
varying vec2 vertex_out_tex_coord_max;
varying vec2 varying_tex_coord;
varying vec2 varying_tex_coord_min;
varying vec2 varying_tex_coord_max;
void main(void) {
vertex_out_tex_coord = vec2(tex_coord[0], tex_coord[1]);
vertex_out_tex_coord_min =
varying_tex_coord = vec2(tex_coord[0], tex_coord[1]);
varying_tex_coord_min =
vec2(min(tex_coord[0], tex_coord[2]), min(tex_coord[1], tex_coord[3]));
vertex_out_tex_coord_max =
varying_tex_coord_max =
vec2(max(tex_coord[0], tex_coord[2]), max(tex_coord[1], tex_coord[3]));
mat4 geo_matrix = mat4(
vec4(geo_matrix_body[0], geo_matrix_body[2], 0, 0),
@ -63,17 +63,17 @@ precision mediump float;
uniform sampler2D texture;
uniform mat4 color_matrix;
uniform vec4 color_matrix_translation;
varying vec2 vertex_out_tex_coord;
varying vec2 vertex_out_tex_coord_min;
varying vec2 vertex_out_tex_coord_max;
varying vec2 varying_tex_coord;
varying vec2 varying_tex_coord_min;
varying vec2 varying_tex_coord_max;
void main(void) {
vec4 color = vec4(0, 0, 0, 0);
if (vertex_out_tex_coord_min.x <= vertex_out_tex_coord.x &&
vertex_out_tex_coord_min.y <= vertex_out_tex_coord.y &&
vertex_out_tex_coord.x < vertex_out_tex_coord_max.x &&
vertex_out_tex_coord.y < vertex_out_tex_coord_max.y) {
color = texture2D(texture, vertex_out_tex_coord);
if (varying_tex_coord_min.x <= varying_tex_coord.x &&
varying_tex_coord_min.y <= varying_tex_coord.y &&
varying_tex_coord.x < varying_tex_coord_max.x &&
varying_tex_coord.y < varying_tex_coord_max.y) {
color = texture2D(texture, varying_tex_coord);
}
// Un-premultiply alpha