Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/bvh/bvh_unaligned.cpp
| Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | bool BVHUnaligned::compute_aligned_space(const BVHReference &ref, Transform *aligned_space) const | ||||
| const int packed_type = ref.prim_type(); | const int packed_type = ref.prim_type(); | ||||
| const int type = (packed_type & PRIMITIVE_ALL); | const int type = (packed_type & PRIMITIVE_ALL); | ||||
| /* No motion blur curves here, we can't fit them to aligned boxes well. */ | /* No motion blur curves here, we can't fit them to aligned boxes well. */ | ||||
| if (type & (PRIMITIVE_CURVE_RIBBON | PRIMITIVE_CURVE_THICK)) { | if (type & (PRIMITIVE_CURVE_RIBBON | PRIMITIVE_CURVE_THICK)) { | ||||
| const int curve_index = ref.prim_index(); | const int curve_index = ref.prim_index(); | ||||
| const int segment = PRIMITIVE_UNPACK_SEGMENT(packed_type); | const int segment = PRIMITIVE_UNPACK_SEGMENT(packed_type); | ||||
| const Hair *hair = static_cast<const Hair *>(object->get_geometry()); | const Hair *hair = static_cast<const Hair *>(object->get_geometry()); | ||||
| const Hair::Curve &curve = hair->get_curve(curve_index); | const Hair::Curve &curve = hair->get_curve(curve_index); | ||||
| const int key = curve.first_key + segment; | const int key = curve.get_first_key() + segment; | ||||
| const float3 v1 = hair->get_curve_keys()[key], v2 = hair->get_curve_keys()[key + 1]; | const float3 v1 = hair->get_curve_keys()[key], v2 = hair->get_curve_keys()[key + 1]; | ||||
| float length; | float length; | ||||
| const float3 axis = normalize_len(v2 - v1, &length); | const float3 axis = normalize_len(v2 - v1, &length); | ||||
| if (length > 1e-6f) { | if (length > 1e-6f) { | ||||
| *aligned_space = make_transform_frame(axis); | *aligned_space = make_transform_frame(axis); | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines | |||||