prevent radioactive phong materials

metadata
Wenzel Jakob 2010-08-27 01:37:20 +02:00
parent eaf8ba36cb
commit f231d57b7a
2 changed files with 7 additions and 4 deletions

View File

@ -31,8 +31,11 @@ public:
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: 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. diffuse reflectance = %f * %f", m_kd, m_diffuseColor->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;

View File

@ -108,7 +108,7 @@ void ImportDialog::accept() {
QString targetScene = ui->sceneEdit->text();
QString adjustmentFile = ui->adjustmentEdit->text();
QDialog *dialog = new QDialog(this);
QDialog *dialog = new QDialog(static_cast<QWidget *>(parent()));
dialog->setWindowModality(Qt::WindowModal);
dialog->setWindowTitle("Converting ..");
QVBoxLayout *layout = new QVBoxLayout(dialog);
@ -130,9 +130,9 @@ void ImportDialog::accept() {
try {
cvt.convert(sourceFile.toStdString(), directory.toStdString(),
targetScene.toStdString(), adjustmentFile.toStdString());
((MainWindow *) parent())->loadFile(QString(cvt.getFilename().c_str()));
dialog->hide();
delete dialog;
((MainWindow *) parent())->loadFile(QString(cvt.getFilename().c_str()));
} catch (const std::exception &ex) {
dialog->hide();
delete dialog;