summary refs log tree commit diff
path: root/res/shaders
diff options
context:
space:
mode:
authoriurii <[email protected]>2024-09-07 14:00:44 +0200
committeriurii <[email protected]>2024-09-07 14:00:44 +0200
commitc5bf2b9de1504e60c007d3a166beb45c1eab64e9 (patch)
treea3b00289522ca6435958a803b37283cc98ea143b /res/shaders
parentf962ac82a0689560a2ebe1070c7693a78d70172c (diff)
downloadfunhalla-c5bf2b9de1504e60c007d3a166beb45c1eab64e9.tar.gz
fixed shaders
Diffstat (limited to '')
-rw-r--r--res/shaders/colors.fs13
-rw-r--r--res/shaders/colors.vs1
2 files changed, 8 insertions, 6 deletions
diff --git a/res/shaders/colors.fs b/res/shaders/colors.fs
index 79e243f..a486a92 100644
--- a/res/shaders/colors.fs
+++ b/res/shaders/colors.fs
@@ -1,6 +1,9 @@
 #version 330 core
+
+out vec4 FragColor;
+
 struct Material {
-  Sampler2D diffuse;
+  sampler2D diffuse;
   vec3 specular;
   float shininess;
 };
@@ -12,11 +15,9 @@ struct Light {
   vec3 specular;
 };
 
-out vec4 FragColor;
-
 in vec3 Normal;
 in vec3 FragPos;
-in vec3 TexCoords;
+in vec2 TexCoords;
 
 uniform vec3 light_position;
 uniform vec3 view_position;
@@ -26,13 +27,13 @@ uniform Light light;
 
 void main() {
   // ambient
-  vec3 ambient = light.ambient * vec3(texture(material.diffuse, TexCoords));
+  vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;
 
   // diffuse
   vec3 norm = normalize(Normal);
   vec3 light_dir = normalize(light_position - FragPos);
   float diff = max(dot(norm, light_dir), 0.0);
-  vec3 diffuse = light.diffuse * diff * vec3(texture(material.diffuse, TexCoords));
+  vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb;
 
   // specular
   vec3 view_dir = normalize(view_position - FragPos);
diff --git a/res/shaders/colors.vs b/res/shaders/colors.vs
index 9128abc..44f7c34 100644
--- a/res/shaders/colors.vs
+++ b/res/shaders/colors.vs
@@ -16,5 +16,6 @@ void main() {
   FragPos = vec3(model * vec4(a_pos, 1.0));
   Normal = mat3(transpose(inverse(model))) * a_normal;
 
+  TexCoords = a_tex_coords;
   gl_Position = projection * view  * vec4(FragPos, 1.0);
 }