Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2014-03-29 16:03:46 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2014-03-29 16:03:46 +0400
commit934767cf7f51ae82224138de2ffcafe7bae2b8fa (patch)
tree2b59a0b23431be2acc84d1e20d22b964e459a087 /intern/cycles/bvh/bvh_build.cpp
parent0509553b5eb240b3970848a4432e0bbfcbba8690 (diff)
Cycles code refactor: change curve key to float4 for easier storage as attribute.
Diffstat (limited to 'intern/cycles/bvh/bvh_build.cpp')
-rw-r--r--intern/cycles/bvh/bvh_build.cpp21
1 files changed, 2 insertions, 19 deletions
diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index aa8ba36f891..ef48c1edc63 100644
--- a/intern/cycles/bvh/bvh_build.cpp
+++ b/intern/cycles/bvh/bvh_build.cpp
@@ -75,10 +75,7 @@ void BVHBuild::add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh,
BoundBox bounds = BoundBox::empty;
PrimitiveType type = PRIMITIVE_TRIANGLE;
- for(int k = 0; k < 3; k++) {
- float3 co = mesh->verts[t.v[k]];
- bounds.grow(co);
- }
+ t.bounds_grow(&mesh->verts[0], bounds);
if(bounds.valid()) {
references.push_back(BVHReference(bounds, j, i, type));
@@ -93,21 +90,7 @@ void BVHBuild::add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh,
for(int k = 0; k < curve.num_keys - 1; k++) {
BoundBox bounds = BoundBox::empty;
-
- float3 co[4];
- co[0] = mesh->curve_keys[max(curve.first_key + k - 1,curve.first_key)].co;
- co[1] = mesh->curve_keys[curve.first_key + k].co;
- co[2] = mesh->curve_keys[curve.first_key + k + 1].co;
- co[3] = mesh->curve_keys[min(curve.first_key + k + 2, curve.first_key + curve.num_keys - 1)].co;
-
- float3 lower;
- float3 upper;
- curvebounds(&lower.x, &upper.x, co, 0);
- curvebounds(&lower.y, &upper.y, co, 1);
- curvebounds(&lower.z, &upper.z, co, 2);
- float mr = max(mesh->curve_keys[curve.first_key + k].radius, mesh->curve_keys[curve.first_key + k + 1].radius);
- bounds.grow(lower, mr);
- bounds.grow(upper, mr);
+ curve.bounds_grow(k, &mesh->curve_keys[0], bounds);
if(bounds.valid()) {
int packed_type = PRIMITIVE_PACK_SEGMENT(type, k);