Fix rt bake

This commit is contained in:
luboslenco
2025-01-11 21:53:09 +01:00
parent ab4f88d386
commit 8651ccaa9b
3 changed files with 16 additions and 11 deletions
+10 -9
View File
@@ -648,6 +648,15 @@ function _render_path_paint_deriv() {
app_notify_on_init(_render_path_paint_final);
}
///if (arm_direct3d12 || arm_vulkan || arm_metal)
function render_path_paint_is_rt_bake(): bool {
return (context_raw.bake_type == bake_type_t.AO ||
context_raw.bake_type == bake_type_t.LIGHTMAP ||
context_raw.bake_type == bake_type_t.BENT_NORMAL ||
context_raw.bake_type == bake_type_t.THICKNESS);
}
///end
function render_path_paint_draw() {
if (!render_path_paint_paint_enabled()) {
return;
@@ -668,14 +677,6 @@ function render_path_paint_draw() {
}
if (context_raw.tool == workspace_tool_t.BAKE) {
///if (arm_direct3d12 || arm_vulkan || arm_metal)
let is_raytraced_bake: bool = (context_raw.bake_type == bake_type_t.AO ||
context_raw.bake_type == bake_type_t.LIGHTMAP ||
context_raw.bake_type == bake_type_t.BENT_NORMAL ||
context_raw.bake_type == bake_type_t.THICKNESS);
///end
if (context_raw.bake_type == bake_type_t.NORMAL || context_raw.bake_type == bake_type_t.HEIGHT || context_raw.bake_type == bake_type_t.DERIVATIVE) {
if (!render_path_paint_baking && context_raw.pdirty > 0) {
render_path_paint_baking = true;
@@ -723,7 +724,7 @@ function render_path_paint_draw() {
if (is_merged) context_raw.merged_object.base.visible = _visible;
}
///if (arm_direct3d12 || arm_vulkan || arm_metal)
else if (is_raytraced_bake) {
else if (render_path_paint_is_rt_bake()) {
let dirty: bool = render_path_raytrace_bake_commands(make_material_parse_paint_material);
if (dirty) ui_header_handle.redraws = 2;
if (config_raw.dilate == dilate_type_t.INSTANT) { // && raw.pdirty == 1
+5 -2
View File
@@ -145,7 +145,7 @@ function ui_header_draw_tool_properties(ui: ui_t) {
///if (arm_direct3d12 || arm_vulkan || arm_metal)
let baking: bool = context_raw.pdirty > 0;
let rt_bake: bool = context_raw.bake_type == bake_type_t.AO || context_raw.bake_type == bake_type_t.LIGHTMAP || context_raw.bake_type == bake_type_t.BENT_NORMAL || context_raw.bake_type == bake_type_t.THICKNESS;
let rt_bake: bool = render_path_paint_is_rt_bake();
if (baking && ui_button(tr("Stop"))) {
context_raw.pdirty = 0;
context_raw.rdirty = 2;
@@ -214,7 +214,10 @@ function ui_header_draw_tool_properties(ui: ui_t) {
}
///end
if (context_raw.bake_type == bake_type_t.NORMAL_OBJECT || context_raw.bake_type == bake_type_t.POSITION || context_raw.bake_type == bake_type_t.BENT_NORMAL) {
if (context_raw.bake_type == bake_type_t.NORMAL_OBJECT ||
context_raw.bake_type == bake_type_t.POSITION ||
context_raw.bake_type == bake_type_t.BENT_NORMAL
) {
let bake_up_axis_handle: ui_handle_t = ui_handle(__ID__);
if (bake_up_axis_handle.init) {
bake_up_axis_handle.position = context_raw.bake_up_axis;
@@ -64,6 +64,7 @@ function render_path_raytrace_bake_commands(parse_paint_material: (b?: bool)=>vo
context_raw.bake_type = _bake_type;
app_notify_on_next_frame(parse_paint_material);
render_path_raytrace_first = true;
render_path_raytrace_raytrace_init(render_path_raytrace_bake_get_bake_shader_name(), rebuild);
return false;