Fix T60615: Cycles baking not working with some modifiers.

Refactors Cycles mesh export a bit to avoid unnecessary copies and to be in
sync with the Blender baker.
This commit is contained in:
2019-01-15 13:03:09 +01:00
parent 985dcbf6db
commit c9938ebb00
5 changed files with 72 additions and 95 deletions

View File

@@ -580,30 +580,6 @@ void Mesh::clear(bool preserve_voxel_data)
patch_table = NULL;
}
int Mesh::split_vertex(int vertex)
{
/* copy vertex location and vertex attributes */
add_vertex_slow(verts[vertex]);
foreach(Attribute& attr, attributes.attributes) {
if(attr.element == ATTR_ELEMENT_VERTEX) {
array<char> tmp(attr.data_sizeof());
memcpy(tmp.data(), attr.data() + tmp.size()*vertex, tmp.size());
attr.add(tmp.data());
}
}
foreach(Attribute& attr, subd_attributes.attributes) {
if(attr.element == ATTR_ELEMENT_VERTEX) {
array<char> tmp(attr.data_sizeof());
memcpy(tmp.data(), attr.data() + tmp.size()*vertex, tmp.size());
attr.add(tmp.data());
}
}
return verts.size() - 1;
}
void Mesh::add_vertex(float3 P)
{
verts.push_back_reserved(P);