extra run of the script to remove tabs and trailing whitespaces

This commit is contained in:
Sébastien Loriot 2020-03-26 18:58:50 +01:00
parent c1a42c7d37
commit 58b10a3605
16 changed files with 539 additions and 539 deletions

View File

@ -6,7 +6,7 @@
// $URL$ // $URL$
// $Id$ // $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
// //
// //
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr> // Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
@ -57,7 +57,7 @@ namespace internal
normal); normal);
++nb; ++nb;
} }
assert(nb>0); assert(nb>0);
return (typename Kernel_traits<Vector>::Kernel::Construct_scaled_vector_3() return (typename Kernel_traits<Vector>::Kernel::Construct_scaled_vector_3()
(normal, 1.0/nb)); (normal, 1.0/nb));
@ -189,18 +189,18 @@ public:
bool has_flat_normal() const bool has_flat_normal() const
{ return m_flat_normal_buffer!=nullptr; } { return m_flat_normal_buffer!=nullptr; }
bool has_gouraud_normal() const bool has_gouraud_normal() const
{ return m_gouraud_normal_buffer!=nullptr; } { return m_gouraud_normal_buffer!=nullptr; }
bool has_zero_x() const bool has_zero_x() const
{ return m_zero_x; } { return m_zero_x; }
bool has_zero_y() const bool has_zero_y() const
{ return m_zero_y; } { return m_zero_y; }
bool has_zero_z() const bool has_zero_z() const
{ return m_zero_z; } { return m_zero_z; }
void negate_normals() void negate_normals()
{ {
@ -212,19 +212,19 @@ public:
{ (*array)[i]=-(*array)[i]; } { (*array)[i]=-(*array)[i]; }
} }
} }
// 1.1) Add a point, without color. Return the index of the added point. // 1.1) Add a point, without color. Return the index of the added point.
template<typename KPoint> template<typename KPoint>
std::size_t add_point(const KPoint& kp) std::size_t add_point(const KPoint& kp)
{ {
if (!has_position()) return (std::size_t)-1; if (!has_position()) return (std::size_t)-1;
Local_point p=get_local_point(kp); Local_point p=get_local_point(kp);
add_point_in_buffer(p, *m_pos_buffer); add_point_in_buffer(p, *m_pos_buffer);
if (m_bb!=nullptr) if (m_bb!=nullptr)
{ (*m_bb)=(*m_bb)+p.bbox(); } { (*m_bb)=(*m_bb)+p.bbox(); }
if (m_zero_x && p.x()!=0) { m_zero_x=false; } if (m_zero_x && p.x()!=0) { m_zero_x=false; }
if (m_zero_y && p.y()!=0) { m_zero_y=false; } if (m_zero_y && p.y()!=0) { m_zero_y=false; }
if (m_zero_z && p.z()!=0) { m_zero_z=false; } if (m_zero_z && p.z()!=0) { m_zero_z=false; }
@ -265,7 +265,7 @@ public:
add_point(kp1); add_point(kp1);
add_point(kp2); add_point(kp2);
} }
// 2.2) Add a segment, with color. // 2.2) Add a segment, with color.
template<typename KPoint> template<typename KPoint>
void add_segment(const KPoint& kp1, const KPoint& kp2, const CGAL::Color& c) void add_segment(const KPoint& kp1, const KPoint& kp2, const CGAL::Color& c)
@ -273,7 +273,7 @@ public:
add_segment(kp1, kp2); add_segment(kp1, kp2);
add_color(c); add_color(c);
add_color(c); add_color(c);
} }
// 2.3) Add an indexed segment, without color. // 2.3) Add an indexed segment, without color.
template<typename T> template<typename T>
@ -324,7 +324,7 @@ public:
/// @return true iff a face has begun. /// @return true iff a face has begun.
bool is_a_face_started() const bool is_a_face_started() const
{ return m_face_started; } { return m_face_started; }
// 3.1) Add a face, without color, without normal. // 3.1) Add a face, without color, without normal.
void face_begin() void face_begin()
{ face_begin_internal(false, false); } { face_begin_internal(false, false); }
@ -369,7 +369,7 @@ public:
} }
return false; return false;
} }
/// Add a point at the end of the current face /// Add a point at the end of the current face
/// @param p the point to add /// @param p the point to add
/// @p_normal the vertex normal at this point (for Gouraud shading) /// @p_normal the vertex normal at this point (for Gouraud shading)
@ -385,7 +385,7 @@ public:
} }
/// Add an indexed point at the end of the current face, without giving the vertex normal. /// Add an indexed point at the end of the current face, without giving the vertex normal.
/// When Indexation is used, it is not possible to use flat shading or multiple colors /// When Indexation is used, it is not possible to use flat shading or multiple colors
/// for face sor edges. /// for face sor edges.
/// Note that we still need the point itself, in order to triangulate the face when necessary. /// Note that we still need the point itself, in order to triangulate the face when necessary.
template<typename T, typename KPoint> template<typename T, typename KPoint>
@ -398,7 +398,7 @@ public:
} }
return false; return false;
} }
/// End the face: compute the triangulation. /// End the face: compute the triangulation.
void face_end() void face_end()
{ {
@ -408,7 +408,7 @@ public:
{ {
/* std::cerr<<"PB: you try to triangulate a face with "<<m_points_of_face.size()<<" vertices." /* std::cerr<<"PB: you try to triangulate a face with "<<m_points_of_face.size()<<" vertices."
<<std::endl; */ <<std::endl; */
m_face_started=false; m_face_started=false;
m_points_of_face.clear(); m_points_of_face.clear();
m_vertex_normals_for_face.clear(); m_vertex_normals_for_face.clear();
@ -433,7 +433,7 @@ public:
<<std::endl; <<std::endl;
m_vertex_normals_for_face.clear(); m_vertex_normals_for_face.clear();
} }
Local_vector normal=(m_started_face_has_normal?m_normal_of_face: Local_vector normal=(m_started_face_has_normal?m_normal_of_face:
internal::compute_normal_of_face internal::compute_normal_of_face
<Local_point, Local_vector>(m_points_of_face)); <Local_point, Local_vector>(m_points_of_face));
@ -444,7 +444,7 @@ public:
{ {
if (m_points_of_face.size()==4) if (m_points_of_face.size()==4)
{ convex_quadrangular_face_end_internal(normal); } // Convex quad { convex_quadrangular_face_end_internal(normal); } // Convex quad
else else
{ convex_face_end_internal(normal); } // Convex face with > 4 vertices { convex_face_end_internal(normal); } // Convex face with > 4 vertices
} }
else else
@ -515,10 +515,10 @@ public:
const Local_point& S=facet[id]; const Local_point& S=facet[id];
const Local_point& T=facet[(id+1==facet.size())?0:id+1]; const Local_point& T=facet[(id+1==facet.size())?0:id+1];
Local_vector V1=Local_vector((T-S).x(), (T-S).y(), (T-S).z()); Local_vector V1=Local_vector((T-S).x(), (T-S).y(), (T-S).z());
const Local_point& U=facet[(id+2>=facet.size())?id+2-facet.size():id+2]; const Local_point& U=facet[(id+2>=facet.size())?id+2-facet.size():id+2];
Local_vector V2=Local_vector((U-T).x(), (U-T).y(), (U-T).z()); Local_vector V2=Local_vector((U-T).x(), (U-T).y(), (U-T).z());
local_orientation=Local_kernel::Orientation_3()(V1, V2, normal) ; local_orientation=Local_kernel::Orientation_3()(V1, V2, normal) ;
if(local_orientation!=CGAL::ZERO && local_orientation!=orientation) if(local_orientation!=CGAL::ZERO && local_orientation!=orientation)
@ -537,7 +537,7 @@ protected:
std::cerr<<"You cannot start a new face before to finish the previous one."<<std::endl; std::cerr<<"You cannot start a new face before to finish the previous one."<<std::endl;
return; return;
} }
m_face_started=true; m_face_started=true;
m_started_face_is_colored=has_color; m_started_face_is_colored=has_color;
m_started_face_has_normal=has_normal; m_started_face_has_normal=has_normal;
@ -553,14 +553,14 @@ protected:
{ {
// If user gave vertex indices // If user gave vertex indices
if (m_indices_of_points_of_face.size()>0) if (m_indices_of_points_of_face.size()>0)
{ {
add_indexed_point(m_indices_of_points_of_face[i]); add_indexed_point(m_indices_of_points_of_face[i]);
} }
else else
{ {
add_point(m_points_of_face[i]); // Add the position of the point add_point(m_points_of_face[i]); // Add the position of the point
if (m_started_face_is_colored) if (m_started_face_is_colored)
{ add_color(m_color_of_face); } // Add the color { add_color(m_color_of_face); } // Add the color
add_flat_normal(normal); // Add the flat normal add_flat_normal(normal); // Add the flat normal
// Its smooth normal (if given by the user) // Its smooth normal (if given by the user)
if (m_vertex_normals_for_face.size()>0) if (m_vertex_normals_for_face.size()>0)
@ -575,7 +575,7 @@ protected:
} }
} }
} }
void convex_quadrangular_face_end_internal(const Local_vector& normal) void convex_quadrangular_face_end_internal(const Local_vector& normal)
{ {
// Add indices when they exist // Add indices when they exist
@ -584,7 +584,7 @@ protected:
add_indexed_point(m_indices_of_points_of_face[0]); add_indexed_point(m_indices_of_points_of_face[0]);
add_indexed_point(m_indices_of_points_of_face[1]); add_indexed_point(m_indices_of_points_of_face[1]);
add_indexed_point(m_indices_of_points_of_face[2]); add_indexed_point(m_indices_of_points_of_face[2]);
add_indexed_point(m_indices_of_points_of_face[0]); add_indexed_point(m_indices_of_points_of_face[0]);
add_indexed_point(m_indices_of_points_of_face[2]); add_indexed_point(m_indices_of_points_of_face[2]);
add_indexed_point(m_indices_of_points_of_face[3]); add_indexed_point(m_indices_of_points_of_face[3]);
@ -609,7 +609,7 @@ protected:
add_flat_normal(normal); add_flat_normal(normal);
if (m_vertex_normals_for_face.size()==0) if (m_vertex_normals_for_face.size()==0)
{ add_gouraud_normal(normal); } { add_gouraud_normal(normal); }
} }
if (m_vertex_normals_for_face.size()>0) if (m_vertex_normals_for_face.size()>0)
@ -617,14 +617,14 @@ protected:
add_gouraud_normal(m_vertex_normals_for_face[0]); add_gouraud_normal(m_vertex_normals_for_face[0]);
add_gouraud_normal(m_vertex_normals_for_face[1]); add_gouraud_normal(m_vertex_normals_for_face[1]);
add_gouraud_normal(m_vertex_normals_for_face[2]); add_gouraud_normal(m_vertex_normals_for_face[2]);
add_gouraud_normal(m_vertex_normals_for_face[0]); add_gouraud_normal(m_vertex_normals_for_face[0]);
add_gouraud_normal(m_vertex_normals_for_face[2]); add_gouraud_normal(m_vertex_normals_for_face[2]);
add_gouraud_normal(m_vertex_normals_for_face[3]); add_gouraud_normal(m_vertex_normals_for_face[3]);
} }
} }
} }
void convex_face_end_internal(const Local_vector& normal) void convex_face_end_internal(const Local_vector& normal)
{ {
for(std::size_t i=1; i<m_points_of_face.size()-1; ++i) for(std::size_t i=1; i<m_points_of_face.size()-1; ++i)
@ -669,7 +669,7 @@ protected:
} }
} }
} }
void nonconvex_face_end_internal(const Local_vector& normal) void nonconvex_face_end_internal(const Local_vector& normal)
{ {
try try
@ -678,7 +678,7 @@ protected:
CDT cdt(cdt_traits); CDT cdt(cdt_traits);
bool with_vertex_normal=(m_vertex_normals_for_face.size()==m_points_of_face.size()); bool with_vertex_normal=(m_vertex_normals_for_face.size()==m_points_of_face.size());
Local_point p1, p2; Local_point p1, p2;
// For each point of the face, store the list of adjacent points and the number of time // For each point of the face, store the list of adjacent points and the number of time
// the edge is found in the face. For an edge p1, p2, store edge min(p1,p2)->max(p1,p2) // the edge is found in the face. For an edge p1, p2, store edge min(p1,p2)->max(p1,p2)
std::map<Local_point, std::map<Local_point, unsigned int> > edges; std::map<Local_point, std::map<Local_point, unsigned int> > edges;
@ -687,13 +687,13 @@ protected:
p1=m_points_of_face[i]; p1=m_points_of_face[i];
p2=m_points_of_face[i==0?m_points_of_face.size()-1:i-1]; p2=m_points_of_face[i==0?m_points_of_face.size()-1:i-1];
if (p2<p1) { std::swap(p1, p2); } if (p2<p1) { std::swap(p1, p2); }
if (edges.count(p1)==0) if (edges.count(p1)==0)
{ std::map<Local_point, unsigned int> m; m[p2]=1; edges[p1]=m; } { std::map<Local_point, unsigned int> m; m[p2]=1; edges[p1]=m; }
else if (edges[p1].count(p2)==0) { edges[p1][p2]=1; } else if (edges[p1].count(p2)==0) { edges[p1][p2]=1; }
else { ++(edges[p1][p2]); } else { ++(edges[p1][p2]); }
} }
// (1) We insert all the edges as contraint in the CDT. // (1) We insert all the edges as contraint in the CDT.
typename CDT::Vertex_handle previous=nullptr, first=nullptr; typename CDT::Vertex_handle previous=nullptr, first=nullptr;
for (unsigned int i=0; i<m_points_of_face.size(); ++i) for (unsigned int i=0; i<m_points_of_face.size(); ++i)
@ -701,7 +701,7 @@ protected:
typename CDT::Vertex_handle vh = cdt.insert(m_points_of_face[i]); typename CDT::Vertex_handle vh = cdt.insert(m_points_of_face[i]);
if(first==nullptr) if(first==nullptr)
{ first=vh; } { first=vh; }
if (with_vertex_normal) if (with_vertex_normal)
{ vh->info().v=m_vertex_normals_for_face[i]; } { vh->info().v=m_vertex_normals_for_face[i]; }
else else
@ -709,7 +709,7 @@ protected:
if (m_indices_of_points_of_face.size()>0) if (m_indices_of_points_of_face.size()>0)
{ vh->info().index=m_indices_of_points_of_face[i]; } { vh->info().index=m_indices_of_points_of_face[i]; }
if(previous!=nullptr && previous!=vh) if(previous!=nullptr && previous!=vh)
{ {
p1=m_points_of_face[i]; p2=m_points_of_face[i-1]; p1=m_points_of_face[i]; p2=m_points_of_face[i-1];
@ -719,7 +719,7 @@ protected:
} }
previous=vh; previous=vh;
} }
if (previous!=nullptr && previous!=first) if (previous!=nullptr && previous!=first)
{ {
p1=m_points_of_face[m_points_of_face.size()-1]; p2=m_points_of_face[0]; p1=m_points_of_face[m_points_of_face.size()-1]; p2=m_points_of_face[0];
@ -727,9 +727,9 @@ protected:
if ((edges[p1][p2])%2==1) // odd number of time => constraint if ((edges[p1][p2])%2==1) // odd number of time => constraint
{ cdt.insert_constraint(previous, first); } { cdt.insert_constraint(previous, first); }
} }
// (2) We mark all external triangles // (2) We mark all external triangles
// (2.1) We initialize is_external and is_process values // (2.1) We initialize is_external and is_process values
for(typename CDT::All_faces_iterator fit = cdt.all_faces_begin(), for(typename CDT::All_faces_iterator fit = cdt.all_faces_begin(),
fitend = cdt.all_faces_end(); fit!=fitend; ++fit) fitend = cdt.all_faces_end(); fit!=fitend; ++fit)
{ {
@ -762,10 +762,10 @@ protected:
} }
} }
} }
if ( face_internal!=nullptr ) if ( face_internal!=nullptr )
{ face_queue.push(face_internal); } { face_queue.push(face_internal); }
while(!face_queue.empty()) while(!face_queue.empty())
{ {
typename CDT::Face_handle fh = face_queue.front(); typename CDT::Face_handle fh = face_queue.front();
@ -784,8 +784,8 @@ protected:
} }
} }
} }
// (3) Now we iterates on the internal faces to add the vertices // (3) Now we iterates on the internal faces to add the vertices
// and the normals to the appropriate vectors // and the normals to the appropriate vectors
for(typename CDT::Finite_faces_iterator ffit=cdt.finite_faces_begin(), for(typename CDT::Finite_faces_iterator ffit=cdt.finite_faces_begin(),
ffitend = cdt.finite_faces_end(); ffit!=ffitend; ++ffit) ffitend = cdt.finite_faces_end(); ffit!=ffitend; ++ffit)
@ -793,7 +793,7 @@ protected:
if(!ffit->info().is_external) if(!ffit->info().is_external)
{ {
for(unsigned int i=0; i<3; ++i) for(unsigned int i=0; i<3; ++i)
{ {
// Add indices when they exist // Add indices when they exist
if (m_indices_of_points_of_face.size()>0) if (m_indices_of_points_of_face.size()>0)
{ add_indexed_point(ffit->vertex(i)->info().index); } { add_indexed_point(ffit->vertex(i)->info().index); }
@ -832,7 +832,7 @@ protected:
if (m_color_buffer!=nullptr) if (m_color_buffer!=nullptr)
{ add_color_in_buffer(acolor, *m_color_buffer); } { add_color_in_buffer(acolor, *m_color_buffer); }
} }
template<typename KVector> template<typename KVector>
void add_flat_normal(const KVector& kv) void add_flat_normal(const KVector& kv)
{ {
@ -899,7 +899,7 @@ protected:
bool m_zero_z; /// True iff all points have z==0 bool m_zero_z; /// True iff all points have z==0
bool m_inverse_normal;; bool m_inverse_normal;;
// Local variables, used when we started a new face.g // Local variables, used when we started a new face.g
bool m_face_started; bool m_face_started;
bool m_started_face_is_colored; bool m_started_face_is_colored;

View File

@ -202,7 +202,7 @@ This method is automatically called once, before the first call to paintGL().
Overload init() instead of this method to modify viewer specific OpenGL state. Overload init() instead of this method to modify viewer specific OpenGL state.
If a 4.3 context could not be set, a ES 2.0 context will be used instead. If a 4.3 context could not be set, a ES 2.0 context will be used instead.
\see `isOpenGL_4_3()` \see `isOpenGL_4_3()`
*/ */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
@ -214,7 +214,7 @@ void CGAL::QGLViewer::initializeGL() {
if ( !context()->isValid() if ( !context()->isValid()
|| format.majorVersion() != 4 || format.majorVersion() != 4
|| QCoreApplication::arguments().contains(QStringLiteral("--old"))) || QCoreApplication::arguments().contains(QStringLiteral("--old")))
{ {
format.setDepthBufferSize(24); format.setDepthBufferSize(24);
format.setStencilBufferSize(8); format.setStencilBufferSize(8);
@ -223,7 +223,7 @@ void CGAL::QGLViewer::initializeGL() {
format.setSamples(0); format.setSamples(0);
format.setOption(QSurfaceFormat::DebugContext); format.setOption(QSurfaceFormat::DebugContext);
QSurfaceFormat::setDefaultFormat(format); QSurfaceFormat::setDefaultFormat(format);
needNewContext(); needNewContext();
qDebug()<<"GL 4.3 context initialization failed. "; qDebug()<<"GL 4.3 context initialization failed. ";
is_ogl_4_3 = false; is_ogl_4_3 = false;
@ -232,7 +232,7 @@ void CGAL::QGLViewer::initializeGL() {
{ {
is_ogl_4_3 = true; is_ogl_4_3 = true;
} }
QSurfaceFormat cur_f = QOpenGLContext::currentContext()->format(); QSurfaceFormat cur_f = QOpenGLContext::currentContext()->format();
const char* rt =(cur_f.renderableType() == QSurfaceFormat::OpenGLES) ? "GLES" : "GL"; const char* rt =(cur_f.renderableType() == QSurfaceFormat::OpenGLES) ? "GLES" : "GL";
qDebug()<<"Using context " qDebug()<<"Using context "
@ -258,7 +258,7 @@ void CGAL::QGLViewer::initializeGL() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Calls user defined method. Default emits a signal. // Calls user defined method. Default emits a signal.
init(); init();
//OpenGL buffers and programs initialization //OpenGL buffers and programs initialization
for(int i=0; i<VAO_size; ++i) for(int i=0; i<VAO_size; ++i)
{ {
@ -312,11 +312,11 @@ void CGAL::QGLViewer::initializeGL() {
"} \n" "} \n"
"\n" "\n"
}; };
//It is said in the doc that a QOpenGLShader is //It is said in the doc that a QOpenGLShader is
// only destroyed with the QOpenGLShaderProgram // only destroyed with the QOpenGLShaderProgram
//it has been linked with. //it has been linked with.
QOpenGLShader vertex_shader(QOpenGLShader::Vertex); QOpenGLShader vertex_shader(QOpenGLShader::Vertex);
QOpenGLShader fragment_shader(QOpenGLShader::Fragment); QOpenGLShader fragment_shader(QOpenGLShader::Fragment);
if(is_ogl_4_3) if(is_ogl_4_3)
@ -325,7 +325,7 @@ void CGAL::QGLViewer::initializeGL() {
{ {
std::cerr<<"Compiling vertex source FAILED"<<std::endl; std::cerr<<"Compiling vertex source FAILED"<<std::endl;
} }
if(!fragment_shader.compileSourceCode(f_s)) if(!fragment_shader.compileSourceCode(f_s))
{ {
std::cerr<<"Compiling fragmentsource FAILED"<<std::endl; std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
@ -337,7 +337,7 @@ void CGAL::QGLViewer::initializeGL() {
{ {
std::cerr<<"Compiling vertex source FAILED"<<std::endl; std::cerr<<"Compiling vertex source FAILED"<<std::endl;
} }
if(!fragment_shader.compileSourceCode(f_source_comp)) if(!fragment_shader.compileSourceCode(f_source_comp))
{ {
std::cerr<<"Compiling fragmentsource FAILED"<<std::endl; std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
@ -407,7 +407,7 @@ void CGAL::QGLViewer::initializeGL() {
"#version 150 \n" "#version 150 \n"
"in vec4 color; \n" "in vec4 color; \n"
"in vec4 fP; \n" "in vec4 fP; \n"
"in vec3 fN; \n" "in vec3 fN; \n"
" out vec4 out_color; \n" " out vec4 out_color; \n"
"void main(void) { \n" "void main(void) { \n"
" vec4 light_pos = vec4(0.0f, 0.0f, 1.0f, 1.0f); \n" " vec4 light_pos = vec4(0.0f, 0.0f, 1.0f, 1.0f); \n"
@ -427,18 +427,18 @@ void CGAL::QGLViewer::initializeGL() {
" vec3 R = reflect(-L, N); \n" " vec3 R = reflect(-L, N); \n"
" vec4 diffuse = max(abs(dot(N,L)),0.0) * light_diff*color; \n" " vec4 diffuse = max(abs(dot(N,L)),0.0) * light_diff*color; \n"
" vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n" " vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n"
"out_color = color*light_amb + diffuse + specular; \n" "out_color = color*light_amb + diffuse + specular; \n"
"out_color = vec4(out_color.xyz, 1.0f); \n" "out_color = vec4(out_color.xyz, 1.0f); \n"
"} \n" "} \n"
"\n" "\n"
}; };
const char fragment_source_comp[] = const char fragment_source_comp[] =
{ {
"varying highp vec4 color; \n" "varying highp vec4 color; \n"
"varying highp vec4 fP; \n" "varying highp vec4 fP; \n"
"varying highp vec3 fN; \n" "varying highp vec3 fN; \n"
"void main(void) { \n" "void main(void) { \n"
" highp vec4 light_pos = vec4(0.0, 0.0, 1.0, 1.0); \n" " highp vec4 light_pos = vec4(0.0, 0.0, 1.0, 1.0); \n"
" highp vec4 light_diff = vec4(1.0, 1.0, 1.0, 1.0); \n" " highp vec4 light_diff = vec4(1.0, 1.0, 1.0, 1.0); \n"
@ -457,15 +457,15 @@ void CGAL::QGLViewer::initializeGL() {
" highp vec3 R = reflect(-L, N); \n" " highp vec3 R = reflect(-L, N); \n"
" highp vec4 diffuse = max(abs(dot(N,L)),0.0) * light_diff*color; \n" " highp vec4 diffuse = max(abs(dot(N,L)),0.0) * light_diff*color; \n"
" highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n" " highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n"
"gl_FragColor = color*light_amb + diffuse + specular; \n" "gl_FragColor = color*light_amb + diffuse + specular; \n"
"gl_FragColor = vec4(gl_FragColor.xyz, 1.0); \n" "gl_FragColor = vec4(gl_FragColor.xyz, 1.0); \n"
"} \n" "} \n"
"\n" "\n"
}; };
//It is said in the doc that a QOpenGLShader is //It is said in the doc that a QOpenGLShader is
// only destroyed with the QOpenGLShaderProgram // only destroyed with the QOpenGLShaderProgram
//it has been linked with. //it has been linked with.
if(is_ogl_4_3) if(is_ogl_4_3)
{ {
@ -473,7 +473,7 @@ void CGAL::QGLViewer::initializeGL() {
{ {
std::cerr<<"Compiling vertex source FAILED"<<std::endl; std::cerr<<"Compiling vertex source FAILED"<<std::endl;
} }
if(!fragment_shader.compileSourceCode(fragment_source)) if(!fragment_shader.compileSourceCode(fragment_source))
{ {
std::cerr<<"Compiling fragmentsource FAILED"<<std::endl; std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
@ -485,7 +485,7 @@ void CGAL::QGLViewer::initializeGL() {
{ {
std::cerr<<"Compiling vertex source FAILED"<<std::endl; std::cerr<<"Compiling vertex source FAILED"<<std::endl;
} }
if(!fragment_shader.compileSourceCode(fragment_source_comp)) if(!fragment_shader.compileSourceCode(fragment_source_comp))
{ {
std::cerr<<"Compiling fragmentsource FAILED"<<std::endl; std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
@ -578,7 +578,7 @@ void CGAL::QGLViewer::postDraw() {
if (axisIsDrawn()) { if (axisIsDrawn()) {
drawAxis(1.0); drawAxis(1.0);
} }
drawVisualHints(); drawVisualHints();
// FPS computation // FPS computation
@ -590,7 +590,7 @@ void CGAL::QGLViewer::postDraw() {
fpsCounter_ = 0; fpsCounter_ = 0;
} }
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
if (FPSIsDisplayed()) if (FPSIsDisplayed())
@ -693,7 +693,7 @@ void CGAL::QGLViewer::setDefaultShortcuts() {
tr("Increases fly speed", "INCREASE_FLYSPEED action description"); tr("Increases fly speed", "INCREASE_FLYSPEED action description");
keyboardActionDescription_[qglviewer::DECREASE_FLYSPEED] = keyboardActionDescription_[qglviewer::DECREASE_FLYSPEED] =
tr("Decreases fly speed", "DECREASE_FLYSPEED action description"); tr("Decreases fly speed", "DECREASE_FLYSPEED action description");
// K e y f r a m e s s h o r t c u t k e y s // K e y f r a m e s s h o r t c u t k e y s
setPathKey(::Qt::Key_F1, 1); setPathKey(::Qt::Key_F1, 1);
setPathKey(::Qt::Key_F2, 2); setPathKey(::Qt::Key_F2, 2);
@ -1067,11 +1067,11 @@ void CGAL::QGLViewer::closeEvent(QCloseEvent *e) {
C : closeEvent called C : closeEvent called
D : destructor called D : destructor called
E N C D E N C D
y y y y
y n y y n y
n y y n y y
n n y y n n y y
closeEvent is called iif the widget is NOT embedded. closeEvent is called iif the widget is NOT embedded.
@ -1174,7 +1174,7 @@ void CGAL::QGLViewer::select(const QPoint &point) {
drawWithNames(). drawWithNames().
*/ */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::beginSelection(const QPoint &point) void CGAL::QGLViewer::beginSelection(const QPoint &point)
{ {
makeCurrent(); makeCurrent();
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
@ -1182,7 +1182,7 @@ void CGAL::QGLViewer::beginSelection(const QPoint &point)
} }
/*! This method is called by select() after scene elements were drawn by /*! This method is called by select() after scene elements were drawn by
drawWithNames(). drawWithNames().
It clears the OpenGL state set by beginSelection*/ It clears the OpenGL state set by beginSelection*/
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::endSelection(const QPoint &point) { void CGAL::QGLViewer::endSelection(const QPoint &point) {
@ -3132,10 +3132,10 @@ void CGAL::QGLViewer::drawVisualHints() {
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(grid_size)); glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(grid_size));
vaos[GRID].release(); vaos[GRID].release();
rendering_program.release(); rendering_program.release();
rendering_program_light.bind(); rendering_program_light.bind();
vaos[GRID_AXIS].bind(); vaos[GRID_AXIS].bind();
rendering_program_light.setUniformValue("mvp_matrix", mvpMatrix); rendering_program_light.setUniformValue("mvp_matrix", mvpMatrix);
rendering_program_light.setUniformValue("mv_matrix", mvMatrix); rendering_program_light.setUniformValue("mv_matrix", mvMatrix);
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(g_axis_size/9)); glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(g_axis_size/9));
@ -3159,12 +3159,12 @@ void CGAL::QGLViewer::drawVisualHints() {
vaos[AXIS].bind(); vaos[AXIS].bind();
int viewport[4]; int viewport[4];
int scissor[4]; int scissor[4];
// The viewport and the scissor are changed to fit the upper right // The viewport and the scissor are changed to fit the upper right
// corner. Original values are saved. // corner. Original values are saved.
glGetIntegerv(GL_VIEWPORT, viewport); glGetIntegerv(GL_VIEWPORT, viewport);
glGetIntegerv(GL_SCISSOR_BOX, scissor); glGetIntegerv(GL_SCISSOR_BOX, scissor);
// Axis viewport size, in pixels // Axis viewport size, in pixels
int size = 100; int size = 100;
glViewport(width()*devicePixelRatio()-size, height()*devicePixelRatio()-size, size, size); glViewport(width()*devicePixelRatio()-size, height()*devicePixelRatio()-size, size, size);
@ -3175,8 +3175,8 @@ void CGAL::QGLViewer::drawVisualHints() {
glViewport(viewport[0],viewport[1],viewport[2],viewport[3]); glViewport(viewport[0],viewport[1],viewport[2],viewport[3]);
vaos[AXIS].release(); vaos[AXIS].release();
rendering_program_light.release(); rendering_program_light.release();
//P i v o t - P o i n t //P i v o t - P o i n t
if (visualHint_ & 1) if (visualHint_ & 1)
{ {
std::vector<float> vertices; std::vector<float> vertices;
@ -3215,7 +3215,7 @@ void CGAL::QGLViewer::drawVisualHints() {
vaos[PIVOT_POINT].release(); vaos[PIVOT_POINT].release();
rendering_program.release(); rendering_program.release();
} }
} }
/*! Defines the mask that will be used to drawVisualHints(). The only available /*! Defines the mask that will be used to drawVisualHints(). The only available
@ -3238,13 +3238,13 @@ void CGAL::QGLViewer::resetVisualHints() { visualHint_ = 0; }
// A x i s a n d G r i d d i s p l a y l i s t s // // A x i s a n d G r i d d i s p l a y l i s t s //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/*! Draws a 3D arrow between the 3D point \p from and the 3D point \p to. /*! Draws a 3D arrow between the 3D point \p from and the 3D point \p to.
\p data is filled with the three components of a point, then its normal, and then its color, which makes it filled like this: \p data is filled with the three components of a point, then its normal, and then its color, which makes it filled like this:
[P1.x-P1.y-P1.z-N1.x-N1.y-N1.z-C1.r-C1.g-C1.b|P2.x-P2.y-P2.z-N2.x-N2.y-N2.z-C2.r-C2.g-C2.b|...] [P1.x-P1.y-P1.z-N1.x-N1.y-N1.z-C1.r-C1.g-C1.b|P2.x-P2.y-P2.z-N2.x-N2.y-N2.z-C2.r-C2.g-C2.b|...]
*/ */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Vec from, void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Vec from,
CGAL::qglviewer::Vec to, CGAL::qglviewer::Vec color, CGAL::qglviewer::Vec to, CGAL::qglviewer::Vec color,
std::vector<float> &data) { std::vector<float> &data) {
using std::cos; using std::cos;
using std::sin; using std::sin;
@ -3426,7 +3426,7 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
The axis orientation matches the current modelView matrix state: The axis orientation matches the current modelView matrix state:
three arrows (red, green and blue) of length \p length are drawn along the three arrows (red, green and blue) of length \p length are drawn along the
positive X, Y and Z directions in the top right corner of the screen. positive X, Y and Z directions in the top right corner of the screen.
X arrow is red, Y arrow is green and Z arrow is blue.*/ X arrow is red, Y arrow is green and Z arrow is blue.*/
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::drawAxis(qreal length) { void CGAL::QGLViewer::drawAxis(qreal length) {
@ -3442,11 +3442,11 @@ void CGAL::QGLViewer::drawAxis(qreal length) {
rendering_program_light.enableAttributeArray("vertex"); rendering_program_light.enableAttributeArray("vertex");
rendering_program_light.setAttributeBuffer("vertex",GL_FLOAT,0,3, rendering_program_light.setAttributeBuffer("vertex",GL_FLOAT,0,3,
static_cast<int>(9*sizeof(float))); static_cast<int>(9*sizeof(float)));
rendering_program_light.enableAttributeArray("normal"); rendering_program_light.enableAttributeArray("normal");
rendering_program_light.setAttributeBuffer("normal",GL_FLOAT,3*sizeof(float),3, rendering_program_light.setAttributeBuffer("normal",GL_FLOAT,3*sizeof(float),3,
static_cast<int>(9*sizeof(float))); static_cast<int>(9*sizeof(float)));
rendering_program_light.enableAttributeArray("colors"); rendering_program_light.enableAttributeArray("colors");
rendering_program_light.setAttributeBuffer("colors",GL_FLOAT,6*sizeof(float),3, rendering_program_light.setAttributeBuffer("colors",GL_FLOAT,6*sizeof(float),3,
static_cast<int>(9*sizeof(float))); static_cast<int>(9*sizeof(float)));
@ -3462,7 +3462,7 @@ coordinate system).
\p size (OpenGL units) and \p nbSubdivisions define its geometry.*/ \p size (OpenGL units) and \p nbSubdivisions define its geometry.*/
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::drawGrid(qreal size, int nbSubdivisions) { void CGAL::QGLViewer::drawGrid(qreal size, int nbSubdivisions) {
//The Grid //The Grid
std::vector<float> v_Grid; std::vector<float> v_Grid;
for (int i=0; i<=nbSubdivisions; ++i) for (int i=0; i<=nbSubdivisions; ++i)
@ -3494,7 +3494,7 @@ void CGAL::QGLViewer::drawGrid(qreal size, int nbSubdivisions) {
vaos[GRID].release(); vaos[GRID].release();
rendering_program.release(); rendering_program.release();
grid_size = v_Grid.size(); grid_size = v_Grid.size();
//The Axis //The Axis
std::vector<float> d_axis; std::vector<float> d_axis;
d_axis.resize(0); d_axis.resize(0);
@ -3510,11 +3510,11 @@ void CGAL::QGLViewer::drawGrid(qreal size, int nbSubdivisions) {
rendering_program_light.enableAttributeArray("vertex"); rendering_program_light.enableAttributeArray("vertex");
rendering_program_light.setAttributeBuffer("vertex",GL_FLOAT,0,3, rendering_program_light.setAttributeBuffer("vertex",GL_FLOAT,0,3,
static_cast<int>(9*sizeof(float))); static_cast<int>(9*sizeof(float)));
rendering_program_light.enableAttributeArray("normal"); rendering_program_light.enableAttributeArray("normal");
rendering_program_light.setAttributeBuffer("normal",GL_FLOAT,3*sizeof(float),3, rendering_program_light.setAttributeBuffer("normal",GL_FLOAT,3*sizeof(float),3,
static_cast<int>(9*sizeof(float))); static_cast<int>(9*sizeof(float)));
rendering_program_light.enableAttributeArray("colors"); rendering_program_light.enableAttributeArray("colors");
rendering_program_light.setAttributeBuffer("colors",GL_FLOAT,6*sizeof(float),3, rendering_program_light.setAttributeBuffer("colors",GL_FLOAT,6*sizeof(float),3,
static_cast<int>(9*sizeof(float))); static_cast<int>(9*sizeof(float)));
@ -3823,7 +3823,7 @@ void CGAL::QGLViewer::initFromDOMElement(const QDomElement &element) {
// #CONNECTION# default values from defaultConstructor() // #CONNECTION# default values from defaultConstructor()
// setMouseTracking(DomUtils::boolFromDom(child, "mouseTracking", false)); // setMouseTracking(DomUtils::boolFromDom(child, "mouseTracking", false));
// if ((child.attribute("cameraMode", "revolve") == "fly") && // if ((child.attribute("cameraMode", "revolve") == "fly") &&
// (cameraIsInRevolveMode())) toggleCameraMode(); // (cameraIsInRevolveMode())) toggleCameraMode();
QDomElement ch = child.firstChild().toElement(); QDomElement ch = child.firstChild().toElement();
while (!ch.isNull()) { while (!ch.isNull()) {
@ -3909,14 +3909,14 @@ GLuint CGAL::QGLViewer::bufferTextureId() const {
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::setOffset(CGAL::qglviewer::Vec offset) void CGAL::QGLViewer::setOffset(CGAL::qglviewer::Vec offset)
{ {
this->_offset = offset; this->_offset = offset;
} }
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
CGAL::qglviewer::Vec CGAL::QGLViewer::offset()const CGAL::qglviewer::Vec CGAL::QGLViewer::offset()const
{ {
return _offset; return _offset;
} }
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
@ -4039,7 +4039,7 @@ QImage* CGAL::QGLViewer::takeSnapshot( CGAL::qglviewer::SnapShotBackground back
nbX++; nbX++;
if (nbY * subSize.height() < finalSize.height()) if (nbY * subSize.height() < finalSize.height())
nbY++; nbY++;
GLdouble frustum[6]; GLdouble frustum[6];
camera()->getFrustum(frustum); camera()->getFrustum(frustum);
QOpenGLFramebufferObject fbo(size,QOpenGLFramebufferObject::CombinedDepthStencil, GL_TEXTURE_2D, GL_RGBA32F); QOpenGLFramebufferObject fbo(size,QOpenGLFramebufferObject::CombinedDepthStencil, GL_TEXTURE_2D, GL_RGBA32F);
stored_fbo = &fbo; stored_fbo = &fbo;

View File

@ -479,7 +479,7 @@ public:
return sstr.str(); return sstr.str();
} }
/// Adds \c cell to the refinement queue if needed /// Adds \c cell to the refinement queue if needed
void treat_new_cell(const Cell_handle& cell); void treat_new_cell(const Cell_handle& cell);
@ -521,7 +521,7 @@ private:
} }
}; };
#endif // CGAL_LINKED_WITH_TBB #endif // CGAL_LINKED_WITH_TBB
// ----------------------------------- // -----------------------------------
// ----------------------------------- // -----------------------------------
// ----------------------------------- // -----------------------------------
@ -669,7 +669,7 @@ scan_triangulation_impl()
std::cerr << "Scanning triangulation for bad cells (in parallel)"; std::cerr << "Scanning triangulation for bad cells (in parallel)";
# endif # endif
add_to_TLS_lists(true); add_to_TLS_lists(true);
typedef typename Tr::All_cells_iterator All_cells_iterator; typedef typename Tr::All_cells_iterator All_cells_iterator;
// WITH PARALLEL_FOR // WITH PARALLEL_FOR
@ -795,7 +795,7 @@ conflicts_zone_impl(const Weighted_point& point
facet_is_in_its_cz = true; // Always true facet_is_in_its_cz = true; // Always true
CGAL_HISTOGRAM_PROFILER("Mesh_3::Refine_cells::conflict zone", CGAL_HISTOGRAM_PROFILER("Mesh_3::Refine_cells::conflict zone",
static_cast<unsigned int>(zone.cells.size())); static_cast<unsigned int>(zone.cells.size()));
return zone; return zone;
} }

View File

@ -28,17 +28,17 @@ public Mesh_3::Abstract_criterion<Tr, Visitor_>
{ {
private: private:
typedef typename Tr::Facet Facet; typedef typename Tr::Facet Facet;
typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base; typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
typedef typename Base::Quality Quality; typedef typename Base::Quality Quality;
typedef typename Base::Is_bad Is_bad; typedef typename Base::Is_bad Is_bad;
typedef Facet_topological_criterion_with_adjacency<Tr,MeshDomain, Visitor_> Self; typedef Facet_topological_criterion_with_adjacency<Tr,MeshDomain, Visitor_> Self;
typedef typename Tr::Geom_traits::FT FT; typedef typename Tr::Geom_traits::FT FT;
const MeshDomain* domain; const MeshDomain* domain;
public: public:
/// Constructor /// Constructor
Facet_topological_criterion_with_adjacency(const MeshDomain* domain) Facet_topological_criterion_with_adjacency(const MeshDomain* domain)
@ -47,24 +47,24 @@ public:
/// Destructor /// Destructor
virtual ~Facet_topological_criterion_with_adjacency() {} virtual ~Facet_topological_criterion_with_adjacency() {}
protected: protected:
virtual void do_accept(Visitor_& v) const virtual void do_accept(Visitor_& v) const
{ {
v.visit(*this); v.visit(*this);
} }
virtual Self* do_clone() const virtual Self* do_clone() const
{ {
// Call copy ctor on this // Call copy ctor on this
return new Self(*this); return new Self(*this);
} }
virtual Is_bad do_is_bad (const Tr& /*tr*/, const Facet& f) const virtual Is_bad do_is_bad (const Tr& /*tr*/, const Facet& f) const
{ {
typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Vertex_handle Vertex_handle;
typedef typename Tr::Cell_handle Cell_handle; typedef typename Tr::Cell_handle Cell_handle;
const Cell_handle& ch = f.first; const Cell_handle& ch = f.first;
const int& i = f.second; const int& i = f.second;
@ -99,7 +99,7 @@ protected:
} }
} }
break; break;
case 1: case 1:
{ {
++nb_vertices_on_curves; ++nb_vertices_on_curves;
const typename MeshDomain::Curve_index curve_id = const typename MeshDomain::Curve_index curve_id =

View File

@ -307,7 +307,7 @@ class Facet_size_criterion :
public Mesh_3::Abstract_criterion<Tr, Visitor_> public Mesh_3::Abstract_criterion<Tr, Visitor_>
{ {
}; };
// Variable size Criterion class // Variable size Criterion class
template <typename Tr, typename Visitor_, typename SizingField> template <typename Tr, typename Visitor_, typename SizingField>
class Variable_size_criterion : class Variable_size_criterion :
@ -317,25 +317,25 @@ private:
typedef typename Tr::Facet Facet; typedef typename Tr::Facet Facet;
typedef typename Tr::Geom_traits::FT FT; typedef typename Tr::Geom_traits::FT FT;
typedef typename Tr::Vertex::Index Index; typedef typename Tr::Vertex::Index Index;
typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base; typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
typedef typename Base::Quality Quality; typedef typename Base::Quality Quality;
typedef typename Base::Is_bad Is_bad; typedef typename Base::Is_bad Is_bad;
typedef Variable_size_criterion<Tr,Visitor_,SizingField> Self; typedef Variable_size_criterion<Tr,Visitor_,SizingField> Self;
typedef SizingField Sizing_field; typedef SizingField Sizing_field;
public: public:
// Nb: the default bound of the criterion is such that the criterion // Nb: the default bound of the criterion is such that the criterion
// is always fulfilled // is always fulfilled
Variable_size_criterion(const Sizing_field& s) : size_(s) {} Variable_size_criterion(const Sizing_field& s) : size_(s) {}
protected: protected:
virtual void do_accept(Visitor_& v) const virtual void do_accept(Visitor_& v) const
{ {
v.visit(*this); v.visit(*this);
} }
virtual Self* do_clone() const virtual Self* do_clone() const
{ {
// Call copy ctor on this // Call copy ctor on this
@ -345,7 +345,7 @@ protected:
virtual Is_bad do_is_bad(const Tr& tr, const Facet& f) const virtual Is_bad do_is_bad(const Tr& tr, const Facet& f) const
{ {
CGAL_assertion (f.first->is_facet_on_surface(f.second)); CGAL_assertion (f.first->is_facet_on_surface(f.second));
typedef typename Tr::Geom_traits Gt; typedef typename Tr::Geom_traits Gt;
typedef typename Tr::Bare_point Bare_point; typedef typename Tr::Bare_point Bare_point;
typedef typename Tr::Weighted_point Weighted_point; typedef typename Tr::Weighted_point Weighted_point;
@ -360,7 +360,7 @@ protected:
const FT sq_radius = tr.min_squared_distance(p1, ball_center); const FT sq_radius = tr.min_squared_distance(p1, ball_center);
const FT sq_bound = CGAL::square(size_(ball_center, 2, index)); const FT sq_bound = CGAL::square(size_(ball_center, 2, index));
CGAL_assertion(sq_bound > FT(0)); CGAL_assertion(sq_bound > FT(0));
if ( sq_radius > sq_bound ) if ( sq_radius > sq_bound )
{ {
#ifdef CGAL_MESH_3_DEBUG_FACET_CRITERIA #ifdef CGAL_MESH_3_DEBUG_FACET_CRITERIA
@ -372,14 +372,14 @@ protected:
else else
return Is_bad(); return Is_bad();
} }
private: private:
Sizing_field size_; Sizing_field size_;
}; // end Variable_size_criterion }; // end Variable_size_criterion
// Uniform size Criterion class // Uniform size Criterion class
template <typename Tr, typename Visitor_> template <typename Tr, typename Visitor_>
class Uniform_size_criterion : class Uniform_size_criterion :
@ -394,7 +394,7 @@ private:
typedef typename Base::Is_bad Is_bad; typedef typename Base::Is_bad Is_bad;
typedef Uniform_size_criterion<Tr,Visitor_> Self; typedef Uniform_size_criterion<Tr,Visitor_> Self;
public: public:
// Nb: the default bound of the criterion is such that the criterion // Nb: the default bound of the criterion is such that the criterion
// is always fulfilled // is always fulfilled
@ -505,20 +505,20 @@ protected:
} }
}; // end class Facet_on_surface_criterion }; // end class Facet_on_surface_criterion
template <typename Tr, typename Visitor_> template <typename Tr, typename Visitor_>
class Facet_on_same_surface_criterion : class Facet_on_same_surface_criterion :
public Mesh_3::Abstract_criterion<Tr, Visitor_> public Mesh_3::Abstract_criterion<Tr, Visitor_>
{ {
private: private:
typedef typename Tr::Facet Facet; typedef typename Tr::Facet Facet;
typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base; typedef Mesh_3::Abstract_criterion<Tr,Visitor_> Base;
typedef typename Base::Quality Quality; typedef typename Base::Quality Quality;
typedef typename Base::Is_bad Is_bad; typedef typename Base::Is_bad Is_bad;
typedef Facet_on_same_surface_criterion<Tr,Visitor_> Self; typedef Facet_on_same_surface_criterion<Tr,Visitor_> Self;
public: public:
/// Constructor /// Constructor
Facet_on_same_surface_criterion() {} Facet_on_same_surface_criterion() {}
@ -530,7 +530,7 @@ protected:
{ {
v.visit(*this); v.visit(*this);
} }
virtual Self* do_clone() const virtual Self* do_clone() const
{ {
// Call copy ctor on this // Call copy ctor on this
@ -542,23 +542,23 @@ protected:
typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Vertex_handle Vertex_handle;
typedef typename Tr::Cell_handle Cell_handle; typedef typename Tr::Cell_handle Cell_handle;
typedef typename Tr::Vertex::Index Index; typedef typename Tr::Vertex::Index Index;
const Cell_handle& ch = f.first; const Cell_handle& ch = f.first;
const int& i = f.second; const int& i = f.second;
const Vertex_handle& v1 = ch->vertex((i+1)&3); const Vertex_handle& v1 = ch->vertex((i+1)&3);
const Vertex_handle& v2 = ch->vertex((i+2)&3); const Vertex_handle& v2 = ch->vertex((i+2)&3);
const Vertex_handle& v3 = ch->vertex((i+3)&3); const Vertex_handle& v3 = ch->vertex((i+3)&3);
Index index = Index(); Index index = Index();
bool is_index_initialized = false; bool is_index_initialized = false;
if ( v1->in_dimension() == 2 ) if ( v1->in_dimension() == 2 )
{ {
index = v1->index(); index = v1->index();
is_index_initialized = true; is_index_initialized = true;
} }
if ( v2->in_dimension() == 2 ) if ( v2->in_dimension() == 2 )
{ {
if ( is_index_initialized ) if ( is_index_initialized )
@ -575,10 +575,10 @@ protected:
else else
{ {
index = v2->index(); index = v2->index();
is_index_initialized = true; is_index_initialized = true;
} }
} }
if ( v3->in_dimension() == 2 ) if ( v3->in_dimension() == 2 )
{ {
if ( is_index_initialized && !(v3->index() == index) ) if ( is_index_initialized && !(v3->index() == index) )
@ -588,12 +588,12 @@ protected:
<< v3->index() << " != " << index << ")" << std::endl; << v3->index() << " != " << index << ")" << std::endl;
#endif #endif
return Is_bad(Quality(1)); return Is_bad(Quality(1));
} }
} }
return Is_bad(); return Is_bad();
} }
}; // end class Facet_on_same_surface_criterion }; // end class Facet_on_same_surface_criterion
@ -625,16 +625,16 @@ public:
} }
}; // end class Facet_criterion_visitor }; // end class Facet_criterion_visitor
template <typename Tr> template <typename Tr>
class Facet_criterion_visitor_with_features class Facet_criterion_visitor_with_features
: public Mesh_3::Criterion_visitor<Tr, typename Tr::Facet> : public Mesh_3::Criterion_visitor<Tr, typename Tr::Facet>
{ {
typedef Mesh_3::Criterion_visitor<Tr, typename Tr::Facet> Base; typedef Mesh_3::Criterion_visitor<Tr, typename Tr::Facet> Base;
typedef Facet_criterion_visitor_with_features<Tr> Self; typedef Facet_criterion_visitor_with_features<Tr> Self;
typedef Mesh_3::Abstract_criterion<Tr, Self> Criterion; typedef Mesh_3::Abstract_criterion<Tr, Self> Criterion;
typedef Mesh_3::Curvature_size_criterion<Tr, Self> Curvature_size_criterion; typedef Mesh_3::Curvature_size_criterion<Tr, Self> Curvature_size_criterion;
typedef Mesh_3::Aspect_ratio_criterion<Tr, Self> Aspect_ratio_criterion; typedef Mesh_3::Aspect_ratio_criterion<Tr, Self> Aspect_ratio_criterion;
@ -645,12 +645,12 @@ class Facet_criterion_visitor_with_features
typedef typename Tr::Geom_traits Gt; typedef typename Tr::Geom_traits Gt;
typedef typename Gt::FT FT; typedef typename Gt::FT FT;
public: public:
typedef typename Base::Quality Facet_quality; typedef typename Base::Quality Facet_quality;
typedef typename Base::Is_bad Is_facet_bad; typedef typename Base::Is_bad Is_facet_bad;
typedef typename Base::Handle Handle; typedef typename Base::Handle Handle;
typedef Handle Facet; typedef Handle Facet;
// Constructor // Constructor
Facet_criterion_visitor_with_features(const Tr& tr, const Facet& fh) Facet_criterion_visitor_with_features(const Tr& tr, const Facet& fh)
: Base(tr, fh) : Base(tr, fh)
@ -674,11 +674,11 @@ public:
const Cell_handle& c = fh.first; const Cell_handle& c = fh.first;
const int& k = fh.second; const int& k = fh.second;
int k1 = (k+1)&3; int k1 = (k+1)&3;
int k2 = (k+2)&3; int k2 = (k+2)&3;
int k3 = (k+3)&3; int k3 = (k+3)&3;
// Get number of weighted points, and ensure that they will be accessible // Get number of weighted points, and ensure that they will be accessible
// using k1...ki, if i is the number of weighted points. // using k1...ki, if i is the number of weighted points.
const Weighted_point& wpk1 = tr.point(c, k1); const Weighted_point& wpk1 = tr.point(c, k1);
@ -715,13 +715,13 @@ public:
ratio_ = r / cw(p1); ratio_ = r / cw(p1);
break; break;
} }
case 2: case 2:
{ {
FT r13 = sq_radius(p1,p3) / cw(p1); FT r13 = sq_radius(p1,p3) / cw(p1);
FT r23 = sq_radius(p2,p3) / cw(p2); FT r23 = sq_radius(p2,p3) / cw(p2);
ratio_ = (std::max)(r13, r23); ratio_ = (std::max)(r13, r23);
do_spheres_intersect_ = (compare(p1,p2,FT(0)) != CGAL::LARGER); do_spheres_intersect_ = (compare(p1,p2,FT(0)) != CGAL::LARGER);
break; break;
} }
@ -730,12 +730,12 @@ public:
{ {
do_spheres_intersect_ = (compare(p1,p2,p3,FT(0)) != CGAL::LARGER); do_spheres_intersect_ = (compare(p1,p2,p3,FT(0)) != CGAL::LARGER);
break; break;
} }
default: break; default: break;
} }
} }
// Destructor // Destructor
~Facet_criterion_visitor_with_features() {} ~Facet_criterion_visitor_with_features() {}
@ -743,14 +743,14 @@ public:
void visit(const Criterion& criterion) void visit(const Criterion& criterion)
{ {
if ( 3 == wp_nb_ && do_spheres_intersect_ ) if ( 3 == wp_nb_ && do_spheres_intersect_ )
{ {
Base::increment_counter(); Base::increment_counter();
return; return;
} }
Base::do_visit(criterion); Base::do_visit(criterion);
} }
void visit(const Curvature_size_criterion& criterion) void visit(const Curvature_size_criterion& criterion)
{ {
if ( ratio_ < approx_ratio_ if ( ratio_ < approx_ratio_
@ -759,10 +759,10 @@ public:
Base::increment_counter(); Base::increment_counter();
return; return;
} }
Base::do_visit(criterion); Base::do_visit(criterion);
} }
void visit(const Aspect_ratio_criterion& criterion) void visit(const Aspect_ratio_criterion& criterion)
{ {
if ( ratio_ < angle_ratio_ if ( ratio_ < angle_ratio_
@ -771,10 +771,10 @@ public:
Base::increment_counter(); Base::increment_counter();
return; return;
} }
Base::do_visit(criterion); Base::do_visit(criterion);
} }
void visit(const Facet_size_criterion& criterion) void visit(const Facet_size_criterion& criterion)
{ {
if ( ratio_ < size_ratio_ if ( ratio_ < size_ratio_
@ -783,10 +783,10 @@ public:
Base::increment_counter(); Base::increment_counter();
return; return;
} }
Base::do_visit(criterion); Base::do_visit(criterion);
} }
private: private:
int wp_nb_; int wp_nb_;
bool do_spheres_intersect_; bool do_spheres_intersect_;
@ -794,9 +794,9 @@ private:
FT approx_ratio_; FT approx_ratio_;
FT angle_ratio_; FT angle_ratio_;
FT size_ratio_; FT size_ratio_;
}; // end class Facet_criterion_visitor }; // end class Facet_criterion_visitor
} // end namespace Mesh_3 } // end namespace Mesh_3

View File

@ -635,7 +635,7 @@ public:
PolylinePMap polyline_pmap, PolylinePMap polyline_pmap,
IncidentPatchesIndicesPMap incident_paches_indices_pmap, IncidentPatchesIndicesPMap incident_paches_indices_pmap,
IndicesOutputIterator out /* = CGAL::Emptyset_iterator() */); IndicesOutputIterator out /* = CGAL::Emptyset_iterator() */);
template <typename InputIterator, typename IndicesOutputIterator> template <typename InputIterator, typename IndicesOutputIterator>
IndicesOutputIterator IndicesOutputIterator
add_features_with_context(InputIterator first, InputIterator end, add_features_with_context(InputIterator first, InputIterator end,
@ -644,7 +644,7 @@ public:
/// @} /// @}
/// \endcond /// \endcond
/*! /*!
Add 1-dimensional features in the domain. `InputIterator` value type must Add 1-dimensional features in the domain. `InputIterator` value type must
be a model of the concept `MeshPolyline_3`. be a model of the concept `MeshPolyline_3`.
*/ */
template <typename InputIterator> template <typename InputIterator>
@ -664,9 +664,9 @@ public:
/*! /*!
Add 1-dimensional features (curves) from the range `[first, end)` in the domain with their incidences Add 1-dimensional features (curves) from the range `[first, end)` in the domain with their incidences
with 2-dimensional features (patches) of the domain. with 2-dimensional features (patches) of the domain.
\tparam InputIterator input iterator over curves \tparam InputIterator input iterator over curves
\tparam PolylinePMap is a model of `ReadablePropertyMap` with key type \tparam PolylinePMap is a model of `ReadablePropertyMap` with key type
`std::iterator_traits<InputIterator>::%reference` and a value type `std::iterator_traits<InputIterator>::%reference` and a value type
that is a model of `MeshPolyline_3`. that is a model of `MeshPolyline_3`.
\tparam IncidentPatchesIndicesPMap is a model of `ReadablePropertyMap` \tparam IncidentPatchesIndicesPMap is a model of `ReadablePropertyMap`
@ -681,7 +681,7 @@ public:
\param incident_patches_indices_pmap the property map that provides \param incident_patches_indices_pmap the property map that provides
access to the set of indices of the surface patches that are incident to access to the set of indices of the surface patches that are incident to
a given 1D-feature (curve) a given 1D-feature (curve)
*/ */
template <typename InputIterator, template <typename InputIterator,
typename PolylinePMap, typename PolylinePMap,
typename IncidentPatchesIndicesPMap> typename IncidentPatchesIndicesPMap>
@ -696,7 +696,7 @@ public:
CGAL::Emptyset_iterator()); CGAL::Emptyset_iterator());
} }
/// @} /// @}
/// \name Implementation of the concept MeshDomainWithFeatures_3 /// \name Implementation of the concept MeshDomainWithFeatures_3
/// The following methods implement the requirement of the concept /// The following methods implement the requirement of the concept
/// `MeshDomainWithFeatures_3`. /// `MeshDomainWithFeatures_3`.

View File

@ -6,7 +6,7 @@
// $URL$ // $URL$
// $Id$ // $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
// //
// //
// Author(s) : Laurent RINEAU // Author(s) : Laurent RINEAU
@ -44,7 +44,7 @@
namespace CGAL { namespace CGAL {
template <class _Key, class _Data, class _Direct_compare = std::less<_Key>, template <class _Key, class _Data, class _Direct_compare = std::less<_Key>,
class _Reverse_compare = std::less<_Data> > class _Reverse_compare = std::less<_Data> >
class Double_map class Double_map
{ {
@ -55,10 +55,10 @@ public:
typedef _Reverse_compare Reverse_compare; typedef _Reverse_compare Reverse_compare;
typedef Double_map<Key, Data, Direct_compare, Reverse_compare> Self; typedef Double_map<Key, Data, Direct_compare, Reverse_compare> Self;
#ifdef CGAL_USE_BOOST_BIMAP #ifdef CGAL_USE_BOOST_BIMAP
typedef ::boost::bimap< ::boost::bimaps::set_of<Key, Direct_compare>, typedef ::boost::bimap< ::boost::bimaps::set_of<Key, Direct_compare>,
::boost::bimaps::multiset_of<Data, Reverse_compare> > Boost_bimap; ::boost::bimaps::multiset_of<Data, Reverse_compare> > Boost_bimap;
typedef typename Boost_bimap::left_map Direct_func; typedef typename Boost_bimap::left_map Direct_func;
typedef typename Boost_bimap::right_map Reverse_func; typedef typename Boost_bimap::right_map Reverse_func;
@ -78,7 +78,7 @@ public:
typedef typename Self::Reverse_func::value_type right_value_type; typedef typename Self::Reverse_func::value_type right_value_type;
#endif #endif
typedef typename Direct_func::value_type Direct_entry; typedef typename Direct_func::value_type Direct_entry;
// std::pair<Key, reverse_iterator> // std::pair<Key, reverse_iterator>
typedef typename Reverse_func::value_type Reverse_entry; typedef typename Reverse_func::value_type Reverse_entry;
// std::pair<Data, Key> ; // std::pair<Data, Key> ;
@ -136,7 +136,7 @@ public :
{ {
return(direct_func().size()==reverse_func().size()); return(direct_func().size()==reverse_func().size());
} }
void clear() void clear()
{ {
#ifdef CGAL_USE_BOOST_BIMAP #ifdef CGAL_USE_BOOST_BIMAP
@ -145,7 +145,7 @@ public :
direct_func().clear(); direct_func().clear();
reverse_func().clear(); reverse_func().clear();
#endif #endif
} }
Self& operator=(const Self& dm) Self& operator=(const Self& dm)
@ -161,14 +161,14 @@ public :
#ifdef CGAL_USE_BOOST_BIMAP #ifdef CGAL_USE_BOOST_BIMAP
for(direct_const_iterator rit = dm.direct_func().begin(); for(direct_const_iterator rit = dm.direct_func().begin();
rit != dm.direct_func().end(); rit != dm.direct_func().end();
++rit) ++rit)
{ {
direct_func().insert(*rit); direct_func().insert(*rit);
} }
#else #else
reverse_func() = dm.reverse_func(); reverse_func() = dm.reverse_func();
for(reverse_iterator rit = reverse_func().begin(); for(reverse_iterator rit = reverse_func().begin();
rit != reverse_func().end(); rit != reverse_func().end();
++rit) ++rit)
@ -190,7 +190,7 @@ public :
direct_iterator hint = boost_bimap.left.lower_bound(k); direct_iterator hint = boost_bimap.left.lower_bound(k);
if(hint != boost_bimap.left.end() && hint->first == k) if(hint != boost_bimap.left.end() && hint->first == k)
return false; return false;
boost_bimap.left.insert(hint, Direct_entry(k, d)); boost_bimap.left.insert(hint, Direct_entry(k, d));
return true; return true;
@ -198,11 +198,11 @@ public :
direct_iterator direct_hint = direct_func().lower_bound(k); direct_iterator direct_hint = direct_func().lower_bound(k);
if(direct_hint != direct_func().end() && if(direct_hint != direct_func().end() &&
direct_hint->first == k) direct_hint->first == k)
return false; return false;
reverse_iterator reverse_it = reverse_func().insert(Reverse_entry(d, k)); reverse_iterator reverse_it = reverse_func().insert(Reverse_entry(d, k));
direct_func().insert(direct_hint, Direct_entry(k, reverse_it)); direct_func().insert(direct_hint, Direct_entry(k, reverse_it));
CGAL_assertion(is_valid()); CGAL_assertion(is_valid());
@ -229,7 +229,7 @@ public :
direct_iterator pos = direct_func().find(rit->second); direct_iterator pos = direct_func().find(rit->second);
CGAL_assertion(pos != direct_func().end()); CGAL_assertion(pos != direct_func().end());
CGAL_assertion(pos->second == rit); CGAL_assertion(pos->second == rit);
direct_func().erase(pos); direct_func().erase(pos);
reverse_func().erase(rit); reverse_func().erase(rit);
CGAL_assertion(is_valid()); CGAL_assertion(is_valid());
@ -240,7 +240,7 @@ public :
{ {
return direct_func().begin(); return direct_func().begin();
} }
const_iterator end() const const_iterator end() const
{ {
return direct_func().end(); return direct_func().end();
@ -248,20 +248,20 @@ public :
template <typename Func_key, typename Func_data> template <typename Func_key, typename Func_data>
void dump_direct_func(std::ostream& out, void dump_direct_func(std::ostream& out,
Func_key func_key, Func_key func_key,
Func_data func_data) Func_data func_data)
{ {
for(typename Direct_func::iterator it = direct_func().begin(); for(typename Direct_func::iterator it = direct_func().begin();
it != direct_func().end(); it != direct_func().end();
++it) ++it)
{ {
out << func_key(it->first) << " -> " out << func_key(it->first) << " -> "
#ifdef CGAL_USE_BOOST_BIMAP #ifdef CGAL_USE_BOOST_BIMAP
<< func_data(it->second) << func_data(it->second)
#else #else
<< func_data(it->second->first) << func_data(it->second->first)
#endif #endif
<< std::endl; << std::endl;
} }
} }
@ -272,25 +272,25 @@ public :
template <typename Func_key, typename Func_data> template <typename Func_key, typename Func_data>
void dump_reverse_func(std::ostream& out, void dump_reverse_func(std::ostream& out,
Func_key func_key, Func_key func_key,
Func_data func_data) Func_data func_data)
{ {
for(typename Reverse_func::iterator it = reverse_func().begin(); for(typename Reverse_func::iterator it = reverse_func().begin();
it != reverse_func().end(); it != reverse_func().end();
++it) ++it)
{ {
out << func_data(it->first) << " " out << func_data(it->first) << " "
<< func_key(it->second) << std::endl; << func_key(it->second) << std::endl;
} }
} }
void dump_reverse_func(std::ostream& out) void dump_reverse_func(std::ostream& out)
{ {
dump_reverse_func(out, CGAL::Identity<Data>(), CGAL::Identity<Key>()); dump_reverse_func(out, CGAL::Identity<Data>(), CGAL::Identity<Key>());
} }
}; };
template <class _Key, class _Data, class _Direct_compare, template <class _Key, class _Data, class _Direct_compare,
class _Reverse_compare> class _Reverse_compare>
bool bool
Double_map<_Key, _Data, _Direct_compare, _Reverse_compare>:: Double_map<_Key, _Data, _Direct_compare, _Reverse_compare>::

View File

@ -36,13 +36,13 @@ struct Wrapper
{ {
typedef int return_type; typedef int return_type;
typedef typename K::Point_3 Point_3; typedef typename K::Point_3 Point_3;
Wrapper(const Implicit_function_interface& f) : f_(f) {} Wrapper(const Implicit_function_interface& f) : f_(f) {}
return_type operator()(const Point_3& p, const bool=true) const return_type operator()(const Point_3& p, const bool=true) const
{ {
return (f_(p.x(),p.y(),p.z()) < 0) ? 1 : 0; return (f_(p.x(),p.y(),p.z()) < 0) ? 1 : 0;
} }
private: private:
const Implicit_function_interface& f_; const Implicit_function_interface& f_;
}; };
@ -72,7 +72,7 @@ typedef CGAL::Compact_mesh_cell_base_3<Robust_K, Polyhedral_mesh_domain> Cell
typedef CGAL::Triangulation_cell_base_with_info_3<int, Robust_K, Cell_base> Cell_base_with_info; typedef CGAL::Triangulation_cell_base_with_info_3<int, Robust_K, Cell_base> Cell_base_with_info;
#ifdef CGAL_CONCURRENT_MESH_3 #ifdef CGAL_CONCURRENT_MESH_3
typedef CGAL::Mesh_triangulation_3<Polyhedral_mesh_domain, typedef CGAL::Mesh_triangulation_3<Polyhedral_mesh_domain,
Robust_intersections_traits, Robust_intersections_traits,
CGAL::Parallel_tag, CGAL::Parallel_tag,
CGAL::Default, CGAL::Default,

View File

@ -42,7 +42,7 @@ class C3t3_rib_exporter_plugin :
public: public:
C3t3_rib_exporter_plugin(); C3t3_rib_exporter_plugin();
virtual ~C3t3_rib_exporter_plugin() {} virtual ~C3t3_rib_exporter_plugin() {}
void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*); void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*);
QList<QAction*> actions() const QList<QAction*> actions() const
{ {
@ -51,12 +51,12 @@ public:
bool applicable(QAction*)const{ bool applicable(QAction*)const{
Scene_c3t3_item* item = qobject_cast<Scene_c3t3_item*>(scene->item(scene->mainSelectionIndex())); Scene_c3t3_item* item = qobject_cast<Scene_c3t3_item*>(scene->item(scene->mainSelectionIndex()));
return item && item->is_valid();} return item && item->is_valid();}
public Q_SLOTS: public Q_SLOTS:
void create_rib(); void create_rib();
void height_changed(int i); void height_changed(int i);
void width_changed(int i); void width_changed(int i);
private: private:
typedef Tr::Bare_point Bare_point; typedef Tr::Bare_point Bare_point;
typedef Tr::Weighted_point Weighted_point; typedef Tr::Weighted_point Weighted_point;
@ -65,12 +65,12 @@ private:
typedef Geom_traits::Plane_3 Plane; typedef Geom_traits::Plane_3 Plane;
typedef Geom_traits::FT FT; typedef Geom_traits::FT FT;
typedef Geom_traits::Aff_transformation_3 Aff_transformation_3; typedef Geom_traits::Aff_transformation_3 Aff_transformation_3;
typedef CGAL::qglviewer::Vec qglVec; typedef CGAL::qglviewer::Vec qglVec;
enum Rib_exporter_mode { CUT=0, MESH, TRIANGULATION }; enum Rib_exporter_mode { CUT=0, MESH, TRIANGULATION };
struct Rib_exporter_parameters struct Rib_exporter_parameters
{ {
// Materials // Materials
double sphere_radius; double sphere_radius;
@ -81,88 +81,88 @@ private:
double ambientIntensity; double ambientIntensity;
bool shadowOn; bool shadowOn;
double shadowIntensity; double shadowIntensity;
// Picture // Picture
int width; int width;
int height; int height;
Rib_exporter_mode mode; Rib_exporter_mode mode;
bool is_preview; bool is_preview;
}; };
private: private:
void update_mask(); void update_mask();
bool get_parameters_from_dialog(); bool get_parameters_from_dialog();
QStringList nameFilters() const; QStringList nameFilters() const;
bool save(const Scene_c3t3_item&, const QFileInfo& fileinfo); bool save(const Scene_c3t3_item&, const QFileInfo& fileinfo);
void init_maps(const C3t3& c3t3, const QColor& color); void init_maps(const C3t3& c3t3, const QColor& color);
void init_point_radius(const C3t3& c3t3); void init_point_radius(const C3t3& c3t3);
void init_parameters(); void init_parameters();
Bare_point camera_coordinates(const Bare_point& p); Bare_point camera_coordinates(const Bare_point& p);
void fill_points_and_edges_map(const C3t3& c3t3); void fill_points_and_edges_map(const C3t3& c3t3);
void add_edge(const Bare_point& p, const Bare_point& q, const QColor& color); void add_edge(const Bare_point& p, const Bare_point& q, const QColor& color);
void add_vertex(const Bare_point& p, const QColor& color); void add_vertex(const Bare_point& p, const QColor& color);
void write_header(const std::string& filename, std::ofstream& out); void write_header(const std::string& filename, std::ofstream& out);
void write_lights(std::ofstream& out); void write_lights(std::ofstream& out);
void write_turn_background_light(bool turn_on, std::ofstream& out); void write_turn_background_light(bool turn_on, std::ofstream& out);
void write_facets(const C3t3& c3t3, std::ofstream& out); void write_facets(const C3t3& c3t3, std::ofstream& out);
void write_facets(const C3t3& c3t3, const Plane& plane, std::ofstream& out); void write_facets(const C3t3& c3t3, const Plane& plane, std::ofstream& out);
void write_surface_cells(const C3t3& c3t3, const Plane& plane, std::ofstream& out); void write_surface_cells(const C3t3& c3t3, const Plane& plane, std::ofstream& out);
void write_cells_intersecting_a_plane(const C3t3& c3t3, const Plane& plane, std::ofstream& out); void write_cells_intersecting_a_plane(const C3t3& c3t3, const Plane& plane, std::ofstream& out);
void write_cells_on_the_positive_side_of_a_plane(const C3t3& c3t3, const Plane& plane, std::ofstream& out); void write_cells_on_the_positive_side_of_a_plane(const C3t3& c3t3, const Plane& plane, std::ofstream& out);
void write_triangle(const Bare_point& p, const Bare_point& q, const Bare_point& r, void write_triangle(const Bare_point& p, const Bare_point& q, const Bare_point& r,
const QColor& color, const QColor& edge_color, std::ofstream& out); const QColor& color, const QColor& edge_color, std::ofstream& out);
void write_tetrahedron (const Bare_point& p, const Bare_point& q, const Bare_point& r, const Bare_point& s, void write_tetrahedron (const Bare_point& p, const Bare_point& q, const Bare_point& r, const Bare_point& s,
const QColor& color, const QColor& edge_color, std::ofstream& out); const QColor& color, const QColor& edge_color, std::ofstream& out);
void write_point(const Bare_point& p, std::ofstream& out); void write_point(const Bare_point& p, std::ofstream& out);
void write_point_sphere(const Bare_point& p, std::ofstream& out); void write_point_sphere(const Bare_point& p, std::ofstream& out);
void write_edge_cylinder(const Bare_point& p, const Bare_point& q, std::ofstream& out); void write_edge_cylinder(const Bare_point& p, const Bare_point& q, std::ofstream& out);
// Writes data which has been stored during triangle drawing // Writes data which has been stored during triangle drawing
void write_edges_flat(std::ofstream& out); void write_edges_flat(std::ofstream& out);
void write_edges_volumic(std::ofstream& out); void write_edges_volumic(std::ofstream& out);
void write_vertices_volumic(std::ofstream& out); void write_vertices_volumic(std::ofstream& out);
void write_color(const QColor& color, bool use_transparency, std::ofstream& out); void write_color(const QColor& color, bool use_transparency, std::ofstream& out);
void write_opacity(const double alpha, std::ofstream& out); void write_opacity(const double alpha, std::ofstream& out);
// Background // Background
void write_background(const QColor& color, std::ofstream& out); void write_background(const QColor& color, std::ofstream& out);
private: private:
QAction* actionCreateRib; QAction* actionCreateRib;
// Viewer // Viewer
typedef std::map<C3t3::Surface_patch_index, QColor> Surface_map; typedef std::map<C3t3::Surface_patch_index, QColor> Surface_map;
typedef std::map<C3t3::Subdomain_index, QColor> Subdomain_map; typedef std::map<C3t3::Subdomain_index, QColor> Subdomain_map;
Surface_map surface_map_; Surface_map surface_map_;
Subdomain_map subdomain_map_; Subdomain_map subdomain_map_;
typedef std::map<std::pair<Bare_point, Bare_point>,QColor> Edge_map; typedef std::map<std::pair<Bare_point, Bare_point>,QColor> Edge_map;
typedef std::map<Bare_point, QColor> Vertex_map; typedef std::map<Bare_point, QColor> Vertex_map;
Edge_map edges_; Edge_map edges_;
Vertex_map vertices_; Vertex_map vertices_;
double zmax_; double zmax_;
double diag_; double diag_;
// Cache data to avoid writing too much lines in rib file // Cache data to avoid writing too much lines in rib file
QColor prev_color_; QColor prev_color_;
double prev_alpha_; double prev_alpha_;
const Scene_c3t3_item* prev_c3t3_; const Scene_c3t3_item* prev_c3t3_;
Rib_exporter_parameters parameters_; Rib_exporter_parameters parameters_;
}; };
@ -176,7 +176,7 @@ C3t3_rib_exporter_plugin()
, prev_alpha_(1) , prev_alpha_(1)
, prev_c3t3_(NULL) , prev_c3t3_(NULL)
{ {
} }
@ -186,7 +186,7 @@ init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interfa
{ {
this->scene = scene_interface; this->scene = scene_interface;
this->mw = mainWindow; this->mw = mainWindow;
actionCreateRib = new QAction("Export C3t3 to RIB", mw); actionCreateRib = new QAction("Export C3t3 to RIB", mw);
if( NULL != actionCreateRib ) if( NULL != actionCreateRib )
{ {
@ -205,18 +205,18 @@ C3t3_rib_exporter_plugin::create_rib()
std::cerr << "Can't find viewer" << std::endl; std::cerr << "Can't find viewer" << std::endl;
return; return;
} }
// Get Scene_c3t3_item // Get Scene_c3t3_item
Scene_interface::Item_id index = scene->mainSelectionIndex(); Scene_interface::Item_id index = scene->mainSelectionIndex();
Scene_c3t3_item* c3t3_item = Scene_c3t3_item* c3t3_item =
qobject_cast<Scene_c3t3_item*>(scene->item(index)); qobject_cast<Scene_c3t3_item*>(scene->item(index));
if ( NULL == c3t3_item ) if ( NULL == c3t3_item )
{ {
return; return;
} }
// Init data // Init data
//if ( c3t3_item != prev_c3t3_ ) // Commented because it was causing problems //if ( c3t3_item != prev_c3t3_ ) // Commented because it was causing problems
// when changing the color of the c3t3 // when changing the color of the c3t3
@ -224,40 +224,40 @@ C3t3_rib_exporter_plugin::create_rib()
init_maps(c3t3_item->c3t3(), c3t3_item->color()); init_maps(c3t3_item->c3t3(), c3t3_item->color());
init_point_radius(c3t3_item->c3t3()); init_point_radius(c3t3_item->c3t3());
init_parameters(); init_parameters();
prev_c3t3_ = c3t3_item; prev_c3t3_ = c3t3_item;
} }
// Get parameters from user dialog // Get parameters from user dialog
if ( !get_parameters_from_dialog() ) if ( !get_parameters_from_dialog() )
{ {
QBitmap bitmap; QBitmap bitmap;
bitmap.clear(); bitmap.clear();
Three::activeViewer()->setMask(bitmap); Three::activeViewer()->setMask(bitmap);
return; return;
} }
// Disable Mask // Disable Mask
QBitmap bitmap; QBitmap bitmap;
bitmap.clear(); bitmap.clear();
Three::activeViewer()->setMask(bitmap); Three::activeViewer()->setMask(bitmap);
// Save dialog // Save dialog
QStringList filters; QStringList filters;
filters << nameFilters(); filters << nameFilters();
filters << tr("All files (*)"); filters << tr("All files (*)");
QString filename = QFileDialog::getSaveFileName(mw, QString filename = QFileDialog::getSaveFileName(mw,
tr("Save to File..."), tr("Save to File..."),
QString(), QString(),
filters.join(";;")); filters.join(";;"));
QFileInfo fileinfo(filename); QFileInfo fileinfo(filename);
// Save rib file // Save rib file
save(*c3t3_item,fileinfo); save(*c3t3_item,fileinfo);
std::cout << "Rib file created successfully" << std::endl; std::cout << "Rib file created successfully" << std::endl;
} }
@ -284,7 +284,7 @@ C3t3_rib_exporter_plugin::
update_mask() update_mask()
{ {
double ratio = double(parameters_.width) / double(parameters_.height); double ratio = double(parameters_.width) / double(parameters_.height);
if ( NULL == Three::activeViewer() ) if ( NULL == Three::activeViewer() )
{ {
std::cerr << "Can't find viewer..." << std::endl; std::cerr << "Can't find viewer..." << std::endl;
@ -312,11 +312,11 @@ get_parameters_from_dialog()
connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject())); connect(ui.buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
connect(ui.resWidth, SIGNAL(valueChanged(int)), this, SLOT(width_changed(int))); connect(ui.resWidth, SIGNAL(valueChanged(int)), this, SLOT(width_changed(int)));
connect(ui.resHeight, SIGNAL(valueChanged(int)), this, SLOT(height_changed(int))); connect(ui.resHeight, SIGNAL(valueChanged(int)), this, SLOT(height_changed(int)));
// ----------------------------------- // -----------------------------------
// Set data // Set data
// ----------------------------------- // -----------------------------------
// Materials // Materials
ui.sphereRadius->setValue(parameters_.sphere_radius); ui.sphereRadius->setValue(parameters_.sphere_radius);
ui.cylinderRadius->setValue(parameters_.cylinder_radius); ui.cylinderRadius->setValue(parameters_.cylinder_radius);
@ -326,54 +326,54 @@ get_parameters_from_dialog()
ui.ambientIntensity->setValue(parameters_.ambientIntensity); ui.ambientIntensity->setValue(parameters_.ambientIntensity);
ui.isShadowOn->setChecked(parameters_.shadowOn); ui.isShadowOn->setChecked(parameters_.shadowOn);
ui.shadowIntensity->setValue(parameters_.shadowIntensity); ui.shadowIntensity->setValue(parameters_.shadowIntensity);
// Picture // Picture
QStringList mode_list; QStringList mode_list;
mode_list << "Export Cut (draws current cut view)" mode_list << "Export Cut (draws current cut view)"
<< "Export Mesh (draws all surface facets)" << "Export Mesh (draws all surface facets)"
<< "Export Triangulation (draws all points and edges)"; << "Export Triangulation (draws all points and edges)";
ui.exportMode->insertItems(0,mode_list); ui.exportMode->insertItems(0,mode_list);
ui.resWidth->setValue(parameters_.width); ui.resWidth->setValue(parameters_.width);
ui.resHeight->setValue(parameters_.height); ui.resHeight->setValue(parameters_.height);
ui.exportMode->setCurrentIndex(static_cast<int>(parameters_.mode)); ui.exportMode->setCurrentIndex(static_cast<int>(parameters_.mode));
ui.isPreview->setChecked(parameters_.is_preview); ui.isPreview->setChecked(parameters_.is_preview);
// Update mask // Update mask
update_mask(); update_mask();
// ----------------------------------- // -----------------------------------
// Get data // Get data
// ----------------------------------- // -----------------------------------
int i = dialog.exec(); int i = dialog.exec();
if(i == QDialog::Rejected) if(i == QDialog::Rejected)
return false; return false;
// Materials // Materials
parameters_.sphere_radius = ui.sphereRadius->value(); parameters_.sphere_radius = ui.sphereRadius->value();
parameters_.cylinder_radius = ui.cylinderRadius->value(); parameters_.cylinder_radius = ui.cylinderRadius->value();
// Lights // Lights
parameters_.ambientOn = ui.isAmbientOn->isChecked(); parameters_.ambientOn = ui.isAmbientOn->isChecked();
parameters_.ambientIntensity = ui.ambientIntensity->value(); parameters_.ambientIntensity = ui.ambientIntensity->value();
parameters_.shadowOn = ui.isShadowOn->isChecked(); parameters_.shadowOn = ui.isShadowOn->isChecked();
parameters_.shadowIntensity = ui.shadowIntensity->value(); parameters_.shadowIntensity = ui.shadowIntensity->value();
// Picture // Picture
parameters_.width = ui.resWidth->value(); parameters_.width = ui.resWidth->value();
parameters_.height = ui.resHeight->value(); parameters_.height = ui.resHeight->value();
parameters_.mode = static_cast<Rib_exporter_mode>(ui.exportMode->currentIndex()); parameters_.mode = static_cast<Rib_exporter_mode>(ui.exportMode->currentIndex());
parameters_.is_preview = ui.isPreview->isChecked(); parameters_.is_preview = ui.isPreview->isChecked();
return true; return true;
} }
QStringList QStringList
C3t3_rib_exporter_plugin::nameFilters() const C3t3_rib_exporter_plugin::nameFilters() const
{ {
return QStringList() << "RenderMan file (*.rib)"; return QStringList() << "RenderMan file (*.rib)";
} }
@ -385,52 +385,52 @@ save(const Scene_c3t3_item& c3t3_item, const QFileInfo& fileInfo)
QString path = fileInfo.absoluteFilePath(); QString path = fileInfo.absoluteFilePath();
std::ofstream rib_file (qPrintable(path)); std::ofstream rib_file (qPrintable(path));
rib_file.precision(8); rib_file.precision(8);
// Header // Header
QString basename = fileInfo.baseName(); QString basename = fileInfo.baseName();
write_header(qPrintable(basename), rib_file); write_header(qPrintable(basename), rib_file);
// Lights // Lights
write_lights(rib_file); write_lights(rib_file);
// Triangles // Triangles
switch ( parameters_.mode ) switch ( parameters_.mode )
{ {
case CUT: case CUT:
rib_file << "Surface \"plastic\" \"Ka\" 0.65 \"Kd\" 0.85 \"Ks\" 0.25 \"roughness\" 0.1" << std::endl; rib_file << "Surface \"plastic\" \"Ka\" 0.65 \"Kd\" 0.85 \"Ks\" 0.25 \"roughness\" 0.1" << std::endl;
write_facets(c3t3_item.c3t3(), c3t3_item.plane(), rib_file); write_facets(c3t3_item.c3t3(), c3t3_item.plane(), rib_file);
rib_file << "Surface \"plastic\" \"Ka\" 0.65 \"Kd\" 0.65 \"Ks\" 0.35 \"roughness\" 0.2" << std::endl; rib_file << "Surface \"plastic\" \"Ka\" 0.65 \"Kd\" 0.65 \"Ks\" 0.35 \"roughness\" 0.2" << std::endl;
//write_cells_intersecting_a_plane(c3t3_item.c3t3(), c3t3_item.plane(), rib_file); //write_cells_intersecting_a_plane(c3t3_item.c3t3(), c3t3_item.plane(), rib_file);
write_cells_on_the_positive_side_of_a_plane(c3t3_item.c3t3(), c3t3_item.plane(), rib_file); write_cells_on_the_positive_side_of_a_plane(c3t3_item.c3t3(), c3t3_item.plane(), rib_file);
break; break;
case MESH: case MESH:
rib_file << "Surface \"plastic\" \"Ka\" 0.65 \"Kd\" 0.85 \"Ks\" 0.25 \"roughness\" 0.1" << std::endl; rib_file << "Surface \"plastic\" \"Ka\" 0.65 \"Kd\" 0.85 \"Ks\" 0.25 \"roughness\" 0.1" << std::endl;
//write_facets(c3t3_item.c3t3(), rib_file); //write_facets(c3t3_item.c3t3(), rib_file);
write_surface_cells(c3t3_item.c3t3(), c3t3_item.plane(), rib_file); write_surface_cells(c3t3_item.c3t3(), c3t3_item.plane(), rib_file);
break; break;
case TRIANGULATION: case TRIANGULATION:
fill_points_and_edges_map(c3t3_item.c3t3()); fill_points_and_edges_map(c3t3_item.c3t3());
break; break;
default: default:
std::cerr << "Unexpected mode found" << std::endl; std::cerr << "Unexpected mode found" << std::endl;
return false; return false;
break; break;
} }
// Edges and vertices // Edges and vertices
rib_file << "Surface \"plastic\" \"Ka\" 0.65 \"Kd\" 0.85 \"Ks\" 0.25 \"roughness\" 0.1" << std::endl; rib_file << "Surface \"plastic\" \"Ka\" 0.65 \"Kd\" 0.85 \"Ks\" 0.25 \"roughness\" 0.1" << std::endl;
write_edges_volumic(rib_file); write_edges_volumic(rib_file);
write_vertices_volumic(rib_file); write_vertices_volumic(rib_file);
// Background // Background
write_background(QColor(255,255,255), rib_file); write_background(QColor(255,255,255), rib_file);
rib_file << "WorldEnd" << std::endl; rib_file << "WorldEnd" << std::endl;
return true; return true;
} }
@ -441,23 +441,23 @@ C3t3_rib_exporter_plugin::init_maps(const C3t3& c3t3, const QColor& color)
subdomain_map_.clear(); subdomain_map_.clear();
edges_.clear(); edges_.clear();
vertices_.clear(); vertices_.clear();
// Fill maps with 0 as value // Fill maps with 0 as value
for ( C3t3::Facets_in_complex_iterator fit = c3t3.facets_in_complex_begin(), for ( C3t3::Facets_in_complex_iterator fit = c3t3.facets_in_complex_begin(),
fend = c3t3.facets_in_complex_end() ; fit != fend ; ++fit ) fend = c3t3.facets_in_complex_end() ; fit != fend ; ++fit )
{ {
surface_map_.insert(std::make_pair(c3t3.surface_patch_index(*fit),QColor(0,0,0))); surface_map_.insert(std::make_pair(c3t3.surface_patch_index(*fit),QColor(0,0,0)));
} }
for ( C3t3::Cells_in_complex_iterator cit = c3t3.cells_in_complex_begin(), for ( C3t3::Cells_in_complex_iterator cit = c3t3.cells_in_complex_begin(),
cend = c3t3.cells_in_complex_end() ; cit != cend ; ++cit ) cend = c3t3.cells_in_complex_end() ; cit != cend ; ++cit )
{ {
subdomain_map_.insert(std::make_pair(c3t3.subdomain_index(cit),QColor(0,0,0))); subdomain_map_.insert(std::make_pair(c3t3.subdomain_index(cit),QColor(0,0,0)));
} }
// Fill value of maps // Fill value of maps
size_t nb_colors = subdomain_map_.size(); // + surface_map_.size(); size_t nb_colors = subdomain_map_.size(); // + surface_map_.size();
// Starting hue // Starting hue
double c = color.hueF(); double c = color.hueF();
int i = 0; int i = 0;
@ -476,13 +476,13 @@ C3t3_rib_exporter_plugin::
init_point_radius(const C3t3& c3t3) init_point_radius(const C3t3& c3t3)
{ {
const CGAL::Bbox_3 bbox = c3t3.bbox(); const CGAL::Bbox_3 bbox = c3t3.bbox();
const double xdelta = bbox.xmax() - bbox.xmin(); const double xdelta = bbox.xmax() - bbox.xmin();
const double ydelta = bbox.ymax() - bbox.ymin(); const double ydelta = bbox.ymax() - bbox.ymin();
const double zdelta = bbox.zmax() - bbox.zmin(); const double zdelta = bbox.zmax() - bbox.zmin();
diag_ = std::sqrt(xdelta*xdelta + ydelta*ydelta + zdelta*zdelta); diag_ = std::sqrt(xdelta*xdelta + ydelta*ydelta + zdelta*zdelta);
parameters_.sphere_radius = diag_ * 0.0015; parameters_.sphere_radius = diag_ * 0.0015;
parameters_.cylinder_radius = diag_ * 0.00065; parameters_.cylinder_radius = diag_ * 0.00065;
} }
@ -497,7 +497,7 @@ init_parameters()
parameters_.ambientIntensity = 0.20; parameters_.ambientIntensity = 0.20;
parameters_.shadowOn = true; parameters_.shadowOn = true;
parameters_.shadowIntensity = 0.85; parameters_.shadowIntensity = 0.85;
// Picture // Picture
parameters_.width = 800; parameters_.width = 800;
parameters_.height = 800; parameters_.height = 800;
@ -512,10 +512,10 @@ camera_coordinates(const Bare_point& p)
{ {
qglVec p_vec ( p.x(), p.y(), p.z() ); qglVec p_vec ( p.x(), p.y(), p.z() );
qglVec p_cam = Three::activeViewer()->camera()->cameraCoordinatesOf(p_vec); qglVec p_cam = Three::activeViewer()->camera()->cameraCoordinatesOf(p_vec);
// Store maximal depth // Store maximal depth
zmax_ = (std::max)(zmax_, double(-p_cam[2])); zmax_ = (std::max)(zmax_, double(-p_cam[2]));
return Bare_point(p_cam[0],p_cam[1],p_cam[2]); return Bare_point(p_cam[0],p_cam[1],p_cam[2]);
} }
@ -534,16 +534,16 @@ fill_points_and_edges_map(const C3t3& c3t3)
const Bare_point& p2 = wp2p(it->vertex(1)->point()); const Bare_point& p2 = wp2p(it->vertex(1)->point());
const Bare_point& p3 = wp2p(it->vertex(2)->point()); const Bare_point& p3 = wp2p(it->vertex(2)->point());
const Bare_point& p4 = wp2p(it->vertex(3)->point()); const Bare_point& p4 = wp2p(it->vertex(3)->point());
const QColor& edge_color = subdomain_map_[c3t3.subdomain_index(it)]; const QColor& edge_color = subdomain_map_[c3t3.subdomain_index(it)];
add_edge(p1,p2,edge_color); add_edge(p1,p2,edge_color);
add_edge(p1,p3,edge_color); add_edge(p1,p3,edge_color);
add_edge(p1,p4,edge_color); add_edge(p1,p4,edge_color);
add_edge(p2,p3,edge_color); add_edge(p2,p3,edge_color);
add_edge(p2,p4,edge_color); add_edge(p2,p4,edge_color);
add_edge(p3,p4,edge_color); add_edge(p3,p4,edge_color);
add_vertex(p1,edge_color); add_vertex(p1,edge_color);
add_vertex(p2,edge_color); add_vertex(p2,edge_color);
add_vertex(p3,edge_color); add_vertex(p3,edge_color);
@ -558,11 +558,11 @@ add_edge(const Bare_point& p, const Bare_point& q, const QColor& color)
{ {
if ( p < q ) if ( p < q )
{ {
edges_.insert(std::make_pair(std::make_pair(p,q),color)); edges_.insert(std::make_pair(std::make_pair(p,q),color));
} }
else else
{ {
edges_.insert(std::make_pair(std::make_pair(q,p),color)); edges_.insert(std::make_pair(std::make_pair(q,p),color));
} }
} }
@ -571,7 +571,7 @@ void
C3t3_rib_exporter_plugin:: C3t3_rib_exporter_plugin::
add_vertex(const Bare_point& p, const QColor& color) add_vertex(const Bare_point& p, const QColor& color)
{ {
vertices_.insert(std::make_pair(p,color)); vertices_.insert(std::make_pair(p,color));
} }
@ -581,15 +581,15 @@ write_header(const std::string& filename, std::ofstream& out)
{ {
out << "Option \"limits\" \"numthreads\" [16]" << std::endl out << "Option \"limits\" \"numthreads\" [16]" << std::endl
<< "Option \"searchpath\" \"shader\" \".:./shaders:%PIXIE_SHADERS%:%PIXIEHOME%/shaders\"" << std::endl; << "Option \"searchpath\" \"shader\" \".:./shaders:%PIXIE_SHADERS%:%PIXIEHOME%/shaders\"" << std::endl;
if ( ! parameters_.is_preview ) if ( ! parameters_.is_preview )
{ {
out << "Attribute \"visibility\" \"specular\" 1" << std::endl out << "Attribute \"visibility\" \"specular\" 1" << std::endl
<< "Attribute \"visibility\" \"transmission\" 1" << std::endl << std::endl; << "Attribute \"visibility\" \"transmission\" 1" << std::endl << std::endl;
} }
out << "Display \""<< filename << ".tif\" \"file\" \"rgb\"" << std::endl; out << "Display \""<< filename << ".tif\" \"file\" \"rgb\"" << std::endl;
if ( ! parameters_.is_preview ) if ( ! parameters_.is_preview )
{ {
out << "Format " << parameters_.width << " " << parameters_.height << " 1" << std::endl; out << "Format " << parameters_.width << " " << parameters_.height << " 1" << std::endl;
@ -597,25 +597,25 @@ write_header(const std::string& filename, std::ofstream& out)
else else
{ {
double ratio = double(parameters_.height) / double(parameters_.width); double ratio = double(parameters_.height) / double(parameters_.width);
int width = (ratio < 1.) ? 300 : int(300. / ratio); int width = (ratio < 1.) ? 300 : int(300. / ratio);
int height = (ratio < 1.) ? int(ratio * 300.) : 300; int height = (ratio < 1.) ? int(ratio * 300.) : 300;
out << "Format " << width << " " << height << " 1" << std::endl; out << "Format " << width << " " << height << " 1" << std::endl;
} }
if ( parameters_.width > parameters_.height ) if ( parameters_.width > parameters_.height )
{ {
double ratio = double(parameters_.height) / double(parameters_.width); double ratio = double(parameters_.height) / double(parameters_.width);
out << "ScreenWindow -1 1 " << -ratio << " " << ratio << std::endl; out << "ScreenWindow -1 1 " << -ratio << " " << ratio << std::endl;
} }
else if ( parameters_.height > parameters_.width ) else if ( parameters_.height > parameters_.width )
{ {
double ratio = double(parameters_.width) / double(parameters_.height); double ratio = double(parameters_.width) / double(parameters_.height);
out << "ScreenWindow " << -ratio << " " << ratio << " -1 1" << std::endl; out << "ScreenWindow " << -ratio << " " << ratio << " -1 1" << std::endl;
} }
out << "Projection \"perspective\" \"fov\" 45" << std::endl out << "Projection \"perspective\" \"fov\" 45" << std::endl
<< "PixelSamples 4 4" << std::endl << "PixelSamples 4 4" << std::endl
<< "PixelFilter \"catmull-rom\" 3 3" << std::endl << "PixelFilter \"catmull-rom\" 3 3" << std::endl
@ -634,7 +634,7 @@ write_lights(std::ofstream& out)
// ShadowLight // ShadowLight
out << "LightSource \"shadowdistant\" 1 \"from\" [0 0 0] \"to\" [0 0 1]" out << "LightSource \"shadowdistant\" 1 \"from\" [0 0 0] \"to\" [0 0 1]"
<< " \"shadowname\" \"raytrace\" \"intensity\" " << parameters_.shadowIntensity << std::endl; << " \"shadowname\" \"raytrace\" \"intensity\" " << parameters_.shadowIntensity << std::endl;
// Ambient light // Ambient light
out << "LightSource \"ambientlight\" 2 \"intensity\" " << parameters_.ambientIntensity << std::endl; out << "LightSource \"ambientlight\" 2 \"intensity\" " << parameters_.ambientIntensity << std::endl;
} }
@ -643,7 +643,7 @@ write_lights(std::ofstream& out)
out << "LightSource \"distantLight\" 1 \"from\" [0 0 0] \"to\" [0 0 1]" out << "LightSource \"distantLight\" 1 \"from\" [0 0 0] \"to\" [0 0 1]"
<< " \"intensity\" 0.85" << std::endl; << " \"intensity\" 0.85" << std::endl;
} }
// Background light // Background light
out << "LightSource \"ambientlight\" 99 \"intensity\" 1" << std::endl; out << "LightSource \"ambientlight\" 99 \"intensity\" 1" << std::endl;
write_turn_background_light(false,out); write_turn_background_light(false,out);
@ -681,14 +681,14 @@ write_facets(const C3t3& c3t3, std::ofstream& out)
{ {
const C3t3::Cell_handle& c = it->first; const C3t3::Cell_handle& c = it->first;
const int& k = it->second; const int& k = it->second;
const Bare_point& p1 = wp2p(c->vertex((k+1)&3)->point()); const Bare_point& p1 = wp2p(c->vertex((k+1)&3)->point());
const Bare_point& p2 = wp2p(c->vertex((k+2)&3)->point()); const Bare_point& p2 = wp2p(c->vertex((k+2)&3)->point());
const Bare_point& p3 = wp2p(c->vertex((k+3)&3)->point()); const Bare_point& p3 = wp2p(c->vertex((k+3)&3)->point());
QColor color = c3t3.is_in_complex(c) ? subdomain_map_[c3t3.subdomain_index(c)] QColor color = c3t3.is_in_complex(c) ? subdomain_map_[c3t3.subdomain_index(c)]
: subdomain_map_[c3t3.subdomain_index(c->neighbor(k))]; : subdomain_map_[c3t3.subdomain_index(c->neighbor(k))];
write_triangle(p1, p2, p3, color, color.darker(125), out ); write_triangle(p1, p2, p3, color, color.darker(125), out );
} }
} }
@ -708,7 +708,7 @@ write_facets(const C3t3& c3t3, const Plane& plane, std::ofstream& out)
{ {
const C3t3::Cell_handle& c = it->first; const C3t3::Cell_handle& c = it->first;
const int& k = it->second; const int& k = it->second;
const Bare_point& p1 = wp2p(c->vertex((k+1)&3)->point()); const Bare_point& p1 = wp2p(c->vertex((k+1)&3)->point());
const Bare_point& p2 = wp2p(c->vertex((k+2)&3)->point()); const Bare_point& p2 = wp2p(c->vertex((k+2)&3)->point());
const Bare_point& p3 = wp2p(c->vertex((k+3)&3)->point()); const Bare_point& p3 = wp2p(c->vertex((k+3)&3)->point());
@ -716,13 +716,13 @@ write_facets(const C3t3& c3t3, const Plane& plane, std::ofstream& out)
const Side s1 = plane.oriented_side(p1); const Side s1 = plane.oriented_side(p1);
const Side s2 = plane.oriented_side(p2); const Side s2 = plane.oriented_side(p2);
const Side s3 = plane.oriented_side(p3); const Side s3 = plane.oriented_side(p3);
if( s1 == CGAL::ON_NEGATIVE_SIDE && s2 == CGAL::ON_NEGATIVE_SIDE if( s1 == CGAL::ON_NEGATIVE_SIDE && s2 == CGAL::ON_NEGATIVE_SIDE
&& s3 == CGAL::ON_NEGATIVE_SIDE ) && s3 == CGAL::ON_NEGATIVE_SIDE )
{ {
QColor color = c3t3.is_in_complex(c) ? subdomain_map_[c3t3.subdomain_index(c)] QColor color = c3t3.is_in_complex(c) ? subdomain_map_[c3t3.subdomain_index(c)]
: subdomain_map_[c3t3.subdomain_index(c->neighbor(k))]; : subdomain_map_[c3t3.subdomain_index(c->neighbor(k))];
write_triangle(p1, p2, p3, color, color.darker(125), out ); write_triangle(p1, p2, p3, color, color.darker(125), out );
} }
} }
@ -752,16 +752,16 @@ write_surface_cells(const C3t3& c3t3, const Plane& /* plane */, std::ofstream& o
last_2D_vertex_index = i; last_2D_vertex_index = i;
} }
} }
//const int TRANSPARENCY_ALPHA_VALUE = 100; //const int TRANSPARENCY_ALPHA_VALUE = 100;
CGAL::Bbox_3 bbox = c3t3.bbox(); CGAL::Bbox_3 bbox = c3t3.bbox();
float relPos = static_cast<float>((c->weighted_circumcenter().x() - bbox.xmin()) float relPos = static_cast<float>((c->weighted_circumcenter().x() - bbox.xmin())
/ (bbox.xmax() - bbox.xmin())); / (bbox.xmax() - bbox.xmin()));
float TRANSPARENCY_ALPHA_VALUE = float TRANSPARENCY_ALPHA_VALUE =
1.f - 1.f -
(relPos < 0.25f ? (relPos < 0.25f ?
0.0f : 0.0f :
(relPos > 0.75f ? (relPos > 0.75f ?
1.0f : 1.0f :
(relPos - 0.25f)*1.0f/0.5f (relPos - 0.25f)*1.0f/0.5f
) )
@ -775,7 +775,7 @@ write_surface_cells(const C3t3& c3t3, const Plane& /* plane */, std::ofstream& o
QColor basecolor = subdomain_map_[c3t3.subdomain_index(c)]; QColor basecolor = subdomain_map_[c3t3.subdomain_index(c)];
QColor facecolor = basecolor.darker(150); QColor facecolor = basecolor.darker(150);
QColor edgecolor = facecolor.darker(150); QColor edgecolor = facecolor.darker(150);
for (int i = 0 ; i < 4 ; ++i) for (int i = 0 ; i < 4 ; ++i)
{ {
if (c3t3.in_dimension(c->vertex((i+1)%4)) == 2 if (c3t3.in_dimension(c->vertex((i+1)%4)) == 2
@ -796,14 +796,14 @@ write_surface_cells(const C3t3& c3t3, const Plane& /* plane */, std::ofstream& o
} }
}*/ }*/
// SURFACE CELLS ARE TRANSPARENT // SURFACE CELLS ARE TRANSPARENT
if (num_2D_vertices >= 2) if (num_2D_vertices >= 2)
{ {
QColor basecolor = subdomain_map_[c3t3.subdomain_index(c)]; QColor basecolor = subdomain_map_[c3t3.subdomain_index(c)];
QColor facecolor = basecolor.darker(150); QColor facecolor = basecolor.darker(150);
QColor edgecolor = facecolor.darker(150); QColor edgecolor = facecolor.darker(150);
/* /*
typedef Kernel::Oriented_side Side; typedef Kernel::Oriented_side Side;
@ -812,7 +812,7 @@ write_surface_cells(const C3t3& c3t3, const Plane& /* plane */, std::ofstream& o
const Side s1 = plane.oriented_side(wp2p(c->vertex(1)->point())); const Side s1 = plane.oriented_side(wp2p(c->vertex(1)->point()));
const Side s2 = plane.oriented_side(wp2p(c->vertex(2)->point())); const Side s2 = plane.oriented_side(wp2p(c->vertex(2)->point()));
const Side s3 = plane.oriented_side(wp2p(c->vertex(3)->point())); const Side s3 = plane.oriented_side(wp2p(c->vertex(3)->point()));
if( s0 == CGAL::ON_NEGATIVE_SIDE && s1 == CGAL::ON_NEGATIVE_SIDE if( s0 == CGAL::ON_NEGATIVE_SIDE && s1 == CGAL::ON_NEGATIVE_SIDE
&& s2 == CGAL::ON_NEGATIVE_SIDE && s3 == CGAL::ON_NEGATIVE_SIDE ) && s2 == CGAL::ON_NEGATIVE_SIDE && s3 == CGAL::ON_NEGATIVE_SIDE )
{ {
edgecolor.setAlpha(TRANSPARENCY_ALPHA_VALUE); edgecolor.setAlpha(TRANSPARENCY_ALPHA_VALUE);
@ -821,9 +821,9 @@ write_surface_cells(const C3t3& c3t3, const Plane& /* plane */, std::ofstream& o
{ {
edgecolor.setAlpha(255); edgecolor.setAlpha(255);
}*/ }*/
edgecolor.setAlphaF(TRANSPARENCY_ALPHA_VALUE); edgecolor.setAlphaF(TRANSPARENCY_ALPHA_VALUE);
for (int i = 0 ; i < 4 ; ++i) for (int i = 0 ; i < 4 ; ++i)
{ {
write_triangle(wp2p(c->vertex((i+1)%4)->point()), write_triangle(wp2p(c->vertex((i+1)%4)->point()),
@ -837,7 +837,7 @@ write_surface_cells(const C3t3& c3t3, const Plane& /* plane */, std::ofstream& o
QColor basecolor = subdomain_map_[c3t3.subdomain_index(c)]; QColor basecolor = subdomain_map_[c3t3.subdomain_index(c)];
QColor facecolor = basecolor.darker(150); QColor facecolor = basecolor.darker(150);
QColor edgecolor = facecolor.darker(150); QColor edgecolor = facecolor.darker(150);
for (int i = 0 ; i < 4 ; ++i) for (int i = 0 ; i < 4 ; ++i)
{ {
if (i == last_2D_vertex_index) if (i == last_2D_vertex_index)
@ -875,12 +875,12 @@ write_cells_intersecting_a_plane(const C3t3& c3t3, const Plane& plane, std::ofst
const Bare_point& p2 = wp2p(it->vertex(1)->point()); const Bare_point& p2 = wp2p(it->vertex(1)->point());
const Bare_point& p3 = wp2p(it->vertex(2)->point()); const Bare_point& p3 = wp2p(it->vertex(2)->point());
const Bare_point& p4 = wp2p(it->vertex(3)->point()); const Bare_point& p4 = wp2p(it->vertex(3)->point());
const Side s1 = plane.oriented_side(p1); const Side s1 = plane.oriented_side(p1);
const Side s2 = plane.oriented_side(p2); const Side s2 = plane.oriented_side(p2);
const Side s3 = plane.oriented_side(p3); const Side s3 = plane.oriented_side(p3);
const Side s4 = plane.oriented_side(p4); const Side s4 = plane.oriented_side(p4);
if( s1 == CGAL::ON_ORIENTED_BOUNDARY || s2 == CGAL::ON_ORIENTED_BOUNDARY if( s1 == CGAL::ON_ORIENTED_BOUNDARY || s2 == CGAL::ON_ORIENTED_BOUNDARY
|| s3 == CGAL::ON_ORIENTED_BOUNDARY || s4 == CGAL::ON_ORIENTED_BOUNDARY || s3 == CGAL::ON_ORIENTED_BOUNDARY || s4 == CGAL::ON_ORIENTED_BOUNDARY
|| s2 != s1 || s3 != s1 || s4 != s1 ) || s2 != s1 || s3 != s1 || s4 != s1 )
@ -890,17 +890,17 @@ write_cells_intersecting_a_plane(const C3t3& c3t3, const Plane& plane, std::ofst
QColor edgecolor = facecolor.darker(150); QColor edgecolor = facecolor.darker(150);
edgecolor.setAlpha(20); edgecolor.setAlpha(20);
// Don't write facet twice // Don't write facet twice
if ( s1 != CGAL::ON_NEGATIVE_SIDE || s2 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE ) if ( s1 != CGAL::ON_NEGATIVE_SIDE || s2 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE )
write_triangle(p1, p2, p3, facecolor, edgecolor, out ); write_triangle(p1, p2, p3, facecolor, edgecolor, out );
if ( s1 != CGAL::ON_NEGATIVE_SIDE || s2 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE ) if ( s1 != CGAL::ON_NEGATIVE_SIDE || s2 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE )
write_triangle(p1, p2, p4, facecolor, edgecolor, out ); write_triangle(p1, p2, p4, facecolor, edgecolor, out );
if ( s1 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE ) if ( s1 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE )
write_triangle(p1, p3, p4, facecolor, edgecolor, out ); write_triangle(p1, p3, p4, facecolor, edgecolor, out );
if ( s2 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE ) if ( s2 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE )
write_triangle(p2, p3, p4, facecolor, edgecolor, out ); write_triangle(p2, p3, p4, facecolor, edgecolor, out );
} }
@ -923,12 +923,12 @@ write_cells_on_the_positive_side_of_a_plane(const C3t3& c3t3, const Plane& plane
const Bare_point& p2 = wp2p(it->vertex(1)->point()); const Bare_point& p2 = wp2p(it->vertex(1)->point());
const Bare_point& p3 = wp2p(it->vertex(2)->point()); const Bare_point& p3 = wp2p(it->vertex(2)->point());
const Bare_point& p4 = wp2p(it->vertex(3)->point()); const Bare_point& p4 = wp2p(it->vertex(3)->point());
const Side s1 = plane.oriented_side(p1); const Side s1 = plane.oriented_side(p1);
const Side s2 = plane.oriented_side(p2); const Side s2 = plane.oriented_side(p2);
const Side s3 = plane.oriented_side(p3); const Side s3 = plane.oriented_side(p3);
const Side s4 = plane.oriented_side(p4); const Side s4 = plane.oriented_side(p4);
if( ( s1 == CGAL::ON_POSITIVE_SIDE || s2 == CGAL::ON_POSITIVE_SIDE if( ( s1 == CGAL::ON_POSITIVE_SIDE || s2 == CGAL::ON_POSITIVE_SIDE
|| s3 == CGAL::ON_POSITIVE_SIDE || s4 == CGAL::ON_POSITIVE_SIDE ) || s3 == CGAL::ON_POSITIVE_SIDE || s4 == CGAL::ON_POSITIVE_SIDE )
/*&& /*&&
@ -943,17 +943,17 @@ write_cells_on_the_positive_side_of_a_plane(const C3t3& c3t3, const Plane& plane
QColor edgecolor = facecolor.darker(150); QColor edgecolor = facecolor.darker(150);
edgecolor.setAlpha(10); edgecolor.setAlpha(10);
// Don't write facet twice // Don't write facet twice
if ( s1 != CGAL::ON_NEGATIVE_SIDE || s2 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE ) if ( s1 != CGAL::ON_NEGATIVE_SIDE || s2 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE )
write_triangle(p1, p2, p3, facecolor, edgecolor, out ); write_triangle(p1, p2, p3, facecolor, edgecolor, out );
if ( s1 != CGAL::ON_NEGATIVE_SIDE || s2 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE ) if ( s1 != CGAL::ON_NEGATIVE_SIDE || s2 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE )
write_triangle(p1, p2, p4, facecolor, edgecolor, out ); write_triangle(p1, p2, p4, facecolor, edgecolor, out );
if ( s1 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE ) if ( s1 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE )
write_triangle(p1, p3, p4, facecolor, edgecolor, out ); write_triangle(p1, p3, p4, facecolor, edgecolor, out );
if ( s2 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE ) if ( s2 != CGAL::ON_NEGATIVE_SIDE || s3 != CGAL::ON_NEGATIVE_SIDE || s4 != CGAL::ON_NEGATIVE_SIDE )
write_triangle(p2, p3, p4, facecolor, edgecolor, out ); write_triangle(p2, p3, p4, facecolor, edgecolor, out );
} }
@ -968,14 +968,14 @@ write_triangle (const Bare_point& p, const Bare_point& q, const Bare_point& r,
{ {
// Color // Color
write_color(color, true, out); write_color(color, true, out);
// Triangle // Triangle
out << "Polygon \"P\" ["; out << "Polygon \"P\" [";
write_point(p,out); write_point(p,out);
write_point(q,out); write_point(q,out);
write_point(r,out); write_point(r,out);
out << "]" << std::endl; out << "]" << std::endl;
// Edges (will be drawn later on) // Edges (will be drawn later on)
add_edge(p,q,edge_color); add_edge(p,q,edge_color);
add_edge(p,r,edge_color); add_edge(p,r,edge_color);
@ -994,7 +994,7 @@ write_tetrahedron (const Bare_point& p, const Bare_point& q, const Bare_point& r
{ {
// Color // Color
write_color(color, true, out); write_color(color, true, out);
// Triangle // Triangle
out << "Polygon \"P\" ["; out << "Polygon \"P\" [";
write_point(p,out); write_point(p,out);
@ -1002,7 +1002,7 @@ write_tetrahedron (const Bare_point& p, const Bare_point& q, const Bare_point& r
write_point(r,out); write_point(r,out);
write_point(s,out); write_point(s,out);
out << "]" << std::endl; out << "]" << std::endl;
// Edges (will be drawn later on) // Edges (will be drawn later on)
add_edge(p,q,edge_color); add_edge(p,q,edge_color);
add_edge(p,r,edge_color); add_edge(p,r,edge_color);
@ -1024,7 +1024,7 @@ write_point (const Bare_point& p, std::ofstream& out)
{ {
// Transform point in camera coordinates // Transform point in camera coordinates
const Bare_point& p_cam = camera_coordinates(p); const Bare_point& p_cam = camera_coordinates(p);
// Write it // Write it
out << " " << -p_cam.x() << " " << -p_cam.y() << " " << -p_cam.z() << " "; out << " " << -p_cam.x() << " " << -p_cam.y() << " " << -p_cam.z() << " ";
} }
@ -1036,12 +1036,12 @@ write_point_sphere(const Bare_point& p, std::ofstream& out)
{ {
// Transform point in camera coordinates // Transform point in camera coordinates
const Bare_point& p_cam = camera_coordinates(p); const Bare_point& p_cam = camera_coordinates(p);
// radius // radius
const double& r = parameters_.sphere_radius; const double& r = parameters_.sphere_radius;
out << "Translate " << -p_cam.x() << " " << -p_cam.y() << " " << -p_cam.z() << std::endl; out << "Translate " << -p_cam.x() << " " << -p_cam.y() << " " << -p_cam.z() << std::endl;
// Sphere radius zmin zmax thetamax // Sphere radius zmin zmax thetamax
out << "Sphere " << r << " " << -r << " " << r << " 360" << std::endl; out << "Sphere " << r << " " << -r << " " << r << " 360" << std::endl;
out << "Identity" << std::endl; out << "Identity" << std::endl;
@ -1055,50 +1055,50 @@ write_edge_cylinder(const Bare_point& p, const Bare_point& q, std::ofstream& out
// Transform point in camera coordinates // Transform point in camera coordinates
const Bare_point& p_cam = camera_coordinates(p); const Bare_point& p_cam = camera_coordinates(p);
const Bare_point& q_cam = camera_coordinates(q); const Bare_point& q_cam = camera_coordinates(q);
double pq = CGAL::to_double(CGAL::sqrt(CGAL::squared_distance(p_cam,q_cam))); double pq = CGAL::to_double(CGAL::sqrt(CGAL::squared_distance(p_cam,q_cam)));
Aff_transformation_3 t (CGAL::Translation(), Vector_3(p_cam,CGAL::ORIGIN)); Aff_transformation_3 t (CGAL::Translation(), Vector_3(p_cam,CGAL::ORIGIN));
const Bare_point& q_cam_t = q_cam.transform(t); const Bare_point& q_cam_t = q_cam.transform(t);
Vector_3 Oq (CGAL::ORIGIN,q_cam_t); Vector_3 Oq (CGAL::ORIGIN,q_cam_t);
Vector_3 Oz (FT(0),FT(0),FT(1)); Vector_3 Oz (FT(0),FT(0),FT(1));
Vector_3 r_axis = CGAL::cross_product(Oq,Oz); Vector_3 r_axis = CGAL::cross_product(Oq,Oz);
double cos_angle = CGAL::to_double((Oq*Oz)/CGAL::sqrt(Oq.squared_length())); double cos_angle = CGAL::to_double((Oq*Oz)/CGAL::sqrt(Oq.squared_length()));
double angle = std::acos(cos_angle) * 180. / CGAL_PI; double angle = std::acos(cos_angle) * 180. / CGAL_PI;
// radius // radius
const double& r = parameters_.cylinder_radius; const double& r = parameters_.cylinder_radius;
out << "Translate " << -p_cam.x() << " " << -p_cam.y() << " " << -p_cam.z() << std::endl; out << "Translate " << -p_cam.x() << " " << -p_cam.y() << " " << -p_cam.z() << std::endl;
out << "Rotate " << (angle+180.) << " " << -r_axis.x() << " " << -r_axis.y() << " " << -r_axis.z() << std::endl; out << "Rotate " << (angle+180.) << " " << -r_axis.x() << " " << -r_axis.y() << " " << -r_axis.z() << std::endl;
// Cylinder radius zmin zmax thetamax // Cylinder radius zmin zmax thetamax
out << "Cylinder " << r << " 0 " << pq << " 360" << std::endl; out << "Cylinder " << r << " 0 " << pq << " 360" << std::endl;
out << "Identity" << std::endl; out << "Identity" << std::endl;
} }
void void
C3t3_rib_exporter_plugin:: C3t3_rib_exporter_plugin::
write_edges_flat(std::ofstream& out) write_edges_flat(std::ofstream& out)
{ {
// Lights // Lights
write_turn_background_light(true,out); write_turn_background_light(true,out);
out << "Surface \"constant\"" << std::endl; out << "Surface \"constant\"" << std::endl;
write_opacity(CGAL_RIB_NON_TRANSPARENT_MATERIAL_ALPHA, out); write_opacity(CGAL_RIB_NON_TRANSPARENT_MATERIAL_ALPHA, out);
// Translation // Translation
out << "Translate 0 0 -0.1" << std::endl; out << "Translate 0 0 -0.1" << std::endl;
for ( Edge_map::iterator it = edges_.begin(), end = edges_.end() ; for ( Edge_map::iterator it = edges_.begin(), end = edges_.end() ;
it != end ; ++it ) it != end ; ++it )
{ {
// Color // Color
write_color(it->second, true, out); write_color(it->second, true, out);
// Edge // Edge
out << "Curves \"linear\" [2] \"nonperiodic\" \"P\" ["; out << "Curves \"linear\" [2] \"nonperiodic\" \"P\" [";
write_point(it->first.first,out); write_point(it->first.first,out);
@ -1108,13 +1108,13 @@ write_edges_flat(std::ofstream& out)
} }
void void
C3t3_rib_exporter_plugin:: C3t3_rib_exporter_plugin::
write_edges_volumic(std::ofstream& out) write_edges_volumic(std::ofstream& out)
{ {
// Material // Material
write_opacity(CGAL_RIB_NON_TRANSPARENT_MATERIAL_ALPHA, out); write_opacity(CGAL_RIB_NON_TRANSPARENT_MATERIAL_ALPHA, out);
for ( Edge_map::iterator it = edges_.begin(), end = edges_.end() ; for ( Edge_map::iterator it = edges_.begin(), end = edges_.end() ;
it != end ; ++it ) it != end ; ++it )
{ {
@ -1125,13 +1125,13 @@ write_edges_volumic(std::ofstream& out)
} }
} }
void void
C3t3_rib_exporter_plugin:: C3t3_rib_exporter_plugin::
write_vertices_volumic(std::ofstream& out) write_vertices_volumic(std::ofstream& out)
{ {
// Material // Material
write_opacity(CGAL_RIB_NON_TRANSPARENT_MATERIAL_ALPHA, out); write_opacity(CGAL_RIB_NON_TRANSPARENT_MATERIAL_ALPHA, out);
for ( Vertex_map::iterator it = vertices_.begin(), end = vertices_.end() ; for ( Vertex_map::iterator it = vertices_.begin(), end = vertices_.end() ;
it != end ; ++it ) it != end ; ++it )
{ {
@ -1143,26 +1143,26 @@ write_vertices_volumic(std::ofstream& out)
} }
void void
C3t3_rib_exporter_plugin:: C3t3_rib_exporter_plugin::
write_color(const QColor& color, bool use_transparency, std::ofstream& out) write_color(const QColor& color, bool use_transparency, std::ofstream& out)
{ {
if ( prev_color_ == color ) if ( prev_color_ == color )
{ {
return; return;
} }
// Cache data // Cache data
prev_color_ = color; prev_color_ = color;
// Write opacity data // Write opacity data
if (use_transparency) if (use_transparency)
{ {
write_opacity(color.alphaF(),out); write_opacity(color.alphaF(),out);
} }
// Write color data // Write color data
out << "Color [ " << color.redF() << " " << color.greenF() << " " out << "Color [ " << color.redF() << " " << color.greenF() << " "
<< color.blueF() << " ]" << std::endl; << color.blueF() << " ]" << std::endl;
} }
@ -1175,27 +1175,27 @@ write_opacity(const double alpha, std::ofstream& out)
{ {
return; return;
} }
// Cache data // Cache data
prev_alpha_ = alpha; prev_alpha_ = alpha;
// Write opacity data // Write opacity data
out << "Opacity " << alpha << " " << alpha << " " << alpha << std::endl; out << "Opacity " << alpha << " " << alpha << " " << alpha << std::endl;
} }
void void
C3t3_rib_exporter_plugin:: C3t3_rib_exporter_plugin::
write_background(const QColor& color, std::ofstream& out) write_background(const QColor& color, std::ofstream& out)
{ {
write_turn_background_light(false,out); write_turn_background_light(false,out);
out << "Surface \"constant\"" << std::endl; out << "Surface \"constant\"" << std::endl;
write_color(color,false,out); write_color(color,false,out);
double corner = zmax_ * 2.; double corner = zmax_ * 2.;
double depth_pos = zmax_ * 1.6; double depth_pos = zmax_ * 1.6;
out << "Polygon \"P\" ["; out << "Polygon \"P\" [";
out << " " << -corner << " " << -corner << " " << depth_pos << " "; out << " " << -corner << " " << -corner << " " << depth_pos << " ";
out << " " << corner << " " << -corner << " " << depth_pos << " "; out << " " << corner << " " << -corner << " " << depth_pos << " ";

View File

@ -86,7 +86,7 @@ public:
Mesh_3_optimization_plugin(); Mesh_3_optimization_plugin();
virtual void init(QMainWindow*, Scene_interface*, Messages_interface*); virtual void init(QMainWindow*, Scene_interface*, Messages_interface*);
inline virtual QList<QAction*> actions() const; inline virtual QList<QAction*> actions() const;
bool applicable(QAction* a) const { bool applicable(QAction* a) const {
Scene_c3t3_item* item Scene_c3t3_item* item
= qobject_cast<Scene_c3t3_item*>(scene->item(scene->mainSelectionIndex())); = qobject_cast<Scene_c3t3_item*>(scene->item(scene->mainSelectionIndex()));
@ -112,16 +112,16 @@ public Q_SLOTS:
#ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER #ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER
void exude(); void exude();
#endif #endif
void optimization_done(Optimizer_thread* t); void optimization_done(Optimizer_thread* t);
void status_report(QString s); void status_report(QString s);
private: private:
Scene_c3t3_item* get_c3t3_item() const; Scene_c3t3_item* get_c3t3_item() const;
void treat_result(Scene_c3t3_item& source_item, Scene_c3t3_item& result_item, void treat_result(Scene_c3t3_item& source_item, Scene_c3t3_item& result_item,
const QString& name) const; const QString& name) const;
void launch_thread(Optimizer_thread* thread, const QString& msg); void launch_thread(Optimizer_thread* thread, const QString& msg);
private: private:
@ -131,7 +131,7 @@ private:
QAction* actionExude; QAction* actionExude;
Messages_interface* msg; Messages_interface* msg;
QMessageBox* message_box_; QMessageBox* message_box_;
Scene_c3t3_item* source_item_; Scene_c3t3_item* source_item_;
Scene_interface *scene; Scene_interface *scene;
QMainWindow* mw; QMainWindow* mw;
@ -151,7 +151,7 @@ Mesh_3_optimization_plugin()
{ {
} }
void void
Mesh_3_optimization_plugin:: Mesh_3_optimization_plugin::
init(QMainWindow* mainWindow, init(QMainWindow* mainWindow,
Scene_interface* scene_interface, Scene_interface* scene_interface,
@ -159,7 +159,7 @@ init(QMainWindow* mainWindow,
{ {
this->scene = scene_interface; this->scene = scene_interface;
this->mw = mainWindow; this->mw = mainWindow;
// Create menu items // Create menu items
#ifndef CGAL_MESH_3_DEMO_DISABLE_ODT #ifndef CGAL_MESH_3_DEMO_DISABLE_ODT
actionOdt = new QAction(tr("odt_optimize_mesh_3"), mw); actionOdt = new QAction(tr("odt_optimize_mesh_3"), mw);
@ -169,7 +169,7 @@ init(QMainWindow* mainWindow,
connect(actionOdt, SIGNAL(triggered()), this, SLOT(odt())); connect(actionOdt, SIGNAL(triggered()), this, SLOT(odt()));
} }
#endif #endif
#ifndef CGAL_MESH_3_DEMO_DISABLE_LLOYD #ifndef CGAL_MESH_3_DEMO_DISABLE_LLOYD
actionLloyd = new QAction(tr("lloyd_optimize_mesh_3"), mw); actionLloyd = new QAction(tr("lloyd_optimize_mesh_3"), mw);
if( NULL != actionLloyd ) if( NULL != actionLloyd )
@ -178,7 +178,7 @@ init(QMainWindow* mainWindow,
connect(actionLloyd, SIGNAL(triggered()), this, SLOT(lloyd())); connect(actionLloyd, SIGNAL(triggered()), this, SLOT(lloyd()));
} }
#endif #endif
#ifndef CGAL_MESH_3_DEMO_DISABLE_PERTURBER #ifndef CGAL_MESH_3_DEMO_DISABLE_PERTURBER
actionPerturb = new QAction(tr("perturb_mesh_3"), mw); actionPerturb = new QAction(tr("perturb_mesh_3"), mw);
if( NULL != actionPerturb ) if( NULL != actionPerturb )
@ -187,7 +187,7 @@ init(QMainWindow* mainWindow,
connect(actionPerturb, SIGNAL(triggered()), this, SLOT(perturb())); connect(actionPerturb, SIGNAL(triggered()), this, SLOT(perturb()));
} }
#endif #endif
#ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER #ifndef CGAL_MESH_3_DEMO_DISABLE_EXUDER
actionExude =new QAction(tr("exude_mesh_3"), mw); actionExude =new QAction(tr("exude_mesh_3"), mw);
if( NULL != actionExude ) if( NULL != actionExude )
@ -196,16 +196,16 @@ init(QMainWindow* mainWindow,
connect(actionExude, SIGNAL(triggered()), this, SLOT(exude())); connect(actionExude, SIGNAL(triggered()), this, SLOT(exude()));
} }
#endif #endif
msg = msg_interface; msg = msg_interface;
} }
inline inline
QList<QAction*> QList<QAction*>
Mesh_3_optimization_plugin::actions() const Mesh_3_optimization_plugin::actions() const
{ {
return QList<QAction*>() << actionOdt << actionLloyd return QList<QAction*>() << actionOdt << actionLloyd
<< actionPerturb << actionExude; << actionPerturb << actionExude;
} }
@ -236,45 +236,45 @@ Mesh_3_optimization_plugin::odt()
&dialog, SLOT(accept())); &dialog, SLOT(accept()));
connect(ui.buttonBox, SIGNAL(rejected()), connect(ui.buttonBox, SIGNAL(rejected()),
&dialog, SLOT(reject())); &dialog, SLOT(reject()));
connect(ui.noTimeLimit, SIGNAL(toggled(bool)), connect(ui.noTimeLimit, SIGNAL(toggled(bool)),
ui.maxTime, SLOT(setDisabled(bool))); ui.maxTime, SLOT(setDisabled(bool)));
ui.objectName->setText(item->name()); ui.objectName->setText(item->name());
namespace cgpd = CGAL::parameters::default_values; namespace cgpd = CGAL::parameters::default_values;
ui.convergenceRatio->setValue(cgpd::odt_convergence_ratio); ui.convergenceRatio->setValue(cgpd::odt_convergence_ratio);
ui.freezeRatio->setValue(cgpd::odt_freeze_ratio); ui.freezeRatio->setValue(cgpd::odt_freeze_ratio);
int i = dialog.exec(); int i = dialog.exec();
if(i == QDialog::Rejected) if(i == QDialog::Rejected)
return; return;
// 0 means parameter is not considered // 0 means parameter is not considered
const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value(); const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value();
const int max_iteration_nb = static_cast<int>(ui.maxIterationNb->value()); const int max_iteration_nb = static_cast<int>(ui.maxIterationNb->value());
const double convergence = ui.convergenceRatio->value(); const double convergence = ui.convergenceRatio->value();
const double freeze = ui.freezeRatio->value(); const double freeze = ui.freezeRatio->value();
const bool create_new_item = ui.createNewItem->isChecked(); const bool create_new_item = ui.createNewItem->isChecked();
// ----------------------------------- // -----------------------------------
// Launch optimization // Launch optimization
// ----------------------------------- // -----------------------------------
QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::setOverrideCursor(Qt::WaitCursor);
Optimizer_thread* opt_thread = cgal_code_odt_mesh_3(*item, Optimizer_thread* opt_thread = cgal_code_odt_mesh_3(*item,
max_time, max_time,
convergence, convergence,
freeze, freeze,
max_iteration_nb, max_iteration_nb,
create_new_item); create_new_item);
if ( NULL == opt_thread ) if ( NULL == opt_thread )
{ {
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
return; return;
} }
source_item_ = item; source_item_ = item;
launch_thread(opt_thread, "Odt iterations are running..."); launch_thread(opt_thread, "Odt iterations are running...");
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
@ -299,25 +299,25 @@ Mesh_3_optimization_plugin::lloyd()
ui.setupUi(&dialog); ui.setupUi(&dialog);
dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint); dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint);
dialog.setWindowTitle(tr("Lloyd-smoothing parameters")); dialog.setWindowTitle(tr("Lloyd-smoothing parameters"));
connect(ui.buttonBox, SIGNAL(accepted()), connect(ui.buttonBox, SIGNAL(accepted()),
&dialog, SLOT(accept())); &dialog, SLOT(accept()));
connect(ui.buttonBox, SIGNAL(rejected()), connect(ui.buttonBox, SIGNAL(rejected()),
&dialog, SLOT(reject())); &dialog, SLOT(reject()));
connect(ui.noTimeLimit, SIGNAL(toggled(bool)), connect(ui.noTimeLimit, SIGNAL(toggled(bool)),
ui.maxTime, SLOT(setDisabled(bool))); ui.maxTime, SLOT(setDisabled(bool)));
ui.objectName->setText(item->name()); ui.objectName->setText(item->name());
namespace cgpd = CGAL::parameters::default_values; namespace cgpd = CGAL::parameters::default_values;
ui.convergenceRatio->setValue(cgpd::lloyd_convergence_ratio); ui.convergenceRatio->setValue(cgpd::lloyd_convergence_ratio);
ui.freezeRatio->setValue(cgpd::lloyd_freeze_ratio); ui.freezeRatio->setValue(cgpd::lloyd_freeze_ratio);
int i = dialog.exec(); int i = dialog.exec();
if(i == QDialog::Rejected) if(i == QDialog::Rejected)
return; return;
// 0 means parameter is not considered // 0 means parameter is not considered
const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value(); const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value();
const int max_iteration_nb = static_cast<int>(ui.maxIterationNb->value()); const int max_iteration_nb = static_cast<int>(ui.maxIterationNb->value());
@ -329,7 +329,7 @@ Mesh_3_optimization_plugin::lloyd()
// Launch optimization // Launch optimization
// ----------------------------------- // -----------------------------------
QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::setOverrideCursor(Qt::WaitCursor);
Optimizer_thread* opt_thread = cgal_code_lloyd_mesh_3(*item, Optimizer_thread* opt_thread = cgal_code_lloyd_mesh_3(*item,
max_time, max_time,
convergence, convergence,
@ -357,7 +357,7 @@ Mesh_3_optimization_plugin::perturb()
// ----------------------------------- // -----------------------------------
Scene_c3t3_item* item = get_c3t3_item(); Scene_c3t3_item* item = get_c3t3_item();
if ( NULL == item ) { return; } if ( NULL == item ) { return; }
// ----------------------------------- // -----------------------------------
// Dialog box // Dialog box
// ----------------------------------- // -----------------------------------
@ -367,46 +367,46 @@ Mesh_3_optimization_plugin::perturb()
ui.sliverBound->setRange(0,180); ui.sliverBound->setRange(0,180);
dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint); dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint);
dialog.setWindowTitle(tr("Sliver perturbation parameters")); dialog.setWindowTitle(tr("Sliver perturbation parameters"));
connect(ui.buttonBox, SIGNAL(accepted()), connect(ui.buttonBox, SIGNAL(accepted()),
&dialog, SLOT(accept())); &dialog, SLOT(accept()));
connect(ui.buttonBox, SIGNAL(rejected()), connect(ui.buttonBox, SIGNAL(rejected()),
&dialog, SLOT(reject())); &dialog, SLOT(reject()));
connect(ui.noTimeLimit, SIGNAL(toggled(bool)), connect(ui.noTimeLimit, SIGNAL(toggled(bool)),
ui.maxTime, SLOT(setDisabled(bool))); ui.maxTime, SLOT(setDisabled(bool)));
connect(ui.noBound, SIGNAL(toggled(bool)), connect(ui.noBound, SIGNAL(toggled(bool)),
ui.sliverBound, SLOT(setDisabled(bool))); ui.sliverBound, SLOT(setDisabled(bool)));
ui.objectName->setText(item->name()); ui.objectName->setText(item->name());
int i = dialog.exec(); int i = dialog.exec();
if(i == QDialog::Rejected) if(i == QDialog::Rejected)
return; return;
// 0 means parameter is not considered // 0 means parameter is not considered
const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value(); const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value();
const double sliver_bound = ui.noBound->isChecked() ? 0 : ui.sliverBound->value(); const double sliver_bound = ui.noBound->isChecked() ? 0 : ui.sliverBound->value();
const bool create_new_item = ui.createNewItem->isChecked(); const bool create_new_item = ui.createNewItem->isChecked();
// ----------------------------------- // -----------------------------------
// Launch optimization // Launch optimization
// ----------------------------------- // -----------------------------------
QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::setOverrideCursor(Qt::WaitCursor);
Optimizer_thread* opt_thread = cgal_code_perturb_mesh_3(*item, Optimizer_thread* opt_thread = cgal_code_perturb_mesh_3(*item,
max_time, max_time,
sliver_bound, sliver_bound,
create_new_item); create_new_item);
if ( NULL == opt_thread ) if ( NULL == opt_thread )
{ {
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
return; return;
} }
source_item_ = item; source_item_ = item;
launch_thread(opt_thread, "Sliver perturbation is running..."); launch_thread(opt_thread, "Sliver perturbation is running...");
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
@ -423,7 +423,7 @@ Mesh_3_optimization_plugin::exude()
// ----------------------------------- // -----------------------------------
Scene_c3t3_item* item = get_c3t3_item(); Scene_c3t3_item* item = get_c3t3_item();
if ( NULL == item ) { return; } if ( NULL == item ) { return; }
// ----------------------------------- // -----------------------------------
// Dialog box // Dialog box
// ----------------------------------- // -----------------------------------
@ -432,35 +432,35 @@ Mesh_3_optimization_plugin::exude()
ui.setupUi(&dialog); ui.setupUi(&dialog);
dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint); dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint);
dialog.setWindowTitle(tr("Sliver exudation parameters")); dialog.setWindowTitle(tr("Sliver exudation parameters"));
connect(ui.buttonBox, SIGNAL(accepted()), connect(ui.buttonBox, SIGNAL(accepted()),
&dialog, SLOT(accept())); &dialog, SLOT(accept()));
connect(ui.buttonBox, SIGNAL(rejected()), connect(ui.buttonBox, SIGNAL(rejected()),
&dialog, SLOT(reject())); &dialog, SLOT(reject()));
connect(ui.noTimeLimit, SIGNAL(toggled(bool)), connect(ui.noTimeLimit, SIGNAL(toggled(bool)),
ui.maxTime, SLOT(setDisabled(bool))); ui.maxTime, SLOT(setDisabled(bool)));
connect(ui.noBound, SIGNAL(toggled(bool)), connect(ui.noBound, SIGNAL(toggled(bool)),
ui.sliverBound, SLOT(setDisabled(bool))); ui.sliverBound, SLOT(setDisabled(bool)));
ui.objectName->setText(item->name()); ui.objectName->setText(item->name());
ui.sliverBound->setValue(25.); ui.sliverBound->setValue(25.);
int i = dialog.exec(); int i = dialog.exec();
if(i == QDialog::Rejected) if(i == QDialog::Rejected)
return; return;
// 0 means parameter is not considered // 0 means parameter is not considered
const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value(); const double max_time = ui.noTimeLimit->isChecked() ? 0 : ui.maxTime->value();
const double sliver_bound = ui.noBound->isChecked() ? 0 : ui.sliverBound->value(); const double sliver_bound = ui.noBound->isChecked() ? 0 : ui.sliverBound->value();
const bool create_new_item = ui.createNewItem->isChecked(); const bool create_new_item = ui.createNewItem->isChecked();
// ----------------------------------- // -----------------------------------
// Launch optimization // Launch optimization
// ----------------------------------- // -----------------------------------
QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::setOverrideCursor(Qt::WaitCursor);
Optimizer_thread* opt_thread = cgal_code_exude_mesh_3(*item, Optimizer_thread* opt_thread = cgal_code_exude_mesh_3(*item,
max_time, max_time,
sliver_bound, sliver_bound,
@ -471,7 +471,7 @@ Mesh_3_optimization_plugin::exude()
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
return; return;
} }
source_item_ = item; source_item_ = item;
launch_thread(opt_thread, "Sliver exudation is running..."); launch_thread(opt_thread, "Sliver exudation is running...");
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
@ -492,14 +492,14 @@ get_c3t3_item() const
tr("Selected object is not a mesh... optimization can't be performed")); tr("Selected object is not a mesh... optimization can't be performed"));
return NULL; return NULL;
} }
if ( NULL == item->data_item() ) if ( NULL == item->data_item() )
{ {
QMessageBox::critical(mw,tr(""), QMessageBox::critical(mw,tr(""),
tr("Can't perturb: data object has been destroyed !")); tr("Can't perturb: data object has been destroyed !"));
return NULL; return NULL;
} }
return item; return item;
} }
@ -513,9 +513,9 @@ treat_result(Scene_c3t3_item& source_item,
{ {
result_item.setName(tr("%1 [%2]").arg(source_item.name()) result_item.setName(tr("%1 [%2]").arg(source_item.name())
.arg(name)); .arg(name));
result_item.c3t3_changed(); result_item.c3t3_changed();
// If a new item has been created // If a new item has been created
if ( &source_item != &result_item) if ( &source_item != &result_item)
{ {
@ -523,23 +523,23 @@ treat_result(Scene_c3t3_item& source_item,
result_item.setPosition(static_cast<float>(bbox.xmin() + bbox.xmax())/2.f, result_item.setPosition(static_cast<float>(bbox.xmin() + bbox.xmax())/2.f,
static_cast<float>(bbox.ymin() + bbox.ymax())/2.f, static_cast<float>(bbox.ymin() + bbox.ymax())/2.f,
static_cast<float>(bbox.zmin() + bbox.zmax())/2.f); static_cast<float>(bbox.zmin() + bbox.zmax())/2.f);
result_item.setColor(QColor(59,74,226)); result_item.setColor(QColor(59,74,226));
result_item.setRenderingMode(source_item.renderingMode()); result_item.setRenderingMode(source_item.renderingMode());
result_item.set_data_item(source_item.data_item()); result_item.set_data_item(source_item.data_item());
source_item.setVisible(false); source_item.setVisible(false);
const Scene_interface::Item_id index = scene->mainSelectionIndex(); const Scene_interface::Item_id index = scene->mainSelectionIndex();
scene->itemChanged(index); scene->itemChanged(index);
Scene_interface::Item_id new_item_id = scene->addItem(&result_item); Scene_interface::Item_id new_item_id = scene->addItem(&result_item);
scene->setSelectedItem(new_item_id); scene->setSelectedItem(new_item_id);
} }
else else
{ {
result_item.update_histogram(); result_item.update_histogram();
const Scene_interface::Item_id index = scene->mainSelectionIndex(); const Scene_interface::Item_id index = scene->mainSelectionIndex();
scene->itemChanged(index); scene->itemChanged(index);
} }
@ -552,7 +552,7 @@ optimization_done(Optimizer_thread* thread)
{ {
CGAL::Mesh_optimization_return_code return_code = thread->return_code(); CGAL::Mesh_optimization_return_code return_code = thread->return_code();
QString name = thread->optimizer_name(); QString name = thread->optimizer_name();
// Print message in console // Print message in console
QString str = QString("%1 of \"%2\" done in %3s<br>" QString str = QString("%1 of \"%2\" done in %3s<br>"
"End reason: '%4'<br>") "End reason: '%4'<br>")
@ -560,14 +560,14 @@ optimization_done(Optimizer_thread* thread)
.arg(source_item_->name()) .arg(source_item_->name())
.arg(thread->time()) .arg(thread->time())
.arg(translate(return_code)); .arg(translate(return_code));
Q_FOREACH( QString param, thread->parameters_log() ) Q_FOREACH( QString param, thread->parameters_log() )
{ {
str.append(QString("( %1 )<br>").arg(param)); str.append(QString("( %1 )<br>").arg(param));
} }
CGAL::Three::Three::information(qPrintable(str)); CGAL::Three::Three::information(qPrintable(str));
// Treat new c3t3 item // Treat new c3t3 item
Scene_c3t3_item* result_item = thread->item(); Scene_c3t3_item* result_item = thread->item();
treat_result( *source_item_, *result_item, name); treat_result( *source_item_, *result_item, name);
@ -591,25 +591,25 @@ launch_thread(Optimizer_thread* opt_thread, const QString& window_text)
window_text, window_text,
QMessageBox::Cancel, QMessageBox::Cancel,
mw); mw);
message_box_->setDefaultButton(QMessageBox::Cancel); message_box_->setDefaultButton(QMessageBox::Cancel);
QAbstractButton* cancelButton = message_box_->button(QMessageBox::Cancel); QAbstractButton* cancelButton = message_box_->button(QMessageBox::Cancel);
cancelButton->setText(tr("Stop")); cancelButton->setText(tr("Stop"));
QObject::connect(cancelButton, SIGNAL(clicked()), QObject::connect(cancelButton, SIGNAL(clicked()),
opt_thread, SLOT(stop())); opt_thread, SLOT(stop()));
message_box_->show(); message_box_->show();
// ----------------------------------- // -----------------------------------
// Connect main thread to optimization thread and launch optimizer // Connect main thread to optimization thread and launch optimizer
// ----------------------------------- // -----------------------------------
QObject::connect(opt_thread, SIGNAL(done(Optimizer_thread*)), QObject::connect(opt_thread, SIGNAL(done(Optimizer_thread*)),
this, SLOT(optimization_done(Optimizer_thread*))); this, SLOT(optimization_done(Optimizer_thread*)));
QObject::connect(opt_thread, SIGNAL(status_report(QString)), QObject::connect(opt_thread, SIGNAL(status_report(QString)),
this, SLOT(status_report(QString))); this, SLOT(status_report(QString)));
opt_thread->start(); opt_thread->start();
} }
@ -620,7 +620,7 @@ Mesh_3_optimization_plugin::
status_report(QString str) status_report(QString str)
{ {
if ( NULL == message_box_ ) { return; } if ( NULL == message_box_ ) { return; }
message_box_->setInformativeText(str); message_box_->setInformativeText(str);
} }
@ -638,7 +638,7 @@ translate(CGAL::Mesh_optimization_return_code rc)
case CGAL::MAX_ITERATION_NUMBER_REACHED: return QString("Max iteration number reached"); case CGAL::MAX_ITERATION_NUMBER_REACHED: return QString("Max iteration number reached");
case CGAL::ALL_VERTICES_FROZEN: return QString("All vertices have been frozen"); case CGAL::ALL_VERTICES_FROZEN: return QString("All vertices have been frozen");
} }
return QString("ERROR"); return QString("ERROR");
} }

View File

@ -99,7 +99,7 @@
// ===================== // =====================
// Worksharing strategy // Worksharing strategy
// ===================== // =====================
//# define CGAL_MESH_3_LOAD_BASED_WORKSHARING // Not recommended //# define CGAL_MESH_3_LOAD_BASED_WORKSHARING // Not recommended
// ========================================================================== // ==========================================================================
@ -125,7 +125,7 @@
# define CGAL_MESH_3_IF_UNSORTED_QUEUE_JUST_SORT_AFTER_SCAN # define CGAL_MESH_3_IF_UNSORTED_QUEUE_JUST_SORT_AFTER_SCAN
#endif // CGAL_CONCURRENT_MESH_3 #endif // CGAL_CONCURRENT_MESH_3
//#define CGAL_MESH_3_PROFILING //#define CGAL_MESH_3_PROFILING
#endif // CGAL_DEMO_MESH_3_CONFIG_H #endif // CGAL_DEMO_MESH_3_CONFIG_H

View File

@ -55,7 +55,7 @@ public :
QMenu* menuFile = mw->findChild<QMenu*>("menuFile"); QMenu* menuFile = mw->findChild<QMenu*>("menuFile");
QMenu* menu = menuFile->findChild<QMenu*>("menuGenerateObject"); QMenu* menu = menuFile->findChild<QMenu*>("menuGenerateObject");
if(!menu){ if(!menu){
QAction* actionLoad = mw->findChild<QAction*>("actionLoadPlugin"); QAction* actionLoad = mw->findChild<QAction*>("actionLoadPlugin");

View File

@ -82,7 +82,7 @@ Scene::addItem(CGAL::Three::Scene_item* item)
qobject_cast<CGAL::Three::Scene_group_item*>(item); qobject_cast<CGAL::Three::Scene_group_item*>(item);
if(group) if(group)
addGroup(group); addGroup(group);
//init the item for the mainViewer to avoid using unexisting //init the item for the mainViewer to avoid using unexisting
//VAOs if the mainViewer is not the first to be drawn. //VAOs if the mainViewer is not the first to be drawn.
QOpenGLFramebufferObject* fbo = CGAL::Three::Three::mainViewer()->depthPeelingFbo(); QOpenGLFramebufferObject* fbo = CGAL::Three::Three::mainViewer()->depthPeelingFbo();
CGAL::Three::Three::mainViewer()->setDepthPeelingFbo(nullptr);//to prevent crashing as the fbo is not initialized in this call. CGAL::Three::Three::mainViewer()->setDepthPeelingFbo(nullptr);//to prevent crashing as the fbo is not initialized in this call.
@ -249,7 +249,7 @@ Scene::erase(QList<int> indices)
children.removeAll(removed_item); children.removeAll(removed_item);
indexErased(removed_item); indexErased(removed_item);
m_entries.removeAll(item); m_entries.removeAll(item);
Q_EMIT itemAboutToBeDestroyed(item); Q_EMIT itemAboutToBeDestroyed(item);
item->aboutToBeDestroyed(); item->aboutToBeDestroyed();
item->deleteLater(); item->deleteLater();
@ -312,7 +312,7 @@ Scene::item(Item_id index) const
return m_entries.value(index); // QList::value checks bounds return m_entries.value(index); // QList::value checks bounds
} }
Scene::Item_id Scene::Item_id
Scene::item_id(CGAL::Three::Scene_item* scene_item) const Scene::item_id(CGAL::Three::Scene_item* scene_item) const
{ {
return m_entries.indexOf(scene_item); return m_entries.indexOf(scene_item);
@ -347,7 +347,7 @@ Scene::duplicate(Item_id index)
void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer) void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer)
{ {
//Vertex source code //Vertex source code
const char vertex_source[] = const char vertex_source[] =
{ {
@ -361,9 +361,9 @@ void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer)
" f_texCoord = v_texCoord; \n" " f_texCoord = v_texCoord; \n"
" gl_Position = projection_matrix * vertex; \n" " gl_Position = projection_matrix * vertex; \n"
"} \n" "} \n"
}; };
const char vertex_source_comp[] = const char vertex_source_comp[] =
{ {
"attribute highp vec4 vertex; \n" "attribute highp vec4 vertex; \n"
@ -375,7 +375,7 @@ void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer)
" f_texCoord = v_texCoord; \n" " f_texCoord = v_texCoord; \n"
" gl_Position = projection_matrix * vertex; \n" " gl_Position = projection_matrix * vertex; \n"
"} \n" "} \n"
}; };
//Fragment source code //Fragment source code
const char fragment_source[] = const char fragment_source[] =
@ -398,8 +398,8 @@ void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer)
" gl_FragColor = texture2D(texture, f_texCoord); \n" " gl_FragColor = texture2D(texture, f_texCoord); \n"
"} \n" "} \n"
}; };
QOpenGLShader vertex_shader(QOpenGLShader::Vertex); QOpenGLShader vertex_shader(QOpenGLShader::Vertex);
QOpenGLShader fragment_shader(QOpenGLShader::Fragment); QOpenGLShader fragment_shader(QOpenGLShader::Fragment);
if(viewer->isOpenGL_4_3()) if(viewer->isOpenGL_4_3())
@ -408,7 +408,7 @@ void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer)
{ {
std::cerr<<"Compiling vertex source FAILED"<<std::endl; std::cerr<<"Compiling vertex source FAILED"<<std::endl;
} }
if(!fragment_shader.compileSourceCode(fragment_source)) if(!fragment_shader.compileSourceCode(fragment_source))
{ {
std::cerr<<"Compiling fragmentsource FAILED"<<std::endl; std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
@ -420,13 +420,13 @@ void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer)
{ {
std::cerr<<"Compiling vertex source FAILED"<<std::endl; std::cerr<<"Compiling vertex source FAILED"<<std::endl;
} }
if(!fragment_shader.compileSourceCode(fragment_source_comp)) if(!fragment_shader.compileSourceCode(fragment_source_comp))
{ {
std::cerr<<"Compiling fragmentsource FAILED"<<std::endl; std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
} }
} }
if(!program.addShader(&vertex_shader)) if(!program.addShader(&vertex_shader))
{ {
std::cerr<<"adding vertex shader FAILED"<<std::endl; std::cerr<<"adding vertex shader FAILED"<<std::endl;
@ -446,17 +446,17 @@ void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer)
points[9] = -1.0f; points[10] = -1.0f; points[11] = 0.0f; points[9] = -1.0f; points[10] = -1.0f; points[11] = 0.0f;
points[12] = -1.0f; points[13] = 1.0f; points[14] = 0.0f; points[12] = -1.0f; points[13] = 1.0f; points[14] = 0.0f;
points[15] = 1.0f; points[16] = 1.0f; points[17] = 0.0f; points[15] = 1.0f; points[16] = 1.0f; points[17] = 0.0f;
uvs[0] = 0.0f; uvs[1] = 0.0f; uvs[0] = 0.0f; uvs[1] = 0.0f;
uvs[2] = 1.0f; uvs[3] = 1.0f; uvs[2] = 1.0f; uvs[3] = 1.0f;
uvs[4] = 1.0f; uvs[5] = 0.0f; uvs[4] = 1.0f; uvs[5] = 0.0f;
uvs[6] = 0.0f; uvs[7] = 0.0f; uvs[6] = 0.0f; uvs[7] = 0.0f;
uvs[8] = 0.0f; uvs[9] = 1.0f; uvs[8] = 0.0f; uvs[9] = 1.0f;
uvs[10] = 1.0f; uvs[11] = 1.0f; uvs[10] = 1.0f; uvs[11] = 1.0f;
vbo[0].create(); vbo[0].create();
vbo[1].create(); vbo[1].create();
viewer->makeCurrent(); viewer->makeCurrent();
vaos[viewer] = new QOpenGLVertexArrayObject(); vaos[viewer] = new QOpenGLVertexArrayObject();
vaos[viewer]->create(); vaos[viewer]->create();
@ -467,7 +467,7 @@ void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer)
program.enableAttributeArray("vertex"); program.enableAttributeArray("vertex");
program.setAttributeArray("vertex", GL_FLOAT, 0, 3); program.setAttributeArray("vertex", GL_FLOAT, 0, 3);
vbo[0].release(); vbo[0].release();
vbo[1].bind(); vbo[1].bind();
vbo[1].allocate(uvs, 12 * sizeof(float)); vbo[1].allocate(uvs, 12 * sizeof(float));
program.enableAttributeArray("v_texCoord"); program.enableAttributeArray("v_texCoord");
@ -519,7 +519,7 @@ bool item_should_be_skipped_in_draw(Scene_item* item) {
} }
return true; return true;
} }
void Scene::renderScene(const QList<Scene_interface::Item_id> &items, void Scene::renderScene(const QList<Scene_interface::Item_id> &items,
Viewer_interface *viewer, Viewer_interface *viewer,
@ -555,7 +555,7 @@ void Scene::renderScene(const QList<Scene_interface::Item_id> &items,
} }
item.draw(viewer); item.draw(viewer);
if(with_names) { if(with_names) {
// read depth buffer at pick location; // read depth buffer at pick location;
float depth = 1.0; float depth = 1.0;
viewer->glReadPixels(picked_pixel.x(),viewer->camera()->screenHeight()-1-picked_pixel.y(),1,1,GL_DEPTH_COMPONENT, GL_FLOAT, &depth); viewer->glReadPixels(picked_pixel.x(),viewer->camera()->screenHeight()-1-picked_pixel.y(),1,1,GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
@ -681,7 +681,7 @@ void Scene::renderPointScene(const QList<Scene_interface::Item_id> &items,
return true; return true;
return false; return false;
} }
void void
Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
{ {
QMap<float, int> picked_item_IDs; QMap<float, int> picked_item_IDs;
@ -704,9 +704,9 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
renderScene(children, viewer, picked_item_IDs, with_names, -1, false, NULL); renderScene(children, viewer, picked_item_IDs, with_names, -1, false, NULL);
if(with_names) if(with_names)
{ {
//here we get the selected point, before erasing the depth buffer. We store it //here we get the selected point, before erasing the depth buffer. We store it
//in a dynamic property as a QList<double>. If there is some alpha, the //in a dynamic property as a QList<double>. If there is some alpha, the
//depth buffer is altered, and the picking will return true even when it is //depth buffer is altered, and the picking will return true even when it is
// performed in the background, when it should return false. To avoid that, // performed in the background, when it should return false. To avoid that,
// we distinguish the case were there is no alpha, to let the viewer // we distinguish the case were there is no alpha, to let the viewer
//perform it, and the case where the pixel is not found. In the first case, //perform it, and the case where the pixel is not found. In the first case,
@ -737,7 +737,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
QColor background = viewer->backgroundColor(); QColor background = viewer->backgroundColor();
fbos.resize((int)viewer->total_pass()); fbos.resize((int)viewer->total_pass());
depth_test.resize((int)viewer->total_pass()-1); depth_test.resize((int)viewer->total_pass()-1);
//first pass //first pass
fbos[0] = new QOpenGLFramebufferObject(viewer->width(), viewer->height(),QOpenGLFramebufferObject::Depth, GL_TEXTURE_2D, GL_RGBA32F); fbos[0] = new QOpenGLFramebufferObject(viewer->width(), viewer->height(),QOpenGLFramebufferObject::Depth, GL_TEXTURE_2D, GL_RGBA32F);
fbos[0]->bind(); fbos[0]->bind();
@ -767,7 +767,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
renderScene(opaque_items, viewer, picked_item_IDs, false, 0,true, NULL); renderScene(opaque_items, viewer, picked_item_IDs, false, 0,true, NULL);
renderScene(transparent_items, viewer, picked_item_IDs, false, 0,true, NULL); renderScene(transparent_items, viewer, picked_item_IDs, false, 0,true, NULL);
depth_test[0]->release(); depth_test[0]->release();
//other passes //other passes
for(int i=1; i<viewer->total_pass()-1; ++i) for(int i=1; i<viewer->total_pass()-1; ++i)
{ {
@ -787,7 +787,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
renderScene(opaque_items , viewer, picked_item_IDs, false, i, false, depth_test[i-1]); renderScene(opaque_items , viewer, picked_item_IDs, false, i, false, depth_test[i-1]);
renderScene(transparent_items, viewer, picked_item_IDs, false, i, false, depth_test[i-1]); renderScene(transparent_items, viewer, picked_item_IDs, false, i, false, depth_test[i-1]);
fbos[i]->release(); fbos[i]->release();
depth_test[i] = new QOpenGLFramebufferObject(viewer->width(), viewer->height(),QOpenGLFramebufferObject::Depth, GL_TEXTURE_2D, GL_RGBA32F); depth_test[i] = new QOpenGLFramebufferObject(viewer->width(), viewer->height(),QOpenGLFramebufferObject::Depth, GL_TEXTURE_2D, GL_RGBA32F);
depth_test[i]->bind(); depth_test[i]->bind();
viewer->glDisable(GL_BLEND); viewer->glDisable(GL_BLEND);
@ -803,8 +803,8 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
renderScene(transparent_items, viewer, picked_item_IDs, false, i, true, depth_test[i-1]); renderScene(transparent_items, viewer, picked_item_IDs, false, i, true, depth_test[i-1]);
depth_test[i]->release(); depth_test[i]->release();
} }
//last pass //last pass
fbos[(int)viewer->total_pass()-1] = new QOpenGLFramebufferObject(viewer->width(), viewer->height(),QOpenGLFramebufferObject::Depth, GL_TEXTURE_2D, GL_RGBA32F); fbos[(int)viewer->total_pass()-1] = new QOpenGLFramebufferObject(viewer->width(), viewer->height(),QOpenGLFramebufferObject::Depth, GL_TEXTURE_2D, GL_RGBA32F);
fbos[(int)viewer->total_pass()-1]->bind(); fbos[(int)viewer->total_pass()-1]->bind();
@ -822,7 +822,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
fbos[(int)viewer->total_pass()-1]->release(); fbos[(int)viewer->total_pass()-1]->release();
if(viewer->getStoredFrameBuffer() != NULL) if(viewer->getStoredFrameBuffer() != NULL)
viewer->getStoredFrameBuffer()->bind(); viewer->getStoredFrameBuffer()->bind();
//blending //blending
program.bind(); program.bind();
vaos[viewer]->bind(); vaos[viewer]->bind();
@ -834,7 +834,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
viewer->glClear(GL_COLOR_BUFFER_BIT); viewer->glClear(GL_COLOR_BUFFER_BIT);
viewer->glEnable(GL_BLEND); viewer->glEnable(GL_BLEND);
viewer->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); viewer->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
QMatrix4x4 proj_mat; QMatrix4x4 proj_mat;
proj_mat.setToIdentity(); proj_mat.setToIdentity();
proj_mat.ortho(-1,1,-1,1,0,1); proj_mat.ortho(-1,1,-1,1,0,1);
@ -852,13 +852,13 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
vaos[viewer]->release(); vaos[viewer]->release();
program.release(); program.release();
} }
viewer->glDepthFunc(GL_LEQUAL); viewer->glDepthFunc(GL_LEQUAL);
// Wireframe OpenGL drawing // Wireframe OpenGL drawing
renderWireScene(children, viewer, picked_item_IDs, with_names); renderWireScene(children, viewer, picked_item_IDs, with_names);
// Points OpenGL drawing // Points OpenGL drawing
renderPointScene(children, viewer, picked_item_IDs, with_names); renderPointScene(children, viewer, picked_item_IDs, with_names);
if(with_names) if(with_names)
{ {
QList<float> depths = picked_item_IDs.keys(); QList<float> depths = picked_item_IDs.keys();
@ -1126,7 +1126,7 @@ bool Scene::dropMimeData(const QMimeData * /*data*/,
//todo : if a group is selected, don't treat it's children. //todo : if a group is selected, don't treat it's children.
bool Scene::sort_lists(QVector<QList<int> >&sorted_lists, bool up) bool Scene::sort_lists(QVector<QList<int> >&sorted_lists, bool up)
{ {
QVector<int> group_found; QVector<int> group_found;
Q_FOREACH(int i, selectionIndices()) Q_FOREACH(int i, selectionIndices())
{ {
@ -1149,7 +1149,7 @@ bool Scene::sort_lists(QVector<QList<int> >&sorted_lists, bool up)
} }
} }
} }
//iterate the first list to find the groups that are selected and remove the corresponding //iterate the first list to find the groups that are selected and remove the corresponding
//sub lists. //sub lists.
//todo: do that for each group. (treat subgroups) //todo: do that for each group. (treat subgroups)
for(int i = 0; i< sorted_lists.first().size(); ++i) for(int i = 0; i< sorted_lists.first().size(); ++i)
@ -1198,7 +1198,7 @@ void Scene::moveRowUp()
//if moving one up would put it out of range, then we stop and do nothing. //if moving one up would put it out of range, then we stop and do nothing.
if(!sort_lists(sorted_lists, true)) if(!sort_lists(sorted_lists, true))
return; return;
for(int i=0; i<sorted_lists.first().size(); ++i) for(int i=0; i<sorted_lists.first().size(); ++i)
{ {
Item_id selected_id = sorted_lists.first()[i]; Item_id selected_id = sorted_lists.first()[i];
@ -1262,7 +1262,7 @@ void Scene::moveRowDown()
int newId = children.indexOf( int newId = children.indexOf(
index_map.value(index(baseId.row()+1, baseId.column(),baseId.parent()))) ; index_map.value(index(baseId.row()+1, baseId.column(),baseId.parent()))) ;
children.move(children.indexOf(selected_id), newId); children.move(children.indexOf(selected_id), newId);
redraw_model(); redraw_model();
to_select.prepend(m_entries.indexOf(selected_item)); to_select.prepend(m_entries.indexOf(selected_item));
} }
@ -1327,7 +1327,7 @@ QItemSelection Scene::createSelection(QList<int> is)
QItemSelection Scene::createSelectionAll() QItemSelection Scene::createSelectionAll()
{ {
//it is not possible to directly create a selection with items that have different parents, so //it is not possible to directly create a selection with items that have different parents, so
//we do it iteratively. //we do it iteratively.
QItemSelection sel; QItemSelection sel;
for(int i=0; i< m_entries.size(); ++i) for(int i=0; i< m_entries.size(); ++i)
@ -1382,7 +1382,7 @@ void Scene::itemVisibilityChanged(CGAL::Three::Scene_item* item)
//does not recenter //does not recenter
if(visibility_recentering_enabled){ if(visibility_recentering_enabled){
Q_EMIT updated_bbox(true); Q_EMIT updated_bbox(true);
} }
} }
} }
@ -1917,7 +1917,7 @@ void Scene::initGL(Viewer_interface *viewer)
program.release(); program.release();
} }
void Scene::callDraw(){ void Scene::callDraw(){
Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool())
{ {
qobject_cast<Viewer_interface*>(v)->update(); qobject_cast<Viewer_interface*>(v)->update();

View File

@ -79,7 +79,7 @@ public :
delete alphaSlider; delete alphaSlider;
} }
void compute_bbox() const Q_DECL_OVERRIDE{} void compute_bbox() const Q_DECL_OVERRIDE{}
void gl_initialization(Vi* viewer) void gl_initialization(Vi* viewer)
{ {
if(!isInit(viewer)) if(!isInit(viewer))
@ -113,7 +113,7 @@ public :
{ {
getTriangleContainer(0)->reset_vbos(ALL); getTriangleContainer(0)->reset_vbos(ALL);
getEdgeContainer(0)->reset_vbos(ALL); getEdgeContainer(0)->reset_vbos(ALL);
getTriangleContainer(0)->allocate(Tc::Flat_vertices, getTriangleContainer(0)->allocate(Tc::Flat_vertices,
vertices->data(), static_cast<int>(vertices->size()*sizeof(float))); vertices->data(), static_cast<int>(vertices->size()*sizeof(float)));
getTriangleContainer(0)->allocate(Tc::Flat_normals, normals->data(), getTriangleContainer(0)->allocate(Tc::Flat_normals, normals->data(),
@ -139,7 +139,7 @@ public :
getEdgeContainer(0)->setFlatDataSize(edges->size()); getEdgeContainer(0)->setFlatDataSize(edges->size());
} }
} }
//Displays the item //Displays the item
void draw(CGAL::Three::Viewer_interface* viewer) const Q_DECL_OVERRIDE void draw(CGAL::Three::Viewer_interface* viewer) const Q_DECL_OVERRIDE
{ {
@ -173,7 +173,7 @@ public :
getEdgeContainer(0)->setPlane(cp); getEdgeContainer(0)->setPlane(cp);
getEdgeContainer(0)->setColor(QColor(Qt::black)); getEdgeContainer(0)->setColor(QColor(Qt::black));
getEdgeContainer(0)->draw(viewer, true); getEdgeContainer(0)->draw(viewer, true);
} }
void setFast(bool b) void setFast(bool b)
@ -238,10 +238,10 @@ public :
QMenu* contextMenu() Q_DECL_OVERRIDE QMenu* contextMenu() Q_DECL_OVERRIDE
{ {
QMenu* menu = Scene_item::contextMenu(); QMenu* menu = Scene_item::contextMenu();
const char* prop_name = "Menu modified by Scene_surface_mesh_item."; const char* prop_name = "Menu modified by Scene_surface_mesh_item.";
bool menuChanged = menu->property(prop_name).toBool(); bool menuChanged = menu->property(prop_name).toBool();
if(!menuChanged) { if(!menuChanged) {
menu->addSeparator(); menu->addSeparator();
QMenu *container = new QMenu(tr("Alpha value")); QMenu *container = new QMenu(tr("Alpha value"));
@ -253,7 +253,7 @@ public :
setAlpha(alphaSlider->value()); setAlpha(alphaSlider->value());
redraw(); redraw();
}); });
container->addAction(sliderAction); container->addAction(sliderAction);
menu->addMenu(container); menu->addMenu(container);
setProperty("menu_changed", true); setProperty("menu_changed", true);
@ -265,10 +265,10 @@ public :
{ {
return m_alpha ; return m_alpha ;
} }
void setAlpha(int a) Q_DECL_OVERRIDE void setAlpha(int a) Q_DECL_OVERRIDE
{ {
m_alpha = a / 255.0f; m_alpha = a / 255.0f;
redraw(); redraw();
} }
private: private:
@ -541,14 +541,14 @@ void Scene_c3t3_item::common_constructor(bool is_surface)
c3t3_changed(); c3t3_changed();
setRenderingMode(FlatPlusEdges); setRenderingMode(FlatPlusEdges);
create_flat_and_wire_sphere(1.0f,d->s_vertex,d->s_normals, d->ws_vertex); create_flat_and_wire_sphere(1.0f,d->s_vertex,d->s_normals, d->ws_vertex);
d->is_surface = is_surface; d->is_surface = is_surface;
d->is_grid_shown = !is_surface; d->is_grid_shown = !is_surface;
d->show_tetrahedra = !is_surface; d->show_tetrahedra = !is_surface;
d->last_intersection = !d->show_tetrahedra; d->last_intersection = !d->show_tetrahedra;
setTriangleContainer(C3t3_faces, new Tc(Vi::PROGRAM_C3T3, false)); setTriangleContainer(C3t3_faces, new Tc(Vi::PROGRAM_C3T3, false));
setEdgeContainer(CNC, new Ec(Vi::PROGRAM_NO_SELECTION, false)); setEdgeContainer(CNC, new Ec(Vi::PROGRAM_NO_SELECTION, false));
setEdgeContainer(Grid_edges, new Ec(Vi::PROGRAM_NO_SELECTION, false)); setEdgeContainer(Grid_edges, new Ec(Vi::PROGRAM_NO_SELECTION, false));
setEdgeContainer(C3t3_edges, new Ec(Vi::PROGRAM_C3T3_EDGES, false)); setEdgeContainer(C3t3_edges, new Ec(Vi::PROGRAM_C3T3_EDGES, false));
@ -569,7 +569,7 @@ Scene_c3t3_item::Scene_c3t3_item(const C3t3& c3t3, bool is_surface)
: Scene_group_item("unnamed") : Scene_group_item("unnamed")
, d(new Scene_c3t3_item_priv(c3t3, this)) , d(new Scene_c3t3_item_priv(c3t3, this))
{ {
d->reset_cut_plane(); d->reset_cut_plane();
common_constructor(is_surface); common_constructor(is_surface);
} }
@ -968,7 +968,7 @@ void Scene_c3t3_item::draw(CGAL::Three::Viewer_interface* viewer) const {
d->intersection->setFast(false); d->intersection->setFast(false);
else else
d->intersection->setFast(true); d->intersection->setFast(true);
if(!d->frame->isManipulated() && !d->areInterBufFilled(viewer)) if(!d->frame->isManipulated() && !d->areInterBufFilled(viewer))
{ {
//initGL //initGL
@ -984,7 +984,7 @@ void Scene_c3t3_item::draw(CGAL::Three::Viewer_interface* viewer) const {
} }
if(d->is_grid_shown) if(d->is_grid_shown)
{ {
//viewer->makeCurrent(); //messes with the depthPeeling //viewer->makeCurrent(); //messes with the depthPeeling
getEdgeContainer(Grid_edges)->setColor(QColor(Qt::black)); getEdgeContainer(Grid_edges)->setColor(QColor(Qt::black));
QMatrix4x4 f_mat; QMatrix4x4 f_mat;
for (int i = 0; i<16; i++) for (int i = 0; i<16; i++)
@ -1029,13 +1029,13 @@ void Scene_c3t3_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const {
getEdgeContainer(Grid_edges)->setFrameMatrix(f_mat); getEdgeContainer(Grid_edges)->setFrameMatrix(f_mat);
getEdgeContainer(Grid_edges)->draw(viewer, true); getEdgeContainer(Grid_edges)->draw(viewer, true);
} }
QVector4D cp = cgal_plane_to_vector4d(this->plane()); QVector4D cp = cgal_plane_to_vector4d(this->plane());
getEdgeContainer(C3t3_edges)->setPlane(cp); getEdgeContainer(C3t3_edges)->setPlane(cp);
getEdgeContainer(C3t3_edges)->setIsSurface(d->is_surface); getEdgeContainer(C3t3_edges)->setIsSurface(d->is_surface);
getEdgeContainer(C3t3_edges)->setColor(QColor(Qt::black)); getEdgeContainer(C3t3_edges)->setColor(QColor(Qt::black));
getEdgeContainer(C3t3_edges)->draw(viewer, true); getEdgeContainer(C3t3_edges)->draw(viewer, true);
if(d->show_tetrahedra){ if(d->show_tetrahedra){
if(!d->frame->isManipulated()) if(!d->frame->isManipulated())
d->intersection->setFast(false); d->intersection->setFast(false);
@ -1078,14 +1078,14 @@ void Scene_c3t3_item::drawPoints(CGAL::Three::Viewer_interface * viewer) const
computeElements(); computeElements();
initializeBuffers(viewer); initializeBuffers(viewer);
} }
QVector4D cp = cgal_plane_to_vector4d(this->plane()); QVector4D cp = cgal_plane_to_vector4d(this->plane());
getPointContainer(C3t3_points)->setPlane(cp); getPointContainer(C3t3_points)->setPlane(cp);
getPointContainer(C3t3_points)->setIsSurface(d->is_surface); getPointContainer(C3t3_points)->setIsSurface(d->is_surface);
getPointContainer(C3t3_points)->setColor(this->color()); getPointContainer(C3t3_points)->setColor(this->color());
getPointContainer(C3t3_points)->draw(viewer, true); getPointContainer(C3t3_points)->draw(viewer, true);
if(d->is_grid_shown) if(d->is_grid_shown)
{ {
getEdgeContainer(Grid_edges)->setColor(QColor(Qt::black)); getEdgeContainer(Grid_edges)->setColor(QColor(Qt::black));
@ -1175,7 +1175,7 @@ QMenu* Scene_c3t3_item::contextMenu()
bool menuChanged = menu->property(prop_name).toBool(); bool menuChanged = menu->property(prop_name).toBool();
if (!menuChanged) { if (!menuChanged) {
QMenu *container = new QMenu(tr("Alpha value")); QMenu *container = new QMenu(tr("Alpha value"));
container->menuAction()->setProperty("is_groupable", true); container->menuAction()->setProperty("is_groupable", true);
QWidgetAction *sliderAction = new QWidgetAction(0); QWidgetAction *sliderAction = new QWidgetAction(0);
@ -1190,7 +1190,7 @@ QMenu* Scene_c3t3_item::contextMenu()
); );
container->addAction(sliderAction); container->addAction(sliderAction);
menu->addMenu(container); menu->addMenu(container);
container = new QMenu(tr("Tetrahedra's Shrink Factor")); container = new QMenu(tr("Tetrahedra's Shrink Factor"));
sliderAction = new QWidgetAction(0); sliderAction = new QWidgetAction(0);
connect(d->tet_Slider, &QSlider::valueChanged, this, &Scene_c3t3_item::itemChanged); connect(d->tet_Slider, &QSlider::valueChanged, this, &Scene_c3t3_item::itemChanged);
@ -1234,7 +1234,7 @@ QMenu* Scene_c3t3_item::contextMenu()
connect(actionShowGrid, SIGNAL(toggled(bool)), connect(actionShowGrid, SIGNAL(toggled(bool)),
this, SLOT(show_grid(bool))); this, SLOT(show_grid(bool)));
menu->setProperty(prop_name, true); menu->setProperty(prop_name, true);
} }
return menu; return menu;
@ -1248,8 +1248,8 @@ void Scene_c3t3_item_priv::initializeBuffers(CGAL::Three::Viewer_interface *view
item->getTriangleContainer(Scene_c3t3_item::C3t3_faces)->initializeBuffers(viewer); item->getTriangleContainer(Scene_c3t3_item::C3t3_faces)->initializeBuffers(viewer);
item->getTriangleContainer(Scene_c3t3_item::C3t3_faces)->setFlatDataSize( item->getTriangleContainer(Scene_c3t3_item::C3t3_faces)->setFlatDataSize(
positions_poly_size); positions_poly_size);
positions_poly.clear(); positions_poly.clear();
positions_poly.shrink_to_fit(); positions_poly.shrink_to_fit();
normals.clear(); normals.clear();
@ -1271,7 +1271,7 @@ void Scene_c3t3_item_priv::initializeBuffers(CGAL::Three::Viewer_interface *view
item->getPointContainer(Scene_c3t3_item::C3t3_points)->initializeBuffers(viewer); item->getPointContainer(Scene_c3t3_item::C3t3_points)->initializeBuffers(viewer);
item->getPointContainer(Scene_c3t3_item::C3t3_points)->setFlatDataSize( item->getPointContainer(Scene_c3t3_item::C3t3_points)->setFlatDataSize(
positions_lines_size); positions_lines_size);
positions_lines.clear(); positions_lines.clear();
positions_lines.shrink_to_fit(); positions_lines.shrink_to_fit();
} }
@ -1341,7 +1341,7 @@ void Scene_c3t3_item_priv::computeIntersections(CGAL::Three::Viewer_interface* v
positions_barycenter.clear(); positions_barycenter.clear();
const Geom_traits::Plane_3& plane = item->plane(offset); const Geom_traits::Plane_3& plane = item->plane(offset);
tree.all_intersected_primitives(plane, tree.all_intersected_primitives(plane,
boost::make_function_output_iterator(ComputeIntersection(*this))); boost::make_function_output_iterator(ComputeIntersection(*this)));
intersection->gl_initialization(viewer); intersection->gl_initialization(viewer);
} }
@ -1401,13 +1401,13 @@ void Scene_c3t3_item_priv::computeSpheres()
tr_vertices.push_back(*vit); tr_vertices.push_back(*vit);
spheres->add_sphere(Geom_traits::Sphere_3(center, radius),s_id++, spheres->add_sphere(Geom_traits::Sphere_3(center, radius),s_id++,
CGAL::Color(UC(c.red()), UC(c.green()), UC(c.blue()))); CGAL::Color(UC(c.red()), UC(c.green()), UC(c.blue())));
} }
spheres->invalidateOpenGLBuffers(); spheres->invalidateOpenGLBuffers();
} }
void Scene_c3t3_item_priv::computeElements() void Scene_c3t3_item_priv::computeElements()
{ {
if(!alphaSlider) if(!alphaSlider)
{ {
alphaSlider = new QSlider(::Qt::Horizontal); alphaSlider = new QSlider(::Qt::Horizontal);
@ -1415,7 +1415,7 @@ void Scene_c3t3_item_priv::computeElements()
alphaSlider->setMaximum(255); alphaSlider->setMaximum(255);
alphaSlider->setValue(255); alphaSlider->setValue(255);
} }
positions_poly.clear(); positions_poly.clear();
positions_grid.clear(); positions_grid.clear();
normals.clear(); normals.clear();
@ -1576,7 +1576,7 @@ void Scene_c3t3_item::show_spheres(bool b)
QString msg = QString("Vertex's index : %1; Vertex's in dimension: %2.").arg(d->tr_vertices[id].index()).arg(d->tr_vertices[id].in_dimension()); QString msg = QString("Vertex's index : %1; Vertex's in dimension: %2.").arg(d->tr_vertices[id].index()).arg(d->tr_vertices[id].in_dimension());
CGAL::Three::Three::information(msg); CGAL::Three::Three::information(msg);
CGAL::Three::Three::mainViewer()->displayMessage(msg, 5000); CGAL::Three::Three::mainViewer()->displayMessage(msg, 5000);
}); });
d->spheres->setName("Protecting spheres"); d->spheres->setName("Protecting spheres");
d->spheres->setRenderingMode(Gouraud); d->spheres->setRenderingMode(Gouraud);
@ -1958,7 +1958,7 @@ void Scene_c3t3_item::invalidateOpenGLBuffers()
getEdgeContainer(CNC)->reset_vbos(ALL); getEdgeContainer(CNC)->reset_vbos(ALL);
getEdgeContainer(Grid_edges)->reset_vbos(ALL); getEdgeContainer(Grid_edges)->reset_vbos(ALL);
getPointContainer(C3t3_points)->reset_vbos(ALL); getPointContainer(C3t3_points)->reset_vbos(ALL);
Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool())
{ {
CGAL::Three::Viewer_interface* viewer = static_cast<CGAL::Three::Viewer_interface*>(v); CGAL::Three::Viewer_interface* viewer = static_cast<CGAL::Three::Viewer_interface*>(v);
@ -2037,52 +2037,52 @@ void Scene_c3t3_item::computeElements()const
{ {
QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::setOverrideCursor(Qt::WaitCursor);
const_cast<Scene_c3t3_item*>(this)->d->computeElements(); const_cast<Scene_c3t3_item*>(this)->d->computeElements();
getTriangleContainer(C3t3_faces)->allocate( getTriangleContainer(C3t3_faces)->allocate(
Tc::Flat_vertices, d->positions_poly.data(), Tc::Flat_vertices, d->positions_poly.data(),
static_cast<int>(d->positions_poly.size()*sizeof(float))); static_cast<int>(d->positions_poly.size()*sizeof(float)));
getTriangleContainer(C3t3_faces)->allocate( getTriangleContainer(C3t3_faces)->allocate(
Tc::Flat_normals, Tc::Flat_normals,
d->normals.data(), d->normals.data(),
static_cast<int>(d->normals.size()*sizeof(float))); static_cast<int>(d->normals.size()*sizeof(float)));
getTriangleContainer(C3t3_faces)->allocate( getTriangleContainer(C3t3_faces)->allocate(
Tc::FColors, Tc::FColors,
d->f_colors.data(), d->f_colors.data(),
static_cast<int>(d->f_colors.size()*sizeof(float))); static_cast<int>(d->f_colors.size()*sizeof(float)));
getTriangleContainer(C3t3_faces)->allocate( getTriangleContainer(C3t3_faces)->allocate(
Tc::Facet_centers, Tc::Facet_centers,
d->positions_barycenter.data(), d->positions_barycenter.data(),
static_cast<int>(d->positions_barycenter.size()*sizeof(float))); static_cast<int>(d->positions_barycenter.size()*sizeof(float)));
d->positions_poly_size = d->positions_poly.size(); d->positions_poly_size = d->positions_poly.size();
getEdgeContainer(C3t3_edges)->allocate( getEdgeContainer(C3t3_edges)->allocate(
Ec::Vertices, Ec::Vertices,
d->positions_lines.data(), d->positions_lines.data(),
static_cast<int>(d->positions_lines.size()*sizeof(float))); static_cast<int>(d->positions_lines.size()*sizeof(float)));
d->positions_lines_size = d->positions_lines.size(); d->positions_lines_size = d->positions_lines.size();
getEdgeContainer(CNC)->allocate( getEdgeContainer(CNC)->allocate(
Ec::Vertices, Ec::Vertices,
d->positions_lines_not_in_complex.data(), d->positions_lines_not_in_complex.data(),
static_cast<int>(d->positions_lines_not_in_complex.size()*sizeof(float))); static_cast<int>(d->positions_lines_not_in_complex.size()*sizeof(float)));
d->positions_lines_not_in_complex_size = d->positions_lines_not_in_complex.size(); d->positions_lines_not_in_complex_size = d->positions_lines_not_in_complex.size();
getEdgeContainer(Grid_edges)->allocate( getEdgeContainer(Grid_edges)->allocate(
Ec::Vertices, Ec::Vertices,
d->positions_grid.data(), d->positions_grid.data(),
static_cast<int>(d->positions_grid.size()*sizeof(float))); static_cast<int>(d->positions_grid.size()*sizeof(float)));
getPointContainer(C3t3_points)->allocate( getPointContainer(C3t3_points)->allocate(
Pc::Vertices, Pc::Vertices,
d->positions_lines.data(), d->positions_lines.data(),
static_cast<int>(d->positions_lines.size()*sizeof(float))); static_cast<int>(d->positions_lines.size()*sizeof(float)));
setBuffersFilled(true); setBuffersFilled(true);
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
} }

View File

@ -76,13 +76,13 @@ void Scene_implicit_function_item_priv::initialize_buffers(CGAL::Three::Viewer_i
{ {
item->getTriangleContainer(0)->initializeBuffers(viewer); item->getTriangleContainer(0)->initializeBuffers(viewer);
item->getTriangleContainer(0)->setFlatDataSize(nb_quad); item->getTriangleContainer(0)->setFlatDataSize(nb_quad);
item->getEdgeContainer(0)->initializeBuffers(viewer); item->getEdgeContainer(0)->initializeBuffers(viewer);
item->getEdgeContainer(0)->setFlatDataSize(nb_cube); item->getEdgeContainer(0)->setFlatDataSize(nb_cube);
item->getEdgeContainer(1)->initializeBuffers(viewer); item->getEdgeContainer(1)->initializeBuffers(viewer);
item->getEdgeContainer(1)->setFlatDataSize(nb_grid); item->getEdgeContainer(1)->setFlatDataSize(nb_grid);
positions_tex_quad.clear(); positions_tex_quad.clear();
positions_tex_quad.shrink_to_fit(); positions_tex_quad.shrink_to_fit();
texture_map.clear(); texture_map.clear();
@ -371,14 +371,14 @@ Scene_implicit_function_item::draw(CGAL::Three::Viewer_interface* viewer) const
d->frame_->setOrientation(1., 0, 0, 0); d->frame_->setOrientation(1., 0, 0, 0);
d->init = true; d->init = true;
} }
if(d->frame_->isManipulated()) { if(d->frame_->isManipulated()) {
if(d->need_update_) { if(d->need_update_) {
compute_function_grid(); compute_function_grid();
d->need_update_ = false; d->need_update_ = false;
} }
} }
if(!isInit(viewer)) if(!isInit(viewer))
initGL(viewer); initGL(viewer);
if ( getBuffersFilled() && if ( getBuffersFilled() &&
@ -420,7 +420,7 @@ Scene_implicit_function_item::drawEdges(CGAL::Three::Viewer_interface* viewer) c
computeElements(); computeElements();
initializeBuffers(viewer); initializeBuffers(viewer);
} }
getEdgeContainer(0)->setColor(QColor(0,0,0)); getEdgeContainer(0)->setColor(QColor(0,0,0));
getEdgeContainer(0)->draw(viewer, true); getEdgeContainer(0)->draw(viewer, true);
QMatrix4x4 f_mat; QMatrix4x4 f_mat;
@ -601,18 +601,18 @@ void Scene_implicit_function_item::computeElements() const
d->positions_tex_quad.data(), d->positions_tex_quad.data(),
static_cast<int>(d->positions_tex_quad.size()*sizeof(float))); static_cast<int>(d->positions_tex_quad.size()*sizeof(float)));
d->nb_quad = d->positions_tex_quad.size(); d->nb_quad = d->positions_tex_quad.size();
getTriangleContainer(0)->allocate( getTriangleContainer(0)->allocate(
Tc::Texture_map, Tc::Texture_map,
d->texture_map.data(), d->texture_map.data(),
static_cast<int>(d->texture_map.size()*sizeof(float))); static_cast<int>(d->texture_map.size()*sizeof(float)));
getEdgeContainer(0)->allocate( getEdgeContainer(0)->allocate(
Ec::Vertices, Ec::Vertices,
d->positions_cube.data(), d->positions_cube.data(),
static_cast<int>(d->positions_cube.size()*sizeof(float))); static_cast<int>(d->positions_cube.size()*sizeof(float)));
d->nb_cube= d->positions_cube.size(); d->nb_cube= d->positions_cube.size();
getEdgeContainer(1)->allocate( getEdgeContainer(1)->allocate(
Ec::Vertices, Ec::Vertices,
d->positions_grid.data(), d->positions_grid.data(),

View File

@ -53,13 +53,13 @@ public:
static int getDefaultLinesWidth(); static int getDefaultLinesWidth();
/*! \brief Adds a dock widget to the interface /*! \brief Adds a dock widget to the interface
* *
* Adds a dock widget in the left section of the MainWindow. If the slot is already * Adds a dock widget in the left section of the MainWindow. If the slot is already
* taken, the dock widgets will be tabified. * taken, the dock widgets will be tabified.
*/ */
void addDockWidget(QDockWidget* dock_widget); void addDockWidget(QDockWidget* dock_widget);
/*! \brief Gets an item of the templated type. /*! \brief Gets an item of the templated type.
* \returns the first `SceneType` item found in the scene's list of currently selected * \returns the first `SceneType` item found in the scene's list of currently selected
* items; * items;
* \returns nullptr if there is no `SceneType` in the list. * \returns nullptr if there is no `SceneType` in the list.
*/ */