diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_subsurf.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 20 |
3 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index b8cedfb5708..0416e217168 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -248,6 +248,7 @@ struct DerivedMesh { DMGridAdjacency *(*getGridAdjacency)(DerivedMesh *dm); int *(*getGridOffset)(DerivedMesh *dm); DMFlagMat *(*getGridFlagMats)(DerivedMesh *dm); + unsigned int **(*getGridHidden)(DerivedMesh *dm); /* Iterate over each mapped vertex in the derived mesh, calling the diff --git a/source/blender/blenkernel/BKE_subsurf.h b/source/blender/blenkernel/BKE_subsurf.h index bc333f8fd66..4b80e2ec9df 100644 --- a/source/blender/blenkernel/BKE_subsurf.h +++ b/source/blender/blenkernel/BKE_subsurf.h @@ -102,6 +102,7 @@ typedef struct CCGDerivedMesh { int *gridOffset; struct CCGFace **gridFaces; struct DMFlagMat *gridFlagMats; + unsigned int **gridHidden; struct { struct MultiresModifierData *mmd; diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 401f678344b..ba7394c9e91 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -45,6 +45,7 @@ #include "DNA_scene_types.h" #include "BLI_utildefines.h" +#include "BLI_bitmap.h" #include "BLI_blenlib.h" #include "BLI_edgehash.h" #include "BLI_math.h" @@ -2357,6 +2358,14 @@ static void ccgDM_release(DerivedMesh *dm) if(ccgdm->gridAdjacency) MEM_freeN(ccgdm->gridAdjacency); if(ccgdm->gridOffset) MEM_freeN(ccgdm->gridOffset); if(ccgdm->gridFlagMats) MEM_freeN(ccgdm->gridFlagMats); + if(ccgdm->gridHidden) { + int i, numGrids = dm->getNumGrids(dm); + for(i = 0; i < numGrids; i++) { + if(ccgdm->gridHidden[i]) + MEM_freeN(ccgdm->gridHidden[i]); + } + MEM_freeN(ccgdm->gridHidden); + } if(ccgdm->freeSS) ccgSubSurf_free(ccgdm->ss); if(ccgdm->fmap) MEM_freeN(ccgdm->fmap); if(ccgdm->fmap_mem) MEM_freeN(ccgdm->fmap_mem); @@ -2663,6 +2672,8 @@ static void ccgdm_create_grids(DerivedMesh *dm) gridFaces = MEM_mallocN(sizeof(CCGFace*)*numGrids, "ccgdm.gridFaces"); gridFlagMats = MEM_mallocN(sizeof(DMFlagMat)*numGrids, "ccgdm.gridFlagMats"); + ccgdm->gridHidden = MEM_callocN(sizeof(BLI_bitmap)*numGrids, "ccgdm.gridHidden"); + for(gIndex = 0, index = 0; index < numFaces; index++) { CCGFace *f = ccgdm->faceMap[index].face; int numVerts = ccgSubSurf_getFaceNumVerts(f); @@ -2727,6 +2738,14 @@ static DMFlagMat *ccgDM_getGridFlagMats(DerivedMesh *dm) return ccgdm->gridFlagMats; } +static BLI_bitmap *ccgDM_getGridHidden(DerivedMesh *dm) +{ + CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm; + + ccgdm_create_grids(dm); + return ccgdm->gridHidden; +} + static ListBase *ccgDM_getPolyMap(Object *ob, DerivedMesh *dm) { CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm; @@ -2909,6 +2928,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, ccgdm->dm.getGridAdjacency = ccgDM_getGridAdjacency; ccgdm->dm.getGridOffset = ccgDM_getGridOffset; ccgdm->dm.getGridFlagMats = ccgDM_getGridFlagMats; + ccgdm->dm.getGridHidden = ccgDM_getGridHidden; ccgdm->dm.getPolyMap = ccgDM_getPolyMap; ccgdm->dm.getPBVH = ccgDM_getPBVH; |