Skip to content

Commit

Permalink
ソースコード整形
Browse files Browse the repository at this point in the history
  • Loading branch information
githole committed Nov 13, 2013
1 parent 7c9f0dd commit 1e20d06
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bidirectional_pathtracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,4 @@ BidirectionalPathtracingResult bidirectional_pathtracing(const Camera &camera, c

};

#endif
#endif
7 changes: 5 additions & 2 deletions lighttracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ LighttracingResult generate_vertices_by_lighttracing(const Camera &camera, Rando

const Sphere &now_object = spheres[intersection.object_id];
const Hitpoint &hitpoint = intersection.hitpoint;
const Vec orienting_normal = dot(hitpoint.normal , now_ray.dir) < 0.0 ? hitpoint.normal: (-1.0 * hitpoint.normal); // 交差位置の法線(物体からのレイの入出を考慮)
// 交差位置の法線(物体からのレイの入出を考慮)
const Vec orienting_normal = dot(hitpoint.normal , now_ray.dir) < 0.0 ? hitpoint.normal: (-1.0 * hitpoint.normal);
const double russian_roulette_probability = russian_roulette(now_object);
// ロシアンルーレット
if (rnd->next01() >= russian_roulette_probability) {
Expand Down Expand Up @@ -141,7 +142,9 @@ LighttracingResult generate_vertices_by_lighttracing(const Camera &camera, Rando

Vec reflection_dir, refraction_dir;
double fresnel_reflectance, fresnel_transmittance;
if (check_refraction(into, hitpoint.position, now_ray.dir, hitpoint.normal, orienting_normal, &reflection_dir, &refraction_dir, &fresnel_reflectance, &fresnel_transmittance)) {
if (check_refraction(
into, hitpoint.position, now_ray.dir, hitpoint.normal, orienting_normal,
&reflection_dir, &refraction_dir, &fresnel_reflectance, &fresnel_transmittance)) {
// 屈折 + 反射
if (rnd->next01() < reflection_probability) { // 反射
now_sampled_pdf_omega = 1.0;
Expand Down
7 changes: 5 additions & 2 deletions pathtracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ PathtracingResult generate_vertices_by_pathtracing(const Camera &camera, const i

const Sphere &now_object = spheres[intersection.object_id];
const Hitpoint &hitpoint = intersection.hitpoint;
const Vec orienting_normal = dot(hitpoint.normal , now_ray.dir) < 0.0 ? hitpoint.normal: (-1.0 * hitpoint.normal); // 交差位置の法線(物体からのレイの入出を考慮)
// 交差位置の法線(物体からのレイの入出を考慮)
const Vec orienting_normal = dot(hitpoint.normal , now_ray.dir) < 0.0 ? hitpoint.normal: (-1.0 * hitpoint.normal);
const double russian_roulette_probability = russian_roulette(now_object);

// ロシアンルーレットによって、新しい頂点を「実際に」サンプリングし、生成するのかどうかを決定する。
Expand Down Expand Up @@ -120,7 +121,9 @@ PathtracingResult generate_vertices_by_pathtracing(const Camera &camera, const i

Vec reflection_dir, refraction_dir;
double fresnel_reflectance, fresnel_transmittance;
if (check_refraction(into, hitpoint.position, now_ray.dir, hitpoint.normal, orienting_normal, &reflection_dir, &refraction_dir, &fresnel_reflectance, &fresnel_transmittance)) {
if (check_refraction(
into, hitpoint.position, now_ray.dir, hitpoint.normal, orienting_normal,
&reflection_dir, &refraction_dir, &fresnel_reflectance, &fresnel_transmittance)) {
// 屈折 + 反射
if (rnd->next01() < reflection_probability) { // 反射
now_sampled_pdf_omega = 1.0;
Expand Down
10 changes: 6 additions & 4 deletions reference_pathtracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ Color radiance_no_recursion(const Ray &ray, Random *rnd) {
}
pdf *= russian_roulette_probability;

// 影響加算
// 放射輝度加算
L = L + multiply(weight, now_object.emission) / pdf;

const Hitpoint &hitpoint = intersection.hitpoint;
const Vec orienting_normal = dot(hitpoint.normal , now_ray.dir) < 0.0 ? hitpoint.normal: (-1.0 * hitpoint.normal); // 交差位置の法線(物体からのレイの入出を考慮)
// 交差位置の法線(物体からのレイの入出を考慮)
const Vec orienting_normal = dot(hitpoint.normal , now_ray.dir) < 0.0 ? hitpoint.normal: (-1.0 * hitpoint.normal);

switch (now_object.reflection_type) {
// 完全拡散面
Expand All @@ -62,7 +63,9 @@ Color radiance_no_recursion(const Ray &ray, Random *rnd) {

Vec reflection_dir, refraction_dir;
double fresnel_reflectance, fresnel_transmittance;
if (check_refraction(into, hitpoint.position, now_ray.dir, hitpoint.normal, orienting_normal, &reflection_dir, &refraction_dir, &fresnel_reflectance, &fresnel_transmittance)) {
if (check_refraction(
into, hitpoint.position, now_ray.dir, hitpoint.normal, orienting_normal,
&reflection_dir, &refraction_dir, &fresnel_reflectance, &fresnel_transmittance)) {
// 屈折 + 反射
if (rnd->next01() < reflection_probability) { // 反射
now_ray = Ray(hitpoint.position, reflection_dir);
Expand All @@ -88,7 +91,6 @@ Color radiance_no_recursion(const Ray &ray, Random *rnd) {
} break;
}
}

return L;
}

Expand Down

0 comments on commit 1e20d06

Please sign in to comment.