void MyGL::SceneLoadDialog() { QString filepath = QFileDialog::getOpenFileName(0, QString("Load Scene"), QString("../scene_files"), tr("*.xml")); if(filepath.length() == 0) { return; } QFile file(filepath); int i = filepath.length() - 1; while(QString::compare(filepath.at(i), QChar('/')) != 0) { i--; } QStringRef local_path = filepath.leftRef(i+1); //Reset all of our objects scene.Clear(); //integrator = Integrator(); dir_integrator = DirectLightingIntegrator(); intersection_engine = IntersectionEngine(); //Load new objects based on the XML file chosen. xml_reader.LoadSceneFromFile(file, local_path, scene, dir_integrator); dir_integrator.scene = &scene; dir_integrator.intersection_engine = &intersection_engine; tot_integrator.scene = &scene; tot_integrator.intersection_engine = &intersection_engine; intersection_engine.scene = &scene; ResizeToSceneCamera(); update(); }
void MyGL::SceneLoadDialog() { QString filepath = QFileDialog::getOpenFileName(0, QString("Load Scene"), QString("../scene_files"), tr("*.xml")); if(filepath.length() == 0) { return; } QFile file(filepath); int i = filepath.length() - 1; while(QString::compare(filepath.at(i), QChar('/')) != 0) { i--; } QStringRef local_path = filepath.leftRef(i+1); //Reset all of our objects scene.Clear(); integrator = Integrator(); //delete existing bvh tree clearTree(this->intersection_engine.BVHrootNode); delete this->intersection_engine.BVHrootNode; intersection_engine = IntersectionEngine(); //Load new objects based on the XML file chosen. xml_reader.LoadSceneFromFile(file, local_path, scene, integrator); integrator.scene = &scene; integrator.intersection_engine = &intersection_engine; intersection_engine.scene = &scene; //create new tree with this new set of geometry! this->intersection_engine.BVHrootNode = new BVHnode(); this->intersection_engine.BVHrootNode = createBVHtree(this->intersection_engine.BVHrootNode, this->scene.objects, 0); update(); }