[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43428] trunk/blender: Carve booleans library integration

Sergey Sharybin sergey.vfx at gmail.com
Mon Jan 16 17:46:06 CET 2012


Revision: 43428
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43428
Author:   nazgul
Date:     2012-01-16 16:46:00 +0000 (Mon, 16 Jan 2012)
Log Message:
-----------
Carve booleans library integration
==================================

Merging Carve library integration project into the trunk.

This commit switches Boolean modifier to another library which handles
mesh boolean operations in much stable and faster way, resolving old
well-known limitations of intern boolop library.

Carve is integrating as alternative interface for boolop library and
which makes it totally transparent for blender sources to switch between
old-fashioned boolop and new Carve backends.

Detailed changes in this commit:

- Integrated needed subset of Carve library sources into extern/
  Added script for re-bundling it (currently works only if repo
  was cloned by git-svn).
- Added BOP_CarveInterface for boolop library which can be used by
  Boolean modifier.
- Carve backend is enabled by default, can be disabled by WITH_BF_CARVE
  SCons option and WITH_CARVE CMake option.
- If Boost library is found in build environment it'll be used for
  unordered collections. If Boost isn't found, it'll fallback to TR1
  implementation for GCC compilers. Boost is obligatory if MSVC is used.

Tested on Linux 64bit and Windows 7 64bit.

NOTE: behavior of flat objects was changed. E.g. Plane-Sphere now gives
      plane with circle hole, not plane with semisphere. Don't think
      it's really issue because it's not actually defined behavior in
      such situations and both of ways might be useful. Since it's
      only known "regression" think it's OK to deal with it.

Details are there http://wiki.blender.org/index.php/User:Nazg-gul/CarveBooleans

Special thanks to:

- Ken Hughes: author of original carve integration patch.
- Campbell Barton: help in project development, review tests.
- Tobias Sargeant: author of Carve library, help in resolving some
                   merge stoppers, bug fixing.

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/build_files/scons/tools/btools.py
    trunk/blender/extern/CMakeLists.txt
    trunk/blender/extern/SConscript
    trunk/blender/intern/boolop/CMakeLists.txt
    trunk/blender/intern/boolop/SConscript
    trunk/blender/intern/boolop/intern/BOP_BSPNode.cpp
    trunk/blender/intern/boolop/intern/BOP_BSPNode.h
    trunk/blender/intern/boolop/intern/BOP_BSPTree.cpp
    trunk/blender/intern/boolop/intern/BOP_Edge.cpp
    trunk/blender/intern/boolop/intern/BOP_Face.h
    trunk/blender/intern/boolop/intern/BOP_Indexs.h
    trunk/blender/intern/boolop/intern/BOP_Interface.cpp
    trunk/blender/intern/boolop/intern/BOP_MathUtils.cpp
    trunk/blender/intern/boolop/intern/BOP_Merge.h
    trunk/blender/intern/boolop/intern/BOP_Merge2.h
    trunk/blender/intern/boolop/intern/BOP_Mesh.h
    trunk/blender/intern/boolop/intern/BOP_Segment.cpp
    trunk/blender/intern/boolop/intern/BOP_Segment.h
    trunk/blender/intern/boolop/intern/BOP_Splitter.cpp
    trunk/blender/intern/boolop/intern/BOP_Triangulator.cpp
    trunk/blender/source/blender/modifiers/intern/MOD_boolean.c
    trunk/blender/source/creator/CMakeLists.txt

