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:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-08-10 10:19:40 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-08-10 10:21:02 +0300
commit5a618ab737225869555bb9782265a90f7ca2c373 (patch)
tree0b6d5f9d385f6266bb409aedf3cee36c203e6722 /intern/cycles/bvh
parentde3c1657132b404d8611134c24894f7157665c29 (diff)
Cycles: De-duplicate trace-time object visibility calculation
We already have enough files to worry about in BVH builders. no need to add yet another copy-paste code which is tempting to be running out of sync.
Diffstat (limited to 'intern/cycles/bvh')
-rw-r--r--intern/cycles/bvh/bvh.cpp12
-rw-r--r--intern/cycles/bvh/bvh2.cpp8
-rw-r--r--intern/cycles/bvh/bvh4.cpp8
3 files changed, 5 insertions, 23 deletions
diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index c7e11539cf9..0ad3c8a7429 100644
--- a/intern/cycles/bvh/bvh.cpp
+++ b/intern/cycles/bvh/bvh.cpp
@@ -153,7 +153,6 @@ void BVH::pack_primitives()
if(pack.prim_index[i] != -1) {
int tob = pack.prim_object[i];
Object *ob = objects[tob];
-
if((pack.prim_type[i] & PRIMITIVE_ALL_TRIANGLE) != 0) {
pack_triangle(i, (float4*)&pack.prim_tri_verts[3 * prim_triangle_index]);
pack.prim_tri_index[i] = 3 * prim_triangle_index;
@@ -162,15 +161,10 @@ void BVH::pack_primitives()
else {
pack.prim_tri_index[i] = -1;
}
-
- pack.prim_visibility[i] = ob->visibility;
-
- if(pack.prim_type[i] & PRIMITIVE_ALL_CURVE)
+ pack.prim_visibility[i] = ob->visibility_for_tracing();
+ if(pack.prim_type[i] & PRIMITIVE_ALL_CURVE) {
pack.prim_visibility[i] |= PATH_RAY_CURVE;
- if (ob->is_shadow_catcher)
- pack.prim_visibility[i] &= ~PATH_RAY_SHADOW_NON_CATCHER;
- else
- pack.prim_visibility[i] &= ~PATH_RAY_SHADOW_CATCHER;
+ }
}
else {
pack.prim_tri_index[i] = -1;
diff --git a/intern/cycles/bvh/bvh2.cpp b/intern/cycles/bvh/bvh2.cpp
index 3e3a5d604d8..9aa8e71dfd0 100644
--- a/intern/cycles/bvh/bvh2.cpp
+++ b/intern/cycles/bvh/bvh2.cpp
@@ -312,14 +312,8 @@ void BVH2::refit_node(int idx, bool leaf, BoundBox& bbox, uint& visibility)
}
}
}
-
- visibility |= ob->visibility;
- if (ob->is_shadow_catcher)
- visibility &= ~PATH_RAY_SHADOW_NON_CATCHER;
- else
- visibility &= ~PATH_RAY_SHADOW_CATCHER;
+ visibility |= ob->visibility_for_tracing();
}
-
/* TODO(sergey): De-duplicate with pack_leaf(). */
float4 leaf_data[BVH_NODE_LEAF_SIZE];
leaf_data[0].x = __int_as_float(c0);
diff --git a/intern/cycles/bvh/bvh4.cpp b/intern/cycles/bvh/bvh4.cpp
index 0e460db7ed7..aeedd802f49 100644
--- a/intern/cycles/bvh/bvh4.cpp
+++ b/intern/cycles/bvh/bvh4.cpp
@@ -438,14 +438,8 @@ void BVH4::refit_node(int idx, bool leaf, BoundBox& bbox, uint& visibility)
}
}
}
-
- visibility |= ob->visibility;
- if (ob->is_shadow_catcher)
- visibility &= ~PATH_RAY_SHADOW_NON_CATCHER;
- else
- visibility &= ~PATH_RAY_SHADOW_CATCHER;
+ visibility |= ob->visibility_for_tracing();
}
-
/* TODO(sergey): This is actually a copy of pack_leaf(),
* but this chunk of code only knows actual data and has
* no idea about BVHNode.