Skip to content

Commit

Permalink
Fix curve shading when multiple curves are defined in a single object
Browse files Browse the repository at this point in the history
  • Loading branch information
njroussel committed May 11, 2023
1 parent 0c984ad commit 3875f9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/shapes/bsplinecurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,8 @@ class BSplineCurve final : public Shape<Float, Spectrum> {
}

std::tuple<Point3f, Vector3f, Vector3f, Vector3f, Float, Float, Float>
cubic_interpolation(const Float v, const UInt32 idx, Mask active) const {
cubic_interpolation(const Float v, const UInt32 prim_idx, Mask active) const {
UInt32 idx = dr::gather<UInt32>(m_indices, prim_idx, active);
Point4f c0 = dr::gather<Point4f>(m_control_points, idx + 0, active),
c1 = dr::gather<Point4f>(m_control_points, idx + 1, active),
c2 = dr::gather<Point4f>(m_control_points, idx + 2, active),
Expand Down
5 changes: 3 additions & 2 deletions src/shapes/linearcurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,9 @@ class LinearCurve final : public Shape<Float, Spectrum> {
// taken into account the changing radius: `v_local` is shifted such
// that the normal can be easily computed as `si.p - c`,
// where `c = (1 - c_local) * cp1 + v_local * cp2`
Point4f c0 = dr::gather<Point4f>(m_control_points, prim_idx + 0, active),
c1 = dr::gather<Point4f>(m_control_points, prim_idx + 1, active);
UInt32 idx = dr::gather<UInt32>(m_indices, prim_idx, active);
Point4f c0 = dr::gather<Point4f>(m_control_points, idx, active),
c1 = dr::gather<Point4f>(m_control_points, idx + 1, active);
Point3f p0 = Point3f(c0.x(), c0.y(), c0.z()),
p1 = Point3f(c1.x(), c1.y(), c1.z());

Expand Down

0 comments on commit 3875f9a

Please sign in to comment.