Added Paths:
-----------
    trunk/blender/extern/carve/
    trunk/blender/extern/carve/CMakeLists.txt
    trunk/blender/extern/carve/LICENSE.GPL2
    trunk/blender/extern/carve/SConscript
    trunk/blender/extern/carve/bundle.sh
    trunk/blender/extern/carve/files.txt
    trunk/blender/extern/carve/include/
    trunk/blender/extern/carve/include/carve/
    trunk/blender/extern/carve/include/carve/aabb.hpp
    trunk/blender/extern/carve/include/carve/aabb_impl.hpp
    trunk/blender/extern/carve/include/carve/carve.hpp
    trunk/blender/extern/carve/include/carve/cbrt.h
    trunk/blender/extern/carve/include/carve/classification.hpp
    trunk/blender/extern/carve/include/carve/collection/
    trunk/blender/extern/carve/include/carve/collection/unordered/
    trunk/blender/extern/carve/include/carve/collection/unordered/boost_impl.hpp
    trunk/blender/extern/carve/include/carve/collection/unordered/fallback_impl.hpp
    trunk/blender/extern/carve/include/carve/collection/unordered/libstdcpp_impl.hpp
    trunk/blender/extern/carve/include/carve/collection/unordered/std_impl.hpp
    trunk/blender/extern/carve/include/carve/collection/unordered/tr1_impl.hpp
    trunk/blender/extern/carve/include/carve/collection/unordered/vcpp_impl.hpp
    trunk/blender/extern/carve/include/carve/collection/unordered.hpp
    trunk/blender/extern/carve/include/carve/collection.hpp
    trunk/blender/extern/carve/include/carve/collection_types.hpp
    trunk/blender/extern/carve/include/carve/colour.hpp
    trunk/blender/extern/carve/include/carve/config.h
    trunk/blender/extern/carve/include/carve/convex_hull.hpp
    trunk/blender/extern/carve/include/carve/csg.hpp
    trunk/blender/extern/carve/include/carve/csg_triangulator.hpp
    trunk/blender/extern/carve/include/carve/debug_hooks.hpp
    trunk/blender/extern/carve/include/carve/djset.hpp
    trunk/blender/extern/carve/include/carve/edge_decl.hpp
    trunk/blender/extern/carve/include/carve/edge_impl.hpp
    trunk/blender/extern/carve/include/carve/exact.hpp
    trunk/blender/extern/carve/include/carve/external/
    trunk/blender/extern/carve/include/carve/external/boost/
    trunk/blender/extern/carve/include/carve/external/boost/random.hpp
    trunk/blender/extern/carve/include/carve/face_decl.hpp
    trunk/blender/extern/carve/include/carve/face_impl.hpp
    trunk/blender/extern/carve/include/carve/faceloop.hpp
    trunk/blender/extern/carve/include/carve/geom.hpp
    trunk/blender/extern/carve/include/carve/geom2d.hpp
    trunk/blender/extern/carve/include/carve/geom3d.hpp
    trunk/blender/extern/carve/include/carve/geom_impl.hpp
    trunk/blender/extern/carve/include/carve/gnu_cxx.h
    trunk/blender/extern/carve/include/carve/heap.hpp
    trunk/blender/extern/carve/include/carve/input.hpp
    trunk/blender/extern/carve/include/carve/interpolator.hpp
    trunk/blender/extern/carve/include/carve/intersection.hpp
    trunk/blender/extern/carve/include/carve/iobj.hpp
    trunk/blender/extern/carve/include/carve/kd_node.hpp
    trunk/blender/extern/carve/include/carve/math.hpp
    trunk/blender/extern/carve/include/carve/math_constants.hpp
    trunk/blender/extern/carve/include/carve/matrix.hpp
    trunk/blender/extern/carve/include/carve/mesh.hpp
    trunk/blender/extern/carve/include/carve/mesh_impl.hpp
    trunk/blender/extern/carve/include/carve/mesh_ops.hpp
    trunk/blender/extern/carve/include/carve/mesh_simplify.hpp
    trunk/blender/extern/carve/include/carve/octree_decl.hpp
    trunk/blender/extern/carve/include/carve/octree_impl.hpp
    trunk/blender/extern/carve/include/carve/pointset.hpp
    trunk/blender/extern/carve/include/carve/pointset_decl.hpp
    trunk/blender/extern/carve/include/carve/pointset_impl.hpp
    trunk/blender/extern/carve/include/carve/pointset_iter.hpp
    trunk/blender/extern/carve/include/carve/poly.hpp
    trunk/blender/extern/carve/include/carve/poly_decl.hpp
    trunk/blender/extern/carve/include/carve/poly_impl.hpp
    trunk/blender/extern/carve/include/carve/polyhedron_base.hpp
    trunk/blender/extern/carve/include/carve/polyhedron_decl.hpp
    trunk/blender/extern/carve/include/carve/polyhedron_impl.hpp
    trunk/blender/extern/carve/include/carve/polyline.hpp
    trunk/blender/extern/carve/include/carve/polyline_decl.hpp
    trunk/blender/extern/carve/include/carve/polyline_impl.hpp
    trunk/blender/extern/carve/include/carve/polyline_iter.hpp
    trunk/blender/extern/carve/include/carve/rescale.hpp
    trunk/blender/extern/carve/include/carve/rtree.hpp
    trunk/blender/extern/carve/include/carve/spacetree.hpp
    trunk/blender/extern/carve/include/carve/tag.hpp
    trunk/blender/extern/carve/include/carve/timing.hpp
    trunk/blender/extern/carve/include/carve/tree.hpp
    trunk/blender/extern/carve/include/carve/triangulator.hpp
    trunk/blender/extern/carve/include/carve/triangulator_impl.hpp
    trunk/blender/extern/carve/include/carve/util.hpp
    trunk/blender/extern/carve/include/carve/vcpp_config.h
    trunk/blender/extern/carve/include/carve/vector.hpp
    trunk/blender/extern/carve/include/carve/vertex_decl.hpp
    trunk/blender/extern/carve/include/carve/vertex_impl.hpp
    trunk/blender/extern/carve/include/carve/win32.h
    trunk/blender/extern/carve/lib/
    trunk/blender/extern/carve/lib/aabb.cpp
    trunk/blender/extern/carve/lib/carve.cpp
    trunk/blender/extern/carve/lib/convex_hull.cpp
    trunk/blender/extern/carve/lib/csg.cpp
    trunk/blender/extern/carve/lib/csg_collector.cpp
    trunk/blender/extern/carve/lib/csg_collector.hpp
    trunk/blender/extern/carve/lib/csg_data.hpp
    trunk/blender/extern/carve/lib/csg_detail.hpp
    trunk/blender/extern/carve/lib/edge.cpp
    trunk/blender/extern/carve/lib/face.cpp
    trunk/blender/extern/carve/lib/geom2d.cpp
    trunk/blender/extern/carve/lib/geom3d.cpp
    trunk/blender/extern/carve/lib/intersect.cpp
    trunk/blender/extern/carve/lib/intersect_classify_common.hpp
    trunk/blender/extern/carve/lib/intersect_classify_common_impl.hpp
    trunk/blender/extern/carve/lib/intersect_classify_edge.cpp
    trunk/blender/extern/carve/lib/intersect_classify_group.cpp
    trunk/blender/extern/carve/lib/intersect_common.hpp
    trunk/blender/extern/carve/lib/intersect_debug.cpp
    trunk/blender/extern/carve/lib/intersect_debug.hpp
    trunk/blender/extern/carve/lib/intersect_face_division.cpp
    trunk/blender/extern/carve/lib/intersect_group.cpp
    trunk/blender/extern/carve/lib/intersect_half_classify_group.cpp
    trunk/blender/extern/carve/lib/intersection.cpp
    trunk/blender/extern/carve/lib/math.cpp
    trunk/blender/extern/carve/lib/mesh.cpp
    trunk/blender/extern/carve/lib/octree.cpp
    trunk/blender/extern/carve/lib/pointset.cpp
    trunk/blender/extern/carve/lib/polyhedron.cpp
    trunk/blender/extern/carve/lib/polyline.cpp
    trunk/blender/extern/carve/lib/tag.cpp
    trunk/blender/extern/carve/lib/timing.cpp
    trunk/blender/extern/carve/lib/triangulator.cpp
    trunk/blender/extern/carve/mkfiles.sh
    trunk/blender/extern/carve/patches/
    trunk/blender/extern/carve/patches/files/
    trunk/blender/extern/carve/patches/files/config.h
    trunk/blender/extern/carve/patches/files/random.hpp
    trunk/blender/extern/carve/patches/includes.patch
    trunk/blender/extern/carve/patches/mesh_iterator.patch
    trunk/blender/extern/carve/patches/series
    trunk/blender/extern/carve/patches/strict_flags.patch
    trunk/blender/extern/carve/patches/win32.patch
    trunk/blender/intern/boolop/intern/BOP_CarveInterface.cpp

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt	2012-01-16 16:23:25 UTC (rev 43427)
+++ trunk/blender/CMakeLists.txt	2012-01-16 16:46:00 UTC (rev 43428)
@@ -208,6 +208,9 @@
 # Camera/motion tracking
 option(WITH_LIBMV         "Enable libmv structure from motion library" ON)
 
