mirror of https://github.com/CGAL/cgal
Merge pull request #5473 from maxGimeno/Demo-Fixes-maxGimeno
Polyhedron demo: Fixes for 5.1 Conflicts: Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_spheres.vert Polyhedron/demo/Polyhedron/resources/shader_spheres.vert
This commit is contained in:
commit
f712a2a3a0
|
|
@ -59,7 +59,7 @@ void AxisPlaneConstraint::setTranslationConstraintDirection(
|
|||
if ((translationConstraintType() != AxisPlaneConstraint::FREE) &&
|
||||
(translationConstraintType() != AxisPlaneConstraint::FORBIDDEN)) {
|
||||
const qreal norm = direction.norm();
|
||||
if (norm < 1E-8) {
|
||||
if (norm == 0) {
|
||||
qWarning("AxisPlaneConstraint::setTranslationConstraintDir: null vector "
|
||||
"for translation constraint");
|
||||
translationConstraintType_ = AxisPlaneConstraint::FREE;
|
||||
|
|
|
|||
|
|
@ -2957,6 +2957,8 @@ void MainWindow::on_actionSa_ve_Scene_as_Script_triggered()
|
|||
last_saved_dir,
|
||||
"Qt Script files (*.js)");
|
||||
}
|
||||
if(!filename.endsWith(".js"))
|
||||
filename.append(".js");
|
||||
std::ofstream os(filename.toUtf8(), std::ofstream::binary);
|
||||
if(!os)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -175,11 +175,11 @@ void Polyhedron_demo_diff_between_meshes_plugin::diff()
|
|||
|
||||
Scene_surface_mesh_item* m1_over_m2_item = new Scene_surface_mesh_item(m1_over_m2);
|
||||
m1_over_m2_item->setColor(QColor(Qt::blue));
|
||||
m1_over_m2_item->setName(QString("%1 - %2").arg(m1_item->name()).arg(m2_item->name()));
|
||||
m1_over_m2_item->setName(QString("%2 - %1").arg(m1_item->name()).arg(m2_item->name()));
|
||||
CGAL::Three::Three::scene()->addItem(m1_over_m2_item);
|
||||
Scene_surface_mesh_item* m2_over_m1_item = new Scene_surface_mesh_item(m2_over_m1);
|
||||
m2_over_m1_item->setColor(QColor(Qt::red));
|
||||
m2_over_m1_item->setName(QString("%2 - %1").arg(m1_item->name()).arg(m2_item->name()));
|
||||
m2_over_m1_item->setName(QString("%1 - %2").arg(m1_item->name()).arg(m2_item->name()));
|
||||
CGAL::Three::Three::scene()->addItem(m2_over_m1_item);
|
||||
Scene_surface_mesh_item* common_item = new Scene_surface_mesh_item(common);
|
||||
common_item->setColor(QColor(Qt::green));
|
||||
|
|
|
|||
|
|
@ -809,12 +809,14 @@ bool Scene_edit_box_item::eventFilter(QObject *obj, QEvent *event)
|
|||
d->selected_vertices.push_back(d->faces[picked].vertices[i]);
|
||||
Kernel::Point_3 a1(d->faces[picked].vertices[1]->position()), a0(d->faces[picked].vertices[0]->position())
|
||||
,a3(d->faces[picked].vertices[3]->position());
|
||||
QVector3D a(a1.x()-a0.x(), a1.y()-a0.y(),a1.z()-a0.z()),b(a3.x()-a0.x(), a3.y()-a0.y(),a3.z()-a0.z());
|
||||
QVector3D n = QVector3D::crossProduct(a,b);
|
||||
Kernel::Vector_3 a = a1 - a0,
|
||||
b = a3 - a0;
|
||||
Kernel::Vector_3 n = CGAL::cross_product(a,b);
|
||||
|
||||
d->remodel_frame->setConstraint(&d->constraint);
|
||||
d->constraint.setTranslationConstraintType(CGAL::qglviewer::AxisPlaneConstraint::AXIS);
|
||||
d->constraint.setTranslationConstraintDirection(CGAL::qglviewer::Vec(n.x(), n.y(), n.z()));
|
||||
|
||||
}
|
||||
|
||||
viewer->setManipulatedFrame(d->remodel_frame);
|
||||
|
|
|
|||
|
|
@ -1029,6 +1029,10 @@ bool Scene_polyhedron_selection_item::treat_selection(const std::set<fg_vertex_d
|
|||
setProperty("need_hl_restore", true);
|
||||
set_highlighting(false);
|
||||
}
|
||||
if(property("need_invalidate_aabb_tree").toBool()){
|
||||
polyhedron_item()->invalidate_aabb_tree();
|
||||
setProperty("need_invalidate_aabb_tree", false);
|
||||
}
|
||||
invalidateOpenGLBuffers();
|
||||
Q_EMIT updateInstructions("Ctrl+Right-click to move the point. \nHit Ctrl+Z to leave the selection. (2/2)");
|
||||
}
|
||||
|
|
@ -1953,6 +1957,7 @@ void Scene_polyhedron_selection_item::moveVertex()
|
|||
put(vpm, vh, Point_3(d->manipulated_frame->position().x-offset.x,
|
||||
d->manipulated_frame->position().y-offset.y,
|
||||
d->manipulated_frame->position().z-offset.z));
|
||||
setProperty("need_invalidate_aabb_tree", true);
|
||||
invalidateOpenGLBuffers();
|
||||
poly_item->updateVertex(vh);
|
||||
// poly_item->invalidateOpenGLBuffers();
|
||||
|
|
@ -1972,6 +1977,10 @@ void Scene_polyhedron_selection_item::validateMoveVertex()
|
|||
set_highlighting(true);
|
||||
setProperty("need_hl_restore", false);
|
||||
}
|
||||
if(property("need_invalidate_aabb_tree").toBool()){
|
||||
polyhedron_item()->invalidate_aabb_tree();
|
||||
setProperty("need_invalidate_aabb_tree", false);
|
||||
}
|
||||
Q_EMIT updateInstructions("Select a vertex. (1/2)");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ void create_flat_and_wire_sphere(FLOAT R,
|
|||
const float sectors=float(prec);
|
||||
const float to_rad = static_cast<float>(CGAL_PI / 180.0);
|
||||
|
||||
create_flat_sphere(R, positions_spheres, normals_spheres);
|
||||
create_flat_sphere(R, positions_spheres, normals_spheres, prec);
|
||||
|
||||
float T, P;
|
||||
float x[4],y[4],z[4];
|
||||
|
|
|
|||
|
|
@ -20,12 +20,13 @@ void main(void)
|
|||
for(int i=0; i<6; ++i)
|
||||
dist[i] = 1.0;
|
||||
color = vec4(colors, 1.0);
|
||||
fP = mv_matrix * vertex;
|
||||
vec4 transformed_vertex =
|
||||
vec4(radius*vertex.x + center.x, radius* vertex.y + center.y, radius*vertex.z + center.z, 1.0);
|
||||
fP = mv_matrix * transformed_vertex;
|
||||
mat3 norm_matrix_3;
|
||||
norm_matrix_3[0] = norm_matrix[0].xyz;
|
||||
norm_matrix_3[1] = norm_matrix[1].xyz;
|
||||
norm_matrix_3[2] = norm_matrix[2].xyz;
|
||||
fN = norm_matrix_3* normals;
|
||||
gl_Position = mvp_matrix * f_matrix *
|
||||
vec4(radius*vertex.x + center.x, radius* vertex.y + center.y, radius*vertex.z + center.z, 1.0) ;
|
||||
gl_Position = mvp_matrix * f_matrix * transformed_vertex;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,13 @@ void main(void)
|
|||
for(int i=0; i<6; ++i)
|
||||
dist[i] = 1.0;
|
||||
color = vec4(colors, 1.0);
|
||||
fP = mv_matrix * vertex;
|
||||
vec4 transformed_vertex =
|
||||
vec4(radius*vertex.x + center.x, radius* vertex.y + center.y, radius*vertex.z + center.z, 1.0);
|
||||
fP = mv_matrix * transformed_vertex;
|
||||
mat3 norm_matrix_3;
|
||||
norm_matrix_3[0] = norm_matrix[0].xyz;
|
||||
norm_matrix_3[1] = norm_matrix[1].xyz;
|
||||
norm_matrix_3[2] = norm_matrix[2].xyz;
|
||||
fN = norm_matrix_3* normals;
|
||||
gl_Position = mvp_matrix * f_matrix *
|
||||
vec4(radius*vertex.x + center.x, radius* vertex.y + center.y, radius*vertex.z + center.z, 1.0) ;
|
||||
gl_Position = mvp_matrix * f_matrix * transformed_vertex;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue