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

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2018-08-17 16:53:43 +0300
committerbubnikv <bubnikv@gmail.com>2018-08-17 16:53:43 +0300
commit65011f93827a6e10757faef3d14ee068d9da8c94 (patch)
tree987d53bee4ebfa5d5dddbc3a14811c26953b2aa1 /xs/src/slic3r/GUI/3DScene.cpp
parent1ba64da3fee97433d6b580aae8fc8e9875143a66 (diff)
Removed the x(), y(), z() Point/Pointf/Point3/Pointf3 accessors.
Diffstat (limited to 'xs/src/slic3r/GUI/3DScene.cpp')
-rw-r--r--xs/src/slic3r/GUI/3DScene.cpp96
1 files changed, 48 insertions, 48 deletions
diff --git a/xs/src/slic3r/GUI/3DScene.cpp b/xs/src/slic3r/GUI/3DScene.cpp
index 68e11e378..03d997ae6 100644
--- a/xs/src/slic3r/GUI/3DScene.cpp
+++ b/xs/src/slic3r/GUI/3DScene.cpp
@@ -279,7 +279,7 @@ const Transform3f& GLVolume::world_matrix() const
if (m_dirty)
{
m_world_mat = Transform3f::Identity();
- m_world_mat.translate(Vec3f(m_origin.x(), m_origin.y(), 0));
+ m_world_mat.translate(Vec3f(m_origin(0), m_origin(1), 0));
m_world_mat.rotate(Eigen::AngleAxisf(m_angle_z, Vec3f::UnitZ()));
m_world_mat.scale(m_scale_factor);
m_dirty = false;
@@ -338,7 +338,7 @@ void GLVolume::render() const
::glCullFace(GL_BACK);
::glPushMatrix();
- ::glTranslated(m_origin.x(), m_origin.y(), m_origin.z());
+ ::glTranslated(m_origin(0), m_origin(1), m_origin(2));
::glRotatef(m_angle_z * 180.0f / PI, 0.0f, 0.0f, 1.0f);
::glScalef(m_scale_factor, m_scale_factor, m_scale_factor);
if (this->indexed_vertex_array.indexed())
@@ -372,7 +372,7 @@ void GLVolume::render_using_layer_height() const
glUniform1f(z_texture_row_to_normalized_id, (GLfloat)(1.0f / layer_height_texture_height()));
if (z_cursor_id >= 0)
- glUniform1f(z_cursor_id, (GLfloat)(layer_height_texture_data.print_object->model_object()->bounding_box().max.z() * layer_height_texture_data.z_cursor_relative));
+ glUniform1f(z_cursor_id, (GLfloat)(layer_height_texture_data.print_object->model_object()->bounding_box().max(2) * layer_height_texture_data.z_cursor_relative));
if (z_cursor_band_width_id >= 0)
glUniform1f(z_cursor_band_width_id, (GLfloat)layer_height_texture_data.edit_band_width);
@@ -464,7 +464,7 @@ void GLVolume::render_VBOs(int color_id, int detection_id, int worldmatrix_id) c
::glNormalPointer(GL_FLOAT, 6 * sizeof(float), nullptr);
::glPushMatrix();
- ::glTranslated(m_origin.x(), m_origin.y(), m_origin.z());
+ ::glTranslated(m_origin(0), m_origin(1), m_origin(2));
::glRotatef(m_angle_z * 180.0f / PI, 0.0f, 0.0f, 1.0f);
::glScalef(m_scale_factor, m_scale_factor, m_scale_factor);
@@ -509,7 +509,7 @@ void GLVolume::render_legacy() const
::glNormalPointer(GL_FLOAT, 6 * sizeof(float), indexed_vertex_array.vertices_and_normals_interleaved.data());
::glPushMatrix();
- ::glTranslated(m_origin.x(), m_origin.y(), m_origin.z());
+ ::glTranslated(m_origin(0), m_origin(1), m_origin(2));
::glRotatef(m_angle_z * 180.0f / PI, 0.0f, 0.0f, 1.0f);
::glScalef(m_scale_factor, m_scale_factor, m_scale_factor);
@@ -524,7 +524,7 @@ void GLVolume::render_legacy() const
double GLVolume::layer_height_texture_z_to_row_id() const
{
- return (this->layer_height_texture.get() == nullptr) ? 0.0 : double(this->layer_height_texture->cells - 1) / (double(this->layer_height_texture->width) * this->layer_height_texture_data.print_object->model_object()->bounding_box().max.z());
+ return (this->layer_height_texture.get() == nullptr) ? 0.0 : double(this->layer_height_texture->cells - 1) / (double(this->layer_height_texture->width) * this->layer_height_texture_data.print_object->model_object()->bounding_box().max(2));
}
void GLVolume::generate_layer_height_texture(PrintObject *print_object, bool force)
@@ -628,7 +628,7 @@ std::vector<int> GLVolumeCollection::load_object(
}
v.is_modifier = model_volume->modifier;
v.outside_printer_detection_enabled = !model_volume->modifier;
- v.set_origin(Pointf3(instance->offset.x(), instance->offset.y(), 0.0));
+ v.set_origin(Pointf3(instance->offset(0), instance->offset(1), 0.0));
v.set_angle_z(instance->rotation);
v.set_scale_factor(instance->scaling_factor);
}
@@ -742,9 +742,9 @@ bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, M
return false;
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(opt->values));
- BoundingBoxf3 print_volume(Pointf3(unscale(bed_box_2D.min.x()), unscale(bed_box_2D.min.y()), 0.0), Pointf3(unscale(bed_box_2D.max.x()), unscale(bed_box_2D.max.y()), config->opt_float("max_print_height")));
+ BoundingBoxf3 print_volume(Pointf3(unscale(bed_box_2D.min(0)), unscale(bed_box_2D.min(1)), 0.0), Pointf3(unscale(bed_box_2D.max(0)), unscale(bed_box_2D.max(1)), config->opt_float("max_print_height")));
// Allow the objects to protrude below the print bed
- print_volume.min.z() = -1e10;
+ print_volume.min(2) = -1e10;
ModelInstance::EPrintVolumeState state = ModelInstance::PVS_Inside;
bool all_contained = true;
@@ -939,8 +939,8 @@ static void thick_lines_to_indexed_vertex_array(
Pointf b2 = b;
{
double dist = 0.5 * width; // scaled
- double dx = dist * v.x();
- double dy = dist * v.y();
+ double dx = dist * v(0);
+ double dy = dist * v(1);
a1 += Vectorf(+dy, -dx);
a2 += Vectorf(-dy, +dx);
b1 += Vectorf(+dy, -dx);
@@ -949,7 +949,7 @@ static void thick_lines_to_indexed_vertex_array(
// calculate new XY normals
Vector n = line.normal();
- Vectorf3 xy_right_normal = Vectorf3::new_unscale(n.x(), n.y(), 0);
+ Vectorf3 xy_right_normal = Vectorf3::new_unscale(n(0), n(1), 0);
xy_right_normal *= inv_len;
int idx_a[4];
@@ -968,7 +968,7 @@ static void thick_lines_to_indexed_vertex_array(
// Share top / bottom vertices if possible.
if (is_first) {
idx_a[TOP] = idx_last++;
- volume.push_geometry(a.x(), a.y(), top_z , 0., 0., 1.);
+ volume.push_geometry(a(0), a(1), top_z , 0., 0., 1.);
} else {
idx_a[TOP] = idx_prev[TOP];
}
@@ -976,11 +976,11 @@ static void thick_lines_to_indexed_vertex_array(
if (is_first || bottom_z_different) {
// Start of the 1st line segment or a change of the layer thickness while maintaining the print_z.
idx_a[BOTTOM] = idx_last ++;
- volume.push_geometry(a.x(), a.y(), bottom_z, 0., 0., -1.);
+ volume.push_geometry(a(0), a(1), bottom_z, 0., 0., -1.);
idx_a[LEFT ] = idx_last ++;
- volume.push_geometry(a2.x(), a2.y(), middle_z, -xy_right_normal.x(), -xy_right_normal.y(), -xy_right_normal.z());
+ volume.push_geometry(a2(0), a2(1), middle_z, -xy_right_normal(0), -xy_right_normal(1), -xy_right_normal(2));
idx_a[RIGHT] = idx_last ++;
- volume.push_geometry(a1.x(), a1.y(), middle_z, xy_right_normal.x(), xy_right_normal.y(), xy_right_normal.z());
+ volume.push_geometry(a1(0), a1(1), middle_z, xy_right_normal(0), xy_right_normal(1), xy_right_normal(2));
}
else {
idx_a[BOTTOM] = idx_prev[BOTTOM];
@@ -1001,9 +1001,9 @@ static void thick_lines_to_indexed_vertex_array(
{
// Allocate new left / right points for the start of this segment as these points will receive their own normals to indicate a sharp turn.
idx_a[RIGHT] = idx_last++;
- volume.push_geometry(a1.x(), a1.y(), middle_z, xy_right_normal.x(), xy_right_normal.y(), xy_right_normal.z());
+ volume.push_geometry(a1(0), a1(1), middle_z, xy_right_normal(0), xy_right_normal(1), xy_right_normal(2));
idx_a[LEFT] = idx_last++;
- volume.push_geometry(a2.x(), a2.y(), middle_z, -xy_right_normal.x(), -xy_right_normal.y(), -xy_right_normal.z());
+ volume.push_geometry(a2(0), a2(1), middle_z, -xy_right_normal(0), -xy_right_normal(1), -xy_right_normal(2));
}
}
if (v_dot > 0.9) {
@@ -1029,17 +1029,17 @@ static void thick_lines_to_indexed_vertex_array(
float *p_left_prev = n_left_prev + 3;
float *n_right_prev = volume.vertices_and_normals_interleaved.data() + idx_prev[RIGHT] * 6;
float *p_right_prev = n_right_prev + 3;
- p_left_prev [0] = float(a2.x());
- p_left_prev [1] = float(a2.y());
- p_right_prev[0] = float(a1.x());
- p_right_prev[1] = float(a1.y());
- xy_right_normal.x() += n_right_prev[0];
- xy_right_normal.y() += n_right_prev[1];
+ p_left_prev [0] = float(a2(0));
+ p_left_prev [1] = float(a2(1));
+ p_right_prev[0] = float(a1(0));
+ p_right_prev[1] = float(a1(1));
+ xy_right_normal(0) += n_right_prev[0];
+ xy_right_normal(1) += n_right_prev[1];
xy_right_normal *= 1. / xy_right_normal.norm();
- n_left_prev [0] = float(-xy_right_normal.x());
- n_left_prev [1] = float(-xy_right_normal.y());
- n_right_prev[0] = float( xy_right_normal.x());
- n_right_prev[1] = float( xy_right_normal.y());
+ n_left_prev [0] = float(-xy_right_normal(0));
+ n_left_prev [1] = float(-xy_right_normal(1));
+ n_right_prev[0] = float( xy_right_normal(0));
+ n_right_prev[1] = float( xy_right_normal(1));
idx_a[LEFT ] = idx_prev[LEFT ];
idx_a[RIGHT] = idx_prev[RIGHT];
}
@@ -1080,20 +1080,20 @@ static void thick_lines_to_indexed_vertex_array(
idx_b[TOP] = idx_initial[TOP];
} else {
idx_b[TOP] = idx_last ++;
- volume.push_geometry(b.x(), b.y(), top_z , 0., 0., 1.);
+ volume.push_geometry(b(0), b(1), top_z , 0., 0., 1.);
}
if (is_closing && (width == width_initial) && (bottom_z == bottom_z_initial)) {
idx_b[BOTTOM] = idx_initial[BOTTOM];
} else {
idx_b[BOTTOM] = idx_last ++;
- volume.push_geometry(b.x(), b.y(), bottom_z, 0., 0., -1.);
+ volume.push_geometry(b(0), b(1), bottom_z, 0., 0., -1.);
}
// Generate new vertices for the end of this line segment.
idx_b[LEFT ] = idx_last ++;
- volume.push_geometry(b2.x(), b2.y(), middle_z, -xy_right_normal.x(), -xy_right_normal.y(), -xy_right_normal.z());
+ volume.push_geometry(b2(0), b2(1), middle_z, -xy_right_normal(0), -xy_right_normal(1), -xy_right_normal(2));
idx_b[RIGHT ] = idx_last ++;
- volume.push_geometry(b1.x(), b1.y(), middle_z, xy_right_normal.x(), xy_right_normal.y(), xy_right_normal.z());
+ volume.push_geometry(b1(0), b1(1), middle_z, xy_right_normal(0), xy_right_normal(1), xy_right_normal(2));
memcpy(idx_prev, idx_b, 4 * sizeof(int));
bottom_z_prev = bottom_z;
@@ -1178,10 +1178,10 @@ static void thick_lines_to_indexed_vertex_array(const Lines3& lines,
Vectorf3 n_right;
Vectorf3 unit_positive_z(0.0, 0.0, 1.0);
- if ((line.a.x() == line.b.x()) && (line.a.y() == line.b.y()))
+ if ((line.a(0) == line.b(0)) && (line.a(1) == line.b(1)))
{
// vertical segment
- n_right = (line.a.z() < line.b.z()) ? Vectorf3(-1.0, 0.0, 0.0) : Vectorf3(1.0, 0.0, 0.0);
+ n_right = (line.a(2) < line.b(2)) ? Vectorf3(-1.0, 0.0, 0.0) : Vectorf3(1.0, 0.0, 0.0);
n_top = Vectorf3(0.0, 1.0, 0.0);
}
else
@@ -1212,8 +1212,8 @@ static void thick_lines_to_indexed_vertex_array(const Lines3& lines,
int idx_b[4];
int idx_last = int(volume.vertices_and_normals_interleaved.size() / 6);
- bool z_different = (z_prev != l_a.z());
- z_prev = l_b.z();
+ bool z_different = (z_prev != l_a(2));
+ z_prev = l_b(2);
// Share top / bottom vertices if possible.
if (ii == 0)
@@ -1282,25 +1282,25 @@ static void thick_lines_to_indexed_vertex_array(const Lines3& lines,
// updates previous line normals
float* normal_left_prev = volume.vertices_and_normals_interleaved.data() + idx_prev[LEFT] * 6;
- normal_left_prev[0] = float(average_n_left.x());
- normal_left_prev[1] = float(average_n_left.y());
- normal_left_prev[2] = float(average_n_left.z());
+ normal_left_prev[0] = float(average_n_left(0));
+ normal_left_prev[1] = float(average_n_left(1));
+ normal_left_prev[2] = float(average_n_left(2));
float* normal_right_prev = volume.vertices_and_normals_interleaved.data() + idx_prev[RIGHT] * 6;
- normal_right_prev[0] = float(average_n_right.x());
- normal_right_prev[1] = float(average_n_right.y());
- normal_right_prev[2] = float(average_n_right.z());
+ normal_right_prev[0] = float(average_n_right(0));
+ normal_right_prev[1] = float(average_n_right(1));
+ normal_right_prev[2] = float(average_n_right(2));
// updates previous line's vertices around b
float* b_left_prev = normal_left_prev + 3;
- b_left_prev[0] = float(a[LEFT].x());
- b_left_prev[1] = float(a[LEFT].y());
- b_left_prev[2] = float(a[LEFT].z());
+ b_left_prev[0] = float(a[LEFT](0));
+ b_left_prev[1] = float(a[LEFT](1));
+ b_left_prev[2] = float(a[LEFT](2));
float* b_right_prev = normal_right_prev + 3;
- b_right_prev[0] = float(a[RIGHT].x());
- b_right_prev[1] = float(a[RIGHT].y());
- b_right_prev[2] = float(a[RIGHT].z());
+ b_right_prev[0] = float(a[RIGHT](0));
+ b_right_prev[1] = float(a[RIGHT](1));
+ b_right_prev[2] = float(a[RIGHT](2));
idx_a[LEFT] = idx_prev[LEFT];
idx_a[RIGHT] = idx_prev[RIGHT];