+# Mesh boolean lib
+option(WITH_CARVE         "Enable Carve library to handle mesh boolean operations" ON)
+
 # Misc
 option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
 option(WITH_RAYOPTIMIZATION	"Enable use of SIMD (SSE) optimizations for the raytracer" ON)
@@ -300,9 +303,13 @@
 	set(WITH_HEADLESS ON)
 endif()
 
-# auto enable openimageio and boost for cycles
+# auto enable openimageio for cycles
 if(WITH_CYCLES)
 	set(WITH_OPENIMAGEIO ON)
+endif()
+
+# auto enable boost for cycles and carve
+if(WITH_CYCLES OR WITH_CARVE)
 	set(WITH_BOOST ON)
 endif()
 

Modified: trunk/blender/build_files/scons/tools/btools.py
===================================================================
--- trunk/blender/build_files/scons/tools/btools.py	2012-01-16 16:23:25 UTC (rev 43427)
+++ trunk/blender/build_files/scons/tools/btools.py	2012-01-16 16:46:00 UTC (rev 43428)
@@ -161,7 +161,7 @@
             'WITH_BF_CYCLES', 'WITH_BF_CYCLES_CUDA_BINARIES' 'BF_CYCLES_CUDA_NVCC', 'BF_CYCLES_CUDA_NVCC', 'WITH_BF_CYCLES_CUDA_THREADED_COMPILE',
             'WITH_BF_OIIO', 'WITH_BF_STATICOIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIB_STATIC', 'BF_OIIO_LIBPATH',
             'WITH_BF_BOOST', 'WITH_BF_STATICBOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH',
