[Bf-blender-cvs] [6d13143] openvdb: OpenVDB 3.1 update.

Kévin Dietrich noreply at git.blender.org
Fri Sep 11 12:19:36 CEST 2015


Commit: 6d13143b89727ec4c984b9bd98c7d1e9c1b24af3
Author: Kévin Dietrich
Date:   Sat Aug 29 03:11:23 2015 +0200
Branches: openvdb
https://developer.blender.org/rB6d13143b89727ec4c984b9bd98c7d1e9c1b24af3

OpenVDB 3.1 update.

This commit makes it so OpenVDB 3.1 is to used for compilation (the
current dev version at the time of the commit).

Changes are as follows:

- remove OPENVDB_USE_BLOSC, as this was due to a bug which "required"
client code to define this when it was also defined on OpenVDB's side.
- Cycles: make use of floating-point precision rays and volume
intersectors.

===================================================================

M	CMakeLists.txt
M	intern/cycles/CMakeLists.txt
M	intern/cycles/kernel/osl/osl_services.cpp
M	intern/cycles/util/util_volume.h
M	intern/openvdb/CMakeLists.txt
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/nodes/CMakeLists.txt
M	source/blender/python/intern/CMakeLists.txt

===================================================================

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 02a5b48..ccd6660 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1592,7 +1592,6 @@ elseif(WIN32)
 			set(OPENVDB_LIBRARIES openvdb ${TBB_LIBRARIES})
 			set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
 			set(OPENVDB_DEFINITIONS)
-			add_definitions(-DOPENVDB_USE_BLOSC)
 		endif()
 
 		if(WITH_MOD_CLOTH_ELTOPO)
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index fcaad29..a09976b 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -153,7 +153,6 @@ endif()
 
 if(WITH_OPENVDB)
 	add_definitions(-DWITH_OPENVDB)
