medfall

A super great game engine
Log | Files | Refs

flat_vertex_colours_to_gbuffer.glsl (527B)


      1 layout( std140 ) uniform view {
      2 	mat4 camera_from_world;
      3 	mat4 clip_from_camera;
      4 };
      5 
      6 layout( std140 ) uniform model {
      7 	mat4 world_from_model;
      8 };
      9 
     10 struct VSOut {
     11 	vec3 normal;
     12 };
     13 
     14 #ifdef VERTEX_SHADER
     15 
     16 in vec3 position;
     17 in vec3 normal;
     18 
     19 out VSOut v2f;
     20 
     21 void main() {
     22 	gl_Position = clip_from_camera * camera_from_world * world_from_model * vec4( position, 1.0 );
     23 	v2f.normal = mat3( world_from_model ) * normal;
     24 }
     25 
     26 #else
     27 
     28 in VSOut v2f;
     29 
     30 out vec3 output_normal;
     31 
     32 void main() {
     33 	output_normal = normalize( v2f.normal );
     34 }
     35 
     36 #endif