From 77685023caaee092a4c1ed4a3da13ff67861a962 Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Tue, 29 Jan 2008 21:01:12 +0000 Subject: Initial commit of cloth modifier from branch rev 13453 --- intern/elbeem/CMakeLists.txt | 4 +++ intern/elbeem/SConscript | 6 +++- intern/elbeem/intern/isosurface.cpp | 56 ++++++++++++++++++++++++++----------- 3 files changed, 48 insertions(+), 18 deletions(-) (limited to 'intern/elbeem') diff --git a/intern/elbeem/CMakeLists.txt b/intern/elbeem/CMakeLists.txt index 86a60180b05..ac35b8ce00f 100644 --- a/intern/elbeem/CMakeLists.txt +++ b/intern/elbeem/CMakeLists.txt @@ -36,5 +36,9 @@ IF(WINDOWS) ADD_DEFINITIONS(-DUSE_MSVC6FIXES) ENDIF(WINDOWS) +IF(WITH_OPENMP) + ADD_DEFINITIONS(-DPARALLEL) +ENDIF(WITH_OPENMP) + BLENDERLIB_NOLIST(bf_elbeem "${SRC}" "${INC}") #, libtype='blender', priority=0 ) diff --git a/intern/elbeem/SConscript b/intern/elbeem/SConscript index bb6637ba32d..bdcb0507987 100644 --- a/intern/elbeem/SConscript +++ b/intern/elbeem/SConscript @@ -5,7 +5,11 @@ Import('env') sources = env.Glob('intern/*.cpp') -defs = 'NOGUI ELBEEM_BLENDER=1' +defs = ' NOGUI ELBEEM_BLENDER=1' + +if env['WITH_BF_OPENMP'] == 1: + defs += ' PARALLEL' + if env['OURPLATFORM']=='win32-vc': defs += ' USE_MSVC6FIXES' incs = env['BF_PNG_INC'] + ' ' + env['BF_ZLIB_INC'] + ' ' +env['BF_SDL_INC'] diff --git a/intern/elbeem/intern/isosurface.cpp b/intern/elbeem/intern/isosurface.cpp index 1b0ba13c707..f90621f3b73 100644 --- a/intern/elbeem/intern/isosurface.cpp +++ b/intern/elbeem/intern/isosurface.cpp @@ -22,6 +22,10 @@ #define round(x) (x) #endif +#if PARALLEL==1 +#include +#endif + /****************************************************************************** * Constructor *****************************************************************************/ @@ -160,13 +164,6 @@ void IsoSurface::triangulate( void ) mpEdgeVerticesZ[i] = -1; } - ntlVec3Gfx pos[8]; - float value[8]; - int cubeIndex; // index entry of the cube - int triIndices[12]; // vertex indices - int *eVert[12]; - IsoLevelVertex ilv; - // edges between which points? const int mcEdges[24] = { 0,1, 1,2, 2,3, 3,0, @@ -193,7 +190,12 @@ void IsoSurface::triangulate( void ) px = mStart[0]-gsx*0.5; for(int i=1;i<(mSizex-2);i++) { px += gsx; - + int cubeIndex; // index entry of the cube + float value[8]; + int triIndices[12]; // vertex indices + int *eVert[12]; + IsoLevelVertex ilv; + value[0] = *getData(i ,j ,k ); value[1] = *getData(i+1,j ,k ); value[2] = *getData(i+1,j+1,k ); @@ -239,6 +241,7 @@ void IsoSurface::triangulate( void ) eVert[11] = &mpEdgeVerticesZ[ ISOLEVEL_INDEX( i+0, j+1, edgek+0) ]; // grid positions + ntlVec3Gfx pos[8]; pos[0] = ntlVec3Gfx(px ,py ,pz); pos[1] = ntlVec3Gfx(px+gsx,py ,pz); pos[2] = ntlVec3Gfx(px+gsx,py+gsy,pz); @@ -344,10 +347,7 @@ void IsoSurface::triangulate( void ) if(mUseFullEdgeArrays) { errMsg("IsoSurface::triangulate","Disabling mUseFullEdgeArrays!"); } - - // subdiv local arrays - gfxReal orgval[8]; - gfxReal subdAr[2][11][11]; // max 10 subdivs! + ParticleObject* *arppnt = new ParticleObject*[mSizez*mSizey*mSizex]; // construct pointers @@ -408,13 +408,25 @@ void IsoSurface::triangulate( void ) debMsgStd("IsoSurface::triangulate",DM_MSG,"Starting. Parts in use:"<