file.seek(0);
return read_stl_ascii(file);
}
- confusing_stl = true;
- }
- else
- {
- confusing_stl = false;
+ // Otherwise, this STL is a binary stl but contains 'solid' as
+ // the first five characters. This is a bad life choice, but
+ // we can gracefully handle it by falling through to the binary
+ // STL reader below.
}
- // Otherwise, skip the rest of the header material and read as binary
file.seek(0);
return read_stl_binary(file);
}
QVector<Vertex> verts(tri_count*3);
// Dummy array, because readRawData is faster than skipRawData
- std::unique_ptr<uint8_t> buffer(new uint8_t[tri_count * 50]);
+ std::unique_ptr<uint8_t[]> buffer(new uint8_t[tri_count * 50]);
data.readRawData((char*)buffer.get(), tri_count * 50);
// Store vertices in the array, processing one triangle at a time.
// Load vertex data from .stl file into vertices
for (unsigned i=0; i < 3; ++i)
{
- memcpy(&v[i], b, 3*sizeof(float));
+ qFromLittleEndian<float>(b, 3, &v[i]);
b += 3 * sizeof(float);
}
b += 3 * sizeof(float) + sizeof(uint16_t);
}
- if (confusing_stl)
- {
- emit warning_confusing_stl();
- }
-
return mesh_from_verts(tri_count, verts);
}