Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/bvh/bvh_split.cpp
| Show First 20 Lines • Show All 384 Lines • ▼ Show 20 Lines | void BVHSpatialSplit::split_curve_primitive(const Hair *hair, | ||||
| int segment_index, | int segment_index, | ||||
| int dim, | int dim, | ||||
| float pos, | float pos, | ||||
| BoundBox &left_bounds, | BoundBox &left_bounds, | ||||
| BoundBox &right_bounds) | BoundBox &right_bounds) | ||||
| { | { | ||||
| /* curve split: NOTE - Currently ignores curve width and needs to be fixed.*/ | /* curve split: NOTE - Currently ignores curve width and needs to be fixed.*/ | ||||
| Hair::Curve curve = hair->get_curve(prim_index); | Hair::Curve curve = hair->get_curve(prim_index); | ||||
| const int k0 = curve.first_key + segment_index; | const int k0 = curve.get_first_key() + segment_index; | ||||
| const int k1 = k0 + 1; | const int k1 = k0 + 1; | ||||
| float3 v0 = hair->get_curve_keys()[k0]; | float3 v0 = hair->get_curve_keys()[k0]; | ||||
| float3 v1 = hair->get_curve_keys()[k1]; | float3 v1 = hair->get_curve_keys()[k1]; | ||||
| if (tfm != NULL) { | if (tfm != NULL) { | ||||
| v0 = transform_point(tfm, v0); | v0 = transform_point(tfm, v0); | ||||
| v1 = transform_point(tfm, v1); | v1 = transform_point(tfm, v1); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | split_curve_primitive(hair, | ||||
| right_bounds); | right_bounds); | ||||
| } | } | ||||
| void BVHSpatialSplit::split_object_reference( | void BVHSpatialSplit::split_object_reference( | ||||
| const Object *object, int dim, float pos, BoundBox &left_bounds, BoundBox &right_bounds) | const Object *object, int dim, float pos, BoundBox &left_bounds, BoundBox &right_bounds) | ||||
| { | { | ||||
| Geometry *geom = object->get_geometry(); | Geometry *geom = object->get_geometry(); | ||||
| if (geom->geometry_type == Geometry::MESH || geom->geometry_type == Geometry::VOLUME) { | if (geom->is_mesh() || geom->is_volume()) { | ||||
| Mesh *mesh = static_cast<Mesh *>(geom); | Mesh *mesh = static_cast<Mesh *>(geom); | ||||
| for (int tri_idx = 0; tri_idx < mesh->num_triangles(); ++tri_idx) { | for (int tri_idx = 0; tri_idx < mesh->num_triangles(); ++tri_idx) { | ||||
| split_triangle_primitive( | split_triangle_primitive( | ||||
| mesh, &object->get_tfm(), tri_idx, dim, pos, left_bounds, right_bounds); | mesh, &object->get_tfm(), tri_idx, dim, pos, left_bounds, right_bounds); | ||||
| } | } | ||||
| } | } | ||||
| else if (geom->geometry_type == Geometry::HAIR) { | else if (geom->is_hair()) { | ||||
| Hair *hair = static_cast<Hair *>(geom); | Hair *hair = static_cast<Hair *>(geom); | ||||
| for (int curve_idx = 0; curve_idx < hair->num_curves(); ++curve_idx) { | for (int curve_idx = 0; curve_idx < hair->num_curves(); ++curve_idx) { | ||||
| Hair::Curve curve = hair->get_curve(curve_idx); | Hair::Curve curve = hair->get_curve(curve_idx); | ||||
| for (int segment_idx = 0; segment_idx < curve.num_keys - 1; ++segment_idx) { | for (int segment_idx = 0; segment_idx < curve.get_num_keys() - 1; ++segment_idx) { | ||||
| split_curve_primitive( | split_curve_primitive( | ||||
| hair, &object->get_tfm(), curve_idx, segment_idx, dim, pos, left_bounds, right_bounds); | hair, &object->get_tfm(), curve_idx, segment_idx, dim, pos, left_bounds, right_bounds); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void BVHSpatialSplit::split_reference(const BVHBuild &builder, | void BVHSpatialSplit::split_reference(const BVHBuild &builder, | ||||
| Show All 38 Lines | |||||