Hello, I’m also looking to speed up attaching meshes and have tried just about everything i could find on these forums. Curious about using memcpy. I’ve tried implementing a function using it in a modifier but i’m not really seeing any performance boost. There must be something I’m missing, does anyone have any ideas?
void meshMemCopy(Mesh& dest, Mesh& src)
{
int vCount{ dest.numVerts };
int fCount{ dest.numFaces };
dest.setNumVerts(vCount + src.numVerts, true);
dest.setNumFaces(fCount + src.numFaces, true);
memcpy(&(dest.verts[vCount]), src.verts, sizeof(Point3) * src.numVerts);
memcpy(&(dest.faces[fCount]), src.faces, sizeof(Face) * src.numFaces);
for (int i{ fCount }; i < dest.numFaces; i++)
{
DWORD* v = dest.faces[i].v;
DWORD vArr[3]{ v[0] + vCount,v[1] + vCount,v[2] + vCount };
memcpy(v, &vArr, sizeof(vArr));
}
}