diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-06-18 12:14:00 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-06-18 12:14:00 +0300 |
commit | d5ec62a0c3a489d94d77854b563f7c42a5a9d174 (patch) | |
tree | a0ec379fba89c7f10f8ee8ceb4f7e4976ddb1d8d /source/blender/blenkernel/intern/multires.c | |
parent | 4330027895ca05df3bba9ae4cc842792689d1d7f (diff) |
Multires: Remove unused function
It uses derived mesh, and relies on scene stored in modifier data.
So port is needed anyway.
Diffstat (limited to 'source/blender/blenkernel/intern/multires.c')
-rw-r--r-- | source/blender/blenkernel/intern/multires.c | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index a9fded4a074..5bd4a1a0475 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -1333,126 +1333,6 @@ void multires_modifier_update_hidden(DerivedMesh *dm) } } -void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to) -{ - DerivedMesh *ccgdm = NULL, *subsurf = NULL; - CCGElem **gridData, **subGridData = NULL; - CCGKey key; - MPoly *mpoly = CustomData_get_layer(&dm->polyData, CD_MPOLY); - MDisps *mdisps; - MultiresModifierData *mmd = get_multires_modifier(NULL, ob, 1); - int *gridOffset, totlvl; - int i, k, numGrids, gridSize, dGridSize, dSkip; - - if (!mmd) - return; - - mdisps = CustomData_get_layer(&dm->loopData, CD_MDISPS); - - if (!mdisps) { - goto cleanup; - } - - totlvl = mmd->totlvl; - ccgdm = multires_dm_create_local(ob, dm, totlvl, totlvl, mmd->simple, false); - - subsurf = subsurf_dm_create_local(ob, dm, totlvl, - mmd->simple, mmd->flags & eMultiresModifierFlag_ControlEdges, mmd->flags & eMultiresModifierFlag_PlainUv, 0); - - numGrids = subsurf->getNumGrids(subsurf); - gridSize = subsurf->getGridSize(subsurf); - gridData = subsurf->getGridData(subsurf); - subsurf->getGridKey(subsurf, &key); - - subGridData = MEM_calloc_arrayN(numGrids, sizeof(CCGElem *), "subGridData*"); - - for (i = 0; i < numGrids; i++) { - subGridData[i] = MEM_calloc_arrayN(key.elem_size, gridSize * gridSize, "subGridData"); - memcpy(subGridData[i], gridData[i], key.elem_size * gridSize * gridSize); - } - - /* numGrids = ccgdm->dm->getNumGrids((DerivedMesh *)ccgdm); */ /*UNUSED*/ - gridSize = ccgdm->getGridSize((DerivedMesh *)ccgdm); - gridData = ccgdm->getGridData((DerivedMesh *)ccgdm); - gridOffset = ccgdm->getGridOffset((DerivedMesh *)ccgdm); - - dGridSize = multires_side_tot[totlvl]; - dSkip = (dGridSize - 1) / (gridSize - 1); - - k = 0; /*current loop/mdisp index within the mloop array*/ - - /* TODO: Use BLI_task parallel range for that one too? */ - for (i = 0; i < dm->numPolyData; ++i) { - const int numVerts = mpoly[i].totloop; - int S, x, y, gIndex = gridOffset[i]; - - for (S = 0; S < numVerts; ++S, ++gIndex, ++k) { - MDisps *mdisp = &mdisps[mpoly[i].loopstart + S]; - /* CCGElem *grid = gridData[gIndex]; */ /* UNUSED */ - CCGElem *subgrid = subGridData[gIndex]; - float (*dispgrid)[3] = NULL; - - /* when adding new faces in edit mode, need to allocate disps */ - if (!mdisp->disps) { - mdisp->totdisp = gridSize * gridSize; - mdisp->level = totlvl; - mdisp->disps = MEM_calloc_arrayN(mdisp->totdisp, 3 * sizeof(float), "disp in multires_set_space"); - } - - dispgrid = mdisp->disps; - - for (y = 0; y < gridSize; y++) { - for (x = 0; x < gridSize; x++) { - float *data = dispgrid[dGridSize * y * dSkip + x * dSkip]; - float *co = CCG_grid_elem_co(&key, subgrid, x, y); - float mat[3][3], dco[3]; - - /* construct tangent space matrix */ - grid_tangent_matrix(mat, &key, x, y, subgrid); - - /* convert to absolute coordinates in space */ - if (from == MULTIRES_SPACE_TANGENT) { - mul_v3_m3v3(dco, mat, data); - add_v3_v3(dco, co); - } - else if (from == MULTIRES_SPACE_OBJECT) { - add_v3_v3v3(dco, co, data); - } - else if (from == MULTIRES_SPACE_ABSOLUTE) { - copy_v3_v3(dco, data); - } - - /*now, convert to desired displacement type*/ - if (to == MULTIRES_SPACE_TANGENT) { - invert_m3(mat); - - sub_v3_v3(dco, co); - mul_v3_m3v3(data, mat, dco); - } - else if (to == MULTIRES_SPACE_OBJECT) { - sub_v3_v3(dco, co); - mul_v3_m3v3(data, mat, dco); - } - else if (to == MULTIRES_SPACE_ABSOLUTE) { - copy_v3_v3(data, dco); - } - } - } - } - } - -cleanup: - if (subsurf) { - subsurf->needsFree = 1; - subsurf->release(subsurf); - } - - if (ccgdm) { - ccgdm->needsFree = 1; - ccgdm->release(ccgdm); - } -} - void multires_stitch_grids(Object *ob) { /* utility for smooth brush */ |