-            'WITH_BF_LIBMV'
+            'WITH_BF_LIBMV', 'WITH_BF_CARVE'
             ]
     
     # Have options here that scons expects to be lists
@@ -521,6 +521,7 @@
         
         (BoolVariable('WITH_BF_LZO', 'Enable fast LZO pointcache compression', True)),
         (BoolVariable('WITH_BF_LZMA', 'Enable best LZMA pointcache compression', True)),
+        (BoolVariable('WITH_BF_CARVE', 'Enable carve library for mesh boolean operations', True)),
         
         (BoolVariable('WITH_BF_LIBMV', 'Enable libmv structure from motion library', True)),
 

Modified: trunk/blender/extern/CMakeLists.txt
===================================================================
--- trunk/blender/extern/CMakeLists.txt	2012-01-16 16:23:25 UTC (rev 43427)
+++ trunk/blender/extern/CMakeLists.txt	2012-01-16 16:46:00 UTC (rev 43428)
@@ -67,3 +67,7 @@
 if(WITH_LIBMV)
 	add_subdirectory(libmv)
 endif()
+
+if(WITH_CARVE)
+	add_subdirectory(carve)
+endif()

Modified: trunk/blender/extern/SConscript
===================================================================
--- trunk/blender/extern/SConscript	2012-01-16 16:23:25 UTC (rev 43427)
+++ trunk/blender/extern/SConscript	2012-01-16 16:46:00 UTC (rev 43428)
@@ -31,3 +31,6 @@
 
 if env['WITH_BF_LIBMV']:
     SConscript(['libmv/SConscript'])
+
+if env['WITH_BF_CARVE']:
+    SConscript(['carve/SConscript'])

