summaryrefslogtreecommitdiffstats
path: root/scene/3d/gi_probe.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-10-30 16:33:07 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-10-30 16:33:37 -0300
commit495bcd730177f58053b8e76199d3ccd15ca0dcc9 (patch)
treed5a8caaafa97a9525915c4c8772b8a18d574a555 /scene/3d/gi_probe.cpp
parent1e8c33fc62dc97afcce297c264afd0b51fb73df7 (diff)
downloadredot-engine-495bcd730177f58053b8e76199d3ccd15ca0dcc9.tar.gz
Clean up GI Probe baking, proper button and progress bar.
Diffstat (limited to 'scene/3d/gi_probe.cpp')
-rw-r--r--scene/3d/gi_probe.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index d5a030b35c..c0ca358717 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -1134,6 +1134,10 @@ void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) {
}
}
+GIProbe::BakeBeginFunc GIProbe::bake_begin_function = NULL;
+GIProbe::BakeStepFunc GIProbe::bake_step_function = NULL;
+GIProbe::BakeEndFunc GIProbe::bake_end_function = NULL;
+
void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
Baker baker;
@@ -1177,14 +1181,25 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
_find_meshes(p_from_node ? p_from_node : get_parent(), &baker);
+ if (bake_begin_function) {
+ bake_begin_function(baker.mesh_list.size() + 1);
+ }
+
int pmc = 0;
for (List<Baker::PlotMesh>::Element *E = baker.mesh_list.front(); E; E = E->next()) {
- print_line("plotting mesh " + itos(pmc++) + "/" + itos(baker.mesh_list.size()));
+ if (bake_step_function) {
+ bake_step_function(pmc, RTR("Plotting Meshes") + " " + itos(pmc) + "/" + itos(baker.mesh_list.size()));
+ }
+
+ pmc++;
_plot_mesh(E->get().local_xform, E->get().mesh, &baker, E->get().instance_materials, E->get().override_material);
}
+ if (bake_step_function) {
+ bake_step_function(pmc++, RTR("Finishing Plot"));
+ }
_fixup_plot(0, 0, 0, 0, 0, &baker);
@@ -1282,6 +1297,10 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
set_probe_data(probe_data);
}
+
+ if (bake_end_function) {
+ bake_end_function();
+ }
}
void GIProbe::_debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker) {