diff options
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | SConstruct | 1 | ||||
-rw-r--r-- | build_files/cmake/config/blender_lite.cmake | 1 | ||||
-rw-r--r-- | intern/CMakeLists.txt | 5 | ||||
-rw-r--r-- | source/blender/bmesh/CMakeLists.txt | 8 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_smooth_laplacian.c | 16 | ||||
-rw-r--r-- | source/blender/editors/armature/CMakeLists.txt | 8 | ||||
-rw-r--r-- | source/blender/editors/armature/armature_skinning.c | 6 | ||||
-rw-r--r-- | source/blender/editors/armature/meshlaplacian.c | 15 | ||||
-rw-r--r-- | source/blender/editors/uvedit/CMakeLists.txt | 8 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_parametrizer.c | 39 | ||||
-rw-r--r-- | source/blender/modifiers/CMakeLists.txt | 8 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_laplaciandeform.c | 16 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_laplaciansmooth.c | 102 | ||||
-rw-r--r-- | source/creator/CMakeLists.txt | 5 |
15 files changed, 181 insertions, 61 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a7f6b879555..4cd4dee2a9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -254,6 +254,7 @@ option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" 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) +option(WITH_OPENNL "Enable use of Open Numerical Library" ON) if(UNIX AND NOT APPLE) option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON) option(WITH_STATIC_LIBS "Try to link with static libraries, as much as possible, to make blender more portable across distributions" OFF) @@ -2306,6 +2307,9 @@ if(FIRST_RUN) info_cfg_option(WITH_MOD_FLUID) info_cfg_option(WITH_MOD_OCEANSIM) + info_cfg_text("Other:") + info_cfg_option(WITH_OPENNL) + # debug message(STATUS "HAVE_STDBOOL_H = ${HAVE_STDBOOL_H}") diff --git a/SConstruct b/SConstruct index 8c27424f617..edf9cda6cd4 100644 --- a/SConstruct +++ b/SConstruct @@ -487,6 +487,7 @@ else: # TODO, make optional (as with CMake) env['CPPFLAGS'].append('-DWITH_AUDASPACE') env['CPPFLAGS'].append('-DWITH_AVI') +env['CPPFLAGS'].append('-DWITH_OPENNL') env['CPPFLAGS'].append('-DWITH_BOOL_COMPAT') if env['OURPLATFORM'] in ('win32-vc', 'win64-vc') and env['MSVC_VERSION'] == '11.0': env['CPPFLAGS'].append('-D_ALLOW_KEYWORD_MACROS') diff --git a/build_files/cmake/config/blender_lite.cmake b/build_files/cmake/config/blender_lite.cmake index e9ff31fc6c5..ca9aadd649c 100644 --- a/build_files/cmake/config/blender_lite.cmake +++ b/build_files/cmake/config/blender_lite.cmake @@ -45,6 +45,7 @@ set(WITH_OPENAL OFF CACHE BOOL "" FORCE) set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE) set(WITH_OPENCOLORIO OFF CACHE BOOL "" FORCE) set(WITH_OPENMP OFF CACHE BOOL "" FORCE) +set(WITH_OPENNL OFF CACHE BOOL "" FORCE) set(WITH_PYTHON_INSTALL OFF CACHE BOOL "" FORCE) set(WITH_RAYOPTIMIZATION OFF CACHE BOOL "" FORCE) set(WITH_SDL OFF CACHE BOOL "" FORCE) diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt index c45e66cd77b..b7aff03a710 100644 --- a/intern/CMakeLists.txt +++ b/intern/CMakeLists.txt @@ -29,7 +29,6 @@ add_subdirectory(ghost) add_subdirectory(guardedalloc) add_subdirectory(memutil) add_subdirectory(opencolorio) -add_subdirectory(opennl) add_subdirectory(mikktspace) add_subdirectory(raskter) @@ -81,6 +80,10 @@ if(WITH_COMPOSITOR) add_subdirectory(opencl) endif() +if(WITH_OPENNL) + add_subdirectory(opennl) +endif() + # only windows needs utf16 converter if(WIN32) add_subdirectory(utfconv) diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt index b80a10b43fe..afb8b07b1a6 100644 --- a/source/blender/bmesh/CMakeLists.txt +++ b/source/blender/bmesh/CMakeLists.txt @@ -31,7 +31,6 @@ set(INC ../makesdna ../../../intern/guardedalloc ../../../extern/rangetree - ../../../intern/opennl/extern ) set(INC_SYS @@ -160,6 +159,13 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +if(WITH_OPENNL) + add_definitions(-DWITH_OPENNL) + list(APPEND INC_SYS + ../../../intern/opennl/extern + ) +endif() + if(WITH_FREESTYLE) add_definitions(-DWITH_FREESTYLE) endif() diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c index 3f04e23aa73..16e70e8c155 100644 --- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c +++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c @@ -34,10 +34,12 @@ #include "bmesh.h" -#include "ONL_opennl.h" - #include "intern/bmesh_operators_private.h" /* own include */ +#ifdef WITH_OPENNL + +#include "ONL_opennl.h" + // #define SMOOTH_LAPLACIAN_AREA_FACTOR 4.0f /* UNUSED */ // #define SMOOTH_LAPLACIAN_EDGE_FACTOR 2.0f /* UNUSED */ #define SMOOTH_LAPLACIAN_MAX_EDGE_PERCENTAGE 1.8f @@ -572,3 +574,13 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op) delete_laplacian_system(sys); } + +#else /* WITH_OPENNL */ + +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op) {} + +#endif /* WITH_OPENNL */ diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt index 1a0841f5342..ca2dc1b66e2 100644 --- a/source/blender/editors/armature/CMakeLists.txt +++ b/source/blender/editors/armature/CMakeLists.txt @@ -27,7 +27,6 @@ set(INC ../../makesrna ../../windowmanager ../../../../intern/guardedalloc - ../../../../intern/opennl/extern ) set(INC_SYS @@ -67,4 +66,11 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +if(WITH_OPENNL) + add_definitions(-DWITH_OPENNL) + list(APPEND INC_SYS + ../../../../intern/opennl/extern + ) +endif() + blender_add_lib(bf_editor_armature "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c index 5f15d15d478..7ec0acf12d1 100644 --- a/source/blender/editors/armature/armature_skinning.c +++ b/source/blender/editors/armature/armature_skinning.c @@ -386,9 +386,13 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, /* compute the weights based on gathered vertices and bones */ if (heat) { const char *error = NULL; + +#ifdef WITH_OPENNL heat_bone_weighting(ob, mesh, verts, numbones, dgrouplist, dgroupflip, root, tip, selected, &error); - +#else + error = "Built without OpenNL"; +#endif if (error) { BKE_report(reports, RPT_WARNING, error); } diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 16d7f9c9420..3b285e12331 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -46,13 +46,14 @@ #include "BLI_polardecomp.h" #endif -#include "ONL_opennl.h" - #include "ED_mesh.h" #include "ED_armature.h" #include "meshlaplacian.h" +#ifdef WITH_OPENNL + +#include "ONL_opennl.h" /* ************* XXX *************** */ static void waitcursor(int UNUSED(val)) {} @@ -2006,3 +2007,13 @@ void mesh_deform_bind(Scene *scene, MeshDeformModifierData *mmd, float *vertexco waitcursor(0); } +#else /* WITH_OPENNL */ + +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +void mesh_deform_bind(Scene *scene, MeshDeformModifierData *mmd, float *vertexcos, int totvert, float cagemat[4][4]) {} +void *modifier_mdef_compact_influences_link_kludge = modifier_mdef_compact_influences; + +#endif /* WITH_OPENNL */ diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt index 62d4b01cab7..45edbde7482 100644 --- a/source/blender/editors/uvedit/CMakeLists.txt +++ b/source/blender/editors/uvedit/CMakeLists.txt @@ -28,7 +28,6 @@ set(INC ../../makesrna ../../windowmanager ../../../../intern/guardedalloc - ../../../../intern/opennl/extern ) set(INC_SYS @@ -51,4 +50,11 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +if(WITH_OPENNL) + add_definitions(-DWITH_OPENNL) + list(APPEND INC_SYS + ../../../../intern/opennl/extern + ) +endif() + blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 2d33a2d3937..e5c3510db4b 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -35,8 +35,6 @@ #include "BLI_boxpack2d.h" #include "BLI_convexhull2d.h" -#include "ONL_opennl.h" - #include "uvedit_intern.h" #include "uvedit_parametrizer.h" @@ -47,6 +45,10 @@ #include "BLI_sys_types.h" /* for intptr_t support */ +#ifdef WITH_OPENNL + +#include "ONL_opennl.h" + /* Utils */ #if 0 @@ -4715,3 +4717,36 @@ void param_flush_restore(ParamHandle *handle) } } +#else /* WITH_OPENNL */ + +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +/* stubs */ +void param_face_add(ParamHandle *handle, ParamKey key, int nverts, + ParamKey *vkeys, float **co, float **uv, + ParamBool *pin, ParamBool *select, float normal[3]) {} +void param_edge_set_seam(ParamHandle *handle, + ParamKey *vkeys) {} +void param_aspect_ratio(ParamHandle *handle, float aspx, float aspy) {} +ParamHandle *param_construct_begin(void) { return NULL; } +void param_construct_end(ParamHandle *handle, ParamBool fill, ParamBool impl) {} +void param_delete(ParamHandle *handle) {} + +void param_stretch_begin(ParamHandle *handle) {} +void param_stretch_blend(ParamHandle *handle, float blend) {} +void param_stretch_iter(ParamHandle *handle) {} +void param_stretch_end(ParamHandle *handle) {} + +void param_pack(ParamHandle *handle, float margin, bool do_rotate) {} +void param_average(ParamHandle *handle) {} + +void param_flush(ParamHandle *handle) {} +void param_flush_restore(ParamHandle *handle) {} + +void param_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf) {} +void param_lscm_solve(ParamHandle *handle) {} +void param_lscm_end(ParamHandle *handle) {} + +#endif /* WITH_OPENNL */ diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 450501c9db5..4eb15c0fbdb 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -36,7 +36,6 @@ set(INC ../render/extern/include ../../../intern/elbeem/extern ../../../intern/guardedalloc - ../../../intern/opennl/extern ) set(INC_SYS @@ -146,4 +145,11 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +if(WITH_OPENNL) + add_definitions(-DWITH_OPENNL) + list(APPEND INC_SYS + ../../../intern/opennl/extern + ) +endif() + blender_add_lib(bf_modifiers "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c index 3b909a4b209..a8a6f1a1cb9 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.c +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c @@ -41,7 +41,6 @@ #include "MOD_util.h" -#include "ONL_opennl.h" enum { LAPDEFORM_SYSTEM_NOT_CHANGE = 0, @@ -54,6 +53,10 @@ enum { LAPDEFORM_SYSTEM_CHANGE_NOT_VALID_GROUP, }; +#ifdef WITH_OPENNL + +#include "ONL_opennl.h" + typedef struct LaplacianSystem { bool is_matrix_computed; bool has_solution; @@ -766,6 +769,14 @@ static void LaplacianDeformModifier_do( } } +#else /* WITH_OPENNL */ +static void LaplacianDeformModifier_do( + LaplacianDeformModifierData *lmd, Object *ob, DerivedMesh *dm, + float (*vertexCos)[3], int numVerts) +{ + (void)lmd, (void)ob, (void)dm, (void)vertexCos, (void)numVerts; +} +#endif /* WITH_OPENNL */ static void initData(ModifierData *md) { @@ -831,11 +842,12 @@ static void deformVertsEM( static void freeData(ModifierData *md) { LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md; +#ifdef WITH_OPENNL LaplacianSystem *sys = (LaplacianSystem *)lmd->cache_system; - if (sys) { deleteLaplacianSystem(sys); } +#endif MEM_SAFE_FREE(lmd->vertexco); lmd->total_verts = 0; } diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c index 3843ee6f535..f97818a02d4 100644 --- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c +++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c @@ -50,6 +50,8 @@ #include "MOD_modifiertypes.h" #include "MOD_util.h" +#ifdef WITH_OPENNL + #include "ONL_opennl.h" #if 0 @@ -195,52 +197,6 @@ static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numFaces, in return sys; } -static void init_data(ModifierData *md) -{ - LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md; - smd->lambda = 0.01f; - smd->lambda_border = 0.01f; - smd->repeat = 1; - smd->flag = MOD_LAPLACIANSMOOTH_X | MOD_LAPLACIANSMOOTH_Y | MOD_LAPLACIANSMOOTH_Z | MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME | MOD_LAPLACIANSMOOTH_NORMALIZED; - smd->defgrp_name[0] = '\0'; -} - -static void copy_data(ModifierData *md, ModifierData *target) -{ - LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md; - LaplacianSmoothModifierData *tsmd = (LaplacianSmoothModifierData *) target; - - tsmd->lambda = smd->lambda; - tsmd->lambda_border = smd->lambda_border; - tsmd->repeat = smd->repeat; - tsmd->flag = smd->flag; - BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, sizeof(tsmd->defgrp_name)); -} - -static bool is_disabled(ModifierData *md, int UNUSED(useRenderParams)) -{ - LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md; - short flag; - - flag = smd->flag & (MOD_LAPLACIANSMOOTH_X | MOD_LAPLACIANSMOOTH_Y | MOD_LAPLACIANSMOOTH_Z); - - /* disable if modifier is off for X, Y and Z or if factor is 0 */ - if (flag == 0) return 1; - - return 0; -} - -static CustomDataMask required_data_mask(Object *UNUSED(ob), ModifierData *md) -{ - LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *)md; - CustomDataMask dataMask = 0; - - /* ask for vertexgroups if we need them */ - if (smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; - - return dataMask; -} - static float average_area_quad_v3(float *v1, float *v2, float *v3, float *v4) { float areaq; @@ -663,7 +619,61 @@ static void laplaciansmoothModifier_do( nlDeleteContext(sys->context); sys->context = NULL; delete_laplacian_system(sys); +} + +#else /* WITH_OPENNL */ +static void laplaciansmoothModifier_do( + LaplacianSmoothModifierData *smd, Object *ob, DerivedMesh *dm, + float (*vertexCos)[3], int numVerts) +{ + (void)smd, (void)ob, (void)dm, (void)vertexCos, (void)numVerts; +} +#endif /* WITH_OPENNL */ +static void init_data(ModifierData *md) +{ + LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md; + smd->lambda = 0.01f; + smd->lambda_border = 0.01f; + smd->repeat = 1; + smd->flag = MOD_LAPLACIANSMOOTH_X | MOD_LAPLACIANSMOOTH_Y | MOD_LAPLACIANSMOOTH_Z | MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME | MOD_LAPLACIANSMOOTH_NORMALIZED; + smd->defgrp_name[0] = '\0'; +} + +static void copy_data(ModifierData *md, ModifierData *target) +{ + LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md; + LaplacianSmoothModifierData *tsmd = (LaplacianSmoothModifierData *) target; + + tsmd->lambda = smd->lambda; + tsmd->lambda_border = smd->lambda_border; + tsmd->repeat = smd->repeat; + tsmd->flag = smd->flag; + BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, sizeof(tsmd->defgrp_name)); +} + +static bool is_disabled(ModifierData *md, int UNUSED(useRenderParams)) +{ + LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md; + short flag; + + flag = smd->flag & (MOD_LAPLACIANSMOOTH_X | MOD_LAPLACIANSMOOTH_Y | MOD_LAPLACIANSMOOTH_Z); + + /* disable if modifier is off for X, Y and Z or if factor is 0 */ + if (flag == 0) return 1; + + return 0; +} + +static CustomDataMask required_data_mask(Object *UNUSED(ob), ModifierData *md) +{ + LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *)md; + CustomDataMask dataMask = 0; + + /* ask for vertexgroups if we need them */ + if (smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; + + return dataMask; } static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index cb745d46fa4..2a355bd5606 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -932,7 +932,6 @@ endif() bf_editor_io bf_render - bf_intern_opennl bf_python bf_python_ext bf_python_mathutils @@ -1061,6 +1060,10 @@ endif() list(APPEND BLENDER_SORTED_LIBS bf_intern_locale) endif() + if(WITH_OPENNL) + list_insert_after(BLENDER_SORTED_LIBS "bf_render" "bf_intern_opennl") + endif() + if(WITH_BULLET) list_insert_after(BLENDER_SORTED_LIBS "bf_blenkernel" "bf_intern_rigidbody") endif() |