Merge branch 'master' into blender2.8

This commit is contained in:
Bastien Montagne 2017-08-10 11:14:36 +02:00
commit 8c4ccab5fe
8 changed files with 41 additions and 39 deletions

View File

@ -1591,7 +1591,7 @@ compile_OIIO() {
fi
# To be changed each time we make edits that would modify the compiled result!
oiio_magic=16
oiio_magic=17
_init_oiio
# Clean install if needed!
@ -1655,6 +1655,9 @@ compile_OIIO() {
INFO "ILMBASE_HOME=$INST/openexr"
fi
# ptex is only needed when nicholas bishop is ready
cmake_d="$cmake_d -D USE_PTEX=OFF"
# Optional tests and cmd tools
cmake_d="$cmake_d -D USE_QT=OFF"
cmake_d="$cmake_d -D USE_PYTHON=OFF"

View File

@ -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;

View File

@ -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);

View File

@ -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.

View File

@ -865,7 +865,7 @@ BVHNode *BVHBuild::create_object_leaf_nodes(const BVHReference *ref, int start,
prim_time[start] = make_float2(ref->time_from(), ref->time_to());
}
uint visibility = objects[ref->prim_object()]->visibility;
const uint visibility = objects[ref->prim_object()]->visibility_for_tracing();
BVHNode *leaf_node = new LeafNode(ref->bounds(), visibility, start, start+1);
leaf_node->time_from = ref->time_from();
leaf_node->time_to = ref->time_to();
@ -939,7 +939,7 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range,
ref.time_to()));
bounds[type_index].grow(ref.bounds());
visibility[type_index] |= objects[ref.prim_object()]->visibility;
visibility[type_index] |= objects[ref.prim_object()]->visibility_for_tracing();
if(ref.prim_type() & PRIMITIVE_ALL_CURVE) {
visibility[type_index] |= PATH_RAY_CURVE;
}

View File

@ -262,6 +262,17 @@ bool Object::is_traceable()
return true;
}
uint Object::visibility_for_tracing() const {
uint trace_visibility = visibility;
if (is_shadow_catcher) {
trace_visibility &= ~PATH_RAY_SHADOW_NON_CATCHER;
}
else {
trace_visibility &= ~PATH_RAY_SHADOW_CATCHER;
}
return trace_visibility;
}
/* Object Manager */
ObjectManager::ObjectManager()

View File

@ -60,7 +60,7 @@ public:
ParticleSystem *particle_system;
int particle_index;
Object();
~Object();
@ -75,6 +75,11 @@ public:
* kernel scene.
*/
bool is_traceable();
/* Combine object's visibility with all possible internal run-time
* determined flags which denotes trace-time visibility.
*/
uint visibility_for_tracing() const;
};
/* Object Manager */

View File

@ -1120,23 +1120,21 @@ void *BKE_libblock_alloc_notest(short type)
*/
void *BKE_libblock_alloc(Main *bmain, short type, const char *name, const int flag)
{
ID *id = NULL;
BLI_assert((flag & LIB_ID_CREATE_NO_ALLOCATE) == 0);
id = BKE_libblock_alloc_notest(type);
if ((flag & LIB_ID_CREATE_NO_MAIN) != 0) {
id->tag |= LIB_TAG_NO_MAIN;
}
if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) != 0) {
id->tag |= LIB_TAG_NO_USER_REFCOUNT;
}
ID *id = BKE_libblock_alloc_notest(type);
if (id) {
if ((flag & LIB_ID_CREATE_NO_MAIN) != 0) {
id->tag |= LIB_TAG_NO_MAIN;
}
if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) != 0) {
id->tag |= LIB_TAG_NO_USER_REFCOUNT;
}
id->icon_id = 0;
*( (short *)id->name) = type;
if ((flag & LIB_ID_FREE_NO_USER_REFCOUNT) == 0) {
*((short *)id->name) = type;
if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
id->us = 1;
}
if ((flag & LIB_ID_CREATE_NO_MAIN) == 0) {
@ -1153,6 +1151,9 @@ void *BKE_libblock_alloc(Main *bmain, short type, const char *name, const int fl
DEG_id_type_tag(bmain, type);
}
}
else {
BLI_strncpy(id->name + 2, name, sizeof(id->name) - 2);
}
}
return id;