CCG: Remove number of layers from key

The issue there was that number of layers did not include normals,
while element size counts bytes used by normals. This sounds very
fragile and dangerous to work further. Also, one value can easily
be delivered from another, so it is redundancy going on here.

Possible difference now is that multires subdivision will copy
normals to a higher levels. Shouldn't be big of a problem, since
leaving old normals and updating coordinates is not correct either.
This commit is contained in:
Sergey Sharybin 2018-09-05 15:56:50 +02:00
parent 44d4a61ed0
commit 94ec80d21c
3 changed files with 2 additions and 4 deletions

View File

@ -72,7 +72,6 @@ typedef struct CCGKey {
* true */
int mask_offset;
int num_layers;
int has_normals;
int has_mask;
} CCGKey;

View File

@ -1553,7 +1553,6 @@ void CCG_key(CCGKey *key, const CCGSubSurf *ss, int level)
key->elem_size = ss->meshIFC.vertDataSize;
key->has_normals = ss->calcVertNormals;
key->num_layers = ss->meshIFC.numLayers;
/* if normals are present, always the last three floats of an
* element */

View File

@ -578,7 +578,7 @@ static void multires_copy_dm_grid(CCGElem *gridA, CCGElem *gridB, CCGKey *keyA,
for (x = 0; x < keyB->grid_size; x++, j++)
memcpy(CCG_elem_offset_co(keyA, gridA, y * skip * keyA->grid_size + x * skip),
CCG_elem_offset_co(keyB, gridB, j),
sizeof(float) * keyA->num_layers);
keyA->elem_size);
}
else {
skip = (keyB->grid_size - 1) / (keyA->grid_size - 1);
@ -587,7 +587,7 @@ static void multires_copy_dm_grid(CCGElem *gridA, CCGElem *gridB, CCGKey *keyA,
for (x = 0; x < keyA->grid_size; x++, j++)
memcpy(CCG_elem_offset_co(keyA, gridA, j),
CCG_elem_offset_co(keyB, gridB, y * skip * keyB->grid_size + x * skip),
sizeof(float) * keyA->num_layers);
keyA->elem_size);
}
}