Merge pull request #6 from faiface/dev

merge shader error fix
This commit is contained in:
Michal Štrba 2017-04-26 18:01:45 +02:00 committed by GitHub
commit 64aa32a4b4
1 changed files with 7 additions and 7 deletions

View File

@ -311,14 +311,14 @@ func (cp *canvasPicture) Draw(t pixel.TargetTriangles) {
const ( const (
canvasPosition int = iota canvasPosition int = iota
canvasColor canvasColor
canvasTexture canvasTexCoords
canvasIntensity canvasIntensity
) )
var canvasVertexFormat = glhf.AttrFormat{ var canvasVertexFormat = glhf.AttrFormat{
canvasPosition: {Name: "position", Type: glhf.Vec2}, canvasPosition: {Name: "position", Type: glhf.Vec2},
canvasColor: {Name: "color", Type: glhf.Vec4}, canvasColor: {Name: "color", Type: glhf.Vec4},
canvasTexture: {Name: "texture", Type: glhf.Vec2}, canvasTexCoords: {Name: "texCoords", Type: glhf.Vec2},
canvasIntensity: {Name: "intensity", Type: glhf.Float}, canvasIntensity: {Name: "intensity", Type: glhf.Float},
} }
@ -341,11 +341,11 @@ var canvasVertexShader = `
in vec2 position; in vec2 position;
in vec4 color; in vec4 color;
in vec2 texture; in vec2 texCoords;
in float intensity; in float intensity;
out vec4 Color; out vec4 Color;
out vec2 Texture; out vec2 TexCoords;
out float Intensity; out float Intensity;
uniform mat3 transform; uniform mat3 transform;
@ -356,7 +356,7 @@ void main() {
vec2 normPos = (transPos - bounds.xy) / bounds.zw * 2 - vec2(1, 1); vec2 normPos = (transPos - bounds.xy) / bounds.zw * 2 - vec2(1, 1);
gl_Position = vec4(normPos, 0.0, 1.0); gl_Position = vec4(normPos, 0.0, 1.0);
Color = color; Color = color;
Texture = texture; TexCoords = texCoords;
Intensity = intensity; Intensity = intensity;
} }
` `
@ -365,7 +365,7 @@ var canvasFragmentShader = `
#version 330 core #version 330 core
in vec4 Color; in vec4 Color;
in vec2 Texture; in vec2 TexCoords;
in float Intensity; in float Intensity;
out vec4 color; out vec4 color;
@ -380,7 +380,7 @@ void main() {
} else { } else {
color = vec4(0, 0, 0, 0); color = vec4(0, 0, 0, 0);
color += (1 - Intensity) * Color; color += (1 - Intensity) * Color;
vec2 t = (Texture - texBounds.xy) / texBounds.zw; vec2 t = (TexCoords - texBounds.xy) / texBounds.zw;
color += Intensity * Color * texture(tex, t); color += Intensity * Color * texture(tex, t);
color *= colorMask; color *= colorMask;
} }