diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-11-25 08:33:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-11-25 08:36:19 +0400 |
commit | 2b4c68b902b261127f7deabf922048c41be6fb55 (patch) | |
tree | 1c40311a6c8e13ea4754fc692283b11cafdb8bea /source/blender/modifiers/intern | |
parent | 295116ea6b3a81a6c7b84d8a9d21288108c5f19e (diff) |
CMake Build: option to compile without opennl/superlu.
Diffstat (limited to 'source/blender/modifiers/intern')
-rw-r--r-- | source/blender/modifiers/intern/MOD_laplaciandeform.c | 16 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_laplaciansmooth.c | 102 |
2 files changed, 70 insertions, 48 deletions
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, |