diff --git a/data/tests/test_bsdf.xml b/data/tests/test_bsdf.xml index 0c826dff..44c02f78 100644 --- a/data/tests/test_bsdf.xml +++ b/data/tests/test_bsdf.xml @@ -106,6 +106,4 @@ - - diff --git a/data/tests/test_phase.xml b/data/tests/test_phase.xml new file mode 100644 index 00000000..0c826dff --- /dev/null +++ b/data/tests/test_phase.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/librender/scene.cpp b/src/librender/scene.cpp index 088afee3..d64444a6 100644 --- a/src/librender/scene.cpp +++ b/src/librender/scene.cpp @@ -225,26 +225,27 @@ void Scene::configure() { m_integrator->configure(); } if (m_camera == NULL) { - Log(EWarn, "No camera found! Adding a default camera."); - Properties props("perspective"); /* Create a perspective camera with 45deg. FOV, which can see the whole scene */ AABB aabb; for (size_t i=0; igetAABB()); - if (!aabb.isValid()) - Log(EError, "Unable to set up a default camera -- does the scene contain anything at all?"); - Point center = aabb.getCenter(); - Vector extents = aabb.getExtents(); - Float maxExtents = std::max(extents.x, extents.y); - Float distance = maxExtents/(2.0f * std::tan(45 * .5f * M_PI/180)); + if (aabb.isValid()) { + Log(EInfo, "No camera found! Adding a default camera."); + Point center = aabb.getCenter(); + Vector extents = aabb.getExtents(); + Float maxExtents = std::max(extents.x, extents.y); + Float distance = maxExtents/(2.0f * std::tan(45 * .5f * M_PI/180)); - props.setTransform("toWorld", Transform::translate(Vector(center.x, center.y, aabb.min.z - distance))); - props.setFloat("fov", 45.0f); + props.setTransform("toWorld", Transform::translate(Vector(center.x, center.y, aabb.min.z - distance))); + props.setFloat("fov", 45.0f); - m_camera = static_cast (PluginManager::getInstance()->createObject(MTS_CLASS(Camera), props)); - m_camera->configure(); - m_sampler = m_camera->getSampler(); + m_camera = static_cast (PluginManager::getInstance()->createObject(MTS_CLASS(Camera), props)); + m_camera->configure(); + m_sampler = m_camera->getSampler(); + } else { + Log(EWarn, "Unable to set up a default camera -- does the scene contain anything at all?"); + } } m_integrator->configureSampler(m_sampler); diff --git a/src/mitsuba/mitsuba.cpp b/src/mitsuba/mitsuba.cpp index 44ea53aa..c34db6cf 100644 --- a/src/mitsuba/mitsuba.cpp +++ b/src/mitsuba/mitsuba.cpp @@ -350,6 +350,9 @@ int ubi_main(int argc, char **argv) { parser->parse(filename.file_string().c_str()); ref scene = handler->getScene(); + if (scene->getCamera() == NULL) + SLog(EError, "Scene does not contain a camera!"); + scene->setSourceFile(filename); scene->setDestinationFile(destFile.length() > 0 ? fs::path(destFile) : (filePath / baseName)); diff --git a/src/qtgui/sceneloader.cpp b/src/qtgui/sceneloader.cpp index 821def95..6f30c6f8 100644 --- a/src/qtgui/sceneloader.cpp +++ b/src/qtgui/sceneloader.cpp @@ -98,13 +98,13 @@ void SceneLoader::run() { scene->initialize(); if (scene->getIntegrator() == NULL) - SLog(EError, "The scene contains no integrator! Aborting.."); + SLog(EError, "Unable to load scene: no integrator found!"); if (scene->getCamera() == NULL) - SLog(EError, "The scene contains no camera! Aborting.."); + SLog(EError, "Unable to load scene: no camera found!"); if (scene->getCamera()->getFilm() == NULL) - SLog(EError, "The scene contains no film! Aborting.."); + SLog(EError, "Unable to load scene: no film found!"); if (scene->getLuminaires().size() == 0) - SLog(EError, "The scene contains no light sources! Aborting.."); + SLog(EError, "Unable to load scene: no light sources found!"); Vector2i size = scene->getFilm()->getSize(); Camera *camera = scene->getCamera();