diff options
Diffstat (limited to 'src/shaders')
| -rw-r--r-- | src/shaders/default.frag | 19 | ||||
| -rw-r--r-- | src/shaders/default.vert | 21 |
2 files changed, 24 insertions, 16 deletions
diff --git a/src/shaders/default.frag b/src/shaders/default.frag index 241369e..2ad6732 100644 --- a/src/shaders/default.frag +++ b/src/shaders/default.frag @@ -1,16 +1,21 @@ #version 330 core out vec4 FragColor; -in vec3 ourColor; -in vec2 TexCoord; +in vec4 v_Color; +in vec2 v_TexCoord; +in float v_TexId; -uniform sampler2D texture1; -//uniform sampler2D texture2; +uniform sampler2D texture_1; void main() { - vec2 texInvert = vec2(TexCoord.x, -TexCoord.y); - FragColor = texture(texture1, texInvert);// * ourColor; - //FragColor = texture(ourTexture, TexCoord) * vec4(ourColor.xyz, 1.0); + if(v_TexId > 0) + { + FragColor = texture(texture_1, v_TexCoord) * v_Color; + } + else + { + FragColor = v_Color; + } } diff --git a/src/shaders/default.vert b/src/shaders/default.vert index 5adf795..38e5343 100644 --- a/src/shaders/default.vert +++ b/src/shaders/default.vert @@ -1,16 +1,19 @@ #version 330 core -layout (location = 0) in vec3 aPos; -layout (location = 1) in vec3 aColor; -layout (location = 2) in vec2 aTexCoord; +layout (location = 0) in vec3 a_Pos; +layout (location = 1) in vec4 a_Color; +layout (location = 2) in vec2 a_TexCoord; +layout (location = 3) in float a_TexId; -uniform float offset_x; +//uniform float offset_x; -out vec3 ourColor; -out vec2 TexCoord; +out vec4 v_Color; +out vec2 v_TexCoord; +out float v_TexId; void main() { - gl_Position = vec4(aPos.x + offset_x, aPos.yz, 1.0); - ourColor = aColor; - TexCoord = aTexCoord; + gl_Position = vec4(a_Pos, 1.0); + v_Color = a_Color; + v_TexCoord = a_TexCoord; + v_TexId = a_TexId; } |
