Skip to content

Instantly share code, notes, and snippets.

@Limeth
Created September 15, 2018 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Limeth/5d8a0f73657669766c472f0bd8d3c0a7 to your computer and use it in GitHub Desktop.
Save Limeth/5d8a0f73657669766c472f0bd8d3c0a7 to your computer and use it in GitHub Desktop.
#version 450
layout(set = 0, binding = 0) uniform SceneUBO {
vec2 dimensions;
mat4 model;
mat4 view;
mat4 projection;
};
layout(set = 0, binding = 1) uniform sampler2D screen_sampler;
layout(set = 0, binding = 2) uniform sampler2D tex;
layout(set = 1, binding = 0) uniform NodeUBO {
mat4 matrix;
};
layout(set = 2, binding = 0) uniform MaterialUBO {
vec4 base_color_factor;
float metallic_factor;
float roughness_factor;
};
layout(set = 2, binding = 1) uniform sampler2D base_color_texture;
layout(location = 0) in vec4 f_homogeneous_position;
layout(location = 1) in vec2 f_tex_coord;
layout(location = 0) out vec4 out_color;
void main() {
vec2 uv = gl_FragCoord.xy / dimensions;
out_color = 0.0.xxxx
/* + texture(base_color_texture, uv) */
/* + vec4(f_homogeneous_position.xyz / f_homogeneous_position.w, 1.0); */
/* + texture(screen_sampler, uv) */
+ texture(base_color_texture, vec2(f_tex_coord))
+ 0.0.xxxx;
}
#version 450
layout(set = 0, binding = 0) uniform SceneUBO {
vec2 dimensions;
mat4 model;
mat4 view;
mat4 projection;
};
layout(set = 1, binding = 0) uniform NodeUBO {
mat4 matrix;
};
layout(location = 0) in vec3 position;
layout(location = 1) in vec2 tex_coord;
layout(location = 0) out vec4 f_homogeneous_position;
layout(location = 1) out vec2 f_tex_coord;
void main() {
/* gl_Position = vec4(position, 1.0); */
gl_Position = projection * view * model * matrix * vec4(position, 1.0);
/* gl_Position = projection * view * model * vec4(position, 1.0); */
f_tex_coord = tex_coord;
f_homogeneous_position = gl_Position;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment