| 1234567891011121314151617181920212223 |
- #version 460
- struct material_type {
- vec3 ambient;
- vec3 diffuse;
- };
- struct light_property {
- vec3 direction;
- };
- uniform material_type material;
- uniform light_property light;
- in vec3 frag_normal;
- layout (location = 0) out vec4 frag_color;
- void main() {
- float diffuse_weight = max(-dot(frag_normal, light.direction), 0.0);
- vec3 color = material.ambient + diffuse_weight * material.diffuse;
- frag_color = vec4(color, 1.0);
- }
|