Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Thu, 10 Aug 2017 09:14:36 +0000 (11:14 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Thu, 10 Aug 2017 09:14:36 +0000 (11:14 +0200)
build_files/build_environment/install_deps.sh
intern/cycles/bvh/bvh.cpp
intern/cycles/bvh/bvh2.cpp
intern/cycles/bvh/bvh4.cpp
intern/cycles/bvh/bvh_build.cpp
intern/cycles/render/object.cpp
intern/cycles/render/object.h
source/blender/blenkernel/intern/library.c

index 1c1e9ea151d42ec867984ab163a54ad4cefb1ed6..3816ab1aa0f2f4ab3b1ed70775a693373f27ba3b 100755 (executable)
@@ -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"
index c7e11539cf9f9defbe78ac65b52aab733d7aa3e7..0ad3c8a74290858b625e5dc39efd35d971897d20 100644 (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;
index 3e3a5d604d85d54af393966392027888d7e885c3..9aa8e71dfd0db65ec257df75003a8ea7361e3303 100644 (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);
index 0e460db7ed77124e260dc4a8ca1107254c08d915..aeedd802f497762e3112b1f6171ae44f43d6bdea 100644 (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.
index 1880964355c15157986974ca17b9294477554edc..933e98fea0142a0add2a4d49beabf02ed1c77c17 100644 (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;
                        }
index 375abfeb27a7a9a08549b0d3ff56c0ec4d5c2d72..b00e5624266ec848565c6dbeea159a906a7814ce 100644 (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()
index 12d7b2c81cfe58b37e43910bc23c7b9e2c5b7fe7..6927bbfe4c7f4a1662f63954f47f9edab999b825 100644 (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 */
index 4721955af439f4556c6fccba379149b6276fd93b..76b8aa2d446ee2d2170189491751562cc04e4f2b 100644 (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;