Indentation fixes

This commit is contained in:
Mael Rouxel-Labbé 2023-05-23 17:27:58 +02:00
parent 676144eb17
commit 35cb845ead
6 changed files with 64 additions and 62 deletions

View File

@ -221,7 +221,7 @@ void Scene_item_rendering_helper::setEdgeContainer(std::size_t id,
} }
void Scene_item_rendering_helper::setPointContainer(std::size_t id, void Scene_item_rendering_helper::setPointContainer(std::size_t id,
Point_container* pc) Point_container* pc)
{ {
if(priv->point_containers.size() <= id) if(priv->point_containers.size() <= id)
{ {

View File

@ -27,29 +27,31 @@
#include <QWidgetAction> #include <QWidgetAction>
#include <CGAL/Qt/manipulatedCameraFrame.h> #include <CGAL/Qt/manipulatedCameraFrame.h>
#include <set>
#include <stack>
#include <algorithm>
#include <boost/array.hpp>
#include <CGAL/boost/graph/properties_Surface_mesh.h>
#ifdef CGAL_LINKED_WITH_TBB #ifdef CGAL_LINKED_WITH_TBB
#include <tbb/parallel_for.h> #include <tbb/parallel_for.h>
#include <tbb/blocked_range.h> #include <tbb/blocked_range.h>
#include <tbb/scalable_allocator.h> #include <tbb/scalable_allocator.h>
#endif // CGAL_LINKED_WITH_TBB #endif // CGAL_LINKED_WITH_TBB
#include <boost/array.hpp>
#include <set>
#include <stack>
#include <algorithm>
const std::size_t limit_fast_drawing = 300000; //arbitraty large value const std::size_t limit_fast_drawing = 300000; //arbitraty large value
typedef CGAL::Three::Point_container Pc; typedef CGAL::Three::Point_container Pc;
typedef CGAL::Three::Edge_container Ec; typedef CGAL::Three::Edge_container Ec;
typedef CGAL::Three::Viewer_interface VI; typedef CGAL::Three::Viewer_interface VI;
typedef Scene_points_with_normal_item_priv Priv; typedef Scene_points_with_normal_item_priv Priv;
struct Scene_points_with_normal_item_priv struct Scene_points_with_normal_item_priv
{ {
enum Point_container_id{ enum Point_container_id
Points =0, {
Points = 0,
Shaded_points, Shaded_points,
Selected_points, Selected_points,
Selected_shaded_points Selected_shaded_points
@ -68,30 +70,28 @@ struct Scene_points_with_normal_item_priv
point_Slider->setMinimum(1); point_Slider->setMinimum(1);
point_Slider->setValue(CGAL::Three::Three::getDefaultPointSize()); point_Slider->setValue(CGAL::Three::Three::getDefaultPointSize());
point_Slider->setMaximum(25); point_Slider->setMaximum(25);
item->setPointContainer(Priv::Selected_shaded_points, new Pc(VI::PROGRAM_WITH_LIGHT, item->setPointContainer(Priv::Selected_shaded_points, new Pc(VI::PROGRAM_WITH_LIGHT, false));
false)); item->setPointContainer(Priv::Selected_points, new Pc(VI::PROGRAM_NO_SELECTION, false));
item->setPointContainer(Priv::Selected_points, new Pc(VI::PROGRAM_NO_SELECTION, item->setPointContainer(Priv::Shaded_points, new Pc(VI::PROGRAM_WITH_LIGHT, false));
false)); item->setPointContainer(Priv::Points, new Pc(VI::PROGRAM_NO_SELECTION, false));
item->setPointContainer(Priv::Shaded_points, new Pc(VI::PROGRAM_WITH_LIGHT, item->setEdgeContainer(0, new Ec(VI::PROGRAM_NO_SELECTION, false));
false));
item->setPointContainer(Priv::Points, new Pc(VI::PROGRAM_NO_SELECTION,
false));
item->setEdgeContainer(0, new Ec(VI::PROGRAM_NO_SELECTION,
false));
} }
Scene_points_with_normal_item_priv(Scene_points_with_normal_item* parent) Scene_points_with_normal_item_priv(Scene_points_with_normal_item* parent)
:m_points(new Point_set) : m_points(new Point_set)
{ {
init_values(parent); init_values(parent);
} }
Scene_points_with_normal_item_priv(const Scene_points_with_normal_item& toCopy, Scene_points_with_normal_item* parent)
Scene_points_with_normal_item_priv(const Scene_points_with_normal_item& toCopy,
Scene_points_with_normal_item* parent)
: m_points(new Point_set(*toCopy.d->m_points)) : m_points(new Point_set(*toCopy.d->m_points))
{ {
init_values(parent); init_values(parent);
} }
Scene_points_with_normal_item_priv(const SMesh& input_mesh, Scene_points_with_normal_item* parent) Scene_points_with_normal_item_priv(const SMesh& input_mesh,
Scene_points_with_normal_item* parent)
: m_points(new Point_set) : m_points(new Point_set)
{ {
init_values(parent); init_values(parent);
@ -118,6 +118,7 @@ struct Scene_points_with_normal_item_priv
delete normal_Slider; delete normal_Slider;
delete point_Slider; delete point_Slider;
} }
bool isPointSliderMoving() { return is_point_slider_moving; } bool isPointSliderMoving() { return is_point_slider_moving; }
void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const; void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
void compute_normals_and_vertices() const; void compute_normals_and_vertices() const;
@ -143,9 +144,10 @@ struct Scene_points_with_normal_item_priv
Scene_points_with_normal_item* item; Scene_points_with_normal_item* item;
}; };
class Fill_buffers { class Fill_buffers
{
Point_set* point_set; Point_set* point_set;
std::vector<Point_set::Index>& indices; std::vector<Point_set::Index>& indices;
std::vector<CGAL_data_type>& positions_lines; std::vector<CGAL_data_type>& positions_lines;
std::vector<CGAL_data_type>& positions_normals; std::vector<CGAL_data_type>& positions_normals;
@ -212,19 +214,16 @@ public:
} }
}; };
Scene_points_with_normal_item::Scene_points_with_normal_item() Scene_points_with_normal_item::Scene_points_with_normal_item()
{ {
setRenderingMode(Points); setRenderingMode(Points);
is_selected = true; is_selected = true;
d = new Scene_points_with_normal_item_priv(this); d = new Scene_points_with_normal_item_priv(this);
} }
// Copy constructor // Copy constructor
Scene_points_with_normal_item::Scene_points_with_normal_item(const Scene_points_with_normal_item& toCopy) Scene_points_with_normal_item::Scene_points_with_normal_item(const Scene_points_with_normal_item& toCopy)
{ {
d = new Scene_points_with_normal_item_priv(toCopy, this); d = new Scene_points_with_normal_item_priv(toCopy, this);
if (!has_normals()) if (!has_normals())
@ -232,7 +231,8 @@ Scene_points_with_normal_item::Scene_points_with_normal_item(const Scene_points_
setRenderingMode(Points); setRenderingMode(Points);
is_selected = true; is_selected = true;
} }
else{ else
{
setRenderingMode(CGAL::Three::Three::defaultPointSetRenderingMode()); setRenderingMode(CGAL::Three::Three::defaultPointSetRenderingMode());
is_selected = true; is_selected = true;
} }
@ -692,7 +692,6 @@ void Scene_points_with_normal_item::drawEdges(CGAL::Three::Viewer_interface* vie
void Scene_points_with_normal_item:: void Scene_points_with_normal_item::
drawPoints(CGAL::Three::Viewer_interface* viewer) const drawPoints(CGAL::Three::Viewer_interface* viewer) const
{ {
GLfloat point_size; GLfloat point_size;
viewer->glGetFloatv(GL_POINT_SIZE, &point_size); viewer->glGetFloatv(GL_POINT_SIZE, &point_size);
viewer->setGlPointSize(GLfloat(d->point_Slider->value())); viewer->setGlPointSize(GLfloat(d->point_Slider->value()));
@ -735,18 +734,16 @@ drawPoints(CGAL::Three::Viewer_interface* viewer) const
{ {
if(!d->m_points->has_colors()) if(!d->m_points->has_colors())
getPointContainer(Priv::Points)->setColor(color()); getPointContainer(Priv::Points)->setColor(color());
std::size_t real_size = std::size_t real_size = getPointContainer(Priv::Points)->getFlatDataSize();
getPointContainer(Priv::Points)->getFlatDataSize();
getPointContainer(Priv::Points)->setFlatDataSize(ratio_displayed * real_size); getPointContainer(Priv::Points)->setFlatDataSize(ratio_displayed * real_size);
getPointContainer(Priv::Points)->setFlatDataSize(real_size); getPointContainer(Priv::Points)->setFlatDataSize(real_size);
getPointContainer(Priv::Points)->draw( viewer, !d->m_points->has_colors()); getPointContainer(Priv::Points)->draw(viewer, !d->m_points->has_colors());
real_size = real_size = getPointContainer(Priv::Selected_points)->getFlatDataSize();
getPointContainer(Priv::Selected_points)->getFlatDataSize();
getPointContainer(Priv::Selected_points)->setColor(QColor(Qt::red)); getPointContainer(Priv::Selected_points)->setColor(QColor(Qt::red));
getPointContainer(Priv::Selected_points)->setFlatDataSize(ratio_displayed * real_size); getPointContainer(Priv::Selected_points)->setFlatDataSize(ratio_displayed * real_size);
getPointContainer(Priv::Selected_points)->setFlatDataSize(real_size); getPointContainer(Priv::Selected_points)->setFlatDataSize(real_size);
getPointContainer(Priv::Selected_points)->draw( viewer, true); getPointContainer(Priv::Selected_points)->draw(viewer, true);
} }
viewer->setGlPointSize(point_size); viewer->setGlPointSize(point_size);

View File

@ -36,11 +36,11 @@ class SCENE_POINTS_WITH_NORMAL_ITEM_EXPORT Scene_points_with_normal_item
public: public:
Scene_points_with_normal_item(); Scene_points_with_normal_item();
Scene_points_with_normal_item(const SMesh& input_mesh);
Scene_points_with_normal_item(const Scene_points_with_normal_item& toCopy); Scene_points_with_normal_item(const Scene_points_with_normal_item& toCopy);
Scene_points_with_normal_item(const SMesh& input_mesh);
~Scene_points_with_normal_item(); ~Scene_points_with_normal_item();
Scene_points_with_normal_item* clone() const Q_DECL_OVERRIDE; Scene_points_with_normal_item* clone() const Q_DECL_OVERRIDE;
// Is selection empty? // Is selection empty?

View File

@ -751,7 +751,6 @@ void Scene_surface_mesh_item_priv::initialize_colors() const
void Scene_surface_mesh_item_priv::initializeBuffers(CGAL::Three::Viewer_interface* viewer)const void Scene_surface_mesh_item_priv::initializeBuffers(CGAL::Three::Viewer_interface* viewer)const
{ {
item->getTriangleContainer(1)->initializeBuffers(viewer); item->getTriangleContainer(1)->initializeBuffers(viewer);
item->getTriangleContainer(0)->initializeBuffers(viewer); item->getTriangleContainer(0)->initializeBuffers(viewer);
item->getEdgeContainer(1)->initializeBuffers(viewer); item->getEdgeContainer(1)->initializeBuffers(viewer);
@ -2388,7 +2387,7 @@ void Scene_surface_mesh_item::setAlpha(int alpha)
QSlider* Scene_surface_mesh_item::alphaSlider() { return d->alphaSlider; } QSlider* Scene_surface_mesh_item::alphaSlider() { return d->alphaSlider; }
void Scene_surface_mesh_item::computeElements()const void Scene_surface_mesh_item::computeElements() const
{ {
d->compute_elements(ALL); d->compute_elements(ALL);
setBuffersFilled(true); setBuffersFilled(true);
@ -2396,7 +2395,7 @@ void Scene_surface_mesh_item::computeElements()const
} }
void void
Scene_surface_mesh_item::initializeBuffers(CGAL::Three::Viewer_interface* viewer)const Scene_surface_mesh_item::initializeBuffers(CGAL::Three::Viewer_interface* viewer) const
{ {
const_cast<Scene_surface_mesh_item*>(this)->//temporary, until the drawing pipeline is not const anymore. const_cast<Scene_surface_mesh_item*>(this)->//temporary, until the drawing pipeline is not const anymore.
d->initializeBuffers(viewer); d->initializeBuffers(viewer);
@ -2416,8 +2415,9 @@ void Scene_surface_mesh_item::computeItemColorVectorAutomatically(bool b)
this->setProperty("recompute_colors",b); this->setProperty("recompute_colors",b);
} }
void write_in_vbo(Vbo* vbo, cgal_gl_data* data, void write_in_vbo(Vbo* vbo,
std::size_t size) cgal_gl_data* data,
std::size_t size)
{ {
vbo->bind(); vbo->bind();
vbo->vbo.write(static_cast<int>((3*size)*sizeof(cgal_gl_data)), vbo->vbo.write(static_cast<int>((3*size)*sizeof(cgal_gl_data)),

View File

@ -28,33 +28,37 @@
#include "properties.h" #include "properties.h"
class QSlider; class QSlider;
struct Scene_surface_mesh_item_priv; struct Scene_surface_mesh_item_priv;
class SCENE_SURFACE_MESH_ITEM_EXPORT Scene_surface_mesh_item class SCENE_SURFACE_MESH_ITEM_EXPORT Scene_surface_mesh_item
: public CGAL::Three::Scene_item_rendering_helper, : public CGAL::Three::Scene_item_rendering_helper,
public CGAL::Three::Scene_item_with_properties, public CGAL::Three::Scene_item_with_properties,
public CGAL::Three::Scene_zoomable_item_interface, public CGAL::Three::Scene_zoomable_item_interface,
public CGAL::Three::Scene_print_item_interface{ public CGAL::Three::Scene_print_item_interface
{
Q_INTERFACES(CGAL::Three::Scene_print_item_interface) Q_INTERFACES(CGAL::Three::Scene_print_item_interface)
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PrintInterface/1.0") Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PrintInterface/1.0")
Q_OBJECT Q_OBJECT
Q_INTERFACES(CGAL::Three::Scene_zoomable_item_interface) Q_INTERFACES(CGAL::Three::Scene_zoomable_item_interface)
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.ZoomInterface/1.0") Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.ZoomInterface/1.0")
public: public:
typedef SMesh Face_graph; typedef SMesh Face_graph;
typedef SMesh::Property_map<vertex_descriptor,int> Vertex_selection_map; typedef SMesh::Property_map<vertex_descriptor,int> Vertex_selection_map;
typedef SMesh::Property_map<face_descriptor,int> Face_selection_map; typedef SMesh::Property_map<face_descriptor,int> Face_selection_map;
void initialize_priv();
Scene_surface_mesh_item(); Scene_surface_mesh_item();
// Takes ownership of the argument. // Takes ownership of the argument.
Scene_surface_mesh_item(SMesh*); Scene_surface_mesh_item(SMesh*);
Scene_surface_mesh_item(const SMesh&); Scene_surface_mesh_item(const SMesh&);
Scene_surface_mesh_item(SMesh&&); Scene_surface_mesh_item(SMesh&&);
Scene_surface_mesh_item(const Scene_surface_mesh_item& other); Scene_surface_mesh_item(const Scene_surface_mesh_item& other);
~Scene_surface_mesh_item(); ~Scene_surface_mesh_item();
Scene_surface_mesh_item* clone() const Q_DECL_OVERRIDE; Scene_surface_mesh_item* clone() const Q_DECL_OVERRIDE;
void draw(CGAL::Three::Viewer_interface *) const Q_DECL_OVERRIDE; void draw(CGAL::Three::Viewer_interface *) const Q_DECL_OVERRIDE;
void drawEdges(CGAL::Three::Viewer_interface *) const Q_DECL_OVERRIDE; void drawEdges(CGAL::Three::Viewer_interface *) const Q_DECL_OVERRIDE;

View File

@ -41,7 +41,7 @@ struct Point_container;
//! be rendered. //! be rendered.
//! //!
class DEMO_FRAMEWORK_EXPORT Scene_item_rendering_helper class DEMO_FRAMEWORK_EXPORT Scene_item_rendering_helper
:public Scene_item : public Scene_item
{ {
Q_OBJECT Q_OBJECT
public: public:
@ -100,11 +100,11 @@ public:
//! //!
//! \brief getEdgeContainer returns the `id`th `Edge_container`. //! \brief getEdgeContainer returns the `id`th `Edge_container`.
//! //!
CGAL::Three::Edge_container* getEdgeContainer(std::size_t id)const; CGAL::Three::Edge_container* getEdgeContainer(std::size_t id) const;
//! //!
//! \brief getPointContainer returns the `id`th `Point_container`. //! \brief getPointContainer returns the `id`th `Point_container`.
//! //!
CGAL::Three::Point_container* getPointContainer(std::size_t id)const; CGAL::Three::Point_container* getPointContainer(std::size_t id) const;
//! //!
//! \brief setTriangleContainer sets the `id`th `Triangle_container` to `tc`. //! \brief setTriangleContainer sets the `id`th `Triangle_container` to `tc`.
@ -134,7 +134,7 @@ public:
//! decreasingly. //! decreasingly.
//! //!
void setPointContainer(std::size_t id, void setPointContainer(std::size_t id,
Point_container* tc); Point_container* tc);
//! //!
//! \brief setBuffersFilled specifies if the data should be re-computed. //! \brief setBuffersFilled specifies if the data should be re-computed.
@ -149,13 +149,13 @@ public:
//! \brief getBuffersFilled returns `false` if the item rendering data needs to be re-computed., //! \brief getBuffersFilled returns `false` if the item rendering data needs to be re-computed.,
//! `true` otherwise. //! `true` otherwise.
//! \see `setBuffersFilled()` //! \see `setBuffersFilled()`
bool getBuffersFilled()const; bool getBuffersFilled() const;
//! //!
//! \brief getBuffersInit returns true if the `Vao`s of `viewer` are ready //! \brief getBuffersInit returns true if the `Vao`s of `viewer` are ready
//! for rendering. //! for rendering.
//! //!
bool getBuffersInit(Viewer_interface *viewer)const; bool getBuffersInit(Viewer_interface *viewer) const;
//! //!
//! \brief setBuffersInit specifies if the `Vbo`s need to be initialized. //! \brief setBuffersInit specifies if the `Vbo`s need to be initialized.
@ -190,7 +190,7 @@ protected:
QSlider* alphaSlider(); QSlider* alphaSlider();
//!Returns`true` if `initGL()` was called for `viewer`. //!Returns`true` if `initGL()` was called for `viewer`.
bool isInit(CGAL::Three::Viewer_interface* viewer)const; bool isInit(CGAL::Three::Viewer_interface* viewer) const;
//!Returns the float alpha value of an item. //!Returns the float alpha value of an item.
//! This value is between 0.0f and 1.0f. //! This value is between 0.0f and 1.0f.
@ -198,7 +198,7 @@ protected:
/*! Fills the `Vbo`s with data. /*! Fills the `Vbo`s with data.
*/ */
virtual void initializeBuffers(Viewer_interface*)const{} virtual void initializeBuffers(Viewer_interface*) const {}
//!Creates the VAOs and VBOs for viewer. //!Creates the VAOs and VBOs for viewer.
virtual void initGL(CGAL::Three::Viewer_interface* viewer) const; virtual void initGL(CGAL::Three::Viewer_interface* viewer) const;
@ -210,9 +210,10 @@ protected:
//! \brief setBbox allows to set the Bbox in compute_bbox(); //! \brief setBbox allows to set the Bbox in compute_bbox();
//! \param b //! \param b
//! //!
void setBbox(Bbox b)const ; void setBbox(Bbox b) const;
virtual void computeElements() const {}
virtual void computeElements()const{}
protected: protected:
friend struct PRIV; friend struct PRIV;
mutable PRIV* priv; mutable PRIV* priv;