Skip to content
This repository has been archived by the owner on Nov 26, 2022. It is now read-only.

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
raywan committed May 24, 2019
1 parent b6b58d8 commit fb1e1ed
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
2 changes: 2 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ Build:
[x] Create Windows entry point i.e. win32_main.cpp

Uncategorized:
[ ] BxDF based materials
[ ] Tile size independent multithreaded rendering
Height and width are must be multiples of the tile size currently
[ ] Use memory arena for allocations
[ ] Render Cornell Box
[ ] Create and parse own scene files
[x] Add transform to Mesh @done (19-05-24 01:02)
[x] Render suzanne @done (19-05-24 01:02)

Expand Down
14 changes: 7 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ void *worker(void *t_arg) {
}

int main(int argc, char *argv[]) {
print_run_info();

rwtm_init();
mtr_start_time = rwtm_now();

// Initialize the camera
puts("Initializing camera...");
int camera_shot = 0;
if (argc > 1) {
camera_shot = atoi(argv[1]);
Expand All @@ -56,6 +49,13 @@ int main(int argc, char *argv[]) {
}
}

print_run_info();

rwtm_init();
mtr_start_time = rwtm_now();

// Initialize the camera
puts("Initializing camera...");
Camera camera;
if (camera_shot == 0) {
#if 0
Expand Down
8 changes: 1 addition & 7 deletions src/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,11 @@ Vec3 cast_ray(World *world, Ray *r, int cur_depth) {
indirect_lighting += r1 * rwm_v3_scalar_div(cast_ray(world, &sample_ray, cur_depth+1), pdf);
}
indirect_lighting = rwm_v3_scalar_div(indirect_lighting, (float) NUM_PT_SAMPLES);
#endif
#endif // #if USE_GLOBAL_ILLUMINATION
color = (rwm_v3_scalar_div(direct_lighting, PI) + 2 * indirect_lighting) * ii.material->albedo;
if (ii.material->use_texture) {
color *= get_checkerboard(ii.tex_coord);
// color = (rwm_v3_scalar_div(direct_lighting, PI) + 2 * indirect_lighting) * get_checkerboard(ii.tex_coord);
} else {
// color = (rwm_v3_scalar_div(direct_lighting, PI) + 2 * indirect_lighting) * ii.material->albedo;
}

#else
float NdV = MAX(0.0f, rwm_v3_inner(ii.normal, -r->dir));
// color = get_checkerboard(ii.tex_coord) * ii.normal * NdV;
Expand All @@ -171,7 +167,6 @@ Vec3 cast_ray(World *world, Ray *r, int cur_depth) {
refraction_ray.type = RT_REFRACT;
color += cast_ray(world, &refraction_ray, cur_depth + 1);
} break;
#if 1
case M_RR: {
Vec3 refract_color = rwm_v3_zero();
float kr = fresnel(r->dir, ii.normal, ii.material->ior);
Expand All @@ -197,7 +192,6 @@ Vec3 cast_ray(World *world, Ray *r, int cur_depth) {
reflect_color = cast_ray(world, &reflect_ray, cur_depth + 1);
color += reflect_color * kr + refract_color * (1 - kr);
} break;
#endif
default:
break;
}
Expand Down
14 changes: 7 additions & 7 deletions src/win32_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ unsigned int worker(void *t_arg) {
}

int main(int argc, char *argv[]) {
print_run_info();

rwtm_init();
mtr_start_time = rwtm_now();

// Initialize the camera
puts("Initializing camera...");
int camera_shot = 0;
if (argc > 1) {
camera_shot = atoi(argv[1]);
Expand All @@ -60,6 +53,13 @@ int main(int argc, char *argv[]) {
}
}

print_run_info();

rwtm_init();
mtr_start_time = rwtm_now();

// Initialize the camera
puts("Initializing camera...");
Camera camera;
if (camera_shot == 0) {
#if 0
Expand Down

0 comments on commit fb1e1ed

Please sign in to comment.