Merge branch 'main' into feature/texture_displacement

This commit is contained in:
SoftFever
2026-09-22 14:46:36 +08:00
committed by GitHub
1059 changed files with 150432 additions and 10431 deletions
+28
View File
@@ -0,0 +1,28 @@
#version 110
// X-Ray view: each surface is a thin translucent layer of its own color, covering more the more
// edge-on it is seen. The caller draws it with depth writes off, so every surface a view ray crosses
// composites and overlapping geometry reads as denser. Source-alpha rather than additive blending:
// additive would saturate to white on the light theme's near-white background.
#define EDGE_FALLOFF 2.0
// Coverage head-on and edge-on.
#define FACE_DENSITY 0.12
#define EDGE_DENSITY 0.65
uniform vec4 uniform_color;
varying vec3 eye_normal;
varying vec3 eye_position;
varying vec3 clipping_planes_dots;
void main()
{
if (any(lessThan(clipping_planes_dots, vec3(0.0))))
discard;
// abs(): back faces are drawn too, and there only the angle matters.
float facing = abs(dot(normalize(eye_normal), normalize(-eye_position)));
float density = mix(EDGE_DENSITY, FACE_DENSITY, pow(facing, EDGE_FALLOFF));
gl_FragColor = vec4(uniform_color.rgb, density * uniform_color.a);
}
+31
View File
@@ -0,0 +1,31 @@
#version 110
uniform mat4 view_model_matrix;
uniform mat4 projection_matrix;
uniform mat3 view_normal_matrix;
uniform mat4 volume_world_matrix;
// Clipping, as in gouraud.vs: the preview's top / bottom plane and the SLA gizmo's free one.
uniform vec2 z_range;
uniform vec4 clipping_plane;
attribute vec3 v_position;
attribute vec3 v_normal;
varying vec3 eye_normal;
varying vec3 eye_position;
varying vec3 clipping_planes_dots;
void main()
{
eye_normal = view_normal_matrix * v_normal;
vec4 position = view_model_matrix * vec4(v_position, 1.0);
eye_position = position.xyz;
// A component below zero means the fragment is clipped away.
vec4 world_pos = volume_world_matrix * vec4(v_position, 1.0);
clipping_planes_dots = vec3(dot(world_pos, clipping_plane), world_pos.z - z_range.x, z_range.y - world_pos.z);
gl_Position = projection_matrix * position;
}
+30
View File
@@ -0,0 +1,30 @@
#version 140
// X-Ray view: each surface is a thin translucent layer of its own color, covering more the more
// edge-on it is seen. The caller draws it with depth writes off, so every surface a view ray crosses
// composites and overlapping geometry reads as denser. Source-alpha rather than additive blending:
// additive would saturate to white on the light theme's near-white background.
#define EDGE_FALLOFF 2.0
// Coverage head-on and edge-on.
#define FACE_DENSITY 0.12
#define EDGE_DENSITY 0.65
uniform vec4 uniform_color;
in vec3 eye_normal;
in vec3 eye_position;
in vec3 clipping_planes_dots;
out vec4 out_color;
void main()
{
if (any(lessThan(clipping_planes_dots, vec3(0.0))))
discard;
// abs(): back faces are drawn too, and there only the angle matters.
float facing = abs(dot(normalize(eye_normal), normalize(-eye_position)));
float density = mix(EDGE_DENSITY, FACE_DENSITY, pow(facing, EDGE_FALLOFF));
out_color = vec4(uniform_color.rgb, density * uniform_color.a);
}
+31
View File
@@ -0,0 +1,31 @@
#version 140
uniform mat4 view_model_matrix;
uniform mat4 projection_matrix;
uniform mat3 view_normal_matrix;
uniform mat4 volume_world_matrix;
// Clipping, as in gouraud.vs: the preview's top / bottom plane and the SLA gizmo's free one.
uniform vec2 z_range;
uniform vec4 clipping_plane;
in vec3 v_position;
in vec3 v_normal;
out vec3 eye_normal;
out vec3 eye_position;
out vec3 clipping_planes_dots;
void main()
{
eye_normal = view_normal_matrix * v_normal;
vec4 position = view_model_matrix * vec4(v_position, 1.0);
eye_position = position.xyz;
// A component below zero means the fragment is clipped away.
vec4 world_pos = volume_world_matrix * vec4(v_position, 1.0);
clipping_planes_dots = vec3(dot(world_pos, clipping_plane), world_pos.z - z_range.x, z_range.y - world_pos.z);
gl_Position = projection_matrix * position;
}