save tonemapping attributes from the GUI
parent
90eb130487
commit
6170f1d9a3
|
@ -200,6 +200,7 @@ void saveScene(QWidget *parent, SceneContext *ctx, const QString &targetFile) {
|
|||
film.setAttribute("type", "exrfilm");
|
||||
camera.insertAfter(film, QDomNode());
|
||||
}
|
||||
|
||||
QDomElement widthProperty = findProperty(film, "width");
|
||||
QDomElement heightProperty = findProperty(film, "height");
|
||||
|
||||
|
@ -215,6 +216,57 @@ void saveScene(QWidget *parent, SceneContext *ctx, const QString &targetFile) {
|
|||
film.insertBefore(heightProperty, QDomNode());
|
||||
}
|
||||
|
||||
if (film.attribute("type") == "pngfilm") {
|
||||
/* Set tonemapping attributes */
|
||||
QDomElement method = findProperty(film, "toneMappingMethod");
|
||||
QDomElement reinhardBurn = findProperty(film, "reinhardBurn");
|
||||
QDomElement reinhardKey = findProperty(film, "reinhardKey");
|
||||
QDomElement exposure = findProperty(film, "exposure");
|
||||
QDomElement gamma = findProperty(film, "gamma");
|
||||
|
||||
if (method.isNull()) {
|
||||
method = doc.createElement("string");
|
||||
method.setAttribute("name", "toneMappingMethod");
|
||||
film.insertBefore(method, QDomNode());
|
||||
}
|
||||
method.setAttribute("value", ctx->toneMappingMethod == EReinhard ? "reinhard" : "gamma");
|
||||
|
||||
if (gamma.isNull()) {
|
||||
gamma = doc.createElement("float");
|
||||
gamma.setAttribute("name", "gamma");
|
||||
film.insertBefore(gamma, QDomNode());
|
||||
}
|
||||
gamma.setAttribute("value", QString::number(ctx->srgb ? (Float) -1 : ctx->gamma));
|
||||
|
||||
if (ctx->toneMappingMethod == EGamma) {
|
||||
if (exposure.isNull()) {
|
||||
exposure = doc.createElement("float");
|
||||
exposure.setAttribute("name", "exposure");
|
||||
film.insertBefore(exposure, QDomNode());
|
||||
}
|
||||
exposure.setAttribute("value", QString::number(ctx->exposure));
|
||||
if (!reinhardKey.isNull())
|
||||
film.removeChild(reinhardKey);
|
||||
if (!reinhardBurn.isNull())
|
||||
film.removeChild(reinhardBurn);
|
||||
} else {
|
||||
if (reinhardKey.isNull()) {
|
||||
reinhardKey = doc.createElement("float");
|
||||
reinhardKey.setAttribute("name", "reinhardKey");
|
||||
film.insertBefore(reinhardKey, QDomNode());
|
||||
}
|
||||
if (reinhardBurn.isNull()) {
|
||||
reinhardBurn = doc.createElement("float");
|
||||
reinhardBurn.setAttribute("name", "reinhardBurn");
|
||||
film.insertBefore(reinhardBurn, QDomNode());
|
||||
}
|
||||
reinhardKey.setAttribute("value", QString::number(ctx->reinhardKey));
|
||||
reinhardBurn.setAttribute("value", QString::number(ctx->reinhardBurn));
|
||||
if (!exposure.isNull())
|
||||
film.removeChild(exposure);
|
||||
}
|
||||
}
|
||||
|
||||
Vector2i filmSize = sceneCamera->getFilm()->getSize();
|
||||
widthProperty.setAttribute("value", QString::number(filmSize.x));
|
||||
heightProperty.setAttribute("value", QString::number(filmSize.y));
|
||||
|
|
Loading…
Reference in New Issue