From bf25f1ea96d01b513907cf3067e8e2dd3c7e41b4 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 3 Jan 2013 12:09:09 +0000 Subject: Cycles Hair: refactoring to store curves with the index of the first key and the number of keys in the curve, rather than curve segments with the indices of two keys. ShaderData.segment now stores the segment number in the curve. --- intern/cycles/bvh/bvh_split.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'intern/cycles/bvh/bvh_split.cpp') diff --git a/intern/cycles/bvh/bvh_split.cpp b/intern/cycles/bvh/bvh_split.cpp index 67fdfd77657..03ff69d7b6d 100644 --- a/intern/cycles/bvh/bvh_split.cpp +++ b/intern/cycles/bvh/bvh_split.cpp @@ -253,7 +253,7 @@ void BVHSpatialSplit::split_reference(BVHBuild *builder, BVHReference& left, BVH Object *ob = builder->objects[ref.prim_object()]; const Mesh *mesh = ob->mesh; - if (!ref.prim_type()) { + if (ref.prim_segment() == ~0) { const int *inds = mesh->triangles[ref.prim_index()].v; const float3 *verts = &mesh->verts[0]; const float3* v1 = &verts[inds[2]]; @@ -281,11 +281,11 @@ void BVHSpatialSplit::split_reference(BVHBuild *builder, BVHReference& left, BVH } } else { - /* Strand split: NOTE - Currently ignores strand width and needs to be fixed.*/ - - const int *inds = mesh->curve_segments[ref.prim_index()].v; - const float3* v0 = &mesh->curve_keys[inds[0]].co; - const float3* v1 = &mesh->curve_keys[inds[1]].co; + /* curve split: NOTE - Currently ignores curve width and needs to be fixed.*/ + const int k0 = mesh->curves[ref.prim_index()].first_key + ref.prim_segment(); + const int k1 = k0 + 1; + const float3* v0 = &mesh->curve_keys[k0].co; + const float3* v1 = &mesh->curve_keys[k1].co; float v0p = (*v0)[dim]; float v1p = (*v1)[dim]; @@ -318,8 +318,8 @@ void BVHSpatialSplit::split_reference(BVHBuild *builder, BVHReference& left, BVH right_bounds.intersect(ref.bounds()); /* set references */ - left = BVHReference(left_bounds, ref.prim_index(), ref.prim_object(), ref.prim_type()); - right = BVHReference(right_bounds, ref.prim_index(), ref.prim_object(), ref.prim_type()); + left = BVHReference(left_bounds, ref.prim_index(), ref.prim_object(), ref.prim_segment()); + right = BVHReference(right_bounds, ref.prim_index(), ref.prim_object(), ref.prim_segment()); } CCL_NAMESPACE_END -- cgit v1.2.3