forked from LuxCoreRender/LuxCore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhaltconditionswindow.cpp
103 lines (87 loc) · 4.2 KB
/
haltconditionswindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/***************************************************************************
* Copyright 1998-2018 by authors (see AUTHORS.txt) *
* *
* This file is part of LuxCoreRender. *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.*
* See the License for the specific language governing permissions and *
* limitations under the License. *
***************************************************************************/
#include <iostream>
#include <boost/format.hpp>
#include "luxcoreapp.h"
using namespace std;
using namespace luxrays;
using namespace luxcore;
//------------------------------------------------------------------------------
// HaltConditionsWindow
//------------------------------------------------------------------------------
HaltConditionsWindow::HaltConditionsWindow(LuxCoreApp *a) : ObjectEditorWindow(a, "Halt conditions") {
}
void HaltConditionsWindow::RefreshObjectProperties(Properties &props) {
RenderConfig *config = app->config;
try {
props = config->ToProperties().GetAllProperties("batch.halt");
} catch(exception &ex) {
LA_LOG("Halt conditions parsing error: " << endl << ex.what());
// Just revert to the initialized properties (note: they will include the error)
props = config->GetProperties().GetAllProperties("batch.halt");
}
}
void HaltConditionsWindow::ParseObjectProperties(const Properties &props) {
app->RenderConfigParse(props.GetAllProperties("batch.halt"));
}
bool HaltConditionsWindow::DrawObjectGUI(Properties &props, bool &modifiedProps) {
if (ImGui::CollapsingHeader("Halt threshold", NULL, true, true)) {
float fval = props.Get("batch.haltnoisethreshold").Get<float>();
if (ImGui::InputFloat("Convergence threshold", &fval)) {
props.Set(Property("batch.haltnoisethreshold")(fval));
modifiedProps = true;
}
int ival = props.Get("batch.haltnoisethreshold.warmup").Get<int>();
if (ImGui::InputInt("Warm up samples/pixel", &ival)) {
props.Set(Property("batch.haltnoisethreshold.warmup")(ival));
modifiedProps = true;
}
ival = props.Get("batch.haltnoisethreshold.step").Get<int>();
if (ImGui::InputInt("Samples/pixel steps", &ival)) {
props.Set(Property("batch.haltnoisethreshold.step")(ival));
modifiedProps = true;
}
bool bval = props.Get("batch.haltnoisethreshold.filter.enable").Get<bool>();
if (ImGui::Checkbox("Use box filter for CONVERGENCE AOV", &bval)) {
props.Set(Property("batch.haltnoisethreshold.filter.enable")(bval));
modifiedProps = true;
}
LuxCoreApp::HelpMarker("batch.haltnoisethreshold.filter.enable");
bval = props.Get("batch.haltnoisethreshold.stoprendering.enable").Get<bool>();
if (ImGui::Checkbox("Stop the rendering", &bval)) {
props.Set(Property("batch.haltnoisethreshold.stoprendering.enable")(bval));
modifiedProps = true;
}
LuxCoreApp::HelpMarker("batch.haltnoisethreshold.stoprendering.enable");
}
if (ImGui::CollapsingHeader("Halt time", NULL, true, true)) {
float fval = props.Get("batch.halttime").Get<float>();
if (ImGui::InputFloat("Total time in secs", &fval)) {
props.Set(Property("batch.halttime")(fval));
modifiedProps = true;
}
}
if (ImGui::CollapsingHeader("Halt samples/pixel", NULL, true, true)) {
int ival = props.Get("batch.haltspp").Get<int>();
if (ImGui::InputInt("Total samples/pixel", &ival)) {
props.Set(Property("batch.haltspp")(ival));
modifiedProps = true;
}
}
return false;
}