-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to use a separate shader for HUD
I think that part is working just fine, though it seems like everything is too bright despite not touching the main shader.
- Loading branch information
Showing
7 changed files
with
161 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#version 330 core | ||
|
||
in vec4 fragmentColor; | ||
in vec3 fragmentNormal; | ||
|
||
uniform float lights_active = 1.0; | ||
|
||
out vec4 color; | ||
|
||
float ambient = 0.7; | ||
vec3 light0 = vec3(-0.136808053, -0.282842726, 0.375877053); | ||
vec3 light1 = vec3(0.102606051, -0.102606043, -0.281907797); | ||
vec3 lightColor = vec3(1, 1, 1); | ||
|
||
vec3 diffuse_light(vec3 light) { | ||
return max(dot(fragmentNormal, light), 0.0) * lightColor; | ||
} | ||
|
||
vec3 diffuse() { | ||
return diffuse_light(light0) | ||
+ diffuse_light(light1); | ||
|
||
} | ||
|
||
vec4 light_color() { | ||
return mix( | ||
ambient * vec4(lightColor, 1.0) * fragmentColor, | ||
vec4((ambient * lightColor) + diffuse(), 1.0) * fragmentColor, | ||
lights_active | ||
); | ||
} | ||
|
||
void main() { | ||
color = light_color(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#version 330 core | ||
|
||
layout(location = 0) in vec3 vertexPosition_modelspace; | ||
layout(location = 1) in vec4 vertexColor; | ||
layout(location = 2) in vec3 vertexNormal; | ||
|
||
uniform mat4 view; | ||
uniform mat4 proj; | ||
uniform mat4 modelview; | ||
|
||
out vec4 fragmentColor; | ||
out vec3 fragmentNormal; | ||
|
||
void main() { | ||
vec4 pos = vec4(vertexPosition_modelspace, 1.0); | ||
gl_Position = proj * (modelview * pos); | ||
fragmentColor = vertexColor; | ||
fragmentNormal = vertexNormal; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters