mirror of
https://github.com/Dark98/SliceBeam.git
synced 2026-07-07 08:49:06 +00:00
Long click to move; Boosty page on click before redirect
This commit is contained in:
@@ -1401,6 +1401,19 @@ extern "C" {
|
||||
bed_util_init_contourlines(ref->contour, ref->contourlines);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_ru_ytkab0bp_slicebeam_slic3r_Native_bed_1init_1triangles_1mesh(JNIEnv* env, jclass, jlong ptr, jlong triangles_ptr) {
|
||||
auto ref = reinterpret_cast<BedRef*>(ptr);
|
||||
auto tRef = reinterpret_cast<GLModelRef*>(triangles_ptr);
|
||||
|
||||
auto contour = ref->contour;
|
||||
BoundingBox bb = get_extents(contour);
|
||||
Point center = bb.center();
|
||||
float scaleFactor = 4;
|
||||
contour.scale(scaleFactor);
|
||||
contour.translate(-center.x() * scaleFactor * 0.5f, -center.y() * scaleFactor * 0.5f);
|
||||
bed_util_init_triangles_its(contour, &tRef->mesh.its);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_ru_ytkab0bp_slicebeam_slic3r_Native_bed_1arrange(JNIEnv* env, jclass, jlong ptr, jlong model) {
|
||||
BedRef* ref = (BedRef*) (intptr_t) ptr;
|
||||
ModelRef* mRef = (ModelRef*) (intptr_t) model;
|
||||
|
||||
@@ -56,6 +56,22 @@ void bed_util_init_gridlines(ExPolygon& contour, GLModel* glGridlines) {
|
||||
glGridlines->init_from(std::move(init_data));
|
||||
}
|
||||
|
||||
void bed_util_init_triangles_its(ExPolygon& contour, indexed_triangle_set* its) {
|
||||
if (contour.empty())
|
||||
return;
|
||||
|
||||
auto triangles = triangulate_expolygon_3d(contour, 0);
|
||||
its->vertices.reserve(triangles.size());
|
||||
|
||||
for (size_t i = 0; i < triangles.size(); i += 3) {
|
||||
its->vertices.emplace_back(triangles[i].cast<float>());
|
||||
its->vertices.emplace_back(triangles[i + 1].cast<float>());
|
||||
its->vertices.emplace_back(triangles[i + 2].cast<float>());
|
||||
|
||||
its->indices.emplace_back(i, i + 1, i + 2);
|
||||
}
|
||||
}
|
||||
|
||||
void bed_util_init_triangles(ExPolygon& contour, GLModel* glTriangles) {
|
||||
if (glTriangles->is_initialized())
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user