now accounting for potentially higher vertex counts

This commit is contained in:
unknown 2024-11-16 15:56:21 +01:00
parent a543dc0a76
commit 91bc0d2b42

View File

@ -1943,10 +1943,11 @@ bool ExportMesh(Mesh mesh, const char *fileName)
if (IsFileExtension(fileName, ".obj")) if (IsFileExtension(fileName, ".obj"))
{ {
// Estimated data size, it should be enough... // Estimated data size, it should be enough...
int dataSize = mesh.vertexCount*(int)strlen("v -0000.000000f -0000.000000f -0000.000000f\n") + int vc = mesh.vertexCount;
mesh.vertexCount*(int)strlen("vt -0.000000f -0.000000f\n") + int dataSize = vc*(int)strlen("v -0000.000000f -0000.000000f -0000.000000f\n") +
mesh.vertexCount*(int)strlen("vn -0.0000f -0.0000f -0.0000f\n") + vc*(int)strlen("vt -0.000000f -0.000000f\n") +
mesh.triangleCount*(int)strlen("f 00000/00000/00000 00000/00000/00000 00000/00000/00000\n"); vc*(int)strlen("vn -0.0000f -0.0000f -0.0000f\n") +
mesh.triangleCount*snprintf(NULL, 0, "f %i/%i/%i %i/%i/%i %i/%i/%i\n", vc, vc, vc, vc, vc, vc, vc, vc, vc);
// NOTE: Text data buffer size is estimated considering mesh data size // NOTE: Text data buffer size is estimated considering mesh data size
char *txtData = (char *)RL_CALLOC(dataSize + 1000, sizeof(char)); char *txtData = (char *)RL_CALLOC(dataSize + 1000, sizeof(char));