Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #version 420 core
- layout (location = 0) in vec3 vertices;
- layout (location = 1) in vec4 uv;
- layout (location = 2) in vec2 vertex_offset;
- layout (location = 3) in vec4 color;
- layout (location = 4) in mat4 model;
- out vec3 v_vertices;
- out vec2 v_uv;
- out vec3 v_world_pos;
- // out vec3 v_normal;
- out vec4 v_color;
- out vec2 v_local_uv;
- uniform mat4 projection;
- void main()
- {
- vec3 temp_vertices = vec3(vertices.xy + vertex_offset, vertices.z);
- vec4 temp = projection * model * vec4(temp_vertices, 1);
- // vec4 temp = projection * model * vec4(temp_vertices, 1);
- gl_Position = temp;
- v_vertices = temp_vertices;
- v_world_pos = (model * vec4(temp_vertices, 1)).xyz;
- // v_normal = normal;
- v_color = color;
- vec2 uv_min = uv.xy;
- vec2 uv_max = uv.zw;
- vec2 uvs[6];
- uvs[0] = uv_min;
- uvs[1] = vec2(uv_max.x, uv_min.y);
- uvs[2] = vec2(uv_max.x, uv_max.y);
- uvs[3] = uv_min;
- uvs[4] = vec2(uv_max.x, uv_max.y);
- uvs[5] = vec2(uv_min.x, uv_max.y);
- v_uv = uvs[gl_VertexID % 6];
- vec2 local_uvs[6];
- local_uvs[0] = vec2(0, 0);
- local_uvs[1] = vec2(1, 0);
- local_uvs[2] = vec2(1, 1);
- local_uvs[3] = vec2(0, 0);
- local_uvs[4] = vec2(1, 1);
- local_uvs[5] = vec2(0, 1);
- v_local_uv = local_uvs[gl_VertexID % 6];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement