- Timestamp:
- Apr 10, 2021, 12:58:17 AM (3 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- 8d92284
- Parents:
- 914bb99
- git-author:
- Dmitry Portnoy <dportnoy@…> (04/10/21 00:49:42)
- git-committer:
- Dmitry Portnoy <dportnoy@…> (04/10/21 00:58:17)
- Location:
- shaders
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
shaders/model.frag
r914bb99 ra00eb06 6 6 layout(location = 0) in vec3 fragColor; 7 7 layout(location = 1) in vec2 fragTexCoord; 8 layout(location = 2) in vec3 normal_eye; 8 9 9 10 layout(location = 0) out vec4 outColor; 10 11 11 12 void main() { 12 outColor = vec4(fragColor * texture(texSampler, fragTexCoord).rgb, 1.0) ;13 outColor = vec4(fragColor * texture(texSampler, fragTexCoord).rgb, 1.0) + vec4(normal_eye, 0.0) - vec4(normal_eye, 0.0); 13 14 } -
shaders/model.vert
r914bb99 ra00eb06 15 15 } sbo; 16 16 17 layout (binding = 2) uniform UboInstance { 18 mat4 model; 19 } uboInstance; 20 17 21 layout(location = 0) in vec3 inPosition; 18 22 layout(location = 1) in vec3 inColor; 19 23 layout(location = 2) in vec2 inTexCoord; 20 layout(location = 3) in uint obj_index; 24 layout(location = 3) in vec3 vertex_normal; 25 layout(location = 4) in uint obj_index; 21 26 22 27 layout(location = 0) out vec3 fragColor; 23 28 layout(location = 1) out vec2 fragTexCoord; 29 layout(location = 2) out vec3 normal_eye; 24 30 25 31 void main() { 32 // Using 0.0 instead of 1.0 means translations won't effect the normal 33 normal_eye = normalize(vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_normal, 0.0))); 34 26 35 fragColor = inColor; 27 36 fragTexCoord = inTexCoord;
Note:
See TracChangeset
for help on using the changeset viewer.