If I have a TArray how can I write the data out to binary file? Below is what I have so far.
projectDir = FPaths::GameDir();
projectDir += "Content/Data/Icosahedron_Data.obj";
FBufferArchive toBinary;
for (int i = 0; i < outVerts.Num(); i++)
toBinary << outVerts[i];
FFileHelper::SaveArrayToFile(toBinary, *projectDir);
toBinary.FlushCache();
toBinary.Empty();
Now I overloaded the << operator so that the type inside outVerts (which holds three uint32) converts the data over - or so I think.
This is how I load in the data which is producing the wrong results
TArray<uint8> inBinaryArray;
FFileHelper::LoadFileToArray(inBinaryArray, *projectDir);
FMemoryReader FromBinary = FMemoryReader(inBinaryArray, true); //true, free data after done
FromBinary.Seek(0);
for (int i = 0; i < outVerts.Num(); i++)
FromBinary << outVerts[i];
FromBinary.FlushCache();
inBinaryArray.Empty();
FromBinary.Close();