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

@ -95,7 +95,7 @@ void profile(const TriangleMesh &mesh)
Eigen::MatrixXd occlusion_output1;
{
std::vector<Vec3d> vertices;
std::vector<Vec3i> triangles;
std::vector<Vec3i32> triangles;
for (int i = 0; i < V.rows(); ++ i)
vertices.emplace_back(V.row(i).transpose());
for (int i = 0; i < F.rows(); ++ i)

View file

@ -45,7 +45,7 @@ FaceNeighborIndex its_create_neighbors_index_1(const indexed_triangle_set &its)
// Go through all edges of all facets and mark the facets touching each edge
for (size_t face_id = 0; face_id < its.indices.size(); ++face_id) {
const Vec3i &face = its.indices[face_id];
const Vec3i32 &face = its.indices[face_id];
EdgeID e1 = hash(face(0), face(1)), e2 = hash(face(1), face(2)),
e3 = hash(face(2), face(0));
@ -59,7 +59,7 @@ FaceNeighborIndex its_create_neighbors_index_1(const indexed_triangle_set &its)
// Now collect the neighbors for each facet into the final index
for (size_t face_id = 0; face_id < its.indices.size(); ++face_id) {
const Vec3i &face = its.indices[face_id];
const Vec3i32 &face = its.indices[face_id];
EdgeID e1 = hash(face(0), face(1)), e2 = hash(face(1), face(2)),
e3 = hash(face(2), face(0));
@ -77,9 +77,9 @@ FaceNeighborIndex its_create_neighbors_index_1(const indexed_triangle_set &its)
return index;
}
std::vector<Vec3i> its_create_neighbors_index_2(const indexed_triangle_set &its)
std::vector<Vec3i32> its_create_neighbors_index_2(const indexed_triangle_set &its)
{
std::vector<Vec3i> out(its.indices.size(), Vec3i(-1, -1, -1));
std::vector<Vec3i32> out(its.indices.size(), Vec3i32(-1, -1, -1));
// Create a mapping from triangle edge into face.
struct EdgeToFace {
@ -157,9 +157,9 @@ std::vector<Vec3i> its_create_neighbors_index_2(const indexed_triangle_set &its)
return out;
}
std::vector<Vec3i> its_create_neighbors_index_3(const indexed_triangle_set &its)
std::vector<Vec3i32> its_create_neighbors_index_3(const indexed_triangle_set &its)
{
std::vector<Vec3i> out(its.indices.size(), Vec3i(-1, -1, -1));
std::vector<Vec3i32> out(its.indices.size(), Vec3i32(-1, -1, -1));
// Create a mapping from triangle edge into face.
struct EdgeToFace {
@ -288,7 +288,7 @@ FaceNeighborIndex its_create_neighbors_index_4(const indexed_triangle_set &its)
// Go through all edges of all facets and mark the facets touching each edge
for (size_t face_id = 0; face_id < its.indices.size(); ++face_id) {
const Vec3i &face = its.indices[face_id];
const Vec3i32 &face = its.indices[face_id];
EdgeID e1 = hash(face(0), face(1)), e2 = hash(face(1), face(2)),
e3 = hash(face(2), face(0));
@ -302,7 +302,7 @@ FaceNeighborIndex its_create_neighbors_index_4(const indexed_triangle_set &its)
// Now collect the neighbors for each facet into the final index
for (size_t face_id = 0; face_id < its.indices.size(); ++face_id) {
const Vec3i &face = its.indices[face_id];
const Vec3i32 &face = its.indices[face_id];
EdgeID e1 = hash(face(0), face(1)), e2 = hash(face(1), face(2)),
e3 = hash(face(2), face(0));
@ -443,7 +443,7 @@ std::vector<std::array<size_t, 3>> its_create_neighbors_index_6(const indexed_tr
// Go through all edges of all facets and mark the facets touching each edge
for (size_t face_id = 0; face_id < facenum; ++face_id) {
const Vec3i &face = its.indices[face_id];
const Vec3i32 &face = its.indices[face_id];
edge_map[face_id * 3] = {hash(face(0), face(1)), face_id};
edge_map[face_id * 3 + 1] = {hash(face(1), face(2)), face_id};
@ -503,7 +503,7 @@ std::vector<std::array<size_t, 3>> its_create_neighbors_index_7(const indexed_tr
// Go through all edges of all facets and mark the facets touching each edge
for (size_t face_id = 0; face_id < facenum; ++face_id) {
const Vec3i &face = its.indices[face_id];
const Vec3i32 &face = its.indices[face_id];
edge_map[face_id * 3] = {hash(face(0), face(1)), face_id};
edge_map[face_id * 3 + 1] = {hash(face(1), face(2)), face_id};
@ -568,7 +568,7 @@ FaceNeighborIndex its_create_neighbors_index_8(const indexed_triangle_set &its)
// Go through all edges of all facets and mark the facets touching each edge
for (size_t face_id = 0; face_id < its.indices.size(); ++face_id) {
const Vec3i &face = its.indices[face_id];
const Vec3i32 &face = its.indices[face_id];
EdgeID e1 = hash(face(0), face(1)), e2 = hash(face(1), face(2)),
e3 = hash(face(2), face(0));
@ -582,7 +582,7 @@ FaceNeighborIndex its_create_neighbors_index_8(const indexed_triangle_set &its)
// Now collect the neighbors for each facet into the final index
for (size_t face_id = 0; face_id < its.indices.size(); ++face_id) {
const Vec3i &face = its.indices[face_id];
const Vec3i32 &face = its.indices[face_id];
EdgeID e1 = hash(face(0), face(1)), e2 = hash(face(1), face(2)),
e3 = hash(face(2), face(0));
@ -605,7 +605,7 @@ std::vector<Vec3crd> its_create_neighbors_index_9(const indexed_triangle_set &it
return create_face_neighbors_index(ex_seq, its);
}
std::vector<Vec3i> its_create_neighbors_index_10(const indexed_triangle_set &its)
std::vector<Vec3i32> its_create_neighbors_index_10(const indexed_triangle_set &its)
{
return create_face_neighbors_index(ex_tbb, its);
}

View file

@ -4,8 +4,8 @@
namespace Slic3r {
using FaceNeighborIndex = std::vector<std::array<size_t, 3>>;
FaceNeighborIndex its_create_neighbors_index_1(const indexed_triangle_set &its);
std::vector<Vec3i> its_create_neighbors_index_2(const indexed_triangle_set &its);
std::vector<Vec3i> its_create_neighbors_index_3(const indexed_triangle_set &its);
std::vector<Vec3i32> its_create_neighbors_index_2(const indexed_triangle_set &its);
std::vector<Vec3i32> its_create_neighbors_index_3(const indexed_triangle_set &its);
FaceNeighborIndex its_create_neighbors_index_4(const indexed_triangle_set &its);
//FaceNeighborIndex its_create_neighbors_index_4(const indexed_triangle_set &its);
std::vector<Vec3crd> its_create_neighbors_index_5(const indexed_triangle_set &its);
@ -13,7 +13,7 @@ std::vector<std::array<size_t, 3>> its_create_neighbors_index_6(const indexed_tr
std::vector<std::array<size_t, 3>> its_create_neighbors_index_7(const indexed_triangle_set &its);
FaceNeighborIndex its_create_neighbors_index_8(const indexed_triangle_set &its);
std::vector<Vec3crd> its_create_neighbors_index_9(const indexed_triangle_set &its);
std::vector<Vec3i> its_create_neighbors_index_10(const indexed_triangle_set &its);
std::vector<Vec3i32> its_create_neighbors_index_10(const indexed_triangle_set &its);
std::vector<std::vector<size_t>> create_vertex_faces_index(const indexed_triangle_set &its);
}

View file

@ -364,7 +364,7 @@ void Controller::on_scroll(long v, long d, MouseInput::WheelAxis /*wa*/)
void Controller::on_moved_to(long x, long y)
{
if (m_left_btn) {
call_cameras(&Camera::rotate, (Vec2i{x, y} - m_mouse_pos).cast<float>());
call_cameras(&Camera::rotate, (Vec2i32{x, y} - m_mouse_pos).cast<float>());
call(&Display::repaint, m_displays);
}

View file

@ -358,7 +358,7 @@ private:
class Display : public Scene::Listener
{
protected:
Vec2i m_size;
Vec2i32 m_size;
bool m_initialized = false;
std::shared_ptr<Camera> m_camera;
@ -379,7 +379,7 @@ public:
virtual void swap_buffers() = 0;
virtual void set_active(long width, long height);
virtual void set_screen_size(long width, long height);
Vec2i get_screen_size() const { return m_size; }
Vec2i32 get_screen_size() const { return m_size; }
virtual void repaint();
@ -438,7 +438,7 @@ class Controller : public std::enable_shared_from_this<Controller>,
public Scene::Listener
{
long m_wheel_pos = 0;
Vec2i m_mouse_pos, m_mouse_pos_rprev, m_mouse_pos_lprev;
Vec2i32 m_mouse_pos, m_mouse_pos_rprev, m_mouse_pos_lprev;
bool m_left_btn = false, m_right_btn = false;
std::shared_ptr<Scene> m_scene;