Merge forge

This commit is contained in:
luboslenco
2025-08-14 21:45:07 +02:00
parent a3b3a7d591
commit 6d6ad5fb89
12 changed files with 85 additions and 85 deletions
+23 -22
View File
@@ -52,28 +52,29 @@ function layers_ext_flatten(height_to_normal: bool = false, layers: slot_layer_t
draw_set_pipeline(null);
draw_end();
///if is_forge
// Do not multiply basecol by alpha
draw_begin(layers_expa); // Copy to temp
draw_set_pipeline(pipes_copy);
draw_image(l1.texpaint, 0, 0);
draw_set_pipeline(null);
draw_end();
///else
_gpu_begin(layers_expa);
gpu_set_pipeline(pipes_merge);
gpu_set_texture(pipes_tex0, l1.texpaint);
gpu_set_texture(pipes_tex1, empty);
gpu_set_texture(pipes_texmask, mask);
gpu_set_texture(pipes_texa, layers_temp_image);
gpu_set_float(pipes_opac, slot_layer_get_opacity(l1));
gpu_set_float(pipes_tex1w, empty.width);
gpu_set_int(pipes_blending, layers.length > 1 ? l1.blending : 0);
gpu_set_vertex_buffer(const_data_screen_aligned_vb);
gpu_set_index_buffer(const_data_screen_aligned_ib);
gpu_draw();
gpu_end();
///end
if (context_raw.tool == tool_type_t.GIZMO) {
// Do not multiply basecol by alpha
draw_begin(layers_expa); // Copy to temp
draw_set_pipeline(pipes_copy);
draw_image(l1.texpaint, 0, 0);
draw_set_pipeline(null);
draw_end();
}
else {
_gpu_begin(layers_expa);
gpu_set_pipeline(pipes_merge);
gpu_set_texture(pipes_tex0, l1.texpaint);
gpu_set_texture(pipes_tex1, empty);
gpu_set_texture(pipes_texmask, mask);
gpu_set_texture(pipes_texa, layers_temp_image);
gpu_set_float(pipes_opac, slot_layer_get_opacity(l1));
gpu_set_float(pipes_tex1w, empty.width);
gpu_set_int(pipes_blending, layers.length > 1 ? l1.blending : 0);
gpu_set_vertex_buffer(const_data_screen_aligned_vb);
gpu_set_index_buffer(const_data_screen_aligned_ib);
gpu_draw();
gpu_end();
}
}
if (l1.paint_nor) {
+13 -11
View File
@@ -250,13 +250,14 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad
node_shader_write_frag(kong, "var height: float = " + height + ";");
node_shader_write_frag(kong, "var mat_opacity: float = " + opac + ";");
node_shader_write_frag(kong, "var opacity: float = mat_opacity;");
///if is_forge
node_shader_write_frag(kong, "opacity = 1.0;");
///else
if (context_raw.layer.fill_layer == null) {
node_shader_write_frag(kong, "opacity *= constants.brush_opacity;");
if (context_raw.tool == tool_type_t.GIZMO) {
node_shader_write_frag(kong, "opacity = 1.0;");
}
else {
if (context_raw.layer.fill_layer == null) {
node_shader_write_frag(kong, "opacity *= constants.brush_opacity;");
}
}
///end
if (context_raw.material.paint_emis) {
node_shader_write_frag(kong, "var emis: float = " + emis + ";");
}
@@ -441,11 +442,12 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad
node_shader_add_texture(kong, "texpaint_pack_undo", "_texpaint_pack_undo");
node_shader_write_frag(kong, "var sample_nor_undo: float4 = sample_lod(texpaint_nor_undo, sampler_linear, sample_tc, 0.0);");
node_shader_write_frag(kong, "var sample_pack_undo: float4 = sample_lod(texpaint_pack_undo, sampler_linear, sample_tc, 0.0);");
///if is_forge
node_shader_write_frag(kong, "output[0] = float4(" + make_material_blend_mode(kong, context_raw.brush_blending, "sample_undo.rgb", "basecol", "str") + ", mat_opacity);");
///else
node_shader_write_frag(kong, "output[0] = float4(" + make_material_blend_mode(kong, context_raw.brush_blending, "sample_undo.rgb", "basecol", "str") + ", max(str, sample_undo.a));");
///end
if (context_raw.tool == tool_type_t.GIZMO) {
node_shader_write_frag(kong, "output[0] = float4(" + make_material_blend_mode(kong, context_raw.brush_blending, "sample_undo.rgb", "basecol", "str") + ", mat_opacity);");
}
else {
node_shader_write_frag(kong, "output[0] = float4(" + make_material_blend_mode(kong, context_raw.brush_blending, "sample_undo.rgb", "basecol", "str") + ", max(str, sample_undo.a));");
}
node_shader_write_frag(kong, "output[1] = float4(lerp3(sample_nor_undo.rgb, nortan, str), matid);");
if (context_raw.material.paint_height && make_material_height_used) {
node_shader_write_frag(kong, "output[2] = lerp4(sample_pack_undo, float4(occlusion, roughness, metallic, height), str);");
-4
View File
@@ -117,10 +117,8 @@ function sim_duplicate() {
physics_body_init(pbdup, dup.base);
}
///if is_forge
_tab_scene_paint_object_length++;
tab_scene_sort();
///end
}
function sim_delete() {
@@ -129,8 +127,6 @@ function sim_delete() {
mesh_object_remove(so);
sim_remove_body(so.base.uid);
///if is_forge
_tab_scene_paint_object_length--;
tab_scene_sort();
///end
}