mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 10:25:56 +08:00
Fixes in tech ENABLE_SMOOTH_NORMALS
This commit is contained in:
parent
0681f92130
commit
4865ca65e8
@ -814,7 +814,10 @@ int GLVolumeCollection::load_object_volume(
|
|||||||
v.set_color(color_from_model_volume(*model_volume));
|
v.set_color(color_from_model_volume(*model_volume));
|
||||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_SMOOTH_NORMALS
|
#if ENABLE_SMOOTH_NORMALS
|
||||||
v.model.init_from(mesh, true);
|
v.model.init_from(*mesh, true);
|
||||||
|
#if ENABLE_RAYCAST_PICKING
|
||||||
|
v.mesh_raycaster = std::make_unique<GUI::MeshRaycaster>(mesh);
|
||||||
|
#endif // ENABLE_RAYCAST_PICKING
|
||||||
#else
|
#else
|
||||||
#if ENABLE_RAYCAST_PICKING
|
#if ENABLE_RAYCAST_PICKING
|
||||||
v.model.init_from(*mesh);
|
v.model.init_from(*mesh);
|
||||||
|
@ -518,7 +518,7 @@ void GLModel::init_from(const TriangleMesh& mesh, bool smooth_normals)
|
|||||||
|
|
||||||
const indexed_triangle_set& its = mesh.its;
|
const indexed_triangle_set& its = mesh.its;
|
||||||
Geometry& data = m_render_data.geometry;
|
Geometry& data = m_render_data.geometry;
|
||||||
data.format = { Geometry::EPrimitiveType::Triangles, Geometry::EVertexLayout::P3N3, GLModel::Geometry::index_type(3 * its.indices.size()) };
|
data.format = { Geometry::EPrimitiveType::Triangles, Geometry::EVertexLayout::P3N3 };
|
||||||
data.reserve_vertices(3 * its.indices.size());
|
data.reserve_vertices(3 * its.indices.size());
|
||||||
data.reserve_indices(3 * its.indices.size());
|
data.reserve_indices(3 * its.indices.size());
|
||||||
|
|
||||||
@ -530,10 +530,7 @@ void GLModel::init_from(const TriangleMesh& mesh, bool smooth_normals)
|
|||||||
// indices
|
// indices
|
||||||
for (size_t i = 0; i < its.indices.size(); ++i) {
|
for (size_t i = 0; i < its.indices.size(); ++i) {
|
||||||
const stl_triangle_vertex_indices& idx = its.indices[i];
|
const stl_triangle_vertex_indices& idx = its.indices[i];
|
||||||
if (data.format.index_type == GLModel::Geometry::EIndexType::USHORT)
|
data.add_triangle((unsigned int)idx(0), (unsigned int)idx(1), (unsigned int)idx(2));
|
||||||
data.add_ushort_triangle((unsigned short)idx(0), (unsigned short)idx(1), (unsigned short)idx(2));
|
|
||||||
else
|
|
||||||
data.add_uint_triangle((unsigned int)idx(0), (unsigned int)idx(1), (unsigned int)idx(2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update bounding box
|
// update bounding box
|
||||||
|
Loading…
x
Reference in New Issue
Block a user