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

@ -413,7 +413,7 @@ ModelVolumeType type_from_string(const std::string &s)
struct Geometry
{
std::vector<Vec3f> vertices;
std::vector<Vec3i> triangles;
std::vector<Vec3i32> triangles;
std::vector<std::string> custom_supports;
std::vector<std::string> custom_seam;
std::vector<std::string> mmu_segmentation;
@ -2107,7 +2107,7 @@ ModelVolumeType type_from_string(const std::string &s)
{
int min_id = its.indices.front()[0];
int max_id = min_id;
for (const Vec3i& face : its.indices) {
for (const Vec3i32& face : its.indices) {
for (const int tri_id : face) {
if (tri_id < 0 || tri_id >= int(geometry.vertices.size())) {
add_error("Found invalid vertex id");
@ -2120,7 +2120,7 @@ ModelVolumeType type_from_string(const std::string &s)
its.vertices.assign(geometry.vertices.begin() + min_id, geometry.vertices.begin() + max_id + 1);
// rebase indices to the current vertices list
for (Vec3i& face : its.indices)
for (Vec3i32& face : its.indices)
for (int& tri_id : face)
tri_id -= min_id;
}
@ -2786,7 +2786,7 @@ ModelVolumeType type_from_string(const std::string &s)
for (int i = 0; i < int(its.indices.size()); ++ i) {
{
const Vec3i &idx = its.indices[i];
const Vec3i32 &idx = its.indices[i];
char *ptr = buf;
boost::spirit::karma::generate(ptr, boost::spirit::lit(" <") << TRIANGLE_TAG <<
" v1=\"" << boost::spirit::int_ <<

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);

View file

@ -303,7 +303,7 @@ ConfigSubstitutions import_sla_archive(const std::string &zipfname, DynamicPrint
// function return if the archive did not contain any profile.
ConfigSubstitutions import_sla_archive(
const std::string & zipfname,
Vec2i windowsize,
Vec2i32 windowsize,
indexed_triangle_set & out,
DynamicPrintConfig & profile_out,
std::function<bool(int)> progr)

View file

@ -42,14 +42,14 @@ ConfigSubstitutions import_sla_archive(const std::string &zipfname, DynamicPrint
ConfigSubstitutions import_sla_archive(
const std::string & zipfname,
Vec2i windowsize,
Vec2i32 windowsize,
indexed_triangle_set & out,
DynamicPrintConfig & profile,
std::function<bool(int)> progr = [](int) { return true; });
inline ConfigSubstitutions import_sla_archive(
const std::string & zipfname,
Vec2i windowsize,
Vec2i32 windowsize,
indexed_triangle_set & out,
std::function<bool(int)> progr = [](int) { return true; })
{

View file

@ -658,7 +658,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
struct Geometry
{
std::vector<Vec3f> vertices;
std::vector<Vec3i> triangles;
std::vector<Vec3i32> triangles;
std::vector<std::string> custom_supports;
std::vector<std::string> custom_seam;
std::vector<std::string> mmu_segmentation;
@ -4608,7 +4608,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
// add_error("found no trianges in the object " + std::to_string(sub_object->id));
// return false;
//}
for (const Vec3i& face : its.indices) {
for (const Vec3i32& face : its.indices) {
for (const int tri_id : face) {
if (tri_id < 0 || tri_id >= int(sub_object->geometry.vertices.size())) {
add_error("invalid vertex id in object " + std::to_string(sub_object->id));
@ -4783,7 +4783,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
{
int min_id = its.indices.front()[0];
int max_id = min_id;
for (const Vec3i& face : its.indices) {
for (const Vec3i32& face : its.indices) {
for (const int tri_id : face) {
if (tri_id < 0 || tri_id >= int(geometry.vertices.size())) {
add_error("Found invalid vertex id");
@ -4803,7 +4803,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
}
// rebase indices to the current vertices list
for (Vec3i& face : its.indices)
for (Vec3i32& face : its.indices)
for (int& tri_id : face)
tri_id -= min_id;
}
@ -6850,7 +6850,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
for (int i = 0; i < int(its.indices.size()); ++ i) {
{
const Vec3i &idx = its.indices[i];
const Vec3i32 &idx = its.indices[i];
char *ptr = buf;
boost::spirit::karma::generate(ptr, boost::spirit::lit(" <") << TRIANGLE_TAG <<
" v1=\"" << boost::spirit::int_ <<