summaryrefslogtreecommitdiff
path: root/aa.h
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-04-21 15:40:42 +0800
committerKeuin <[email protected]>2022-04-21 15:40:42 +0800
commitc317366d5b60f7aa125f1c9f1878a9b01a6b9d66 (patch)
treeecd76af90e314321d45a0faa1d7768119d7bfbf3 /aa.h
parent7dd2b9e3696c1723f0cf30f6b82b3c61440d7ded (diff)
Add bokeh, aperture ad focus_dist.
Diffstat (limited to 'aa.h')
-rw-r--r--aa.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/aa.h b/aa.h
index a1bb51e..2be5f2c 100644
--- a/aa.h
+++ b/aa.h
@@ -26,6 +26,8 @@ class aa_viewport {
hitlist &world;
unsigned samples;
int threads;
+ double aperture;
+ double focus_dist;
public:
@@ -35,6 +37,8 @@ public:
uint16_t image_height,
V screen_hw,
V screen_hh,
+ double aperture,
+ double focus_dist,
hitlist &world,
unsigned samples,
int threads = -1) :
@@ -46,7 +50,9 @@ public:
screen_hh(screen_hh),
world(world),
samples(samples),
- threads((threads > 0) ? threads : (int) std::thread::hardware_concurrency()) {
+ threads((threads > 0) ? threads : (int) std::thread::hardware_concurrency()),
+ aperture{aperture},
+ focus_dist{focus_dist} {
assert(samples >= 1);
assert(std::abs(1.0 * image_width / image_height - 1.0 * screen_hw / screen_hh) < 1e-8);
}
@@ -56,6 +62,8 @@ public:
uint16_t image_width,
uint16_t image_height,
double fov_h,
+ double aperture,
+ double focus_dist,
hitlist &world,
unsigned samples,
int threads = -1) :
@@ -67,7 +75,9 @@ public:
screen_hh{screen_hw * ((double) image_height / image_width)},
world(world),
samples(samples),
- threads((threads > 0) ? threads : (int) std::thread::hardware_concurrency()) {
+ threads((threads > 0) ? threads : (int) std::thread::hardware_concurrency()),
+ aperture{aperture},
+ focus_dist{focus_dist} {
assert(samples >= 1);
}
@@ -94,10 +104,11 @@ public:
ctx.cxyz, ctx.screen_center,
ctx.image_width, ctx.image_height,
ctx.screen_hw, ctx.screen_hh,
- ctx.world
+ ctx.aperture, ctx.focus_dist, ctx.world
};
bias_ctx bc{task.bias_seed};
- images[tid] = vp.render(task.diffuse_seed, bc);
+ bokeh_ctx bokeh{task.diffuse_seed + 6543210987ULL};
+ images[tid] = vp.render(task.diffuse_seed, bc, bokeh);
}, s_render_task{
.bias_seed=seedgen(), .diffuse_seed=seedgen()
});