Many changes to jensen.
This commit is contained in:
19
main.cpp
19
main.cpp
@@ -49,6 +49,7 @@ typedef enum TRACERS { NONE, WHITTED, MONTE_CARLO, JENSEN } tracer_t;
|
||||
|
||||
static char * g_input_file = NULL;
|
||||
static char * g_photons_file = NULL;
|
||||
static char * g_caustics_file = NULL;
|
||||
static char * g_out_file_name = NULL;
|
||||
static int g_samples = 25;
|
||||
static float g_fov = 45.0f;
|
||||
@@ -113,17 +114,22 @@ int main(int argc, char ** argv) {
|
||||
} else if(g_tracer == JENSEN) {
|
||||
cout << "Using " << ANSI_BOLD_YELLOW << "Jensen's photon mapping" << ANSI_RESET_STYLE << " with ray tracing." << endl;
|
||||
p_tracer = new PhotonTracer(g_max_depth, g_p_sample_radius);
|
||||
if (g_photons_file == NULL) {
|
||||
if (g_photons_file == NULL && g_caustics_file == NULL) {
|
||||
cout << "Building global photon map with " << ANSI_BOLD_YELLOW << g_photons / 2 << ANSI_RESET_STYLE << " primary photons per light source." << endl;
|
||||
//p_tracer->photon_tracing(scn, g_photons / 2);
|
||||
p_tracer->photon_tracing(scn, g_photons / 2);
|
||||
cout << "Building caustics photon map with " << ANSI_BOLD_YELLOW << g_photons / 2 << ANSI_RESET_STYLE << " primary photons per light source." << endl;
|
||||
p_tracer->photon_tracing(scn, g_photons / 2, true);
|
||||
p_tracer->build_photon_map();
|
||||
} else {
|
||||
if (g_photons_file != g_caustics_file) {
|
||||
cerr << "Must specify both a photon map file and a caustics file." << endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
p_tracer->build_photon_map(g_photons_file);
|
||||
p_tracer->build_photon_map(g_caustics_file, true);
|
||||
}
|
||||
tracer = static_cast<Tracer *>(p_tracer);
|
||||
|
||||
|
||||
} else {
|
||||
cerr << "Must specify a ray tracer with \"-t\"." << endl;
|
||||
print_usage(argv);
|
||||
@@ -257,7 +263,7 @@ void parse_args(int argc, char ** const argv) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
while((opt = getopt(argc, argv, "-:t:s:w:f:o:r:g:e:p:h:k:")) != -1) {
|
||||
while((opt = getopt(argc, argv, "-:t:s:w:f:o:r:g:e:p:h:k:c:")) != -1) {
|
||||
switch (opt) {
|
||||
case 1:
|
||||
g_input_file = (char *)malloc((strlen(optarg) + 1) * sizeof(char));
|
||||
@@ -374,6 +380,11 @@ void parse_args(int argc, char ** const argv) {
|
||||
strcpy(g_photons_file, optarg);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
g_caustics_file = (char *)malloc((strlen(optarg) + 1) * sizeof(char));
|
||||
strcpy(g_caustics_file, optarg);
|
||||
break;
|
||||
|
||||
case ':':
|
||||
cerr << "Option \"-" << static_cast<char>(optopt) << "\" requires an argument." << endl;
|
||||
print_usage(argv);
|
||||
|
||||
Reference in New Issue
Block a user