New selection -> removed obsolete methods\n+\nFixed a few compile warnings

This commit is contained in:
Enrico Turri 2018-10-08 15:17:36 +02:00
parent 384cfa0e6d
commit 9ae6d115a2
14 changed files with 39 additions and 29 deletions

View file

@ -36,7 +36,7 @@ void GLIndexedVertexArray::load_mesh_flat_shading(const TriangleMesh &mesh)
this->vertices_and_normals_interleaved.reserve(this->vertices_and_normals_interleaved.size() + 3 * 3 * 2 * mesh.facets_count());
for (int i = 0; i < mesh.stl.stats.number_of_facets; ++ i) {
for (int i = 0; i < (int)mesh.stl.stats.number_of_facets; ++i) {
const stl_facet &facet = mesh.stl.facet_start[i];
for (int j = 0; j < 3; ++ j)
this->push_geometry(facet.vertex[j](0), facet.vertex[j](1), facet.vertex[j](2), facet.normal(0), facet.normal(1), facet.normal(2));
@ -52,7 +52,7 @@ void GLIndexedVertexArray::load_mesh_full_shading(const TriangleMesh &mesh)
this->vertices_and_normals_interleaved.reserve(this->vertices_and_normals_interleaved.size() + 3 * 3 * 2 * mesh.facets_count());
unsigned int vertices_count = 0;
for (int i = 0; i < mesh.stl.stats.number_of_facets; ++i) {
for (int i = 0; i < (int)mesh.stl.stats.number_of_facets; ++i) {
const stl_facet &facet = mesh.stl.facet_start[i];
for (int j = 0; j < 3; ++j)
this->push_geometry(facet.vertex[j](0), facet.vertex[j](1), facet.vertex[j](2), facet.normal(0), facet.normal(1), facet.normal(2));
@ -244,7 +244,7 @@ void GLVolume::set_render_color(float r, float g, float b, float a)
void GLVolume::set_render_color(const float* rgba, unsigned int size)
{
size = std::min((unsigned int)4, size);
for (int i = 0; i < size; ++i)
for (unsigned int i = 0; i < size; ++i)
{
render_color[i] = rgba[i];
}
@ -802,9 +802,9 @@ int GLVolumeCollection::load_wipe_tower_preview(
// edge has y=0 and centerline of the back edge has y=depth:
Pointf3s points;
std::vector<Vec3crd> facets;
float out_points_idx[][3] = {{0, -depth, 0}, {0, 0, 0}, {38.453, 0, 0}, {61.547, 0, 0}, {100, 0, 0}, {100, -depth, 0}, {55.7735, -10, 0}, {44.2265, 10, 0},
{38.453, 0, 1}, {0, 0, 1}, {0, -depth, 1}, {100, -depth, 1}, {100, 0, 1}, {61.547, 0, 1}, {55.7735, -10, 1}, {44.2265, 10, 1}};
int out_facets_idx[][3] = {{0, 1, 2}, {3, 4, 5}, {6, 5, 0}, {3, 5, 6}, {6, 2, 7}, {6, 0, 2}, {8, 9, 10}, {11, 12, 13}, {10, 11, 14}, {14, 11, 13}, {15, 8, 14},
float out_points_idx[][3] = { { 0, -depth, 0 }, { 0, 0, 0 }, { 38.453f, 0, 0 }, { 61.547f, 0, 0 }, { 100.0f, 0, 0 }, { 100.0f, -depth, 0 }, { 55.7735f, -10.0f, 0 }, { 44.2265f, 10.0f, 0 },
{ 38.453f, 0, 1 }, { 0, 0, 1 }, { 0, -depth, 1 }, { 100.0f, -depth, 1 }, { 100.0f, 0, 1 }, { 61.547f, 0, 1 }, { 55.7735f, -10.0f, 1 }, { 44.2265f, 10.0f, 1 } };
int out_facets_idx[][3] = { { 0, 1, 2 }, { 3, 4, 5 }, { 6, 5, 0 }, { 3, 5, 6 }, { 6, 2, 7 }, { 6, 0, 2 }, { 8, 9, 10 }, { 11, 12, 13 }, { 10, 11, 14 }, { 14, 11, 13 }, { 15, 8, 14 },
{8, 10, 14}, {3, 12, 4}, {3, 13, 12}, {6, 13, 3}, {6, 14, 13}, {7, 14, 6}, {7, 15, 14}, {2, 15, 7}, {2, 8, 15}, {1, 8, 2}, {1, 9, 8},
{0, 9, 1}, {0, 10, 9}, {5, 10, 0}, {5, 11, 10}, {4, 11, 5}, {4, 12, 11}};
for (int i=0;i<16;++i)
@ -1032,7 +1032,7 @@ void GLVolumeCollection::update_colors_by_extruder(const DynamicPrintConfig* con
continue;
int extruder_id = volume->extruder_id - 1;
if ((extruder_id < 0) || ((unsigned int)colors.size() <= extruder_id))
if ((extruder_id < 0) || ((int)colors.size() <= extruder_id))
extruder_id = 0;
const Color& color = colors[extruder_id];
@ -1837,6 +1837,7 @@ void _3DScene::reset_volumes(wxGLCanvas* canvas)
s_canvas_mgr.reset_volumes(canvas);
}
#if !ENABLE_EXTENDED_SELECTION
void _3DScene::deselect_volumes(wxGLCanvas* canvas)
{
s_canvas_mgr.deselect_volumes(canvas);
@ -1851,6 +1852,7 @@ void _3DScene::update_volumes_selection(wxGLCanvas* canvas, const std::vector<in
{
s_canvas_mgr.update_volumes_selection(canvas, selections);
}
#endif // !ENABLE_EXTENDED_SELECTION
int _3DScene::check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config)
{

View file

@ -510,9 +510,11 @@ public:
static unsigned int get_volumes_count(wxGLCanvas* canvas);
static void reset_volumes(wxGLCanvas* canvas);
#if !ENABLE_EXTENDED_SELECTION
static void deselect_volumes(wxGLCanvas* canvas);
static void select_volume(wxGLCanvas* canvas, unsigned int id);
static void update_volumes_selection(wxGLCanvas* canvas, const std::vector<int>& selections);
#endif // !ENABLE_EXTENDED_SELECTION
static int check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config);
static bool move_volume_up(wxGLCanvas* canvas, unsigned int id);
static bool move_volume_down(wxGLCanvas* canvas, unsigned int id);

View file

@ -414,7 +414,7 @@ void GLCanvas3D::Bed::_calc_gridlines(const ExPolygon& poly, const BoundingBox&
}
// clip with a slightly grown expolygon because our lines lay on the contours and may get erroneously clipped
Lines gridlines = to_lines(intersection_pl(axes_lines, offset(poly, SCALED_EPSILON)));
Lines gridlines = to_lines(intersection_pl(axes_lines, offset(poly, (float)SCALED_EPSILON)));
// append bed contours
Lines contour_lines = to_lines(poly);
@ -644,7 +644,7 @@ bool GLCanvas3D::CuttingPlane::set(float z, const ExPolygons& polygons)
m_z = z;
// grow slices in order to display them better
ExPolygons expolygons = offset_ex(polygons, scale_(0.1));
ExPolygons expolygons = offset_ex(polygons, (float)scale_(0.1));
Lines lines = to_lines(expolygons);
return m_lines.set_from_lines(lines, m_z);
}
@ -2621,32 +2621,28 @@ void GLCanvas3D::reset_volumes()
_reset_warning_texture();
}
#if !ENABLE_EXTENDED_SELECTION
void GLCanvas3D::deselect_volumes()
{
#if !ENABLE_EXTENDED_SELECTION
for (GLVolume* vol : m_volumes.volumes)
{
if (vol != nullptr)
vol->selected = false;
}
#endif // !ENABLE_EXTENDED_SELECTION
}
void GLCanvas3D::select_volume(unsigned int id)
{
#if !ENABLE_EXTENDED_SELECTION
if (id < (unsigned int)m_volumes.volumes.size())
{
GLVolume* vol = m_volumes.volumes[id];
if (vol != nullptr)
vol->selected = true;
}
#endif // !ENABLE_EXTENDED_SELECTION
}
void GLCanvas3D::update_volumes_selection(const std::vector<int>& selections)
{
#if !ENABLE_EXTENDED_SELECTION
if (m_model == nullptr)
return;
@ -2664,8 +2660,8 @@ void GLCanvas3D::update_volumes_selection(const std::vector<int>& selections)
}
}
}
#endif // !ENABLE_EXTENDED_SELECTION
}
#endif // !ENABLE_EXTENDED_SELECTION
int GLCanvas3D::check_volumes_outside_state(const DynamicPrintConfig* config) const
{

View file

@ -693,9 +693,11 @@ public:
unsigned int get_volumes_count() const;
void reset_volumes();
#if !ENABLE_EXTENDED_SELECTION
void deselect_volumes();
void select_volume(unsigned int id);
void update_volumes_selection(const std::vector<int>& selections);
#endif // !ENABLE_EXTENDED_SELECTION
int check_volumes_outside_state(const DynamicPrintConfig* config) const;
bool move_volume_up(unsigned int id);
bool move_volume_down(unsigned int id);

View file

@ -246,6 +246,7 @@ void GLCanvas3DManager::reset_volumes(wxGLCanvas* canvas)
it->second->reset_volumes();
}
#if !ENABLE_EXTENDED_SELECTION
void GLCanvas3DManager::deselect_volumes(wxGLCanvas* canvas)
{
CanvasesMap::iterator it = _get_canvas(canvas);
@ -266,6 +267,7 @@ void GLCanvas3DManager::update_volumes_selection(wxGLCanvas* canvas, const std::
if (it != m_canvases.end())
it->second->update_volumes_selection(selections);
}
#endif // !ENABLE_EXTENDED_SELECTION
int GLCanvas3DManager::check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config) const
{

View file

@ -87,9 +87,11 @@ public:
unsigned int get_volumes_count(wxGLCanvas* canvas) const;
void reset_volumes(wxGLCanvas* canvas);
#if !ENABLE_EXTENDED_SELECTION
void deselect_volumes(wxGLCanvas* canvas);
void select_volume(wxGLCanvas* canvas, unsigned int id);
void update_volumes_selection(wxGLCanvas* canvas, const std::vector<int>& selections);
#endif // !ENABLE_EXTENDED_SELECTION
int check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config) const;
bool move_volume_up(wxGLCanvas* canvas, unsigned int id);
bool move_volume_down(wxGLCanvas* canvas, unsigned int id);

View file

@ -135,7 +135,7 @@ bool GLShader::load_from_file(const char* fragment_shader_filename, const char*
return false;
vs.seekg(0, vs.end);
int file_length = vs.tellg();
int file_length = (int)vs.tellg();
vs.seekg(0, vs.beg);
std::string vertex_shader(file_length, '\0');
vs.read(const_cast<char*>(vertex_shader.data()), file_length);
@ -149,7 +149,7 @@ bool GLShader::load_from_file(const char* fragment_shader_filename, const char*
return false;
fs.seekg(0, fs.end);
file_length = fs.tellg();
file_length = (int)fs.tellg();
fs.seekg(0, fs.beg);
std::string fragment_shader(file_length, '\0');
fs.read(const_cast<char*>(fragment_shader.data()), file_length);

View file

@ -26,7 +26,9 @@ wxDEFINE_EVENT(EVT_GLTOOLBAR_SPLIT, SimpleEvent);
wxDEFINE_EVENT(EVT_GLTOOLBAR_CUT, SimpleEvent);
wxDEFINE_EVENT(EVT_GLTOOLBAR_SETTINGS, SimpleEvent);
wxDEFINE_EVENT(EVT_GLTOOLBAR_LAYERSEDITING, SimpleEvent);
#if !ENABLE_EXTENDED_SELECTION
wxDEFINE_EVENT(EVT_GLTOOLBAR_SELECTBYPARTS, SimpleEvent);
#endif // !ENABLE_EXTENDED_SELECTION
GLToolbarItem::Data::Data()

View file

@ -26,7 +26,9 @@ wxDECLARE_EVENT(EVT_GLTOOLBAR_SPLIT, SimpleEvent);
wxDECLARE_EVENT(EVT_GLTOOLBAR_CUT, SimpleEvent);
wxDECLARE_EVENT(EVT_GLTOOLBAR_SETTINGS, SimpleEvent);
wxDECLARE_EVENT(EVT_GLTOOLBAR_LAYERSEDITING, SimpleEvent);
#if !ENABLE_EXTENDED_SELECTION
wxDECLARE_EVENT(EVT_GLTOOLBAR_SELECTBYPARTS, SimpleEvent);
#endif // !ENABLE_EXTENDED_SELECTION
class GLToolbarItem
{