Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/mball_tessellate.cc
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| mesh->totvert = int(process.curvertex); | mesh->totvert = int(process.curvertex); | ||||
| CustomData_add_layer_named( | CustomData_add_layer_named( | ||||
| &mesh->vdata, CD_PROP_FLOAT3, CD_ASSIGN, process.co, mesh->totvert, "position"); | &mesh->vdata, CD_PROP_FLOAT3, CD_ASSIGN, process.co, mesh->totvert, "position"); | ||||
| process.co = nullptr; | process.co = nullptr; | ||||
| mesh->totpoly = int(process.curindex); | mesh->totpoly = int(process.curindex); | ||||
| MPoly *mpoly = static_cast<MPoly *>( | MPoly *mpoly = static_cast<MPoly *>( | ||||
| CustomData_add_layer(&mesh->pdata, CD_MPOLY, CD_CONSTRUCT, nullptr, mesh->totpoly)); | CustomData_add_layer(&mesh->pdata, CD_MPOLY, CD_CONSTRUCT, nullptr, mesh->totpoly)); | ||||
| MLoop *mloop = static_cast<MLoop *>( | int *corner_verts = static_cast<int *>(CustomData_add_layer_named( | ||||
| CustomData_add_layer(&mesh->ldata, CD_MLOOP, CD_CONSTRUCT, nullptr, mesh->totpoly * 4)); | &mesh->ldata, CD_PROP_INT32, CD_CONSTRUCT, nullptr, mesh->totpoly * 4, ".corner_vert")); | ||||
| int loop_offset = 0; | int loop_offset = 0; | ||||
| for (int i = 0; i < mesh->totpoly; i++) { | for (int i = 0; i < mesh->totpoly; i++) { | ||||
| const int *indices = process.indices[i]; | const int *indices = process.indices[i]; | ||||
| const int count = indices[2] != indices[3] ? 4 : 3; | const int count = indices[2] != indices[3] ? 4 : 3; | ||||
| mpoly[i].loopstart = loop_offset; | mpoly[i].loopstart = loop_offset; | ||||
| mpoly[i].totloop = count; | mpoly[i].totloop = count; | ||||
| mpoly[i].flag = ME_SMOOTH; | mpoly[i].flag = ME_SMOOTH; | ||||
| mloop[loop_offset].v = uint32_t(indices[0]); | corner_verts[loop_offset] = indices[0]; | ||||
| mloop[loop_offset + 1].v = uint32_t(indices[1]); | corner_verts[loop_offset + 1] = indices[1]; | ||||
| mloop[loop_offset + 2].v = uint32_t(indices[2]); | corner_verts[loop_offset + 2] = indices[2]; | ||||
| if (count == 4) { | if (count == 4) { | ||||
| mloop[loop_offset + 3].v = uint32_t(indices[3]); | corner_verts[loop_offset + 3] = indices[3]; | ||||
| } | } | ||||
| loop_offset += count; | loop_offset += count; | ||||
| } | } | ||||
| MEM_freeN(process.indices); | MEM_freeN(process.indices); | ||||
| for (int i = 0; i < mesh->totvert; i++) { | for (int i = 0; i < mesh->totvert; i++) { | ||||
| normalize_v3(process.no[i]); | normalize_v3(process.no[i]); | ||||
| Show All 13 Lines | |||||