Forge test

This commit is contained in:
luboslenco
2024-12-10 22:26:17 +01:00
parent e55edbbb67
commit b969935e68
7 changed files with 38 additions and 9 deletions
+9 -2
View File
@@ -81,14 +81,14 @@ function sim_stop() {
}
}
function sim_add(o: object_t, shape: physics_shape_t, mass: f32) {
function sim_add_body(o: object_t, shape: physics_shape_t, mass: f32) {
let body: physics_body_t = physics_body_create();
body.shape = shape;
body.mass = mass;
physics_body_init(body, o);
}
function sim_remove(uid: i32) {
function sim_remove_body(uid: i32) {
physics_body_remove(uid);
}
@@ -113,3 +113,10 @@ function sim_duplicate() {
physics_body_init(pbdup, dup.base);
}
}
function sim_delete() {
let so: mesh_object_t = context_raw.selected_object.ext;
array_remove(project_paint_objects, so);
mesh_object_remove(so);
sim_remove_body(so.base.uid);
}
+2 -2
View File
@@ -157,9 +157,9 @@ function tab_object_draw(htab: ui_handle_t) {
ui_check(hdynamic, "Dynamic");
if (hshape.changed || hdynamic.changed) {
sim_remove(context_raw.selected_object.uid);
sim_remove_body(context_raw.selected_object.uid);
if (hshape.position > 0) {
sim_add(context_raw.selected_object, hshape.position - 1, hdynamic.selected ? 1.0 : 0.0);
sim_add_body(context_raw.selected_object, hshape.position - 1, hdynamic.selected ? 1.0 : 0.0);
}
}
+3
View File
@@ -88,6 +88,9 @@ function tab_scene_draw_list(ui: ui_t, list_handle: ui_handle_t, current_object:
if (ui_menu_button(ui, tr("Duplicate"))) {
sim_duplicate();
}
if (ui_menu_button(ui, tr("Delete"))) {
sim_delete();
}
});
}
+9
View File
@@ -56,6 +56,14 @@ function layers_ext_flatten(height_to_normal: bool = false, layers: slot_layer_t
g2_set_pipeline(null);
g2_end();
///if is_forge
// Do not multiply basecol by alpha
g2_begin(layers_expa); // Copy to temp
g2_set_pipeline(pipes_copy);
g2_draw_image(l1.texpaint, 0, 0);
g2_set_pipeline(null);
g2_end();
///else
g4_begin(layers_expa);
g4_set_pipeline(pipes_merge);
g4_set_tex(pipes_tex0, l1.texpaint);
@@ -68,6 +76,7 @@ function layers_ext_flatten(height_to_normal: bool = false, layers: slot_layer_t
g4_set_index_buffer(const_data_screen_aligned_ib);
g4_draw();
g4_end();
///end
}
if (l1.paint_nor) {
+8
View File
@@ -257,9 +257,13 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad
node_shader_write(frag, "float height = " + height + ";");
node_shader_write(frag, "float mat_opacity = " + opac + ";");
node_shader_write(frag, "float opacity = mat_opacity;");
///if is_forge
node_shader_write(frag, "opacity = 1.0;");
///else
if (context_raw.layer.fill_layer == null) {
node_shader_write(frag, "opacity *= brush_opacity;");
}
///end
if (context_raw.material.paint_emis) {
node_shader_write(frag, "float emis = " + emis + ";");
}
@@ -449,7 +453,11 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad
node_shader_add_uniform(frag, "sampler2D texpaint_pack_undo", "_texpaint_pack_undo");
node_shader_write(frag, "vec4 sample_nor_undo = textureLod(texpaint_nor_undo, sample_tc, 0.0);");
node_shader_write(frag, "vec4 sample_pack_undo = textureLod(texpaint_pack_undo, sample_tc, 0.0);");
///if is_forge
node_shader_write(frag, "frag_color[0] = vec4(" + make_material_blend_mode(frag, context_raw.brush_blending, "sample_undo.rgb", "basecol", "str") + ", mat_opacity);");
///else
node_shader_write(frag, "frag_color[0] = vec4(" + make_material_blend_mode(frag, context_raw.brush_blending, "sample_undo.rgb", "basecol", "str") + ", max(str, sample_undo.a));");
///end
node_shader_write(frag, "frag_color[1] = vec4(mix(sample_nor_undo.rgb, nortan, str), matid);");
if (context_raw.material.paint_height && make_material_height_used) {
node_shader_write(frag, "frag_color[2] = mix(sample_pack_undo, vec4(occlusion, roughness, metallic, height), str);");
+3 -2
View File
@@ -602,10 +602,11 @@ function box_preferences_show() {
if (hpathtrace_mode.init) {
hpathtrace_mode.position = context_raw.pathtrace_mode;
}
let pathtrace_mode_combo: string[] = [tr("Core"), tr("Full")];
let pathtrace_mode_combo: string[] = [tr("Fast"), tr("Quality")];
context_raw.pathtrace_mode = ui_combo(hpathtrace_mode, pathtrace_mode_combo, tr("Path Tracer"), true);
if (hpathtrace_mode.changed) {
render_path_raytrace_ready = false;
render_path_raytrace_first = true;
}
///end
@@ -614,7 +615,7 @@ function box_preferences_show() {
if (hrender_mode.init) {
hrender_mode.position = context_raw.render_mode;
}
let render_mode_combo: string[] = [tr("Full"), tr("Mobile")];
let render_mode_combo: string[] = [tr("Desktop"), tr("Mobile")];
context_raw.render_mode = ui_combo(hrender_mode, render_mode_combo, tr("Renderer"), true);
if (hrender_mode.changed) {
context_set_render_path();
+4 -3
View File
@@ -32,11 +32,12 @@ function render_path_raytrace_commands(use_live_layer: bool) {
if (!render_path_raytrace_ready || render_path_raytrace_is_bake) {
render_path_raytrace_ready = true;
render_path_raytrace_is_bake = false;
let mode: string = context_raw.pathtrace_mode == path_trace_mode_t.CORE ? "core" : "full";
let ext: string = "";
///if is_forge
mode = "forge";
ext = "forge_";
///end
render_path_raytrace_raytrace_init("raytrace_brute_" + mode + render_path_raytrace_ext);
let mode: string = context_raw.pathtrace_mode == path_trace_mode_t.CORE ? "core" : "full";
render_path_raytrace_raytrace_init("raytrace_brute_" + ext + mode + render_path_raytrace_ext);
render_path_raytrace_last_envmap = null;
}