Fixed positioning of bed model into the scene and changed bundled bed models

This commit is contained in:
Enrico Turri 2019-07-25 08:43:21 +02:00
parent 1483a7fd51
commit 48dc2bb762
5 changed files with 3 additions and 19 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -398,18 +398,8 @@ void Bed3D::render_prusa(GLCanvas3D& canvas, const std::string& key, bool bottom
std::string filename = m_custom_model.empty() ? resources_dir() + "/models/" + key + "_bed.stl" : m_custom_model; std::string filename = m_custom_model.empty() ? resources_dir() + "/models/" + key + "_bed.stl" : m_custom_model;
if ((m_model.get_filename() != filename) && m_model.init_from_file(filename)) if ((m_model.get_filename() != filename) && m_model.init_from_file(filename))
{ {
Vec3d offset = m_bounding_box.center() - Vec3d(0.0, 0.0, 0.5 * m_model.get_bounding_box().size()(2)); // move the model a bit down to avoid z-fighting with the texture quad
if (key == "mk2") m_model.set_offset(-0.03 * Vec3d::UnitZ());
// hardcoded value to match the stl model
offset += Vec3d(0.0, 7.5, -0.03);
else if (key == "mk3")
// hardcoded value to match the stl model
offset += Vec3d(0.0, 5.5, 2.43);
else if (key == "sl1")
// hardcoded value to match the stl model
offset += Vec3d(0.0, 0.0, -0.03);
m_model.center_around(offset);
// update extended bounding box // update extended bounding box
calc_bounding_boxes(); calc_bounding_boxes();

View file

@ -1736,13 +1736,7 @@ bool GLBed::on_init_from_file(const std::string& filename)
m_filename = filename; m_filename = filename;
ModelObject* model_object = model.objects.front(); m_volume.indexed_vertex_array.load_mesh(model.mesh());
model_object->center_around_origin();
TriangleMesh mesh = model.mesh();
mesh.repair();
m_volume.indexed_vertex_array.load_mesh(mesh);
float color[4] = { 0.235f, 0.235f, 0.235f, 1.0f }; float color[4] = { 0.235f, 0.235f, 0.235f, 1.0f };
set_color(color, 4); set_color(color, 4);