-	add_definitions(-DOPENVDB_USE_BLOSC)
 	add_definitions(-DDWREAL_IS_DOUBLE=0)
 	add_definitions(-DTBB_USE_EXCEPTIONS=0)
 	include_directories(
diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp
index 3c1955a..117f74c 100644
--- a/intern/cycles/kernel/osl/osl_services.cpp
+++ b/intern/cycles/kernel/osl/osl_services.cpp
@@ -34,9 +34,6 @@
 #include "osl_services.h"
 #include "osl_shader.h"
 
-#include "util_foreach.h"
-#include "util_string.h"
-
 #include "kernel_compat_cpu.h"
 #include "kernel_globals.h"
 #include "kernel_random.h"
@@ -45,6 +42,13 @@
 #include "kernel_montecarlo.h"
 #include "kernel_camera.h"
 
+/* Note: "util_foreach.h" needs to be included after "kernel_compat_cpu.h", as
+ * for some reason ccl::foreach conflicts with openvdb::tools::foreach, which is
+ * indirectly included through "kernel_compat_cpu.h".
+ */
+#include "util_foreach.h"
+#include "util_string.h"
+
 #include "geom/geom.h"
 
 #include "kernel_projection.h"
diff --git a/intern/cycles/util/util_volume.h b/intern/cycles/util/util_volume.h
index 6638ea0..4faae74 100644
--- a/intern/cycles/util/util_volume.h
+++ b/intern/cycles/util/util_volume.h
@@ -63,14 +63,14 @@ using std::isfinite;
 using boost::math::isfinite;
 #endif
 
-/* eventually this should be openvdb::math::Ray<float>, but OpenVDB does not
- * compile in that case */
-typedef openvdb::math::Ray<openvdb::Real> vdb_ray_t;
+typedef openvdb::math::Ray<float> vdb_ray_t;
 
 class vdb_float_volume : public float_volume {
 	typedef openvdb::tools::GridSampler<openvdb::FloatGrid::ConstAccessor, openvdb::tools::PointSampler> point_sampler_t;
 	typedef openvdb::tools::GridSampler<openvdb::FloatGrid::ConstAccessor, openvdb::tools::BoxSampler> box_sampler_t;
-	typedef openvdb::tools::VolumeRayIntersector<openvdb::FloatGrid> isector_t;
+	typedef openvdb::tools::VolumeRayIntersector<openvdb::FloatGrid,
+	                                             openvdb::FloatTree::RootNodeType::ChildNodeType::LEVEL,
+	                                             vdb_ray_t> isector_t;
 
 	/* mainly used to ensure thread safety for the accessors */
 	typedef unordered_map<pthread_t, isector_t *> isect_map;
@@ -217,11 +217,11 @@ public:
 		isect_map::iterator iter = isectors.find(thread);
 		isector_t *vdb_isect = iter->second;
 
-		openvdb::Real vdb_t0(*t0), vdb_t1(*t1);
+		float vdb_t0(*t0), vdb_t1(*t1);
 
 		if(vdb_isect->march(vdb_t0, vdb_t1)) {
-			*t0 = (float)vdb_isect->getWorldTime(vdb_t0);
-			*t1 = (float)vdb_isect->getWorldTime(vdb_t1);
+			*t0 = vdb_isect->getWorldTime(vdb_t0);
+			*t1 = vdb_isect->getWorldTime(vdb_t1);
 
 			return true;
 		}
@@ -242,7 +242,9 @@ class vdb_float3_volume : public float3_volume {
 	typedef openvdb::tools::GridSampler<openvdb::Vec3SGrid::ConstAccessor, openvdb::tools::StaggeredPointSampler> stag_point_sampler_t;
 	typedef openvdb::tools::GridSampler<openvdb::Vec3SGrid::ConstAccessor, openvdb::tools::StaggeredBoxSampler> stag_box_sampler_t;
 
-	typedef openvdb::tools::VolumeRayIntersector<openvdb::Vec3SGrid> isector_t;
+	typedef openvdb::tools::VolumeRayIntersector<openvdb::Vec3SGrid,
+	                                             openvdb::FloatTree::RootNodeType::ChildNodeType::LEVEL,
+	                                             vdb_ray_t> isector_t;
 
 	/* mainly used to ensure thread safety for the accessors */
 	typedef unordered_map<pthread_t, isector_t *> isect_map;
@@ -460,11 +462,11 @@ public:
 		isect_map::iterator iter = isectors.find(thread);
 		isector_t *vdb_isect = iter->second;
 
-		openvdb::Real vdb_t0(*t0), vdb_t1(*t1);
+		float vdb_t0(*t0), vdb_t1(*t1);
 
 		if(vdb_isect->march(vdb_t0, vdb_t1)) {
-			*t0 = (float)vdb_isect->getWorldTime(vdb_t0);
-			*t1 = (float)vdb_isect->getWorldTime(vdb_t1);
+			*t0 = vdb_isect->getWorldTime(vdb_t0);
+			*t1 = vdb_isect->getWorldTime(vdb_t1);
 
 			return true;
 		}
diff --git a/intern/openvdb/CMakeLists.txt b/intern/openvdb/CMakeLists.txt
index 5646396..37264fa 100644
--- a/intern/openvdb/CMakeLists.txt
+++ b/intern/openvdb/CMakeLists.txt
@@ -38,7 +38,6 @@ set(SRC
 if(WITH_OPENVDB)
 	add_definitions(
 		-DWITH_OPENVDB
-		-DOPENVDB_USE_BLOSC
 	)
 
 	list(APPEND INC_SYS
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 3001ddd..be23fbe 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -520,7 +520,6 @@ endif()
 
 if(WITH_OPENVDB)
 	add_definitions(-DWITH_OPENVDB)
-	add_definitions(-DOPENVDB_USE_BLOSC)
 	list(APPEND INC
 		 ../../../intern/openvdb
 	)
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 51baf82..36c9401 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -295,7 +295,6 @@ endif()
 
 if(WITH_OPENVDB)
 	add_definitions(-DWITH_OPENVDB)
-	add_definitions(-DOPENVDB_USE_BLOSC)
 	list(APPEND INC
 	     ../../../intern/openvdb
 	)
diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt
index 131d21c..f699946 100644
--- a/source/blender/python/intern/CMakeLists.txt
+++ b/source/blender/python/intern/CMakeLists.txt
@@ -268,7 +268,6 @@ endif()
 
 if(WITH_OPENVDB)
     add_definitions(-DWITH_OPENVDB)
-	add_definitions(-DOPENVDB_USE_BLOSC)
     list(APPEND INC
         ../../../../intern/openvdb
     )




More information about the Bf-blender-cvs mailing list