Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-02-21 21:24:21 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-02-21 21:24:21 +0400
commit9064978d0bcd3684d48d3b64d41e650467d27e01 (patch)
treeb881f8c7c8cd19b88ad10a849ae2426c2361548e /source/blender/blenkernel/intern/customdata.c
parent4041c5775650f04d813ad867299daa4fa75e43ef (diff)
Remove unused code left from old multires interpolation stuff
- Removed validate() callback for MDisps layer. It wouldn't actually work correct from CustomData layer and all needed data might be validated from BMesh interpolation level. Also this callback was never actually used in BMesh, so can't see why we'll want to have it in structures. - Removed layrInterp_mdisps callback. Interpolation now happens from another level (bmesh_interp) and this callback isn't needed anymore. - Removed all function from multires.c which were used by old interpolation stuff and seems to be useless for other usages. - multires_topology_changed is still marked as a TODO, Probably it's not needed anymore, buy better to keep for now until it'll be 100% clear this function isn't needed and all needed re-allocations happens in bmesh_interp. Otherwise, it'll be needed to be ported to new system.
Diffstat (limited to 'source/blender/blenkernel/intern/customdata.c')
-rw-r--r--source/blender/blenkernel/intern/customdata.c164
1 files changed, 2 insertions, 162 deletions
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 285496601f5..f019fb740fb 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -120,11 +120,6 @@ typedef struct LayerTypeInfo {
/* a function to determine file size */
size_t (*filesize)(CDataFile *cdf, void *data, int count);
-
- /* a function to validate layer contents depending on
- * sub-elements count
- */
- void (*validate)(void *source, int sub_elements);
} LayerTypeInfo;
static void layerCopy_mdeformvert(const void *source, void *dest,
@@ -445,142 +440,6 @@ static void layerSwap_mdisps(void *data, const int *ci)
}
}
-#if 1 /* BMESH_TODO: place holder function, dont actually interp */
-static void layerInterp_mdisps(void **sources, float *UNUSED(weights),
- float *UNUSED(sub_weights), int UNUSED(count), void *dest)
-{
-#if 0
- MDisps *d = dest;
-
- /* happens when flipping normals of newly created mesh */
- if(!d->totdisp) {
- d->totdisp = ((MDisps*)sources[0])->totdisp;
- }
-
- if (!d->disps && d->totdisp)
- d->disps = MEM_callocN(sizeof(float)*3*d->totdisp, "blank mdisps in layerInterp_mdisps");
-#else
- (void) sources;
- (void) dest;
-#endif
-}
-
-#else // BMESH_TODO
-
-static void layerInterp_mdisps(void **sources, float *UNUSED(weights),
- float *sub_weights, int count, void *dest)
-{
- MDisps *d = dest;
- MDisps *s = NULL;
- int st, stl;
- int i, x, y;
- int side, S, dst_corners, src_corners;
- float crn_weight[4][2];
- float (*sw)[4] = (void*)sub_weights;
- float (*disps)[3], (*out)[3];
-
- /* happens when flipping normals of newly created mesh */
- if(!d->totdisp)
- return;
-
- s = sources[0];
- dst_corners = multires_mdisp_corners(d);
- src_corners = multires_mdisp_corners(s);
-
- if(sub_weights && count == 2 && src_corners == 3) {
- src_corners = multires_mdisp_corners(sources[1]);
-
- /* special case -- converting two triangles to quad */
- if(src_corners == 3 && dst_corners == 4) {
- MDisps tris[2];
- int vindex[4] = {0};
-
- for(i = 0; i < 2; i++)
- for(y = 0; y < 4; y++)
- for(x = 0; x < 4; x++)
- if(sw[x+i*4][y])
- vindex[x] = y;
-
- for(i = 0; i < 2; i++) {
- float sw_m4[4][4] = {{0}};
- int a = 7 & ~(1 << vindex[i*2] | 1 << vindex[i*2+1]);
-
- sw_m4[0][vindex[i*2+1]] = 1;
- sw_m4[1][vindex[i*2]] = 1;
-
- for(x = 0; x < 3; x++)
- if(a & (1 << x))
- sw_m4[2][x] = 1;
-
- tris[i] = *((MDisps*)sources[i]);
- tris[i].disps = MEM_dupallocN(tris[i].disps);
- layerInterp_mdisps(&sources[i], NULL, (float*)sw_m4, 1, &tris[i]);
- }
-
- mdisp_join_tris(d, &tris[0], &tris[1]);
-
- for(i = 0; i < 2; i++)
- MEM_freeN(tris[i].disps);
-
- return;
- }
- }
-
- /* For now, some restrictions on the input */
- if(count != 1 || !sub_weights) {
- for(i = 0; i < d->totdisp; ++i)
- zero_v3(d->disps[i]);
-
- return;
- }
-
- /* Initialize the destination */
- disps = MEM_callocN(3*d->totdisp*sizeof(float), "iterp disps");
-
- side = sqrt(d->totdisp / dst_corners);
- st = (side<<1)-1;
- stl = st - 1;
-
- sw= (void*)sub_weights;
- for(i = 0; i < 4; ++i) {
- crn_weight[i][0] = 0 * sw[i][0] + stl * sw[i][1] + stl * sw[i][2] + 0 * sw[i][3];
- crn_weight[i][1] = 0 * sw[i][0] + 0 * sw[i][1] + stl * sw[i][2] + stl * sw[i][3];
- }
-
- multires_mdisp_smooth_bounds(s);
-
- out = disps;
- for(S = 0; S < dst_corners; S++) {
- float base[2], axis_x[2], axis_y[2];
-
- mdisp_apply_weight(S, dst_corners, 0, 0, st, crn_weight, &base[0], &base[1]);
- mdisp_apply_weight(S, dst_corners, side-1, 0, st, crn_weight, &axis_x[0], &axis_x[1]);
- mdisp_apply_weight(S, dst_corners, 0, side-1, st, crn_weight, &axis_y[0], &axis_y[1]);
-
- sub_v2_v2(axis_x, base);
- sub_v2_v2(axis_y, base);
- normalize_v2(axis_x);
- normalize_v2(axis_y);
-
- for(y = 0; y < side; ++y) {
- for(x = 0; x < side; ++x, ++out) {
- int crn;
- float face_u, face_v, crn_u, crn_v;
-
- mdisp_apply_weight(S, dst_corners, x, y, st, crn_weight, &face_u, &face_v);
- crn = mdisp_rot_face_to_quad_crn(src_corners, st, face_u, face_v, &crn_u, &crn_v);
-
- old_mdisps_bilinear((*out), &s->disps[crn*side*side], side, crn_u, crn_v);
- mdisp_flip_disp(crn, dst_corners, axis_x, axis_y, *out);
- }
- }
- }
-
- MEM_freeN(d->disps);
- d->disps = disps;
-}
-#endif // BMESH_TODO
-
static void layerCopy_mdisps(const void *source, void *dest, int count)
{
int i;
@@ -600,25 +459,6 @@ static void layerCopy_mdisps(const void *source, void *dest, int count)
}
}
-static void layerValidate_mdisps(void *data, int sub_elements)
-{
-#if 1 /*BMESH_TODO*/
- (void)data;
- (void)sub_elements;
-#else
- MDisps *disps = data;
- if(disps->disps) {
- int corners = multires_mdisp_corners(disps);
-
- if(corners != sub_elements) {
- MEM_freeN(disps->disps);
- disps->totdisp = disps->totdisp / corners * sub_elements;
- disps->disps = MEM_callocN(3*disps->totdisp*sizeof(float), "layerValidate_mdisps");
- }
- }
-#endif
-}
-
static void layerFree_mdisps(void *data, int count, int UNUSED(size))
{
int i;
@@ -1124,9 +964,9 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
{sizeof(float)*4*4, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 19: CD_MDISPS */
{sizeof(MDisps), "MDisps", 1, NULL, layerCopy_mdisps,
- layerFree_mdisps, layerInterp_mdisps, layerSwap_mdisps, NULL,
+ layerFree_mdisps, NULL, layerSwap_mdisps, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
- layerRead_mdisps, layerWrite_mdisps, layerFilesize_mdisps, layerValidate_mdisps},
+ layerRead_mdisps, layerWrite_mdisps, layerFilesize_mdisps},
/* 20: CD_WEIGHT_MCOL */
{sizeof(MCol)*4, "MCol", 4, "WeightCol", NULL, NULL, layerInterp_mcol,
layerSwap_mcol, layerDefault_mcol},