diff --git a/src/libpython/core.cpp b/src/libpython/core.cpp index b0a570c8..083cae52 100644 --- a/src/libpython/core.cpp +++ b/src/libpython/core.cpp @@ -901,6 +901,7 @@ struct NativeBuffer { case Bitmap::EUInt8: result = bp::object(((uint8_t *) buf.ptr)[idx]); break; case Bitmap::EUInt16: result = bp::object(((uint16_t *) buf.ptr)[idx]); break; case Bitmap::EUInt32: result = bp::object(((uint32_t *) buf.ptr)[idx]); break; + case Bitmap::EFloat16: result = bp::object((float) ((half *) buf.ptr)[idx]); break; case Bitmap::EFloat32: result = bp::object(((float *) buf.ptr)[idx]); break; case Bitmap::EFloat64: result = bp::object(((double *) buf.ptr)[idx]); break; default: diff --git a/src/mtsgui/main.cpp b/src/mtsgui/main.cpp index 334614b4..d8195cc5 100644 --- a/src/mtsgui/main.cpp +++ b/src/mtsgui/main.cpp @@ -163,7 +163,7 @@ void collect_zombies(int s) { #endif int main(int argc, char *argv[]) { - int retval; + int retval = -1; /* Initialize the core framework */ Class::staticInitialization(); @@ -298,8 +298,8 @@ int main(int argc, char *argv[]) { #endif mainWindow = new MainWindow(); - mainWindow->initWorkers(); - retval = app.exec(); + if (mainWindow->initWorkersProcessArgv()) + retval = app.exec(); #if defined(MTS_HAS_BREAKPAD) #if defined(__OSX__) @@ -313,7 +313,6 @@ int main(int argc, char *argv[]) { SLog(EWarn, "Critical exception during startup: %s", e.what()); QMessageBox::critical(NULL, QString("Critical exception"), e.what(), QMessageBox::Ok); - retval = -1; } Statistics::getInstance()->printStats(); diff --git a/src/mtsgui/mainwindow.cpp b/src/mtsgui/mainwindow.cpp index 2468fb82..9817f963 100644 --- a/src/mtsgui/mainwindow.cpp +++ b/src/mtsgui/mainwindow.cpp @@ -246,7 +246,8 @@ MainWindow::MainWindow(QWidget *parent) : MainWindow::~MainWindow() { m_renderQueue->unregisterListener(m_renderListener); ref scheduler = Scheduler::getInstance(); - scheduler->pause(); + if (scheduler->isRunning()) + scheduler->pause(); for (int i=0; iunregisterWorker(c.worker); @@ -259,10 +260,52 @@ MainWindow::~MainWindow() { delete ui; } -void MainWindow::initWorkers() { +bool MainWindow::initWorkersProcessArgv() { QSettings settings; - ref scheduler = Scheduler::getInstance(); + QStringList args = qApp->arguments(), toBeLoaded; int localWorkerCount = settings.value("localWorkers", getCoreCount()).toInt(); + ref scheduler = Scheduler::getInstance(); + + for (int i=1; i resolver = Thread::getThread()->getFileResolver(); + QString value = args[i].mid(2); + if (value.length() == 0 && i+1appendPath(value.toStdString()); + } else if (args[i].startsWith("-p")) { + QString value = args[i].mid(2); + if (value.length() == 0 && i+1" << endl; + cout << "Options/Arguments:" << endl; + cout << " -h Display this help text" << endl << endl; + cout << " -D key=val Define a constant, which can referenced as \"$key\" in the scene" << endl << endl; + cout << " -a p1;p2;.. Add one or more entries to the resource search path" << endl << endl; + cout << " -p count Override the detected number of processors." << endl << endl; + cout << " For documentation, please refer to http://www.mitsuba-renderer.org/docs.html" << endl; + return false; + } else if (args[i].startsWith("-")) { + cerr << "Unknown option \"" << args[i].toStdString() << "\"" << endl; + } else { + toBeLoaded.append(args[i]); + } + } + m_workerPriority = (Thread::EThreadPriority) settings.value("workerPriority", (int) Thread::ELowPriority).toInt(); for (int i=0; iregisterWorker(new LocalWorker(0, formatString("wrk%i", localWorkerCtr++), m_workerPriority)); } - QStringList args = qApp->arguments(); - for (int i=1; istart(); raise(); + return true; } diff --git a/src/mtsgui/mainwindow.h b/src/mtsgui/mainwindow.h index 2ec338d7..6ecdebbd 100644 --- a/src/mtsgui/mainwindow.h +++ b/src/mtsgui/mainwindow.h @@ -120,7 +120,7 @@ public: void loadFile(QString filename); void adjustSize(); bool isActive(); - void initWorkers(); + bool initWorkersProcessArgv(); protected: SceneContext *loadScene(const QString &filename);