static R3Scene * ReadScene(char *filename) { // Start statistics RNTime start_time; start_time.Read(); // Allocate scene R3Scene *scene = new R3Scene(); if (!scene) { fprintf(stderr, "Unable to allocate scene for %s\n", filename); return NULL; } // Read scene from file if (!scene->ReadFile(filename)) { delete scene; return NULL; } // Print statistics if (print_verbose) { printf("Read scene from %s ...\n", filename); printf(" Time = %.2f seconds\n", start_time.Elapsed()); fflush(stdout); } // Return scene return scene; }
R3Scene *ReadScene(const char *filename) { // Allocate scene R3Scene *scene = new R3Scene(); if (!scene) { fprintf(stderr, "Unable to allocate scene\n"); return NULL; } // Read file if (!scene->Read(filename)) { fprintf(stderr, "Unable to read scene from %s\n", filename); return NULL; } // Remember initial camera // camera = scene->camera; // Return scene return scene; }
static R3Scene * ReadScene(const char *filename, int width, int height) { // Allocate scene R3Scene *scene = new R3Scene(); if (!scene) { fprintf(stderr, "Unable to allocate scene\n"); return NULL; } // Read scene if (!scene->Read(filename)) { fprintf(stderr, "Unable to read scene from %s\n", filename); return NULL; } // Adjust camera vertical field of view to match aspect ratio of image scene->camera.yfov = atan(tan(scene->camera.xfov) * (double) height / (double) width); // Return scene return scene; }