fix(err): Improve error handling to reduce crashes
Some checks failed
Build Zenyx ⚡ / 🧪 Run Cargo Tests (push) Successful in 4m23s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (push) Failing after 7m10s
Build Zenyx ⚡ / 🏗️ Build x86_64-apple-darwin (push) Failing after 9m3s
Build Zenyx ⚡ / 🏗️ Build aarch64-apple-darwin (push) Failing after 9m12s
Build Zenyx ⚡ / 🏗️ Build aarch64-pc-windows-msvc (push) Failing after 9m48s
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (push) Failing after 6m22s
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (push) Failing after 5m7s
Some checks failed
Build Zenyx ⚡ / 🧪 Run Cargo Tests (push) Successful in 4m23s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (push) Failing after 7m10s
Build Zenyx ⚡ / 🏗️ Build x86_64-apple-darwin (push) Failing after 9m3s
Build Zenyx ⚡ / 🏗️ Build aarch64-apple-darwin (push) Failing after 9m12s
Build Zenyx ⚡ / 🏗️ Build aarch64-pc-windows-msvc (push) Failing after 9m48s
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (push) Failing after 6m22s
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (push) Failing after 5m7s
This commit is contained in:
parent
0e8209f9b9
commit
5afd5b0c1e
6 changed files with 57 additions and 33 deletions
|
@ -1,7 +1,7 @@
|
|||
#version 450
|
||||
|
||||
layout(location = 0) in vec2 tex_coords;
|
||||
layout(location = 1) in vec3 normal;
|
||||
layout(location = 1) in vec4 normal;
|
||||
layout(set = 1, binding = 0) uniform texture2D t_diffuse;
|
||||
layout(set = 1, binding = 1) uniform sampler s_diffuse;
|
||||
layout(location = 0) out vec4 out_color;
|
||||
|
@ -9,9 +9,10 @@ layout(location = 0) out vec4 out_color;
|
|||
void main() {
|
||||
float ambient = 0.2;
|
||||
vec3 light_dir = normalize(vec3(0.5, 1.0, 0.5));
|
||||
float diffuse = clamp(dot(normalize(normal), light_dir), 0.0, 1.0);
|
||||
float diffuse = clamp(dot(normalize(vec3(normal.x, normal.y, normal.z)), light_dir), 0.0, 1.0);
|
||||
float brightness = ambient + (1.0 - ambient) * diffuse;
|
||||
|
||||
// out_color = vec4(normal.x, normal.y, normal.z, 1.0);
|
||||
// out_color = vec3(1.0,.0.0)
|
||||
out_color = texture(sampler2D(t_diffuse, s_diffuse), tex_coords);
|
||||
out_color.r = clamp(out_color.r * 0.6 * brightness, 0.0, 1.0);
|
||||
out_color.g = clamp(out_color.g * 0.6 * brightness, 0.0, 1.0);
|
||||
|
|
|
@ -5,7 +5,7 @@ layout(location = 1) in vec3 color;
|
|||
layout(location = 2) in vec3 normal_in;
|
||||
layout(location = 3) in vec2 tex_coords;
|
||||
layout(location = 0) out vec2 tex_coord;
|
||||
layout(location = 1) out vec3 normal;
|
||||
layout(location = 1) out vec4 normal;
|
||||
layout(push_constant) uniform float TIME;
|
||||
layout(set = 0, binding = 0) uniform UniformBufferObject {
|
||||
mat4x4 projection;
|
||||
|
@ -16,16 +16,22 @@ mat4 rotation(float lerp) {
|
|||
0., 0., 1., 0.,
|
||||
0., 0., 0., 1.);
|
||||
}
|
||||
|
||||
void main() {
|
||||
float sum_val = sin(TIME / 5);
|
||||
gl_Position = view.projection * transpose(mat4(
|
||||
1.0, 0.0, 0.0, sum_val,
|
||||
0.0, 1.0, 0.0, sum_val,
|
||||
0.0, 0.0, 1.0, sum_val,
|
||||
0.0, 0.0, 0.0, 1.0) * mat4((sin(TIME) + 1.0) / 2, 0.0, 0.0, 0.0,
|
||||
0.0, (sin(TIME) + 1.0) / 2, 0.0, 0.0,
|
||||
0.0, 0.0, (sin(TIME) + 1.0) / 2, 0.0,
|
||||
0.0, 0.0, 0.0, 1) * rotation(TIME * 2.5)) * vec4(position, 1.0);
|
||||
tex_coord = tex_coords;
|
||||
normal = normal_in;
|
||||
|
||||
mat4 model = transpose(mat4(
|
||||
1.0, 0.0, 0.0, sum_val,
|
||||
0.0, 1.0, 0.0, sum_val,
|
||||
0.0, 0.0, 1.0, sum_val,
|
||||
0.0, 0.0, 0.0, 1.0) * mat4((sin(TIME) + 1.0) / 2, 0.0, 0.0, 0.0,
|
||||
0.0, (sin(TIME) + 1.0) / 2, 0.0, 0.0,
|
||||
0.0, 0.0, (sin(TIME) + 1.0) / 2, 0.0,
|
||||
0.0, 0.0, 0.0, 1) * rotation(TIME * 2.5));
|
||||
|
||||
gl_Position = view.projection * model * vec4(position, 1.0);
|
||||
tex_coord = tex_coords * abs(sin(TIME / 4));
|
||||
// tex_coord.x = tex_coord.x * sin(TIME / 2);
|
||||
// tex_coord.y = tex_coord.y * cos(TIME / 2);
|
||||
normal = model * vec4(normal_in, 1.0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue