Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
xelatihy committed Jan 31, 2024
1 parent b5d3621 commit b0f8901
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 51 deletions.
6 changes: 3 additions & 3 deletions libs/yocto/yocto_diagram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2302,9 +2302,9 @@ static vec4f render_ray(

// prepare shading point
auto outgoing = -ray.d;
auto position = eval_position(scene, intersection);
auto normal = eval_normal(scene, intersection);
auto material = eval_material(scene, intersection);
auto position = intersection_point(scene, intersection);
auto normal = intersection_normal(scene, intersection);
auto material = intersection_material(scene, intersection);

// accumulate color
radiance += weight * material.color * material.opacity;
Expand Down
32 changes: 16 additions & 16 deletions libs/yocto/yocto_raytracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,21 +238,21 @@ intersection3f overlap_scene_bvh(const scene_bvh& bvh, const scene_data& scene,
namespace yocto {

// Convenience functions
inline vec3f eval_position(
inline vec3f intersection_point(
const scene_data& scene, const intersection3f& intersection);
inline vec3f eval_normal(
inline vec3f intersection_normal(
const scene_data& scene, const intersection3f& intersection);
inline vec3f eval_element_normal(
inline vec3f intersection_element_normal(
const scene_data& scene, const intersection3f& intersection);
inline vec3f eval_shading_position(const scene_data& scene,
inline vec3f intersection_shading_point(const scene_data& scene,
const intersection3f& intersection, vec3f outgoing);
inline vec3f eval_shading_normal(const scene_data& scene,
inline vec3f intersection_shading_normal(const scene_data& scene,
const intersection3f& intersection, vec3f outgoing);
inline vec2f eval_texcoord(
inline vec2f intersection_texcoord(
const scene_data& scene, const intersection3f& intersection);
inline material_point eval_material(
inline material_point intersection_material(
const scene_data& scene, const intersection3f& intersection);
inline bool is_volumetric(
inline bool is_volumetric_intersection(
const scene_data& scene, const intersection3f& intersection);

} // namespace yocto
Expand Down Expand Up @@ -726,42 +726,42 @@ inline bool overlap_bbox(const bbox3f& bbox1, const bbox3f& bbox2) {
namespace yocto {

// Convenience functions
inline vec3f eval_position(
inline vec3f intersection_point(
const scene_data& scene, const intersection3f& intersection) {
return eval_position(scene, scene.instances[intersection.instance],
intersection.element, intersection.uv);
}
inline vec3f eval_normal(
inline vec3f intersection_normal(
const scene_data& scene, const intersection3f& intersection) {
return eval_normal(scene, scene.instances[intersection.instance],
intersection.element, intersection.uv);
}
inline vec3f eval_element_normal(
inline vec3f intersection_element_normal(
const scene_data& scene, const intersection3f& intersection) {
return eval_element_normal(
scene, scene.instances[intersection.instance], intersection.element);
}
inline vec3f eval_shading_position(const scene_data& scene,
inline vec3f intersection_shading_point(const scene_data& scene,
const intersection3f& intersection, vec3f outgoing) {
return eval_shading_position(scene, scene.instances[intersection.instance],
intersection.element, intersection.uv, outgoing);
}
inline vec3f eval_shading_normal(const scene_data& scene,
inline vec3f intersection_shading_normal(const scene_data& scene,
const intersection3f& intersection, vec3f outgoing) {
return eval_shading_normal(scene, scene.instances[intersection.instance],
intersection.element, intersection.uv, outgoing);
}
inline vec2f eval_texcoord(
inline vec2f intersection_texcoord(
const scene_data& scene, const intersection3f& intersection) {
return eval_texcoord(scene, scene.instances[intersection.instance],
intersection.element, intersection.uv);
}
inline material_point eval_material(
inline material_point intersection_material(
const scene_data& scene, const intersection3f& intersection) {
return eval_material(scene, scene.instances[intersection.instance],
intersection.element, intersection.uv);
}
inline bool is_volumetric(
inline bool is_volumetric_intersection(
const scene_data& scene, const intersection3f& intersection) {
return is_volumetric(scene, scene.instances[intersection.instance]);
}
Expand Down
64 changes: 32 additions & 32 deletions libs/yocto/yocto_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,9 @@ static trace_result trace_path(const scene_data& scene, const trace_bvh& bvh,
if (!in_volume) {
// prepare shading point
auto outgoing = -ray.d;
auto position = eval_shading_position(scene, intersection, outgoing);
auto normal = eval_shading_normal(scene, intersection, outgoing);
auto material = eval_material(scene, intersection);
auto position = intersection_shading_point(scene, intersection, outgoing);
auto normal = intersection_shading_normal(scene, intersection, outgoing);
auto material = intersection_material(scene, intersection);

// correct roughness
if (params.nocaustics) {
Expand Down Expand Up @@ -523,10 +523,10 @@ static trace_result trace_path(const scene_data& scene, const trace_bvh& bvh,
}

// update volume stack
if (is_volumetric(scene, intersection) &&
if (is_volumetric_intersection(scene, intersection) &&
dot(normal, outgoing) * dot(normal, incoming) < 0) {
if (volume_stack.empty()) {
auto material = eval_material(scene, intersection);
auto material = intersection_material(scene, intersection);
volume_stack.push_back(material);
} else {
volume_stack.pop_back();
Expand Down Expand Up @@ -619,9 +619,9 @@ static trace_result trace_pathdirect(const scene_data& scene,
if (!in_volume) {
// prepare shading point
auto outgoing = -ray.d;
auto position = eval_shading_position(scene, intersection, outgoing);
auto normal = eval_shading_normal(scene, intersection, outgoing);
auto material = eval_material(scene, intersection);
auto position = intersection_shading_point(scene, intersection, outgoing);
auto normal = intersection_shading_normal(scene, intersection, outgoing);
auto material = intersection_material(scene, intersection);

// correct roughness
if (params.nocaustics) {
Expand Down Expand Up @@ -697,10 +697,10 @@ static trace_result trace_pathdirect(const scene_data& scene,
}

// update volume stack
if (is_volumetric(scene, intersection) &&
if (is_volumetric_intersection(scene, intersection) &&
dot(normal, outgoing) * dot(normal, incoming) < 0) {
if (volume_stack.empty()) {
auto material = eval_material(scene, intersection);
auto material = intersection_material(scene, intersection);
volume_stack.push_back(material);
} else {
volume_stack.pop_back();
Expand Down Expand Up @@ -798,9 +798,9 @@ static trace_result trace_pathmis(const scene_data& scene, const trace_bvh& bvh,
if (!in_volume) {
// prepare shading point
auto outgoing = -ray.d;
auto position = eval_shading_position(scene, intersection, outgoing);
auto normal = eval_shading_normal(scene, intersection, outgoing);
auto material = eval_material(scene, intersection);
auto position = intersection_shading_point(scene, intersection, outgoing);
auto normal = intersection_shading_normal(scene, intersection, outgoing);
auto material = intersection_material(scene, intersection);

// correct roughness
if (params.nocaustics) {
Expand Down Expand Up @@ -879,10 +879,10 @@ static trace_result trace_pathmis(const scene_data& scene, const trace_bvh& bvh,
}

// update volume stack
if (is_volumetric(scene, intersection) &&
if (is_volumetric_intersection(scene, intersection) &&
dot(normal, outgoing) * dot(normal, incoming) < 0) {
if (volume_stack.empty()) {
auto material = eval_material(scene, intersection);
auto material = intersection_material(scene, intersection);
volume_stack.push_back(material);
} else {
volume_stack.pop_back();
Expand Down Expand Up @@ -956,9 +956,9 @@ static trace_result trace_pathtest(const scene_data& scene,

// prepare shading point
auto outgoing = -ray.d;
auto position = eval_shading_position(scene, intersection, outgoing);
auto normal = eval_shading_normal(scene, intersection, outgoing);
auto material = eval_material(scene, intersection);
auto position = intersection_shading_point(scene, intersection, outgoing);
auto normal = intersection_shading_normal(scene, intersection, outgoing);
auto material = intersection_material(scene, intersection);
material.type = material_type::matte;

// set hit variables
Expand Down Expand Up @@ -1035,9 +1035,9 @@ static trace_result trace_lightsampling(const scene_data& scene,

// prepare shading point
auto outgoing = -ray.d;
auto position = eval_shading_position(scene, intersection, outgoing);
auto normal = eval_shading_normal(scene, intersection, outgoing);
auto material = eval_material(scene, intersection);
auto position = intersection_shading_point(scene, intersection, outgoing);
auto normal = intersection_shading_normal(scene, intersection, outgoing);
auto material = intersection_material(scene, intersection);

// handle opacity
if (material.opacity < 1 && rand1f(rng) >= material.opacity) {
Expand Down Expand Up @@ -1140,9 +1140,9 @@ static trace_result trace_naive(const scene_data& scene, const trace_bvh& bvh,

// prepare shading point
auto outgoing = -ray.d;
auto position = eval_shading_position(scene, intersection, outgoing);
auto normal = eval_shading_normal(scene, intersection, outgoing);
auto material = eval_material(scene, intersection);
auto position = intersection_shading_point(scene, intersection, outgoing);
auto normal = intersection_shading_normal(scene, intersection, outgoing);
auto material = intersection_material(scene, intersection);

// handle opacity
if (material.opacity < 1 && rand1f(rng) >= material.opacity) {
Expand Down Expand Up @@ -1219,9 +1219,9 @@ static trace_result trace_eyelight(const scene_data& scene,

// prepare shading point
auto outgoing = -ray.d;
auto position = eval_shading_position(scene, intersection, outgoing);
auto normal = eval_shading_normal(scene, intersection, outgoing);
auto material = eval_material(scene, intersection);
auto position = intersection_shading_point(scene, intersection, outgoing);
auto normal = intersection_shading_normal(scene, intersection, outgoing);
auto material = intersection_material(scene, intersection);

// handle opacity
if (material.opacity < 1 && rand1f(rng) >= material.opacity) {
Expand Down Expand Up @@ -1365,11 +1365,11 @@ static trace_result trace_falsecolor(const scene_data& scene,

// prepare shading point
auto outgoing = -ray.d;
auto position = eval_shading_position(scene, intersection, outgoing);
auto normal = eval_shading_normal(scene, intersection, outgoing);
auto gnormal = eval_element_normal(scene, intersection);
auto texcoord = eval_texcoord(scene, intersection);
auto material = eval_material(scene, intersection);
auto position = intersection_shading_point(scene, intersection, outgoing);
auto normal = intersection_shading_normal(scene, intersection, outgoing);
auto gnormal = intersection_element_normal(scene, intersection);
auto texcoord = intersection_texcoord(scene, intersection);
auto material = intersection_material(scene, intersection);
auto delta = is_delta(material) ? 1.0f : 0.0f;

// hash color
Expand Down

0 comments on commit b0f8901

Please sign in to comment.