Cleanup: remove unused MFace custom-data utilities
Remove: - BKE_mesh_loops_to_mface_corners - BKE_mesh_tangent_loops_to_tessdata
This commit is contained in:
@@ -534,25 +534,6 @@ void BKE_mesh_calc_volume(const struct MVert *mverts,
|
|||||||
float r_center[3]);
|
float r_center[3]);
|
||||||
|
|
||||||
/* tessface */
|
/* tessface */
|
||||||
void BKE_mesh_loops_to_mface_corners(struct CustomData *fdata,
|
|
||||||
struct CustomData *ldata,
|
|
||||||
struct CustomData *pdata,
|
|
||||||
unsigned int lindex[4],
|
|
||||||
int findex,
|
|
||||||
const int polyindex,
|
|
||||||
const int mf_len,
|
|
||||||
const int numUV,
|
|
||||||
const int numCol,
|
|
||||||
const bool hasPCol,
|
|
||||||
const bool hasOrigSpace,
|
|
||||||
const bool hasLNor);
|
|
||||||
void BKE_mesh_tangent_loops_to_tessdata(struct CustomData *fdata,
|
|
||||||
struct CustomData *ldata,
|
|
||||||
struct MFace *mface,
|
|
||||||
const int *polyindices,
|
|
||||||
unsigned int (*loopindices)[4],
|
|
||||||
const int num_faces,
|
|
||||||
const char *layer_name);
|
|
||||||
void BKE_mesh_convert_mfaces_to_mpolys(struct Mesh *mesh);
|
void BKE_mesh_convert_mfaces_to_mpolys(struct Mesh *mesh);
|
||||||
void BKE_mesh_do_versions_convert_mfaces_to_mpolys(struct Mesh *mesh);
|
void BKE_mesh_do_versions_convert_mfaces_to_mpolys(struct Mesh *mesh);
|
||||||
void BKE_mesh_convert_mfaces_to_mpolys_ex(struct ID *id,
|
void BKE_mesh_convert_mfaces_to_mpolys_ex(struct ID *id,
|
||||||
|
@@ -2785,126 +2785,6 @@ void BKE_mesh_calc_volume(const MVert *mverts,
|
|||||||
/** \name NGon Tessellation (NGon/Tessface Conversion)
|
/** \name NGon Tessellation (NGon/Tessface Conversion)
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert a triangle or quadrangle of loop/poly data to tessface data
|
|
||||||
*/
|
|
||||||
void BKE_mesh_loops_to_mface_corners(
|
|
||||||
CustomData *fdata,
|
|
||||||
CustomData *ldata,
|
|
||||||
CustomData *UNUSED(pdata),
|
|
||||||
uint lindex[4],
|
|
||||||
int findex,
|
|
||||||
const int UNUSED(polyindex),
|
|
||||||
const int mf_len, /* 3 or 4 */
|
|
||||||
|
|
||||||
/* cache values to avoid lookups every time */
|
|
||||||
const int numUV, /* CustomData_number_of_layers(ldata, CD_MLOOPUV) */
|
|
||||||
const int numCol, /* CustomData_number_of_layers(ldata, CD_MLOOPCOL) */
|
|
||||||
const bool hasPCol, /* CustomData_has_layer(ldata, CD_PREVIEW_MLOOPCOL) */
|
|
||||||
const bool hasOrigSpace, /* CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP) */
|
|
||||||
const bool hasLNor /* CustomData_has_layer(ldata, CD_NORMAL) */
|
|
||||||
)
|
|
||||||
{
|
|
||||||
MTFace *texface;
|
|
||||||
MCol *mcol;
|
|
||||||
MLoopCol *mloopcol;
|
|
||||||
MLoopUV *mloopuv;
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
for (i = 0; i < numUV; i++) {
|
|
||||||
texface = CustomData_get_n(fdata, CD_MTFACE, findex, i);
|
|
||||||
|
|
||||||
for (j = 0; j < mf_len; j++) {
|
|
||||||
mloopuv = CustomData_get_n(ldata, CD_MLOOPUV, (int)lindex[j], i);
|
|
||||||
copy_v2_v2(texface->uv[j], mloopuv->uv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < numCol; i++) {
|
|
||||||
mcol = CustomData_get_n(fdata, CD_MCOL, findex, i);
|
|
||||||
|
|
||||||
for (j = 0; j < mf_len; j++) {
|
|
||||||
mloopcol = CustomData_get_n(ldata, CD_MLOOPCOL, (int)lindex[j], i);
|
|
||||||
MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasPCol) {
|
|
||||||
mcol = CustomData_get(fdata, findex, CD_PREVIEW_MCOL);
|
|
||||||
|
|
||||||
for (j = 0; j < mf_len; j++) {
|
|
||||||
mloopcol = CustomData_get(ldata, (int)lindex[j], CD_PREVIEW_MLOOPCOL);
|
|
||||||
MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasOrigSpace) {
|
|
||||||
OrigSpaceFace *of = CustomData_get(fdata, findex, CD_ORIGSPACE);
|
|
||||||
OrigSpaceLoop *lof;
|
|
||||||
|
|
||||||
for (j = 0; j < mf_len; j++) {
|
|
||||||
lof = CustomData_get(ldata, (int)lindex[j], CD_ORIGSPACE_MLOOP);
|
|
||||||
copy_v2_v2(of->uv[j], lof->uv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasLNor) {
|
|
||||||
short(*tlnors)[3] = CustomData_get(fdata, findex, CD_TESSLOOPNORMAL);
|
|
||||||
|
|
||||||
for (j = 0; j < mf_len; j++) {
|
|
||||||
normal_float_to_short_v3(tlnors[j], CustomData_get(ldata, (int)lindex[j], CD_NORMAL));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BKE_mesh_tangent_loops_to_tessdata(CustomData *fdata,
|
|
||||||
CustomData *ldata,
|
|
||||||
MFace *mface,
|
|
||||||
const int *polyindices,
|
|
||||||
uint (*loopindices)[4],
|
|
||||||
const int num_faces,
|
|
||||||
const char *layer_name)
|
|
||||||
{
|
|
||||||
/* Note: performances are sub-optimal when we get a NULL mface,
|
|
||||||
* we could be ~25% quicker with dedicated code...
|
|
||||||
* Issue is, unless having two different functions with nearly the same code,
|
|
||||||
* there's not much ways to solve this. Better imho to live with it for now. :/ --mont29
|
|
||||||
*/
|
|
||||||
|
|
||||||
float(*ftangents)[4] = NULL;
|
|
||||||
float(*ltangents)[4] = NULL;
|
|
||||||
|
|
||||||
int findex, j;
|
|
||||||
const int *pidx;
|
|
||||||
uint(*lidx)[4];
|
|
||||||
|
|
||||||
if (layer_name) {
|
|
||||||
ltangents = CustomData_get_layer_named(ldata, CD_TANGENT, layer_name);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ltangents = CustomData_get_layer(ldata, CD_TANGENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ltangents) {
|
|
||||||
/* need to do for all uv maps at some point */
|
|
||||||
if (layer_name) {
|
|
||||||
ftangents = CustomData_get_layer_named(fdata, CD_TANGENT, layer_name);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ftangents = CustomData_get_layer(fdata, CD_TANGENT);
|
|
||||||
}
|
|
||||||
if (ftangents) {
|
|
||||||
for (findex = 0, pidx = polyindices, lidx = loopindices; findex < num_faces;
|
|
||||||
pidx++, lidx++, findex++) {
|
|
||||||
int nverts = (mface ? mface[findex].v4 : (*lidx)[3]) ? 4 : 3;
|
|
||||||
for (j = nverts; j--;) {
|
|
||||||
copy_v4_v4(ftangents[findex * 4 + j], ltangents[(*lidx)[j]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bm_corners_to_loops_ex(ID *id,
|
static void bm_corners_to_loops_ex(ID *id,
|
||||||
CustomData *fdata,
|
CustomData *fdata,
|
||||||
CustomData *ldata,
|
CustomData *ldata,
|
||||||
|
Reference in New Issue
Block a user