paint: cleanup
This commit is contained in:
@@ -340,10 +340,6 @@ void base_update(void *_) {
|
||||
|
||||
base_handle_drop_paths();
|
||||
|
||||
if (g_context->ddirty < 0) {
|
||||
g_context->ddirty = 0;
|
||||
}
|
||||
|
||||
if (g_context->tool == TOOL_TYPE_CURSOR && context_in_3d_view()) {
|
||||
if (keyboard_down("control") && keyboard_started("d")) {
|
||||
sim_duplicate();
|
||||
@@ -395,6 +391,12 @@ void base_update(void *_) {
|
||||
sim_stop();
|
||||
}
|
||||
|
||||
if (sim_running || tab_timeline_playing) {
|
||||
if (g_context->ddirty < 0) {
|
||||
g_context->ddirty = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_context->frame == 2) {
|
||||
util_render_make_material_preview();
|
||||
ui_base_hwnds->buffer[TAB_AREA_SIDEBAR1]->redraws = 2;
|
||||
|
||||
@@ -7,7 +7,6 @@ void context_init() {
|
||||
g_context->merged_object_is_atlas = false; // Only objects referenced by atlas are merged
|
||||
g_context->ddirty = 0; // depth
|
||||
g_context->pdirty = 0; // paint
|
||||
g_context->rdirty = 0; // render
|
||||
g_context->brush_blend_dirty = true;
|
||||
g_context->split_view = false;
|
||||
g_context->view_index = -1;
|
||||
|
||||
@@ -787,7 +787,6 @@ void render_path_paint_commands_paint(bool dilation);
|
||||
void render_path_paint_use_live_layer(bool use);
|
||||
void render_path_paint_commands_cursor();
|
||||
bool render_path_paint_paint_enabled();
|
||||
void render_path_paint_live_brush_dirty();
|
||||
void render_path_paint_begin();
|
||||
void render_path_paint_end();
|
||||
bool render_path_paint_is_rt_bake();
|
||||
|
||||
@@ -257,7 +257,6 @@ void history_swap_object_transform(history_step_t *step) {
|
||||
}
|
||||
context_select_paint_object(g_project->_->paint_objects->buffer[step->object]);
|
||||
ui_header_handle->redraws = 2;
|
||||
g_context->rdirty = 2;
|
||||
}
|
||||
|
||||
ui_node_canvas_t *history_get_canvas(history_step_t *step) {
|
||||
|
||||
@@ -798,7 +798,6 @@ void minic_register_builtins() {
|
||||
MINIC_O(paint_object, mesh_object_t);
|
||||
MINIC_I(ddirty);
|
||||
MINIC_I(pdirty);
|
||||
MINIC_I(rdirty);
|
||||
MINIC_O(material, slot_material_t);
|
||||
MINIC_P(layer);
|
||||
MINIC_P(brush);
|
||||
|
||||
@@ -283,7 +283,6 @@ void script_paint_end(void) {
|
||||
|
||||
g_context->pdirty = 0;
|
||||
g_context->rtdirty = 1;
|
||||
g_context->rdirty = 2;
|
||||
g_context->ddirty = 2;
|
||||
g_context->brush_time = 0.0f;
|
||||
g_context->brush_blend_dirty = true;
|
||||
@@ -314,7 +313,6 @@ void script_fill_layer(void) {
|
||||
layers_update_fill_layer(true);
|
||||
g_context->layer_preview_dirty = true;
|
||||
g_context->rtdirty = 1;
|
||||
g_context->rdirty = 2;
|
||||
g_context->ddirty = 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -197,8 +197,11 @@ void brush_output_node_run() {
|
||||
|
||||
if (g_context->painted <= 1) {
|
||||
g_context->pdirty = 1;
|
||||
g_context->rdirty = 2;
|
||||
sculpt_push_undo = true;
|
||||
slot_layer_t *l = g_context->layer;
|
||||
if (l->texpaint_sculpt != NULL || (l->parent != NULL && l->parent->texpaint_sculpt != NULL)) {
|
||||
g_context->ddirty = 2;
|
||||
}
|
||||
sculpt_push_undo = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,6 @@ static void bake_texture_node_run(ui_node_t *node, int bake_type, bool rt_bake)
|
||||
|
||||
g_context->layer->texpaint = rt->_image;
|
||||
g_context->pdirty = rt_bake ? g_context->bake_samples : 1;
|
||||
g_context->rdirty = 3;
|
||||
g_context->rtdirty = 1;
|
||||
render_path_raytrace_bake_current_sample = 0;
|
||||
render_path_raytrace_frame = 0;
|
||||
|
||||
@@ -309,7 +309,6 @@ static void texture_mesh_node_project(ui_node_t *node) {
|
||||
render_path_base_draw_gbuffer();
|
||||
|
||||
g_context->rtdirty = 1;
|
||||
g_context->rdirty = 2;
|
||||
ui_nodes_hwnd->redraws = 2;
|
||||
ui_view2d_hwnd->redraws = 2;
|
||||
|
||||
|
||||
@@ -276,7 +276,6 @@ void render_gizmo_update() {
|
||||
|
||||
if (g_context->translate_x || g_context->translate_y || g_context->translate_z || g_context->scale_x || g_context->scale_y || g_context->scale_z ||
|
||||
g_context->rotate_x || g_context->rotate_y || g_context->rotate_z) {
|
||||
g_context->rdirty = 2;
|
||||
if (is_object) {
|
||||
transform_t *t = paint_object->transform;
|
||||
gizmo_v = (vec4_t){transform_world_x(t), transform_world_y(t), transform_world_z(t), 1.0};
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#include "../global.h"
|
||||
|
||||
f32 render_path_base_super_sample = 1.0;
|
||||
f32 render_path_base_last_x = -1.0;
|
||||
f32 render_path_base_last_y = -1.0;
|
||||
render_target_t_array_t *render_path_base_bloom_mipmaps;
|
||||
|
||||
void render_path_base_init() {
|
||||
@@ -95,46 +93,6 @@ bool render_path_base_ssaa4() {
|
||||
return g_config->rp_supersample == 4;
|
||||
}
|
||||
|
||||
bool render_path_base_is_cached() {
|
||||
if (iron_window_width() == 0 || iron_window_height() == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
f32 mx = render_path_base_last_x;
|
||||
f32 my = render_path_base_last_y;
|
||||
render_path_base_last_x = mouse_view_x();
|
||||
render_path_base_last_y = mouse_view_y();
|
||||
|
||||
if (g_context->ddirty <= 0 && g_context->rdirty <= 0 && g_context->pdirty <= 0) {
|
||||
if (mx != render_path_base_last_x || my != render_path_base_last_y || iron_mouse_is_locked()) {
|
||||
g_context->ddirty = 0;
|
||||
}
|
||||
|
||||
if (g_context->ddirty > -6) {
|
||||
// Accumulate taa frames
|
||||
g_context->ddirty--;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (g_context->ddirty > -12) {
|
||||
render_path_set_target("", NULL, NULL, GPU_CLEAR_NONE, 0, 0.0);
|
||||
render_path_bind_target("last", "tex");
|
||||
if (render_path_base_ssaa4()) {
|
||||
render_path_draw_shader("Scene/supersample_resolve/supersample_resolveRGBA64");
|
||||
}
|
||||
else {
|
||||
render_path_draw_shader("Scene/copy_pass/copy_pass");
|
||||
}
|
||||
render_path_paint_commands_cursor();
|
||||
g_context->ddirty--;
|
||||
}
|
||||
|
||||
render_path_base_end();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void render_path_base_draw_split(void (*draw_commands)(void)) {
|
||||
if (g_context->split_view && !g_context->paint2d_view) {
|
||||
g_context->ddirty = 2;
|
||||
@@ -159,7 +117,7 @@ void render_path_base_draw_split(void (*draw_commands)(void)) {
|
||||
}
|
||||
|
||||
void render_path_base_commands(void (*draw_commands)(void)) {
|
||||
if (render_path_base_is_cached()) {
|
||||
if (iron_window_width() == 0 || iron_window_height() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,6 +126,5 @@ void render_path_deferred_draw_deferred() {
|
||||
}
|
||||
|
||||
void render_path_deferred_commands() {
|
||||
render_path_paint_live_brush_dirty();
|
||||
render_path_base_commands(render_path_deferred_draw_deferred);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,5 @@ void render_path_forward_draw_forward() {
|
||||
}
|
||||
|
||||
void render_path_forward_commands() {
|
||||
render_path_paint_live_brush_dirty();
|
||||
render_path_base_commands(render_path_forward_draw_forward);
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@ render_target_t *_render_path_paint_texpaint_pack;
|
||||
render_target_t *_render_path_paint_texpaint_undo;
|
||||
render_target_t *_render_path_paint_texpaint_nor_undo;
|
||||
render_target_t *_render_path_paint_texpaint_pack_undo;
|
||||
f32 render_path_paint_last_x = -1.0;
|
||||
f32 render_path_paint_last_y = -1.0;
|
||||
bake_type_t _render_path_paint_bake_type;
|
||||
|
||||
void render_path_paint_init() {
|
||||
@@ -828,19 +826,6 @@ bool render_path_paint_paint_enabled() {
|
||||
return !fill_layer && !group_layer && !g_context->foreground_event && !self_in_material;
|
||||
}
|
||||
|
||||
void render_path_paint_live_brush_dirty() {
|
||||
f32 mx = render_path_paint_last_x;
|
||||
f32 my = render_path_paint_last_y;
|
||||
render_path_paint_last_x = mouse_view_x();
|
||||
render_path_paint_last_y = mouse_view_y();
|
||||
if (g_config->brush_live && g_context->pdirty <= 0) {
|
||||
bool moved = (mx != render_path_paint_last_x || my != render_path_paint_last_y) && (context_in_3d_view() || context_in_2d_view(VIEW_2D_TYPE_LAYER));
|
||||
if (moved || g_context->brush_locked) {
|
||||
g_context->rdirty = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void render_path_paint_begin() {
|
||||
if (g_context->layer->texpaint_sculpt != NULL) {
|
||||
render_path_sculpt_begin();
|
||||
@@ -878,7 +863,6 @@ void render_path_paint_begin() {
|
||||
|
||||
void render_path_paint_end() {
|
||||
g_context->ddirty--;
|
||||
g_context->rdirty--;
|
||||
|
||||
g_context->last_paint_vec_x = g_context->paint_vec.x;
|
||||
g_context->last_paint_vec_y = g_context->paint_vec.y;
|
||||
|
||||
@@ -108,12 +108,8 @@ void render_path_raytrace_commands(bool use_live_layer) {
|
||||
render_target_t *framebuffer = any_map_get(render_path_render_targets, "buf");
|
||||
_gpu_raytrace_dispatch_rays(framebuffer->_image, render_path_raytrace_f32a);
|
||||
|
||||
if (g_context->ddirty == 1 || g_context->pdirty == 1) {
|
||||
g_context->rdirty = 4;
|
||||
}
|
||||
g_context->ddirty--;
|
||||
g_context->pdirty--;
|
||||
g_context->rdirty--;
|
||||
|
||||
// g_context->ddirty = 1; // _RENDER
|
||||
}
|
||||
|
||||
@@ -126,7 +126,6 @@ bool render_path_raytrace_bake_commands(void (*parse_paint_material)(bool)) {
|
||||
|
||||
if (g_context->brush_time > 0) {
|
||||
g_context->pdirty = 2;
|
||||
g_context->rdirty = 2;
|
||||
}
|
||||
|
||||
if (g_context->pdirty > 0) {
|
||||
|
||||
@@ -185,7 +185,6 @@ typedef struct context {
|
||||
bool merged_object_is_atlas;
|
||||
i32 ddirty; // depth
|
||||
i32 pdirty; // paint
|
||||
i32 rdirty; // render
|
||||
i32 rtdirty; // raytrace
|
||||
bool brush_blend_dirty;
|
||||
bool split_view;
|
||||
|
||||
@@ -296,7 +296,6 @@ void layers_update_fill_layers() {
|
||||
g_context->tool = _tool;
|
||||
g_context->fill_type = _fill_type;
|
||||
g_context->pdirty = 0;
|
||||
g_context->rdirty = 2;
|
||||
render_path_paint_restore_plane_mesh();
|
||||
make_material_parse_paint_material(true);
|
||||
ui_view2d_hwnd->redraws = 2;
|
||||
@@ -377,7 +376,6 @@ void layers_update_fill_layers() {
|
||||
}
|
||||
g_context->pdirty = 0;
|
||||
g_context->ddirty = 2;
|
||||
g_context->rdirty = 2;
|
||||
g_context->rtdirty = 1;
|
||||
g_context->layers_preview_dirty = true;
|
||||
if (in_use)
|
||||
@@ -447,7 +445,6 @@ void layers_update_fill_layer(bool parse_paint) {
|
||||
render_path_paint_dilate(true, true);
|
||||
}
|
||||
|
||||
g_context->rdirty = 2;
|
||||
g_context->tool = _tool;
|
||||
g_context->fill_type = _fill_type;
|
||||
if (parse_paint && layers_tool_paints_fill_layer(_tool)) {
|
||||
|
||||
@@ -43,7 +43,6 @@ void util_particle_update() {
|
||||
}
|
||||
if (any_active) {
|
||||
g_context->ddirty = 2;
|
||||
g_context->rdirty = 2;
|
||||
iron_delay_idle_sleep();
|
||||
}
|
||||
|
||||
|
||||
@@ -504,7 +504,6 @@ static void path_repaint(slot_layer_t *l) {
|
||||
|
||||
g_context->pdirty = 0;
|
||||
g_context->rtdirty = 1;
|
||||
g_context->rdirty = 2;
|
||||
g_context->tool = _tool;
|
||||
g_context->layer = _layer;
|
||||
g_context->material = _material;
|
||||
|
||||
Reference in New Issue
Block a user