prevent radioactive phong materials
parent
eaf8ba36cb
commit
f231d57b7a
|
@ -31,8 +31,11 @@ public:
|
||||||
|
|
||||||
if (m_kd * m_diffuseColor->getMaximum().max() + m_ks * m_specularColor->getMaximum().max() > 1.0f) {
|
if (m_kd * m_diffuseColor->getMaximum().max() + m_ks * m_specularColor->getMaximum().max() > 1.0f) {
|
||||||
Log(EWarn, "%s: Energy conservation is violated!", props.getID().c_str());
|
Log(EWarn, "%s: Energy conservation is violated!", props.getID().c_str());
|
||||||
Log(EWarn, "%s: Max. diffuse reflectance = %f * %f", m_kd, m_diffuseColor->getMaximum().max());
|
Log(EWarn, "Max. diffuse reflectance = %f * %f", m_kd, m_diffuseColor->getMaximum().max());
|
||||||
Log(EWarn, "%s: Max. specular reflectance = %f * %f", m_ks, m_specularColor->getMaximum().max());
|
Log(EWarn, "Max. specular reflectance = %f * %f", m_ks, m_specularColor->getMaximum().max());
|
||||||
|
Float normalization = 1/(m_kd * m_diffuseColor->getMaximum().max() + m_ks * m_specularColor->getMaximum().max());
|
||||||
|
Log(EWarn, "Reducing the albedo to %.1f%% of the original value", normalization * 100);
|
||||||
|
m_kd *= normalization; m_ks *= normalization;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_componentCount = 2;
|
m_componentCount = 2;
|
||||||
|
|
|
@ -108,7 +108,7 @@ void ImportDialog::accept() {
|
||||||
QString targetScene = ui->sceneEdit->text();
|
QString targetScene = ui->sceneEdit->text();
|
||||||
QString adjustmentFile = ui->adjustmentEdit->text();
|
QString adjustmentFile = ui->adjustmentEdit->text();
|
||||||
|
|
||||||
QDialog *dialog = new QDialog(this);
|
QDialog *dialog = new QDialog(static_cast<QWidget *>(parent()));
|
||||||
dialog->setWindowModality(Qt::WindowModal);
|
dialog->setWindowModality(Qt::WindowModal);
|
||||||
dialog->setWindowTitle("Converting ..");
|
dialog->setWindowTitle("Converting ..");
|
||||||
QVBoxLayout *layout = new QVBoxLayout(dialog);
|
QVBoxLayout *layout = new QVBoxLayout(dialog);
|
||||||
|
@ -130,9 +130,9 @@ void ImportDialog::accept() {
|
||||||
try {
|
try {
|
||||||
cvt.convert(sourceFile.toStdString(), directory.toStdString(),
|
cvt.convert(sourceFile.toStdString(), directory.toStdString(),
|
||||||
targetScene.toStdString(), adjustmentFile.toStdString());
|
targetScene.toStdString(), adjustmentFile.toStdString());
|
||||||
((MainWindow *) parent())->loadFile(QString(cvt.getFilename().c_str()));
|
|
||||||
dialog->hide();
|
dialog->hide();
|
||||||
delete dialog;
|
delete dialog;
|
||||||
|
((MainWindow *) parent())->loadFile(QString(cvt.getFilename().c_str()));
|
||||||
} catch (const std::exception &ex) {
|
} catch (const std::exception &ex) {
|
||||||
dialog->hide();
|
dialog->hide();
|
||||||
delete dialog;
|
delete dialog;
|
||||||
|
|
Loading…
Reference in New Issue