feature/imgui-sdl
points-test
Last change
on this file since 99d44b2 was c8dc5c6, checked in by Dmitry Portnoy <dmp1488@…>, 7 years ago |
Normalize the surface normals in the shaders.
|
-
Property mode
set to
100644
|
File size:
806 bytes
|
Rev | Line | |
---|
[ec4456b] | 1 | #version 410
|
---|
| 2 |
|
---|
[14ff67c] | 3 | #define MAX_NUM_OBJECTS 1024
|
---|
| 4 |
|
---|
| 5 | uniform mat4 view, proj;
|
---|
| 6 |
|
---|
| 7 | layout (std140) uniform models {
|
---|
| 8 | mat4 model_mats[MAX_NUM_OBJECTS];
|
---|
| 9 | };
|
---|
[93baa0e] | 10 |
|
---|
[d0b9596] | 11 | layout(location = 0) in vec3 vertex_position;
|
---|
[485424b] | 12 | layout(location = 1) in vec2 vt;
|
---|
[9dd2eb7] | 13 | layout(location = 2) in vec3 vertex_normal;
|
---|
[14ff67c] | 14 | layout(location = 3) in uint ubo_index;
|
---|
[8b7cfcf] | 15 |
|
---|
[485424b] | 16 | out vec2 texture_coordinates;
|
---|
[9dd2eb7] | 17 | out vec3 position_eye, normal_eye, light_position_eye;
|
---|
| 18 |
|
---|
| 19 | // fixed point light position
|
---|
| 20 | vec3 light_position_world = vec3(0.0, 0.0, 2.0);
|
---|
[ec4456b] | 21 |
|
---|
| 22 | void main() {
|
---|
[14ff67c] | 23 | position_eye = vec3(view * model_mats[ubo_index] * vec4(vertex_position, 1.0));
|
---|
[c8dc5c6] | 24 | normal_eye = normalize(vec3(view * model_mats[ubo_index] * vec4(vertex_normal, 0.0)));
|
---|
[485424b] | 25 | texture_coordinates = vt;
|
---|
[9dd2eb7] | 26 | light_position_eye = vec3(view * vec4(light_position_world, 1.0));
|
---|
| 27 |
|
---|
| 28 | gl_Position = proj * vec4(position_eye, 1.0);
|
---|
[ec4456b] | 29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.