[Bf-blender-cvs] [e9452f9] master: Implementation of OpenVDB as a possible cache format for smoke simulations.
Kévin Dietrich
noreply at git.blender.org
Sat Jan 23 08:44:50 CET 2016
Commit: e9452f909cdba368f54637cd0b15ff14d1c60cf3
Author: Kévin Dietrich
Date: Sat Jan 23 08:39:29 2016 +0100
Branches: master
https://developer.blender.org/rBe9452f909cdba368f54637cd0b15ff14d1c60cf3
Implementation of OpenVDB as a possible cache format for smoke
simulations.
This commits implements OpenVDB as an extra cache format in the Point
Cache system for smoke simulations. Compilation with the library is
turned off by default for now, and shall be enabled when the library is
present.
A documentation of its doings is available here: http://
wiki.blender.org/index.php/User:Kevindietrich/OpenVDBSmokeExport.
A guide to compile OpenVDB can be found here (Linux): http://
wiki.blender.org/index.php?title=Dev:Doc/Building_Blender/Linux/
Dependencies_From_Source#OpenVDB
Reviewers: sergey, lukastoenne, brecht, campbellbarton
Reviewed By: brecht, campbellbarton
Subscribers: galenb, Blendify, robocyte, Lapineige, bliblubli,
jtheninja, lukasstockner97, dingto, brecht
Differential Revision: https://developer.blender.org/D1721
===================================================================
M CMakeLists.txt
A build_files/cmake/Modules/FindOpenVDB.cmake
M build_files/cmake/config/blender_lite.cmake
M build_files/cmake/config/bpy_module.cmake
M build_files/cmake/macros.cmake
M intern/CMakeLists.txt
A intern/openvdb/CMakeLists.txt
A intern/openvdb/intern/openvdb_dense_convert.cc
A intern/openvdb/intern/openvdb_dense_convert.h
A intern/openvdb/intern/openvdb_reader.cc
A intern/openvdb/intern/openvdb_reader.h
A intern/openvdb/intern/openvdb_writer.cc
A intern/openvdb/intern/openvdb_writer.h
A intern/openvdb/openvdb_capi.cc
A intern/openvdb/openvdb_capi.h
A intern/openvdb/openvdb_util.cc
A intern/openvdb/openvdb_util.h
M release/scripts/modules/sys_info.py
M release/scripts/startup/bl_ui/properties_physics_smoke.py
M source/blender/blenkernel/BKE_pointcache.h
M source/blender/blenkernel/CMakeLists.txt
M source/blender/blenkernel/intern/pointcache.c
M source/blender/blenkernel/intern/smoke.c
M source/blender/editors/space_view3d/drawobject.c
M source/blender/makesdna/DNA_smoke_types.h
M source/blender/makesrna/intern/CMakeLists.txt
M source/blender/makesrna/intern/rna_smoke.c
M source/blender/python/intern/CMakeLists.txt
M source/blender/python/intern/bpy_app.c
M source/blender/python/intern/bpy_app_build_options.c
A source/blender/python/intern/bpy_app_openvdb.c
A source/blender/python/intern/bpy_app_openvdb.h
M source/blenderplayer/CMakeLists.txt
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e0326f1..4ec5053 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -242,6 +242,9 @@ option(WITH_OPENSUBDIV "Enable OpenSubdiv for surface subdivision" _init_OPEN
option(WITH_SUBSURF_WERROR "Treat warnings as errors in subsurf code" OFF)
mark_as_advanced(WITH_COMPOSITOR_WERROR)
+option(WITH_OPENVDB "Enable features relying on OpenVDB" OFF)
+option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable if OpenVDB was built with blosc support" OFF)
+
# GHOST Windowing Library Options
option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
mark_as_advanced(WITH_GHOST_DEBUG)
@@ -677,10 +680,11 @@ if(NOT WITH_BOOST)
set_and_warn(WITH_CYCLES OFF)
set_and_warn(WITH_AUDASPACE OFF)
set_and_warn(WITH_INTERNATIONAL OFF)
+ set_and_warn(WITH_OPENVDB OFF)
set_and_warn(WITH_OPENAL OFF) # depends on AUDASPACE
set_and_warn(WITH_GAMEENGINE OFF) # depends on AUDASPACE
-elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
+elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_INTERNATIONAL OR WITH_OPENVDB)
# Keep enabled
else()
# Enabled but we don't need it
@@ -1056,6 +1060,24 @@ if(UNIX AND NOT APPLE)
endif()
endif()
+ if(WITH_OPENVDB)
+ find_package_wrapper(OpenVDB)
+
+ set(TBB ${LIBDIR}/tbb)
+ set(TBB_LIBRARIES tbb)
+ set(TBB_LIBPATH ${TBB}/lib)
+
+ set(OPENVDB_LIBRARIES ${OPENVDB_LIBRARIES} ${BOOST_LIBRARIES} ${ZLIB_LIBRARIES} ${TBB_LIBRARIES})
+ set(OPENVDB_LIBPATH) # TODO, remove and reference the absolute path everywhere
+ set(OPENVDB_DEFINITIONS)
+
+ if(NOT OPENVDB_FOUND)
+ set(WITH_OPENVDB OFF)
+ set(WITH_OPENVDB_BLOSC OFF)
+ message(STATUS "OpenVDB not found")
+ endif()
+ endif()
+
if(WITH_BOOST)
# uses in build instructions to override include and library variables
if(NOT BOOST_CUSTOM)
@@ -1076,6 +1098,9 @@ if(UNIX AND NOT APPLE)
if(WITH_CYCLES_NETWORK)
list(APPEND __boost_packages serialization)
endif()
+ if(WITH_OPENVDB)
+ list(APPEND __boost_packages iostreams)
+ endif()
find_package(Boost 1.48 COMPONENTS ${__boost_packages})
if(NOT Boost_FOUND)
# try to find non-multithreaded if -mt not found, this flag
@@ -1561,7 +1586,14 @@ elseif(WIN32)
set(OPENCOLORIO_LIBPATH ${LIBDIR}/opencolorio/lib)
set(OPENCOLORIO_DEFINITIONS)
endif()
-
+
+ if(WITH_OPENVDB)
+ set(OPENVDB ${LIBDIR}/openvdb)
+ set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
+ set(OPENVDB_LIBRARIES openvdb ${TBB_LIBRARIES})
+ set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
+ set(OPENVDB_DEFINITIONS)
+ endif()
if(WITH_MOD_CLOTH_ELTOPO)
set(LAPACK ${LIBDIR}/lapack)
@@ -1834,6 +1866,14 @@ elseif(WIN32)
set(SDL_LIBPATH ${SDL}/lib)
endif()
+ if(WITH_OPENVDB)
+ set(OPENVDB ${LIBDIR}/openvdb)
+ set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
+ set(OPENVDB_LIBRARIES openvdb ${TBB_LIBRARIES})
+ set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
+ set(OPENVDB_DEFINITIONS)
+ endif()
+
set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
## DISABLE - causes linking errors
@@ -2139,6 +2179,14 @@ elseif(APPLE)
set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
endif()
+ if(WITH_OPENVDB)
+ set(OPENVDB ${LIBDIR}/openvdb)
+ set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
+ set(OPENVDB_LIBRARIES openvdb ${TBB_LIBRARIES})
+ set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
+ set(OPENVDB_DEFINITIONS)
+ endif()
+
if(WITH_LLVM)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
set(LLVM_VERSION "3.4" CACHE STRING "Version of LLVM to use")
@@ -2981,6 +3029,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_CYCLES)
info_cfg_option(WITH_FREESTYLE)
info_cfg_option(WITH_OPENCOLORIO)
+ info_cfg_option(WITH_OPENVDB)
info_cfg_text("Compiler Options:")
info_cfg_option(WITH_BUILDINFO)
diff --git a/build_files/cmake/Modules/FindOpenVDB.cmake b/build_files/cmake/Modules/FindOpenVDB.cmake
new file mode 100644
index 0000000..a13feab
--- /dev/null
+++ b/build_files/cmake/Modules/FindOpenVDB.cmake
@@ -0,0 +1,74 @@
+# - Find OPENVDB library
+# Find the native OPENVDB includes and library
+# This module defines
+# OPENVDB_INCLUDE_DIRS, where to find openvdb.h, Set when
+# OPENVDB_INCLUDE_DIR is found.
+# OPENVDB_LIBRARIES, libraries to link against to use OPENVDB.
+# OPENVDB_ROOT_DIR, The base directory to search for OPENVDB.
+# This can also be an environment variable.
+# OPENVDB_FOUND, If false, do not try to use OPENVDB.
+#
+# also defined, but not for general use are
+# OPENVDB_LIBRARY, where to find the OPENVDB library.
+
+#=============================================================================
+# Copyright 2015 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# If OPENVDB_ROOT_DIR was defined in the environment, use it.
+IF(NOT OPENVDB_ROOT_DIR AND NOT $ENV{OPENVDB_ROOT_DIR} STREQUAL "")
+ SET(OPENVDB_ROOT_DIR $ENV{OPENVDB_ROOT_DIR})
+ENDIF()
+
+SET(_openvdb_SEARCH_DIRS
+ ${OPENVDB_ROOT_DIR}
+ /usr/local
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt/openvdb
+ /opt/lib/openvdb
+)
+
+FIND_PATH(OPENVDB_INCLUDE_DIR
+ NAMES
+ openvdb/openvdb.h
+ HINTS
+ ${_openvdb_SEARCH_DIRS}
+ PATH_SUFFIXES
+ include
+)
+
+FIND_LIBRARY(OPENVDB_LIBRARY
+ NAMES
+ openvdb
+ HINTS
+ ${_openvdb_SEARCH_DIRS}
+ PATH_SUFFIXES
+ lib64 lib
+)
+
+# handle the QUIETLY and REQUIRED arguments and set OPENVDB_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENVDB DEFAULT_MSG
+ OPENVDB_LIBRARY OPENVDB_INCLUDE_DIR)
+
+IF(OPENVDB_FOUND)
+ SET(OPENVDB_LIBRARIES ${OPENVDB_LIBRARY})
+ SET(OPENVDB_INCLUDE_DIRS ${OPENVDB_INCLUDE_DIR})
+ENDIF(OPENVDB_FOUND)
+
+MARK_AS_ADVANCED(
+ OPENVDB_INCLUDE_DIR
+ OPENVDB_LIBRARY
+)
+
+UNSET(_openvdb_SEARCH_DIRS)
diff --git a/build_files/cmake/config/blender_lite.cmake b/build_files/cmake/config/blender_lite.cmake
index 99e90ca..a479506 100644
--- a/build_files/cmake/config/blender_lite.cmake
+++ b/build_files/cmake/config/blender_lite.cmake
@@ -47,6 +47,7 @@ set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
set(WITH_OPENCOLORIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENIMAGEIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
+set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
set(WITH_RAYOPTIMIZATION OFF CACHE BOOL "" FORCE)
set(WITH_SDL OFF CACHE BOOL "" FORCE)
set(WITH_X11_XINPUT OFF CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/config/bpy_module.cmake b/build_files/cmake/config/bpy_module.cmake
index b5b13b4..4114015 100644
--- a/build_files/cmake/config/bpy_module.cmake
+++ b/build_files/cmake/config/bpy_module.cmake
@@ -31,3 +31,4 @@ set(WITH_INPUT_NDOF OFF CACHE BOOL "" FORCE)
set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
set(WITH_BULLET OFF CACHE BOOL "" FORCE)
+set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 6194bd8..28617cd 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -282,6 +282,9 @@ function(SETUP_LIBDIRS)
if(WITH_OPENCOLORIO)
link_directories(${OPENCOLORIO_LIBPATH})
endif()
+ if(WITH_OPENVDB)
+ link_directories(${OPENVDB_LIBPATH})
+ endif()
if(WITH_IMAGE_OPENJPEG AND WITH_SYSTEM_OPENJPEG)
link_directories(${OPENJPEG_LIBPATH})
endif()
@@ -400,6 +403,9 @@ function(setup_liblinks
target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
endif()
endif()
+ if(WITH_OPENVDB)
+ target_link_libraries(${target} ${OPENVDB_LIBRARIES})
+ endif()
if(WITH_CYCLES_OSL)
target_link_libraries(${target} ${OSL_LIBRARIES})
endif()
@@ -713,6 +719,10 @@ function(SETUP_BLENDER_SORTED_LIBS)
list(APPEND BLENDER_SORTED_LIBS bf_intern_opensubdiv)
endif()
+ if(WITH_OPENVDB)
+ list(APPEND BLENDER_SORTED_LIBS bf_intern_openvdb)
+ endif()
+
foreach(SORTLIB ${BLENDER_SORTED_LIBS})
set(REMLIB ${SORTLIB})
foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt
index f5f2d1c..43e5b6b 100644
--- a/intern/CMakeLists.txt
+++ b/intern/CMakeLists.txt
@@ -82,3 +82,7 @@ endif()
if(WIN32)
add_subdirectory(utfconv)
endif()
+
+if(WITH_OPENVDB)
+ add_subdirectory(openvdb)
+endif()
diff --git a/intern/openvdb/CMakeLists.txt b/intern/openvdb/CMakeLists.txt
new file mode 100644
index 0000000..ce683e7
--- /dev/null
+++ b/intern/openvdb/CMakeLists.txt
@@ -0,0 +1,69 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# The Original Code is Copyright (C) 2015, Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): Kevin Dietrich.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+set(INC
+ .
+ intern
+)
+
+set(INC_SYS
+)
+
+set(SRC
+ openvdb_capi.h
+)
+
+if(WITH_OPENVDB)
+ add_definitions(
+ -DWITH_OPENVDB
+ )
+
+ list(APPEND INC_SYS
+ ${BOOST_INC
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list