Depth test.

This commit is contained in:
2022-03-11 23:45:27 +01:00
parent 9d4b85c940
commit 7213c85fdf
10 changed files with 389 additions and 95 deletions

View File

@@ -43,7 +43,7 @@ void main() {
vec2 v0 = p0 - p2;
vec2 v1 = p1 - p2;
out_edge_dist[i] = determinant(mat2(v0, v1)) / length(v1);
out_edge_dist[i] = abs(determinant(mat2(v0, v1))) / length(v1);
EmitVertex();
}

View File

@@ -18,11 +18,12 @@ layout(location = 1) out vec3 out_normal;
layout(location = 2) out vec3 out_color;
void main() {
float lod = clamp(
2.0 * dot(transpose(uniforms.scene_from_model)[0].xyz, in_position) + 0.5,
0.0, 1.0
);
vec3 position = mix(in_position2, in_position, lod);
// float lod = clamp(
// 2.0 * dot(transpose(uniforms.scene_from_model)[0].xyz, in_position) + 0.5,
// 0.0, 1.0
// );
// vec3 position = mix(in_position2, in_position, lod);
vec3 position = in_position;
out_position =
uniforms.projection_from_scene *
uniforms.scene_from_model *