Support larger printer sizes by using 64-bit.

SuperSlicer is referenced for some changes.

Co-authored-by: Merill <merill@free.fr>
This commit is contained in:
SoftFever
2024-05-10 23:42:28 +08:00
parent 5bceebdd9d
commit 9b2c2bff1d
87 changed files with 380 additions and 362 deletions

View File

@@ -248,7 +248,7 @@ struct AMFParserContext
// Current volume allocated for an amf/object/mesh/volume subtree.
ModelVolume *m_volume { nullptr };
// Faces collected for the current m_volume.
std::vector<Vec3i> m_volume_facets;
std::vector<Vec3i32> m_volume_facets;
// Transformation matrix of a volume mesh from its coordinate system to Object's coordinate system.
Transform3d m_volume_transform;
// Current material allocated for an amf/metadata subtree.
@@ -632,7 +632,7 @@ void AMFParserContext::endElement(const char * /* name */)
// Verify validity of face indices, find the vertex span.
int min_id = m_volume_facets.front()[0];
int max_id = min_id;
for (const Vec3i& face : m_volume_facets) {
for (const Vec3i32& face : m_volume_facets) {
for (const int tri_id : face) {
if (tri_id < 0 || tri_id >= int(m_object_vertices.size())) {
this->stop("Found a malformed triangle mesh");
@@ -644,8 +644,8 @@ void AMFParserContext::endElement(const char * /* name */)
}
// rebase indices to the current vertices list
for (Vec3i &face : m_volume_facets)
face -= Vec3i(min_id, min_id, min_id);
for (Vec3i32 &face : m_volume_facets)
face -= Vec3i32(min_id, min_id, min_id);
indexed_triangle_set its { std::move(m_volume_facets), { m_object_vertices.begin() + min_id, m_object_vertices.begin() + max_id + 1 } };
its_compactify_vertices(its);