Fix for "front() called on empty vector" Errors on debug builds.
Now using the C++11 vector.data() to fetch the proper pointer instead of $vector.front() - Which fails on empty vectors because of the standard compiler setting _ITERATOR_DEBUG_LEVEL=2 when debugging
This commit is contained in:
@@ -92,7 +92,7 @@ void loadBinaryMesh(const char* filename, Mesh& mesh) {
|
||||
return;
|
||||
|
||||
vertices.resize(count);
|
||||
file.read((char*)&vertices.front(), sizeof(vec3f) * count);
|
||||
file.read((char*)vertices.data(), sizeof(vec3f) * count);
|
||||
|
||||
//Normals
|
||||
file.read((char*)&count, sizeof(count));
|
||||
@@ -100,7 +100,7 @@ void loadBinaryMesh(const char* filename, Mesh& mesh) {
|
||||
return;
|
||||
|
||||
normals.resize(count);
|
||||
file.read((char*)&normals.front(), sizeof(vec3f) * count);
|
||||
file.read((char*)normals.data(), sizeof(vec3f) * count);
|
||||
|
||||
//UVs
|
||||
file.read((char*)&count, sizeof(count));
|
||||
@@ -108,7 +108,7 @@ void loadBinaryMesh(const char* filename, Mesh& mesh) {
|
||||
return;
|
||||
|
||||
uvs.resize(count);
|
||||
file.read((char*)&uvs.front(), sizeof(UV) * count);
|
||||
file.read((char*)uvs.data(), sizeof(UV) * count);
|
||||
|
||||
//Faces
|
||||
file.read((char*)&count, sizeof(count));
|
||||
|
||||
Reference in New Issue
Block a user