.
This commit is contained in:
parent
7f37187c92
commit
507d635433
7 changed files with 488 additions and 292 deletions
|
|
@ -1,37 +1,50 @@
|
|||
@ctype mat4 mat4
|
||||
@ctype mat4 HMM_Mat4
|
||||
@ctype vec3 HMM_Vec3
|
||||
|
||||
@vs vs
|
||||
layout(binding=0) uniform vs_params {
|
||||
mat4 mvp;
|
||||
vec3 cam_pos;
|
||||
};
|
||||
|
||||
in vec4 position;
|
||||
in vec3 norm;
|
||||
in vec2 uv;
|
||||
in vec2 tex_uv;
|
||||
in vec2 lightmap_uv;
|
||||
|
||||
out vec3 fs_norm;
|
||||
out vec2 fs_uv;
|
||||
out vec2 fs_tex_uv;
|
||||
out vec2 fs_lightmap_uv;
|
||||
out float depth;
|
||||
|
||||
void main() {
|
||||
gl_Position = mvp * position;
|
||||
// for now m == identity
|
||||
vec4 view_pos = mvp * position;
|
||||
depth = -view_pos.z;
|
||||
|
||||
gl_Position = view_pos;
|
||||
fs_norm = norm;
|
||||
fs_uv = uv;
|
||||
fs_tex_uv = tex_uv;
|
||||
fs_lightmap_uv = lightmap_uv;
|
||||
}
|
||||
@end
|
||||
|
||||
@fs fs
|
||||
layout(binding=0) uniform texture2D tex;
|
||||
layout(binding=0) uniform sampler smp;
|
||||
layout(binding=1) uniform texture2D lightmap;
|
||||
layout(binding=1) uniform sampler lightmap_smp;
|
||||
in vec3 fs_norm;
|
||||
in vec2 fs_uv;
|
||||
in vec2 fs_tex_uv;
|
||||
in vec2 fs_lightmap_uv;
|
||||
in float depth;
|
||||
|
||||
out vec4 frag_color;
|
||||
|
||||
void main() {
|
||||
frag_color = texture(sampler2D(tex, smp), fs_uv);
|
||||
// frag_color = vec4(fs_norm * 0.5 + 0.5, 1.0);
|
||||
// vec2 uv = fs_uv * 0.5 + 0.5;
|
||||
// frag_color = vec4(uv, 0.0, 1.0);
|
||||
vec4 tex_color = texture(sampler2D(tex, smp), fs_tex_uv);
|
||||
vec4 lightmap_color = texture(sampler2D(lightmap, lightmap_smp), fs_lightmap_uv);
|
||||
frag_color = tex_color * lightmap_color;
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue