[Bf-blender-cvs] [23aabf5] fracture_modifier: Merge remote-tracking branch 'refs/remotes/origin/blender-v2.78-release' into fracture_modifier
Martin Felke
noreply at git.blender.org
Wed Sep 28 00:03:45 CEST 2016
Commit: 23aabf5c81626e374fe100559c24e66fd26e7072
Author: Martin Felke
Date: Tue Sep 27 21:46:27 2016 +0200
Branches: fracture_modifier
https://developer.blender.org/rB23aabf5c81626e374fe100559c24e66fd26e7072
Merge remote-tracking branch 'refs/remotes/origin/blender-v2.78-release' into fracture_modifier
Conflicts:
CMakeLists.txt
build_files/build_environment/install_deps.sh
build_files/cmake/macros.cmake
doc/python_api/sphinx_doc_gen.sh
intern/cycles/app/CMakeLists.txt
intern/cycles/blender/addon/properties.py
intern/cycles/blender/blender_sync.cpp
intern/cycles/kernel/bvh/bvh.h
intern/cycles/kernel/geom/geom_bvh_volume.h
intern/cycles/kernel/geom/geom_bvh_volume_all.h
intern/cycles/kernel/kernel_volume.h
intern/cycles/kernel/kernels/opencl/kernel.cl
intern/cycles/kernel/shaders/node_subsurface_scattering.osl
intern/cycles/kernel/svm/svm_closure.h
intern/cycles/util/util_vector.h
release/datafiles/splash.png
release/datafiles/splash_2x.png
release/scripts/addons
source/blender/blenfont/intern/blf_font.c
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_mesh_mapping.h
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/particle_distribute.c
source/blender/blenkernel/intern/rigidbody.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/speaker.c
source/blender/blenloader/intern/readfile.c
source/blender/bmesh/intern/bmesh_core.c
source/blender/bmesh/intern/bmesh_polygon.c
source/blender/editors/gpencil/gpencil_brush.c
source/blender/editors/gpencil/gpencil_ops.c
source/blender/editors/object/object_relations.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/drawvolume.c
source/blender/editors/transform/transform_snap.c
source/blender/gpu/shaders/gpu_shader_material.glsl
source/blender/makesdna/DNA_modifier_types.h
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/intern/rna_camera.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_sculpt_paint.c
source/blender/modifiers/MOD_modifiertypes.h
source/blender/modifiers/intern/MOD_util.c
source/blender/nodes/shader/nodes/node_shader_bump.c
source/blender/nodes/shader/nodes/node_shader_fresnel.c
source/blender/nodes/shader/nodes/node_shader_normal_map.c
source/blender/render/intern/source/render_result.c
source/blender/render/intern/source/render_texture.c
source/blender/windowmanager/WM_api.h
source/creator/CMakeLists.txt
===================================================================
===================================================================
diff --cc CMakeLists.txt
index 066ee1e,e061fab..ff0a19b
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -226,9 -234,13 +234,14 @@@ option(WITH_BULLET "Enable Bulle
option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" )
mark_as_advanced(WITH_SYSTEM_BULLET)
option(WITH_GAMEENGINE "Enable Game Engine" ${_init_GAMEENGINE})
+ if(APPLE)
+ set(WITH_GAMEENGINE_DECKLINK OFF)
+ else()
+ option(WITH_GAMEENGINE_DECKLINK "Support BlackMagicDesign DeckLink cards in the Game Engine" ON)
+ endif()
option(WITH_PLAYER "Build Player" OFF)
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
+option(WITH_VORO "Enable Voronoi Fracture based on Voro++" ON)
# Compositor
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
@@@ -3036,8 -1714,8 +1715,9 @@@ if(FIRST_RUN
info_cfg_option(WITH_CYCLES)
info_cfg_option(WITH_FREESTYLE)
info_cfg_option(WITH_OPENCOLORIO)
+ info_cfg_option(WITH_VORO)
info_cfg_option(WITH_OPENVDB)
+ info_cfg_option(WITH_ALEMBIC)
info_cfg_text("Compiler Options:")
info_cfg_option(WITH_BUILDINFO)
diff --cc build_files/cmake/macros.cmake
index 25a93fe,5a67ac9..900a9c7
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@@ -691,11 -737,15 +737,19 @@@ function(SETUP_BLENDER_SORTED_LIBS
list_insert_after(BLENDER_SORTED_LIBS "ge_logic_ngnetwork" "extern_bullet")
endif()
+ if(WITH_GAMEENGINE_DECKLINK)
+ list(APPEND BLENDER_SORTED_LIBS bf_intern_decklink)
+ endif()
+
+ if(WIN32)
+ list(APPEND BLENDER_SORTED_LIBS bf_intern_gpudirect)
+ endif()
+
+ if(WITH_VORO)
+ list(APPEND BLENDER_SORTED_LIBS extern_voro)
+ endif()
+
- if(WITH_OPENSUBDIV)
+ if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
list(APPEND BLENDER_SORTED_LIBS bf_intern_opensubdiv)
endif()
diff --cc source/blender/blenkernel/CMakeLists.txt
index 2529b67,157c440..248bb6f
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@@ -495,14 -502,13 +505,21 @@@ if(WITH_FREESTYLE
add_definitions(-DWITH_FREESTYLE)
endif()
+if(WITH_VORO)
+ add_definitions(-DWITH_VORO)
+ list(APPEND INC
+ ../../../extern/voro++
+ ../../../extern/carve
+ )
+endif()
+
+ if(WITH_ALEMBIC)
+ list(APPEND INC
+ ../alembic
+ )
+ add_definitions(-DWITH_ALEMBIC)
+ endif()
+
if(WITH_OPENSUBDIV)
add_definitions(-DWITH_OPENSUBDIV)
list(APPEND INC_SYS
diff --cc source/blender/blenkernel/intern/fracture.c
index 0cceed8,0000000..595b486
mode 100644,000000..100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@@ -1,3091 -1,0 +1,3091 @@@
+/*
+ * ***** 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) Blender Foundation
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Martin Felke
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenkernel/intern/fracture.c
+ * \ingroup blenkernel
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "BKE_cdderivedmesh.h"
+#include "BKE_customdata.h"
+#include "BKE_deform.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_fracture.h"
+#include "BKE_fracture_util.h"
+#include "BKE_global.h"
+#include "BKE_material.h"
+#include "BKE_mesh.h"
+#include "BKE_modifier.h"
+#include "BKE_object.h"
+#include "BKE_pointcache.h"
+#include "BKE_rigidbody.h"
+
+#include "BLI_kdtree.h"
+#include "BLI_listbase.h"
+#include "BLI_math_vector.h"
+#include "BLI_mempool.h"
+#include "BLI_path_util.h"
+#include "BLI_rand.h"
+#include "BLI_string.h"
+#include "BLI_sort.h"
+#include "BLI_task.h"
+#include "BLI_utildefines.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_fracture_types.h"
+#include "DNA_gpencil_types.h"
+#include "DNA_group_types.h"
+#include "DNA_material_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_rigidbody_types.h"
+
+#include "bmesh.h"
+
+#include "RBI_api.h"
+//#include "GPU_glew.h" /* uaahh, direct access to modelview matrix */
+
+/* debug timing */
+#define USE_DEBUG_TIMER
+
+#ifdef USE_DEBUG_TIMER
+#include "PIL_time.h"
+#endif
+
+#ifdef WITH_VORO
+#include "../../../../extern/voro++/src/c_interface.hh"
+#endif
+
+/* prototypes */
+static void add_shard(FracMesh *fm, Shard *s, float mat[4][4]);
+static Shard *parse_cell(cell c);
+static void parse_cell_verts(cell c, MVert *mvert, int totvert);
+static void parse_cell_polys(cell c, MPoly *mpoly, int totpoly, int *r_totloop);
+static void parse_cell_loops(cell c, MLoop *mloop, int totloop, MPoly *mpoly, int totpoly);
+static void parse_cell_neighbors(cell c, int *neighbors, int totpoly);
+
+static void add_shard(FracMesh *fm, Shard *s, float mat[4][4])
+{
+ MVert *mv;
+ int i = 0;
+
+ for (i = 0, mv = s->mvert; i < s->totvert; i++, mv++ )
+ {
+ mul_m4_v3(mat, mv->co);
+ }
+
+ mul_m4_v3(mat, s->centroid);
+
+ BLI_addtail(&fm->shard_map, s);
+ s->shard_id = fm->shard_count;
+ fm->shard_count++;
+}
+
+static BMesh *shard_to_bmesh(Shard *s)
+{
+ DerivedMesh *dm_parent;
+ BMesh *bm_parent;
+ BMIter iter;
+ BMFace *f;
+
+ dm_parent = BKE_shard_create_dm(s, true);
+ bm_parent = DM_to_bmesh(dm_parent, true);
+ BM_mesh_elem_table_ensure(bm_parent, BM_VERT | BM_FACE);
+
+ BM_ITER_MESH (f, &iter, bm_parent, BM_FACES_OF_MESH)
+ {
+ BM_elem_flag_disable(f, BM_ELEM_SELECT);
+ }
+
+ dm_parent->needsFree = 1;
+ dm_parent->release(dm_parent);
+ dm_parent = NULL;
+
+ return bm_parent;
+}
+
+static void shard_boundbox(Shard *s, float r_loc[3], float r_size[3])
+{
+ float min[3], max[3];
+ float mloc[3], msize[3];
+
+ if (!r_loc) r_loc = mloc;
+ if (!r_size) r_size = msize;
+
+ if (!BKE_shard_calc_minmax(s)) {
+ min[0] = min[1] = min[2] = -1.0f;
+ max[0] = max[1] = max[2] = 1.0f;
+ }
+
+ copy_v3_v3(max, s->max);
+ copy_v3_v3(min, s->min);
+
+ mid_v3_v3v3(r_loc, min, max);
+
+ r_size[0] = (max[0] - min[0]) / 2.0f;
+ r_size[1] = (max[1] - min[1]) / 2.0f;
+ r_size[2] = (max[2] - min[2]) / 2.0f;
+}
+
+static int shard_sortdist(const void *s1, const void *s2, void* context)
+{
+ Shard **sh1 = (Shard **)s1;
+ Shard **sh2 = (Shard **)s2;
+ cell *sh = (cell*)context;
+
+ float val_a, val_b;
+
+ if ((*sh1 == NULL) || (*sh2 == NULL)) {
+ return -1;
+ }
+
+ val_a = len_squared_v3v3(sh->centroid, (*sh1)->centroid);
+ val_b = len_squared_v3v3(sh->centroid, (*sh2)->centroid);
+
+ /* sort descending */
+ if (val_a < val_b) return -1;
+ else if (val_a > val_b) return 1;
+ return 0;
+}
+
+static int shard_sortsize(const void *s1, const void *s2, void* UNUSED(context))
+{
+ Shard **sh1 = (Shard **)s1;
+ Shard **sh2 = (Shard **)s2;
+
+ float size1[3], size2[3], loc[3];
+ float val_a, val_b;
+
+ if ((*sh1 == NULL) || (*sh2 == NULL)) {
+ return -1;
+ }
+
+ shard_boundbox(*sh1, loc, size1);
+ shard_boundbox(*sh2, loc, size2);
+
+ val_a = size1[0] * size1[1] * size1[2];
+ val_b = size2[0] * size2[1] * size2[2];
+
+ /* sort descending */
+ if (val_a < val_b) return 1;
+ else if (val_a > val_b) return -1;
+ return 0;
+}
+
+Shard *BKE_custom_data_to_shard(Shard *s, DerivedMesh *dm)
+{
+ CustomData_reset(&s->vertData);
+ CustomData_reset(&s->loopData);
+ CustomData_reset(&s->polyData);
+
+ CustomData_copy(&dm->vertData, &s->vertData, CD_MASK_MDEFORMVERT, CD_DUPLICATE, s->totvert);
+ CustomData_copy(&dm->loopData, &s->loopData, CD_MASK_MLOOPUV, CD_DUPLICATE, s->totloop);
+ CustomData_copy(&dm->polyData, &s->polyData, CD_MASK_MTEXPOLY, CD_DUPLICATE, s->totpoly);
+
+ return s;
+}
+
+/* modified from BKE_mesh_center_median */
+bool BKE_fracture_shard_center_median(Shard *shard, float cent[3])
+{
+ int i = shard->totvert;
+ MVert *mvert;
+ zero_v3(cent);
+ for (mvert = shard->mvert; i--; mvert++) {
+ add_v3_v3(cent, mvert->co);
+ }
+ /* otherwise we get NAN for 0 verts */
+ if (shard->totvert) {
+ mul_v3_fl(cent, 1.0f / (float)shard->totvert);
+ }
+
+ return (shard->totvert != 0);
+}
+
+/* modified from BKE_mesh_center_centroid */
+bool BKE_fracture_shard_center_centroid(Shard *shard, float cent[3])
+{
+ int i = shard->totpoly;
+ MPoly *mpoly;
+ float poly_area;
+ float total_area = 0.0f;
+ float poly_cent[3];
+
+ zero_v3(cent);
+
+ /* calculate a weighted average of polygon centroids */
+ for (mpoly = shard->mpoly; i--; mpoly++) {
+ BKE_mesh_calc_poly_center(mpoly, shard->mloop + mpoly->loopstart, shard->mvert, poly_cent);
+ poly_area = BKE_mesh_calc_poly_area(mpoly, shard->mloop + mpoly->loopstart, shard->mvert);
+ madd_v3_v3fl(cent, poly_cent, poly_area);
+ total_area += poly_area;
+ }
+ /* otherwise we get NAN for 0 polys */
+ if (shard->totpoly) {
+ mul_v3_fl(cent, 1.0f / total_area);
+ }
+
+ /* zero area faces cause this, fallback to median */
+ if (UNLIKELY(!is_finite_v3(cent))) {
+ return BKE_fracture_shard_center_median(shard, cent);
+ }
+ copy_v3_v3(shard->centroid, cent);
+
+ return (shard->totpoly != 0);
+}
+
+void BKE_shard_free(Shard *s, bool doCustomData)
+{
+ if (s->mvert) {
+ MEM_freeN(s->mvert);
+ }
+ if (s->mloop) {
+ MEM_freeN(s->mloop);
+ }
+ if (s->mpoly) {
+ MEM_freeN(s->mpoly);
+ }
+ if (s->neighbor_ids) {
+ MEM_freeN(s->neighbor_i
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list