Added: trunk/blender/extern/carve/CMakeLists.txt
===================================================================
--- trunk/blender/extern/carve/CMakeLists.txt	                        (rev 0)
+++ trunk/blender/extern/carve/CMakeLists.txt	2012-01-16 16:46:00 UTC (rev 43428)
@@ -0,0 +1,166 @@
+# ***** 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2006, Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): Jacques Beaurai, Erwin Coumans
+#
+# ***** END GPL LICENSE BLOCK *****
+
+# NOTE: This file is automatically generated by bundle.sh script
+#       If you're doing changes in this file, please update template
+#       in that script too
+
+set(INC
+	include
+)
+
+set(INC_SYS
+)
+
+set(SRC
+	lib/carve.cpp
+	lib/mesh.cpp
+	lib/intersect_group.cpp
+	lib/intersect_classify_edge.cpp
+	lib/intersect_classify_group.cpp
+	lib/polyhedron.cpp
+	lib/geom3d.cpp
+	lib/polyline.cpp
+	lib/csg_collector.cpp
+	lib/triangulator.cpp
+	lib/intersect_face_division.cpp
+	lib/intersect_half_classify_group.cpp
+	lib/edge.cpp
+	lib/math.cpp
+	lib/geom2d.cpp
+	lib/tag.cpp
+	lib/intersection.cpp
+	lib/convex_hull.cpp
+	lib/csg.cpp
+	lib/intersect.cpp
+	lib/face.cpp
+	lib/pointset.cpp
+	lib/timing.cpp
+	lib/octree.cpp
+	lib/aabb.cpp
+	lib/intersect_debug.cpp
+
+	lib/intersect_classify_common.hpp
+	lib/csg_data.hpp
+	lib/csg_collector.hpp
+	lib/intersect_common.hpp
+	lib/intersect_classify_common_impl.hpp
+	lib/csg_detail.hpp
+	lib/intersect_debug.hpp
+
+	include/carve/polyhedron_decl.hpp
+	include/carve/geom2d.hpp
+	include/carve/exact.hpp
+	include/carve/triangulator_impl.hpp
+	include/carve/collection.hpp
+	include/carve/pointset.hpp
+	include/carve/djset.hpp
+	include/carve/kd_node.hpp
+	include/carve/polyline.hpp
+	include/carve/polyline_iter.hpp
+	include/carve/geom3d.hpp
+	include/carve/edge_decl.hpp
+	include/carve/face_decl.hpp
+	include/carve/aabb_impl.hpp
+	include/carve/colour.hpp
+	include/carve/pointset_iter.hpp
+	include/carve/polyline_decl.hpp
+	include/carve/rescale.hpp
+	include/carve/mesh_impl.hpp
+	include/carve/classification.hpp
+	include/carve/util.hpp
+	include/carve/triangulator.hpp
+	include/carve/polyhedron_base.hpp
+	include/carve/rtree.hpp
+	include/carve/math.hpp
+	include/carve/math_constants.hpp
+	include/carve/octree_decl.hpp
+	include/carve/input.hpp
+	include/carve/mesh_ops.hpp
+	include/carve/debug_hooks.hpp
+	include/carve/mesh_simplify.hpp
+	include/carve/interpolator.hpp
+	include/carve/poly_decl.hpp
+	include/carve/csg.hpp
+	include/carve/mesh.hpp
+	include/carve/carve.hpp
+	include/carve/gnu_cxx.h
+	include/carve/polyhedron_impl.hpp
+	include/carve/poly_impl.hpp
+	include/carve/aabb.hpp
+	include/carve/convex_hull.hpp
+	include/carve/vertex_decl.hpp
+	include/carve/win32.h
+	include/carve/edge_impl.hpp
+	include/carve/tag.hpp
+	include/carve/tree.hpp
+	include/carve/heap.hpp
+	include/carve/matrix.hpp
+	include/carve/poly.hpp
+	include/carve/vector.hpp
+	include/carve/intersection.hpp
+	include/carve/faceloop.hpp
+	include/carve/geom_impl.hpp
+	include/carve/octree_impl.hpp
+	include/carve/spacetree.hpp
+	include/carve/collection/unordered/std_impl.hpp
+	include/carve/collection/unordered/tr1_impl.hpp
+	include/carve/collection/unordered/libstdcpp_impl.hpp
+	include/carve/collection/unordered/boost_impl.hpp
+	include/carve/collection/unordered/vcpp_impl.hpp
+	include/carve/collection/unordered/fallback_impl.hpp
+	include/carve/collection/unordered.hpp
+	include/carve/face_impl.hpp
+	include/carve/pointset_impl.hpp
+	include/carve/cbrt.h
+	include/carve/vcpp_config.h
+	include/carve/geom.hpp
+	include/carve/vertex_impl.hpp
+	include/carve/polyline_impl.hpp
+	include/carve/pointset_decl.hpp
+	include/carve/timing.hpp
+	include/carve/csg_triangulator.hpp
+	include/carve/iobj.hpp
+	include/carve/collection_types.hpp
+)
+
+if(WITH_BOOST)
+	if(NOT MSVC)
+		# Boost is setting as preferred collections library in the Carve code when using MSVC compiler
+		add_definitions(
+			-DHAVE_BOOST_UNORDERED_COLLECTIONS
+		)
+	endif()
+
+	add_definitions(
+		-DCARVE_SYSTEM_BOOST
+	)
+
+	list(APPEND INC
+		${BOOST_INCLUDE_DIR}
+	)
+endif()
+
+blender_add_lib(extern_carve "${SRC}" "${INC}" "${INC_SYS}")

Added: trunk/blender/extern/carve/LICENSE.GPL2
===================================================================
--- trunk/blender/extern/carve/LICENSE.GPL2	                        (rev 0)
+++ trunk/blender/extern/carve/LICENSE.GPL2	2012-01-16 16:46:00 UTC (rev 43428)
@@ -0,0 +1,361 @@
+                    GNU GENERAL PUBLIC LICENSE
+
+ The Qt GUI Toolkit is Copyright (C) 1994-2008 Trolltech ASA.
+
+ You may use, distribute and copy the Qt GUI Toolkit under the terms of
+ GNU General Public License version 2, which is displayed below.
+
+-------------------------------------------------------------------------
+
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-blender-cvs mailing list