void Renderer::render() { session.Start(); Scene scene = config.GetScene(); std::vector<Point> cameraPositions = getCameraPositions(); // Render each mesh while(hasNextMesh()){ session.BeginSceneEdit(); cleanScene(); addRandomEnvironment(); addNextMesh(); // Every mesh gets a random material config.GetScene().Parse( Property("scene.objects.subject.material")(getRandomMaterial()) << Property("scene.objects.subject.shape")("subject") << Property("scene.objects.subject.id")(1) ); session.EndSceneEdit(); std::cout<< scene.ToProperties() << std::endl; // Render from multiple camera positions std::cout << "Number of lights: " << config.GetScene().GetLightCount() << std::endl; std::cout << "Number of objects: " << config.GetScene().GetObjectCount() << std::endl; for (unsigned long image_number = 0; image_number < cameraPositions.size(); image_number++) { Point point = cameraPositions[image_number]; session.BeginSceneEdit(); scene.Parse( Property("scene.camera.type")("perspective")<< Property("scene.camera.lookat.orig")(point.x*camera_distance, point.y*camera_distance, point.z*camera_distance) << Property("scene.camera.lookat.target")(0.f, 0.f, 0.f)<< Property("scene.camera.cliphither")(0.00100000005)<< Property("scene.camera.clipyon")(1.00000002e+030)<< Property("scene.camera.shutteropen")(0)<< Property("scene.camera.shutterclose")(0.0416666679)<< Property("scene.camera.screenwindow")(-1, 1, -1, 1)<< Property("scene.camera.lensradius")(0.00460526301)<< Property("scene.camera.focaldistance")(0.252408)<< Property("scene.camera.autofocus.enable")(0)<< Property("scene.camera.fieldofview")(49.1343422)<< Property("scene.camera.up")(0.01, 0.0, 1.0) ); session.EndSceneEdit(); waitAndSave(image_number); } current_mesh++; } }
Scene::Scene(SceneID id) { _sceneID = id; cleanScene(); }