Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2019-04-08 19:11:36 +0300
committerbubnikv <bubnikv@gmail.com>2019-04-08 19:11:36 +0300
commit1fffae4e0b7bd17d8dee83ce0a096a5405793cae (patch)
treeabf260ddbb2ebf6adfb962ac03e59c293e6f1eaf /src/slic3r/GUI/3DScene.cpp
parent4904359399e8aa69e4a3b975c9a335da6d69b3d4 (diff)
A little refactoring of loading meshes in VBO / non VBO case.
Diffstat (limited to 'src/slic3r/GUI/3DScene.cpp')
-rw-r--r--src/slic3r/GUI/3DScene.cpp37
1 files changed, 6 insertions, 31 deletions
diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp
index 6d23d1aa4..3dd680820 100644
--- a/src/slic3r/GUI/3DScene.cpp
+++ b/src/slic3r/GUI/3DScene.cpp
@@ -594,10 +594,7 @@ int GLVolumeCollection::load_object_volume(
this->volumes.emplace_back(new GLVolume(color));
GLVolume &v = *this->volumes.back();
v.set_color_from_model_volume(model_volume);
- if (use_VBOs)
- v.indexed_vertex_array.load_mesh_full_shading(mesh);
- else
- v.indexed_vertex_array.load_mesh_flat_shading(mesh);
+ v.indexed_vertex_array.load_mesh(mesh, use_VBOs);
// finalize_geometry() clears the vertex arrays, therefore the bounding box has to be computed before finalize_geometry().
v.bounding_box = v.indexed_vertex_array.bounding_box();
@@ -642,10 +639,7 @@ void GLVolumeCollection::load_object_auxiliary(
const ModelInstance &model_instance = *print_object->model_object()->instances[instance_idx.first];
this->volumes.emplace_back(new GLVolume((milestone == slaposBasePool) ? GLVolume::SLA_PAD_COLOR : GLVolume::SLA_SUPPORT_COLOR));
GLVolume &v = *this->volumes.back();
- if (use_VBOs)
- v.indexed_vertex_array.load_mesh_full_shading(mesh);
- else
- v.indexed_vertex_array.load_mesh_flat_shading(mesh);
+ v.indexed_vertex_array.load_mesh(mesh, use_VBOs);
// finalize_geometry() clears the vertex arrays, therefore the bounding box has to be computed before finalize_geometry().
v.bounding_box = v.indexed_vertex_array.bounding_box();
v.indexed_vertex_array.finalize_geometry(use_VBOs);
@@ -716,14 +710,8 @@ int GLVolumeCollection::load_wipe_tower_preview(
this->volumes.emplace_back(new GLVolume(color));
GLVolume &v = *this->volumes.back();
-
- if (use_VBOs)
- v.indexed_vertex_array.load_mesh_full_shading(mesh);
- else
- v.indexed_vertex_array.load_mesh_flat_shading(mesh);
-
+ v.indexed_vertex_array.load_mesh(mesh, use_VBOs);
v.set_volume_offset(Vec3d(pos_x, pos_y, 0.0));
-
// finalize_geometry() clears the vertex arrays, therefore the bounding box has to be computed before finalize_geometry().
v.bounding_box = v.indexed_vertex_array.bounding_box();
v.indexed_vertex_array.finalize_geometry(use_VBOs);
@@ -1854,12 +1842,7 @@ bool GLArrow::on_init(bool useVBOs)
triangles.emplace_back(7, 13, 6);
m_useVBOs = useVBOs;
-
- if (m_useVBOs)
- m_volume.indexed_vertex_array.load_mesh_full_shading(TriangleMesh(vertices, triangles));
- else
- m_volume.indexed_vertex_array.load_mesh_flat_shading(TriangleMesh(vertices, triangles));
-
+ m_volume.indexed_vertex_array.load_mesh(TriangleMesh(vertices, triangles), useVBOs);
m_volume.finalize_geometry(m_useVBOs);
return true;
}
@@ -1974,12 +1957,7 @@ bool GLCurvedArrow::on_init(bool useVBOs)
triangles.emplace_back(vertices_per_level, 2 * vertices_per_level + 1, vertices_per_level + 1);
m_useVBOs = useVBOs;
-
- if (m_useVBOs)
- m_volume.indexed_vertex_array.load_mesh_full_shading(TriangleMesh(vertices, triangles));
- else
- m_volume.indexed_vertex_array.load_mesh_flat_shading(TriangleMesh(vertices, triangles));
-
+ m_volume.indexed_vertex_array.load_mesh(TriangleMesh(vertices, triangles), useVBOs);
m_volume.bounding_box = m_volume.indexed_vertex_array.bounding_box();
m_volume.finalize_geometry(m_useVBOs);
return true;
@@ -2014,10 +1992,7 @@ bool GLBed::on_init_from_file(const std::string& filename, bool useVBOs)
TriangleMesh mesh = model.mesh();
mesh.repair();
- if (m_useVBOs)
- m_volume.indexed_vertex_array.load_mesh_full_shading(mesh);
- else
- m_volume.indexed_vertex_array.load_mesh_flat_shading(mesh);
+ m_volume.indexed_vertex_array.load_mesh(mesh, useVBOs);
float color[4] = { 0.235f, 0.235f, 0.235f, 1.0f };
set_color(color, 4);