This commit is contained in:
luboslenco
2025-02-09 17:15:58 +01:00
parent be4c63728a
commit 4df4b09340
39 changed files with 4 additions and 228 deletions
-8
View File
@@ -4,11 +4,7 @@ function make_brush_run(vert: node_shader_t, frag: node_shader_t) {
node_shader_write(frag, "float dist = 0.0;");
if (config_raw.brush_3d) {
///if (arm_direct3d12 || arm_metal || arm_vulkan)
node_shader_write(frag, "float depth = textureLod(gbufferD, inp.xy, 0.0).r;");
///else
node_shader_write(frag, "float depth = textureLod(gbufferD, vec2(inp.x, 1.0 - inp.y), 0.0).r;");
///end
node_shader_add_uniform(frag, "mat4 invVP", "_inv_view_proj_matrix");
node_shader_write(frag, "vec4 winp = vec4(vec2(inp.x, 1.0 - inp.y) * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);");
@@ -19,11 +15,7 @@ function make_brush_run(vert: node_shader_t, frag: node_shader_t) {
node_shader_write_attrib(frag, "vec3 wposition = (mul(texelFetch(texpaint_undo, ivec2(tex_coord.x * textureSize(texpaint_undo, 0).x, tex_coord.y * textureSize(texpaint_undo, 0).y), 0), W)).xyz;");
///if (arm_direct3d12 || arm_metal || arm_vulkan)
node_shader_write(frag, "float depthlast = textureLod(gbufferD, inplast.xy, 0.0).r;");
///else
node_shader_write(frag, "float depthlast = textureLod(gbufferD, vec2(inplast.x, 1.0 - inplast.y), 0.0).r;");
///end
node_shader_write(frag, "vec4 winplast = vec4(vec2(inplast.x, 1.0 - inplast.y) * 2.0 - 1.0, depthlast * 2.0 - 1.0, 1.0);");
node_shader_write(frag, "winplast = mul(winplast, invVP);");
-6
View File
@@ -75,9 +75,7 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte
node_shader_add_uniform(frag, "sampler2D gbuffer1");
node_shader_add_uniform(frag, "sampler2D gbuffer2");
node_shader_write(frag, "vec2 fragcoord = (wvpposition.xy / wvpposition.w) * 0.5 + 0.5;");
///if (arm_direct3d12 || arm_metal || arm_vulkan)
node_shader_write(frag, "fragcoord.y = 1.0 - fragcoord.y;");
///end
node_shader_write(frag, "vec4 gbuffer0_sample = textureLod(gbuffer0, fragcoord, 0.0);");
node_shader_write(frag, "vec4 gbuffer1_sample = textureLod(gbuffer1, fragcoord, 0.0);");
node_shader_write(frag, "vec4 gbuffer2_sample = textureLod(gbuffer2, fragcoord, 0.0);");
@@ -253,11 +251,7 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte
}
frag.vvec = true;
///if (arm_direct3d12 || arm_metal || arm_vulkan)
node_shader_write(frag, "mat3 TBN = cotangent_frame(n, vvec, tex_coord);");
///else
node_shader_write(frag, "mat3 TBN = cotangent_frame(n, -vvec, tex_coord);");
///end
node_shader_write(frag, "n = ntex * 2.0 - 1.0;");
node_shader_write(frag, "n.y = -n.y;");
node_shader_write(frag, "n = normalize(mul(n, TBN));");
-4
View File
@@ -137,11 +137,7 @@ function make_mesh_preview_run(data: material_t, matcon: material_context_t): no
}
else {
frag.vvec = true;
///if (arm_direct3d12 || arm_metal || arm_vulkan)
node_shader_write(frag, "mat3 TBN = cotangent_frame(n, vvec, tex_coord);");
///else
node_shader_write(frag, "mat3 TBN = cotangent_frame(n, -vvec, tex_coord);");
///end
node_shader_write(frag, "n = nortan * 2.0 - 1.0;");
node_shader_write(frag, "n.y = -n.y;");
node_shader_write(frag, "n = normalize(mul(n, TBN));");
-2
View File
@@ -37,9 +37,7 @@ function make_sculpt_run(data: material_t, matcon: material_context_t): node_sha
node_shader_add_out(vert, "vec2 tex_coord");
node_shader_write(vert, "const vec2 madd = vec2(0.5, 0.5);");
node_shader_write(vert, "tex_coord = pos.xy * madd + madd;");
///if (arm_direct3d12 || arm_metal || arm_vulkan)
node_shader_write(vert, "tex_coord.y = 1.0 - tex_coord.y;");
///end
node_shader_write(vert, "gl_Position = vec4(pos.xy, 0.0, 1.0);");
node_shader_add_uniform(frag, "vec4 inp", "_input_brush");