mirror of https://github.com/CGAL/cgal
Plugin API made in CamelCase
This commit is contained in:
parent
4dadba77c4
commit
3f0f27a5ac
|
|
@ -124,7 +124,7 @@ MainWindow::MainWindow(QWidget* parent)
|
||||||
menu_map[ui->menuOperations->title()] = ui->menuOperations;
|
menu_map[ui->menuOperations->title()] = ui->menuOperations;
|
||||||
// remove the Load Script menu entry, when the demo has not been compiled with QT_SCRIPT_LIB
|
// remove the Load Script menu entry, when the demo has not been compiled with QT_SCRIPT_LIB
|
||||||
#if !defined(QT_SCRIPT_LIB)
|
#if !defined(QT_SCRIPT_LIB)
|
||||||
ui->menuBar->removeAction(ui->actionLoad_Script);
|
ui->menuBar->removeAction(ui->actionloadScript);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Save some pointers from ui, for latter use.
|
// Save some pointers from ui, for latter use.
|
||||||
|
|
@ -348,7 +348,7 @@ MainWindow::MainWindow(QWidget* parent)
|
||||||
|
|
||||||
if(actionAddToGroup) {
|
if(actionAddToGroup) {
|
||||||
connect(actionAddToGroup, SIGNAL(triggered()),
|
connect(actionAddToGroup, SIGNAL(triggered()),
|
||||||
this, SLOT(make_new_group()));
|
this, SLOT(makeNewGroup()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu* menuFile = findChild<QMenu*>("menuFile");
|
QMenu* menuFile = findChild<QMenu*>("menuFile");
|
||||||
|
|
@ -844,7 +844,7 @@ void MainWindow::updateViewerBBox()
|
||||||
viewer->camera()->showEntireScene();
|
viewer->camera()->showEntireScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::reload_item() {
|
void MainWindow::reloadItem() {
|
||||||
QAction* sender_action = qobject_cast<QAction*>(sender());
|
QAction* sender_action = qobject_cast<QAction*>(sender());
|
||||||
if(!sender_action) return;
|
if(!sender_action) return;
|
||||||
|
|
||||||
|
|
@ -871,10 +871,10 @@ void MainWindow::reload_item() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGAL::Three::Polyhedron_demo_io_plugin_interface* fileloader = find_loader(loader_name);
|
CGAL::Three::Polyhedron_demo_io_plugin_interface* fileloader = findLoader(loader_name);
|
||||||
QFileInfo fileinfo(filename);
|
QFileInfo fileinfo(filename);
|
||||||
|
|
||||||
CGAL::Three::Scene_item* new_item = load_item(fileinfo, fileloader);
|
CGAL::Three::Scene_item* new_item = loadItem(fileinfo, fileloader);
|
||||||
|
|
||||||
new_item->setName(item->name());
|
new_item->setName(item->name());
|
||||||
new_item->setColor(item->color());
|
new_item->setColor(item->color());
|
||||||
|
|
@ -885,7 +885,7 @@ void MainWindow::reload_item() {
|
||||||
item->deleteLater();
|
item->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
CGAL::Three::Polyhedron_demo_io_plugin_interface* MainWindow::find_loader(const QString& loader_name) const {
|
CGAL::Three::Polyhedron_demo_io_plugin_interface* MainWindow::findLoader(const QString& loader_name) const {
|
||||||
Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* io_plugin,
|
Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* io_plugin,
|
||||||
io_plugins) {
|
io_plugins) {
|
||||||
if(io_plugin->name() == loader_name) {
|
if(io_plugin->name() == loader_name) {
|
||||||
|
|
@ -937,7 +937,7 @@ void MainWindow::open(QString filename)
|
||||||
program=filename.right(filename.size() - 9);
|
program=filename.right(filename.size() - 9);
|
||||||
}
|
}
|
||||||
if(filename.endsWith(".js")) {
|
if(filename.endsWith(".js")) {
|
||||||
load_script(fileinfo);
|
loadScript(fileinfo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!program.isEmpty())
|
if(!program.isEmpty())
|
||||||
|
|
@ -1009,9 +1009,7 @@ void MainWindow::open(QString filename)
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.setValue("OFF open directory",
|
settings.setValue("OFF open directory",
|
||||||
fileinfo.absoluteDir().absolutePath());
|
fileinfo.absoluteDir().absolutePath());
|
||||||
|
|
||||||
CGAL::Three::Scene_item* scene_item = load_item(fileinfo, find_loader(load_pair.first));
|
CGAL::Three::Scene_item* scene_item = load_item(fileinfo, find_loader(load_pair.first));
|
||||||
|
|
||||||
if(scene_item != 0) {
|
if(scene_item != 0) {
|
||||||
this->addToRecentFiles(fileinfo.absoluteFilePath());
|
this->addToRecentFiles(fileinfo.absoluteFilePath());
|
||||||
}
|
}
|
||||||
|
|
@ -1022,7 +1020,7 @@ bool MainWindow::open(QString filename, QString loader_name) {
|
||||||
QFileInfo fileinfo(filename);
|
QFileInfo fileinfo(filename);
|
||||||
CGAL::Three::Scene_item* item;
|
CGAL::Three::Scene_item* item;
|
||||||
try {
|
try {
|
||||||
item = load_item(fileinfo, find_loader(loader_name));
|
item = loadItem(fileinfo, findLoader(loader_name));
|
||||||
}
|
}
|
||||||
catch(std::logic_error e) {
|
catch(std::logic_error e) {
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
|
|
@ -1033,7 +1031,7 @@ bool MainWindow::open(QString filename, QString loader_name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CGAL::Three::Scene_item* MainWindow::load_item(QFileInfo fileinfo, CGAL::Three::Polyhedron_demo_io_plugin_interface* loader) {
|
CGAL::Three::Scene_item* MainWindow::loadItem(QFileInfo fileinfo, CGAL::Three::Polyhedron_demo_io_plugin_interface* loader) {
|
||||||
CGAL::Three::Scene_item* item = NULL;
|
CGAL::Three::Scene_item* item = NULL;
|
||||||
if(!fileinfo.isFile() || !fileinfo.isReadable()) {
|
if(!fileinfo.isFile() || !fileinfo.isReadable()) {
|
||||||
throw std::invalid_argument(QString("File %1 is not a readable file.")
|
throw std::invalid_argument(QString("File %1 is not a readable file.")
|
||||||
|
|
@ -1206,7 +1204,7 @@ void MainWindow::showSceneContextMenu(int selectedItemIndex,
|
||||||
QAction* reload = menu->addAction(tr("&Reload Item from File"));
|
QAction* reload = menu->addAction(tr("&Reload Item from File"));
|
||||||
reload->setData(qVariantFromValue(selectedItemIndex));
|
reload->setData(qVariantFromValue(selectedItemIndex));
|
||||||
connect(reload, SIGNAL(triggered()),
|
connect(reload, SIGNAL(triggered()),
|
||||||
this, SLOT(reload_item()));
|
this, SLOT(reloadItem()));
|
||||||
}
|
}
|
||||||
QAction* saveas = menu->addAction(tr("&Save as..."));
|
QAction* saveas = menu->addAction(tr("&Save as..."));
|
||||||
saveas->setData(qVariantFromValue(selectedItemIndex));
|
saveas->setData(qVariantFromValue(selectedItemIndex));
|
||||||
|
|
@ -1339,13 +1337,13 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::load_script(QString filename)
|
bool MainWindow::loadScript(QString filename)
|
||||||
{
|
{
|
||||||
QFileInfo fileinfo(filename);
|
QFileInfo fileinfo(filename);
|
||||||
return load_script(fileinfo);
|
return loadScript(fileinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::load_script(QFileInfo info)
|
bool MainWindow::loadScript(QFileInfo info)
|
||||||
{
|
{
|
||||||
#if defined(QT_SCRIPT_LIB)
|
#if defined(QT_SCRIPT_LIB)
|
||||||
QString program;
|
QString program;
|
||||||
|
|
@ -1365,7 +1363,7 @@ bool MainWindow::load_script(QFileInfo info)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionLoad_Script_triggered()
|
void MainWindow::on_actionloadScript_triggered()
|
||||||
{
|
{
|
||||||
#if defined(QT_SCRIPT_LIB)
|
#if defined(QT_SCRIPT_LIB)
|
||||||
QString filename = QFileDialog::getOpenFileName(
|
QString filename = QFileDialog::getOpenFileName(
|
||||||
|
|
@ -1374,7 +1372,7 @@ void MainWindow::on_actionLoad_Script_triggered()
|
||||||
".",
|
".",
|
||||||
"QTScripts (*.js);;All Files (*)");
|
"QTScripts (*.js);;All Files (*)");
|
||||||
|
|
||||||
load_script(QFileInfo(filename));
|
loadScript(QFileInfo(filename));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1426,7 +1424,7 @@ void MainWindow::on_actionLoad_triggered()
|
||||||
CGAL::Three::Scene_item* item = NULL;
|
CGAL::Three::Scene_item* item = NULL;
|
||||||
if(selectedPlugin) {
|
if(selectedPlugin) {
|
||||||
QFileInfo info(filename);
|
QFileInfo info(filename);
|
||||||
item = load_item(info, selectedPlugin);
|
item = loadItem(info, selectedPlugin);
|
||||||
Scene::Item_id index = scene->addItem(item);
|
Scene::Item_id index = scene->addItem(item);
|
||||||
selectSceneItem(index);
|
selectSceneItem(index);
|
||||||
this->addToRecentFiles(filename);
|
this->addToRecentFiles(filename);
|
||||||
|
|
@ -1638,7 +1636,7 @@ void MainWindow::viewerShowObject()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MainWindow::camera_string() const
|
QString MainWindow::cameraString() const
|
||||||
{
|
{
|
||||||
return viewer->dumpCameraCoordinates();
|
return viewer->dumpCameraCoordinates();
|
||||||
}
|
}
|
||||||
|
|
@ -1646,12 +1644,12 @@ QString MainWindow::camera_string() const
|
||||||
void MainWindow::on_actionDumpCamera_triggered()
|
void MainWindow::on_actionDumpCamera_triggered()
|
||||||
{
|
{
|
||||||
information(QString("Camera: %1")
|
information(QString("Camera: %1")
|
||||||
.arg(camera_string()));
|
.arg(cameraString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_action_Copy_camera_triggered()
|
void MainWindow::on_action_Copy_camera_triggered()
|
||||||
{
|
{
|
||||||
qApp->clipboard()->setText(this->camera_string());
|
qApp->clipboard()->setText(this->cameraString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_action_Paste_camera_triggered()
|
void MainWindow::on_action_Paste_camera_triggered()
|
||||||
|
|
@ -1716,7 +1714,7 @@ void MainWindow::restoreCollapseState()
|
||||||
if(modelIndex.isValid())
|
if(modelIndex.isValid())
|
||||||
recurseExpand(modelIndex);
|
recurseExpand(modelIndex);
|
||||||
}
|
}
|
||||||
void MainWindow::make_new_group()
|
void MainWindow::makeNewGroup()
|
||||||
{
|
{
|
||||||
Scene_group_item * group = new Scene_group_item("New group");
|
Scene_group_item * group = new Scene_group_item("New group");
|
||||||
scene->addItem(group);
|
scene->addItem(group);
|
||||||
|
|
@ -1743,7 +1741,7 @@ void MainWindow::recenterSceneView(const QModelIndex &id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::statistics_on_item()
|
void MainWindow::statisticsOnItem()
|
||||||
{
|
{
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
|
||||||
|
|
@ -1754,7 +1752,7 @@ void MainWindow::statistics_on_item()
|
||||||
connect(statistics_ui->okButtonBox, SIGNAL(accepted()),
|
connect(statistics_ui->okButtonBox, SIGNAL(accepted()),
|
||||||
statistics_dlg, SLOT(accept()));
|
statistics_dlg, SLOT(accept()));
|
||||||
connect(statistics_ui->updateButton, SIGNAL(clicked()),
|
connect(statistics_ui->updateButton, SIGNAL(clicked()),
|
||||||
this, SLOT(statistics_on_item()));
|
this, SLOT(statisticsOnItem()));
|
||||||
}
|
}
|
||||||
statistics_ui->label_htmltab->setText(get_item_stats());
|
statistics_ui->label_htmltab->setText(get_item_stats());
|
||||||
|
|
||||||
|
|
@ -1816,7 +1814,7 @@ QString MainWindow::get_item_stats()
|
||||||
str.append(QString("<td> %1 </td>").arg(data.titles.at(title)));
|
str.append(QString("<td> %1 </td>").arg(data.titles.at(title)));
|
||||||
Q_FOREACH(Scene_item* sit, items[i])
|
Q_FOREACH(Scene_item* sit, items[i])
|
||||||
{
|
{
|
||||||
str.append(QString("<td>%1</td>").arg(sit->compute_stats(title)));
|
str.append(QString("<td>%1</td>").arg(sit->computeStats(title)));
|
||||||
}
|
}
|
||||||
title++;
|
title++;
|
||||||
for(;title<titles_limit; title++)
|
for(;title<titles_limit; title++)
|
||||||
|
|
@ -1824,7 +1822,7 @@ QString MainWindow::get_item_stats()
|
||||||
str.append(QString("</tr><tr><td> %1 </td>").arg(data.titles.at(title)));
|
str.append(QString("</tr><tr><td> %1 </td>").arg(data.titles.at(title)));
|
||||||
Q_FOREACH(Scene_item* sit, items[i])
|
Q_FOREACH(Scene_item* sit, items[i])
|
||||||
{
|
{
|
||||||
str.append(QString("<td>%1</td>").arg(sit->compute_stats(title)));
|
str.append(QString("<td>%1</td>").arg(sit->computeStats(title)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,12 +62,12 @@ public:
|
||||||
/*! Find an IO plugin.
|
/*! Find an IO plugin.
|
||||||
* throws std::invalid_argument if no loader with that argument can be found
|
* throws std::invalid_argument if no loader with that argument can be found
|
||||||
@returns the IO plugin associated with `loader_name`*/
|
@returns the IO plugin associated with `loader_name`*/
|
||||||
CGAL::Three::Polyhedron_demo_io_plugin_interface* find_loader(const QString& loader_name) const;
|
CGAL::Three::Polyhedron_demo_io_plugin_interface* findLoader(const QString& loader_name) const;
|
||||||
|
|
||||||
/*! \brief Load an item with a given loader.
|
/*! \brief Load an item with a given loader.
|
||||||
* throws `std::logic_error` if loading does not succeed or
|
* throws `std::logic_error` if loading does not succeed or
|
||||||
* `std::invalid_argument` if `fileinfo` specifies an invalid file*/
|
* `std::invalid_argument` if `fileinfo` specifies an invalid file*/
|
||||||
CGAL::Three::Scene_item* load_item(QFileInfo fileinfo, CGAL::Three::Polyhedron_demo_io_plugin_interface*);
|
CGAL::Three::Scene_item* loadItem(QFileInfo fileinfo, CGAL::Three::Polyhedron_demo_io_plugin_interface*);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void on_closure();
|
void on_closure();
|
||||||
|
|
@ -77,7 +77,7 @@ Q_SIGNALS:
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
//!Creates a new group and adds it to the scene.
|
//!Creates a new group and adds it to the scene.
|
||||||
void make_new_group();
|
void makeNewGroup();
|
||||||
void updateViewerBBox();
|
void updateViewerBBox();
|
||||||
void open(QString);
|
void open(QString);
|
||||||
void on_upButton_pressed();
|
void on_upButton_pressed();
|
||||||
|
|
@ -87,7 +87,7 @@ public Q_SLOTS:
|
||||||
void setCollapsed(QModelIndex);
|
void setCollapsed(QModelIndex);
|
||||||
bool file_matches_filter(const QString& filters, const QString& filename);
|
bool file_matches_filter(const QString& filters, const QString& filename);
|
||||||
//!Prints a dialog containing statistics on the selected polyhedrons.
|
//!Prints a dialog containing statistics on the selected polyhedrons.
|
||||||
void statistics_on_item();
|
void statisticsOnItem();
|
||||||
/*! Open a file with a given loader, and return true if it was successful.
|
/*! Open a file with a given loader, and return true if it was successful.
|
||||||
This slot is for use by scripts.*/
|
This slot is for use by scripts.*/
|
||||||
bool open(QString filename, QString loader_name);
|
bool open(QString filename, QString loader_name);
|
||||||
|
|
@ -95,19 +95,19 @@ public Q_SLOTS:
|
||||||
/*! Reloads an item. Expects to be called by a QAction with the
|
/*! Reloads an item. Expects to be called by a QAction with the
|
||||||
index of the item to be reloaded as data attached to the action.
|
index of the item to be reloaded as data attached to the action.
|
||||||
The index must identify a valid `Scene_item`.*/
|
The index must identify a valid `Scene_item`.*/
|
||||||
void reload_item();
|
void reloadItem();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This is an overloaded function.
|
* This is an overloaded function.
|
||||||
* If QT_SCRIPT_LIB is defined, returns true if the script is valid.
|
* If QT_SCRIPT_LIB is defined, returns true if the script is valid.
|
||||||
* If not, returns false.
|
* If not, returns false.
|
||||||
*/
|
*/
|
||||||
bool load_script(QString filename);
|
bool loadScript(QString filename);
|
||||||
|
|
||||||
/*! If QT_SCRIPT_LIB is defined, returns true if the script is valid.
|
/*! If QT_SCRIPT_LIB is defined, returns true if the script is valid.
|
||||||
* If not, returns false.
|
* If not, returns false.
|
||||||
*/
|
*/
|
||||||
bool load_script(QFileInfo);
|
bool loadScript(QFileInfo);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Gives the keyboard input focus to the widget searchEdit.
|
* Gives the keyboard input focus to the widget searchEdit.
|
||||||
|
|
@ -268,7 +268,7 @@ protected Q_SLOTS:
|
||||||
//!Duplicates the selected item and selects the new item.
|
//!Duplicates the selected item and selects the new item.
|
||||||
void on_actionDuplicate_triggered();
|
void on_actionDuplicate_triggered();
|
||||||
//!If QT_SCRIPT_LIB is defined, opens a dialog to choose a script.
|
//!If QT_SCRIPT_LIB is defined, opens a dialog to choose a script.
|
||||||
void on_actionLoad_Script_triggered();
|
void on_actionloadScript_triggered();
|
||||||
//!Loads a plugin from a specified directory
|
//!Loads a plugin from a specified directory
|
||||||
void on_actionLoad_plugin_triggered();
|
void on_actionLoad_plugin_triggered();
|
||||||
// Show/Hide
|
// Show/Hide
|
||||||
|
|
@ -299,9 +299,9 @@ protected Q_SLOTS:
|
||||||
*/
|
*/
|
||||||
void on_action_Look_at_triggered();
|
void on_action_Look_at_triggered();
|
||||||
//!Returns the position and orientation of the current camera frame.
|
//!Returns the position and orientation of the current camera frame.
|
||||||
QString camera_string() const;
|
QString cameraString() const;
|
||||||
/*! Prints the position and orientation of the current camera frame.
|
/*! Prints the position and orientation of the current camera frame.
|
||||||
* @see camera_string()
|
* @see cameraString()
|
||||||
*/
|
*/
|
||||||
void on_actionDumpCamera_triggered();
|
void on_actionDumpCamera_triggered();
|
||||||
//!Sets the coordinates of the camera in the clipboard text.
|
//!Sets the coordinates of the camera in the clipboard text.
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ public:
|
||||||
// Wireframe OpenGL drawing in a display list
|
// Wireframe OpenGL drawing in a display list
|
||||||
void invalidateOpenGLBuffers()
|
void invalidateOpenGLBuffers()
|
||||||
{
|
{
|
||||||
compute_elements();
|
computeElements();
|
||||||
are_buffers_filled = false;
|
are_buffers_filled = false;
|
||||||
compute_bbox();
|
compute_bbox();
|
||||||
}
|
}
|
||||||
|
|
@ -95,8 +95,8 @@ private:
|
||||||
|
|
||||||
mutable QOpenGLShaderProgram *program;
|
mutable QOpenGLShaderProgram *program;
|
||||||
|
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer)const
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer)const
|
||||||
{
|
{
|
||||||
program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
|
program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
|
||||||
program->bind();
|
program->bind();
|
||||||
|
|
@ -114,7 +114,7 @@ private:
|
||||||
are_buffers_filled = true;
|
are_buffers_filled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void compute_elements() const
|
void computeElements() const
|
||||||
{
|
{
|
||||||
positions_lines.clear();
|
positions_lines.clear();
|
||||||
|
|
||||||
|
|
@ -123,13 +123,13 @@ private:
|
||||||
|
|
||||||
tree.traversal(0, traits);
|
tree.traversal(0, traits);
|
||||||
}
|
}
|
||||||
void draw_edges(CGAL::Three::Viewer_interface* viewer) const
|
void drawEdges(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
vaos[0]->bind();
|
vaos[0]->bind();
|
||||||
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
attrib_buffers(viewer, PROGRAM_NO_SELECTION);
|
attribBuffers(viewer, PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors",this->color());
|
program->setAttributeValue("colors",this->color());
|
||||||
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/3));
|
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/3));
|
||||||
|
|
@ -168,7 +168,7 @@ public:
|
||||||
}
|
}
|
||||||
void invalidateOpenGLBuffers()
|
void invalidateOpenGLBuffers()
|
||||||
{
|
{
|
||||||
compute_elements();
|
computeElements();
|
||||||
are_buffers_filled = false;
|
are_buffers_filled = false;
|
||||||
compute_bbox();
|
compute_bbox();
|
||||||
}
|
}
|
||||||
|
|
@ -213,8 +213,8 @@ private:
|
||||||
|
|
||||||
mutable QOpenGLShaderProgram *program;
|
mutable QOpenGLShaderProgram *program;
|
||||||
|
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer)const
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer)const
|
||||||
{
|
{
|
||||||
program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
|
program = getShaderProgram(PROGRAM_NO_SELECTION, viewer);
|
||||||
program->bind();
|
program->bind();
|
||||||
|
|
@ -231,7 +231,7 @@ private:
|
||||||
vaos[0]->release();
|
vaos[0]->release();
|
||||||
are_buffers_filled = true;
|
are_buffers_filled = true;
|
||||||
}
|
}
|
||||||
void compute_elements() const
|
void computeElements() const
|
||||||
{
|
{
|
||||||
positions_lines.clear();
|
positions_lines.clear();
|
||||||
|
|
||||||
|
|
@ -244,13 +244,13 @@ private:
|
||||||
positions_lines.push_back(b.x()); positions_lines.push_back(b.y()); positions_lines.push_back(b.z());
|
positions_lines.push_back(b.x()); positions_lines.push_back(b.y()); positions_lines.push_back(b.z());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void draw_edges(CGAL::Three::Viewer_interface* viewer) const
|
void drawEdges(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
vaos[0]->bind();
|
vaos[0]->bind();
|
||||||
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
attrib_buffers(viewer, PROGRAM_NO_SELECTION);
|
attribBuffers(viewer, PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors",this->color());
|
program->setAttributeValue("colors",this->color());
|
||||||
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/3));
|
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/3));
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ void Volume_plane_intersection::compile_shaders()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Volume_plane_intersection::compute_elements()
|
void Volume_plane_intersection::computeElements()
|
||||||
{
|
{
|
||||||
a_vertex.resize(0);
|
a_vertex.resize(0);
|
||||||
b_vertex.resize(0);
|
b_vertex.resize(0);
|
||||||
|
|
@ -113,7 +113,7 @@ void Volume_plane_intersection::init_buffers()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Volume_plane_intersection::attrib_buffers(Viewer_interface* viewer) const
|
void Volume_plane_intersection::attribBuffers(Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
QMatrix4x4 mvpMatrix;
|
QMatrix4x4 mvpMatrix;
|
||||||
double mat[16];
|
double mat[16];
|
||||||
|
|
@ -131,7 +131,7 @@ void Volume_plane_intersection::attrib_buffers(Viewer_interface* viewer) const
|
||||||
|
|
||||||
void Volume_plane_intersection::draw(Viewer_interface* viewer) const {
|
void Volume_plane_intersection::draw(Viewer_interface* viewer) const {
|
||||||
viewer->glLineWidth(4.0f);
|
viewer->glLineWidth(4.0f);
|
||||||
attrib_buffers(viewer);
|
attribBuffers(viewer);
|
||||||
glDepthRange(0.0,0.9999);
|
glDepthRange(0.0,0.9999);
|
||||||
if(b && c) {
|
if(b && c) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ public:
|
||||||
setColor(QColor(255, 0, 0));
|
setColor(QColor(255, 0, 0));
|
||||||
setName("Volume plane intersection");
|
setName("Volume plane intersection");
|
||||||
compile_shaders();
|
compile_shaders();
|
||||||
compute_elements();
|
computeElements();
|
||||||
init_buffers();
|
init_buffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,9 +68,9 @@ private:
|
||||||
mutable QOpenGLBuffer buffers[vboSize];
|
mutable QOpenGLBuffer buffers[vboSize];
|
||||||
mutable QOpenGLVertexArrayObject vao[vaoSize];
|
mutable QOpenGLVertexArrayObject vao[vaoSize];
|
||||||
mutable QOpenGLShaderProgram rendering_program;
|
mutable QOpenGLShaderProgram rendering_program;
|
||||||
void compute_elements();
|
void computeElements();
|
||||||
void init_buffers();
|
void init_buffers();
|
||||||
void attrib_buffers(Viewer_interface*) const;
|
void attribBuffers(Viewer_interface*) const;
|
||||||
void compile_shaders();
|
void compile_shaders();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ public:
|
||||||
void draw(CGAL::Three::Viewer_interface* viewer)const
|
void draw(CGAL::Three::Viewer_interface* viewer)const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
vaos[Facets]->bind();
|
vaos[Facets]->bind();
|
||||||
program = getShaderProgram(PROGRAM_PLANE_TWO_FACES);
|
program = getShaderProgram(PROGRAM_PLANE_TWO_FACES);
|
||||||
attrib_buffers(viewer, PROGRAM_PLANE_TWO_FACES);
|
attribBuffers(viewer, PROGRAM_PLANE_TWO_FACES);
|
||||||
QMatrix4x4 f_matrix;
|
QMatrix4x4 f_matrix;
|
||||||
for(int i=0; i<16; i++)
|
for(int i=0; i<16; i++)
|
||||||
f_matrix.data()[i] = (float)frame->matrix()[i];
|
f_matrix.data()[i] = (float)frame->matrix()[i];
|
||||||
|
|
@ -54,7 +54,7 @@ public:
|
||||||
void selection_changed(bool b){is_selected = b;}
|
void selection_changed(bool b){is_selected = b;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const
|
||||||
{
|
{
|
||||||
program = getShaderProgram(PROGRAM_PLANE_TWO_FACES, viewer);
|
program = getShaderProgram(PROGRAM_PLANE_TWO_FACES, viewer);
|
||||||
program->bind();
|
program->bind();
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ bool Scene_combinatorial_map_item::keyPressEvent(QKeyEvent* e){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_combinatorial_map_item::compute_elements(void) const{
|
void Scene_combinatorial_map_item::computeElements(void) const{
|
||||||
|
|
||||||
positions_facets.resize(0);
|
positions_facets.resize(0);
|
||||||
normals.resize(0);
|
normals.resize(0);
|
||||||
|
|
@ -339,7 +339,7 @@ void Scene_combinatorial_map_item::compute_elements(void) const{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_combinatorial_map_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer) const
|
void Scene_combinatorial_map_item::initializeBuffers(CGAL::Three::Viewer_interface *viewer) const
|
||||||
{
|
{
|
||||||
//vao for the edges
|
//vao for the edges
|
||||||
{
|
{
|
||||||
|
|
@ -473,12 +473,12 @@ void Scene_combinatorial_map_item::draw(CGAL::Three::Viewer_interface* viewer) c
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_elements();
|
computeElements();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
vaos[Facets]->bind();
|
vaos[Facets]->bind();
|
||||||
program=getShaderProgram(PROGRAM_WITH_LIGHT);
|
program=getShaderProgram(PROGRAM_WITH_LIGHT);
|
||||||
attrib_buffers(viewer,PROGRAM_WITH_LIGHT);
|
attribBuffers(viewer,PROGRAM_WITH_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", this->color());
|
program->setAttributeValue("colors", this->color());
|
||||||
viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/3));
|
viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/3));
|
||||||
|
|
@ -486,16 +486,16 @@ void Scene_combinatorial_map_item::draw(CGAL::Three::Viewer_interface* viewer) c
|
||||||
program->release();
|
program->release();
|
||||||
|
|
||||||
}
|
}
|
||||||
void Scene_combinatorial_map_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const
|
void Scene_combinatorial_map_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_elements();
|
computeElements();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
vaos[Edges]->bind();
|
vaos[Edges]->bind();
|
||||||
program=getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
program=getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
attrib_buffers(viewer,PROGRAM_WITHOUT_LIGHT);
|
attribBuffers(viewer,PROGRAM_WITHOUT_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", this->color());
|
program->setAttributeValue("colors", this->color());
|
||||||
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(nb_lines/3));
|
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(nb_lines/3));
|
||||||
|
|
@ -503,16 +503,16 @@ void Scene_combinatorial_map_item::draw(CGAL::Three::Viewer_interface* viewer) c
|
||||||
program->release();
|
program->release();
|
||||||
|
|
||||||
}
|
}
|
||||||
void Scene_combinatorial_map_item::draw_points(CGAL::Three::Viewer_interface* viewer) const
|
void Scene_combinatorial_map_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_elements();
|
computeElements();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
vaos[Points]->bind();
|
vaos[Points]->bind();
|
||||||
program=getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
program=getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
attrib_buffers(viewer,PROGRAM_WITHOUT_LIGHT);
|
attribBuffers(viewer,PROGRAM_WITHOUT_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", this->color());
|
program->setAttributeValue("colors", this->color());
|
||||||
viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_points/3));
|
viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_points/3));
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@ public:
|
||||||
//Event handling
|
//Event handling
|
||||||
virtual bool keyPressEvent(QKeyEvent*);
|
virtual bool keyPressEvent(QKeyEvent*);
|
||||||
//drawing of the scene
|
//drawing of the scene
|
||||||
virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const;
|
virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
|
||||||
virtual void draw_points(CGAL::Three::Viewer_interface*) const;
|
virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
|
||||||
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
||||||
|
|
||||||
bool isFinite() const { return true; }
|
bool isFinite() const { return true; }
|
||||||
|
|
@ -98,11 +98,11 @@ private:
|
||||||
|
|
||||||
mutable QOpenGLShaderProgram *program;
|
mutable QOpenGLShaderProgram *program;
|
||||||
|
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
|
||||||
|
|
||||||
using CGAL::Three::Scene_item::compute_elements;
|
using CGAL::Three::Scene_item::computeElements;
|
||||||
void compute_elements(void) const;
|
void computeElements(void) const;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void set_next_volume();
|
void set_next_volume();
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ Scene_polyhedron_transform_item::Scene_polyhedron_transform_item(const qglviewer
|
||||||
invalidateOpenGLBuffers();
|
invalidateOpenGLBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_polyhedron_transform_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer =0) const
|
void Scene_polyhedron_transform_item::initializeBuffers(CGAL::Three::Viewer_interface *viewer =0) const
|
||||||
{
|
{
|
||||||
//vao for the edges
|
//vao for the edges
|
||||||
{
|
{
|
||||||
|
|
@ -42,7 +42,7 @@ void Scene_polyhedron_transform_item::initialize_buffers(CGAL::Three::Viewer_int
|
||||||
are_buffers_filled = true;
|
are_buffers_filled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_polyhedron_transform_item::compute_elements() const
|
void Scene_polyhedron_transform_item::computeElements() const
|
||||||
{
|
{
|
||||||
positions_lines.resize(0);
|
positions_lines.resize(0);
|
||||||
typedef Kernel::Point_3 Point;
|
typedef Kernel::Point_3 Point;
|
||||||
|
|
@ -66,13 +66,13 @@ void Scene_polyhedron_transform_item::compute_elements() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_polyhedron_transform_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const
|
void Scene_polyhedron_transform_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
vaos[Edges]->bind();
|
vaos[Edges]->bind();
|
||||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
attrib_buffers(viewer,PROGRAM_WITHOUT_LIGHT);
|
attribBuffers(viewer,PROGRAM_WITHOUT_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
QMatrix4x4 f_matrix;
|
QMatrix4x4 f_matrix;
|
||||||
for (int i=0; i<16; ++i){
|
for (int i=0; i<16; ++i){
|
||||||
|
|
@ -118,7 +118,7 @@ Scene_polyhedron_transform_item::compute_bbox() const {
|
||||||
|
|
||||||
void Scene_polyhedron_transform_item::invalidateOpenGLBuffers()
|
void Scene_polyhedron_transform_item::invalidateOpenGLBuffers()
|
||||||
{
|
{
|
||||||
compute_elements();
|
computeElements();
|
||||||
are_buffers_filled = false;
|
are_buffers_filled = false;
|
||||||
compute_bbox();
|
compute_bbox();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ public:
|
||||||
Scene_polyhedron_transform_item(const qglviewer::Vec& pos,const Scene_polyhedron_item* poly_item,const CGAL::Three::Scene_interface* scene_interface);
|
Scene_polyhedron_transform_item(const qglviewer::Vec& pos,const Scene_polyhedron_item* poly_item,const CGAL::Three::Scene_interface* scene_interface);
|
||||||
Scene_item* clone() const{return NULL;}
|
Scene_item* clone() const{return NULL;}
|
||||||
QString toolTip() const;
|
QString toolTip() const;
|
||||||
void draw_edges(CGAL::Three::Viewer_interface*) const;
|
void drawEdges(CGAL::Three::Viewer_interface*) const;
|
||||||
void compute_bbox() const;
|
void compute_bbox() const;
|
||||||
~Scene_polyhedron_transform_item() {delete frame; Q_EMIT killed();}
|
~Scene_polyhedron_transform_item() {delete frame; Q_EMIT killed();}
|
||||||
bool manipulatable() const { return manipulable; }
|
bool manipulatable() const { return manipulable; }
|
||||||
|
|
@ -49,9 +49,9 @@ private:
|
||||||
mutable QOpenGLShaderProgram *program;
|
mutable QOpenGLShaderProgram *program;
|
||||||
mutable std::vector<float> positions_lines;
|
mutable std::vector<float> positions_lines;
|
||||||
mutable std::size_t nb_lines;
|
mutable std::size_t nb_lines;
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
|
||||||
void compute_elements() const;
|
void computeElements() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void stop();
|
void stop();
|
||||||
|
|
|
||||||
|
|
@ -47,13 +47,13 @@ public:
|
||||||
return (m == Wireframe);
|
return (m == Wireframe);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_edges(CGAL::Three::Viewer_interface* viewer) const
|
void drawEdges(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
vaos[0]->bind();
|
vaos[0]->bind();
|
||||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", this->color());
|
program->setAttributeValue("colors", this->color());
|
||||||
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/3));
|
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/3));
|
||||||
|
|
@ -64,7 +64,7 @@ public:
|
||||||
|
|
||||||
void invalidateOpenGLBuffers()
|
void invalidateOpenGLBuffers()
|
||||||
{
|
{
|
||||||
compute_elements();
|
computeElements();
|
||||||
are_buffers_filled = false;
|
are_buffers_filled = false;
|
||||||
compute_bbox();
|
compute_bbox();
|
||||||
}
|
}
|
||||||
|
|
@ -73,8 +73,8 @@ private:
|
||||||
|
|
||||||
mutable std::vector<float> positions_lines;
|
mutable std::vector<float> positions_lines;
|
||||||
mutable QOpenGLShaderProgram *program;
|
mutable QOpenGLShaderProgram *program;
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer)const
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer)const
|
||||||
{
|
{
|
||||||
|
|
||||||
//vao containing the data for the lines
|
//vao containing the data for the lines
|
||||||
|
|
@ -97,7 +97,7 @@ private:
|
||||||
are_buffers_filled = true;
|
are_buffers_filled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void compute_elements() const
|
void computeElements() const
|
||||||
{
|
{
|
||||||
positions_lines.clear();
|
positions_lines.clear();
|
||||||
const Bbox& bb = scene->bbox();
|
const Bbox& bb = scene->bbox();
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ public:
|
||||||
dock_widget->setVisible(false);
|
dock_widget->setVisible(false);
|
||||||
|
|
||||||
ui_widget.setupUi(dock_widget);
|
ui_widget.setupUi(dock_widget);
|
||||||
add_dock_widget(dock_widget);
|
addDockWidget(dock_widget);
|
||||||
|
|
||||||
connect(ui_widget.Fair_button, SIGNAL(clicked()), this, SLOT(on_Fair_button_clicked()));
|
connect(ui_widget.Fair_button, SIGNAL(clicked()), this, SLOT(on_Fair_button_clicked()));
|
||||||
connect(ui_widget.Refine_button, SIGNAL(clicked()), this, SLOT(on_Refine_button_clicked()));
|
connect(ui_widget.Refine_button, SIGNAL(clicked()), this, SLOT(on_Refine_button_clicked()));
|
||||||
|
|
@ -73,7 +73,7 @@ public Q_SLOTS:
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_Fair_button_clicked() {
|
void on_Fair_button_clicked() {
|
||||||
Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
|
Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
|
||||||
if(!selection_item) { return; }
|
if(!selection_item) { return; }
|
||||||
|
|
||||||
if(selection_item->selected_vertices.empty()) {
|
if(selection_item->selected_vertices.empty()) {
|
||||||
|
|
@ -98,7 +98,7 @@ public Q_SLOTS:
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_Refine_button_clicked() {
|
void on_Refine_button_clicked() {
|
||||||
Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
|
Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
|
||||||
if(!selection_item) { return; }
|
if(!selection_item) { return; }
|
||||||
|
|
||||||
if(selection_item->selected_facets.empty()) {
|
if(selection_item->selected_facets.empty()) {
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ public:
|
||||||
return (m == Wireframe);
|
return (m == Wireframe);
|
||||||
}
|
}
|
||||||
void draw() const {}
|
void draw() const {}
|
||||||
void draw_edges(CGAL::Three::Viewer_interface* viewer) const {
|
void drawEdges(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
|
|
||||||
for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it) {
|
for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it) {
|
||||||
if(it == active_hole) { viewer->glLineWidth(7.f); }
|
if(it == active_hole) { viewer->glLineWidth(7.f); }
|
||||||
|
|
@ -109,7 +109,7 @@ public:
|
||||||
else
|
else
|
||||||
{ it->polyline->setRbgColor(0, 0, 255); }
|
{ it->polyline->setRbgColor(0, 0, 255); }
|
||||||
|
|
||||||
it->polyline->draw_edges(viewer);
|
it->polyline->drawEdges(viewer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -411,7 +411,7 @@ void Polyhedron_demo_hole_filling_plugin::init(QMainWindow* mainWindow,
|
||||||
ui_widget.Accept_button->setVisible(false);
|
ui_widget.Accept_button->setVisible(false);
|
||||||
ui_widget.Reject_button->setVisible(false);
|
ui_widget.Reject_button->setVisible(false);
|
||||||
|
|
||||||
add_dock_widget(dock_widget);
|
addDockWidget(dock_widget);
|
||||||
|
|
||||||
connect(ui_widget.Visualize_holes_button, SIGNAL(clicked()), this, SLOT(on_Visualize_holes_button()));
|
connect(ui_widget.Visualize_holes_button, SIGNAL(clicked()), this, SLOT(on_Visualize_holes_button()));
|
||||||
connect(ui_widget.Fill_selected_holes_button, SIGNAL(clicked()), this, SLOT(on_Fill_selected_holes_button()));
|
connect(ui_widget.Fill_selected_holes_button, SIGNAL(clicked()), this, SLOT(on_Fill_selected_holes_button()));
|
||||||
|
|
@ -460,7 +460,7 @@ void Polyhedron_demo_hole_filling_plugin::dock_widget_closed() {
|
||||||
}
|
}
|
||||||
// creates a Scene_hole_visualizer and associate it with active Scene_polyhedron_item
|
// creates a Scene_hole_visualizer and associate it with active Scene_polyhedron_item
|
||||||
void Polyhedron_demo_hole_filling_plugin::on_Visualize_holes_button() {
|
void Polyhedron_demo_hole_filling_plugin::on_Visualize_holes_button() {
|
||||||
Scene_polyhedron_item* poly_item = get_selected_item<Scene_polyhedron_item>();
|
Scene_polyhedron_item* poly_item = getSelectedItem<Scene_polyhedron_item>();
|
||||||
if(!poly_item) {
|
if(!poly_item) {
|
||||||
print_message("Error: please select a polyhedron item from Geometric Objects list!");
|
print_message("Error: please select a polyhedron item from Geometric Objects list!");
|
||||||
return;
|
return;
|
||||||
|
|
@ -491,7 +491,7 @@ void Polyhedron_demo_hole_filling_plugin::on_Visualize_holes_button() {
|
||||||
// fills selected holes on active Scene_hole_visualizer
|
// fills selected holes on active Scene_hole_visualizer
|
||||||
void Polyhedron_demo_hole_filling_plugin::on_Fill_selected_holes_button() {
|
void Polyhedron_demo_hole_filling_plugin::on_Fill_selected_holes_button() {
|
||||||
// get active polylines item
|
// get active polylines item
|
||||||
Scene_hole_visualizer* hole_visualizer = get_selected_item<Scene_hole_visualizer>();
|
Scene_hole_visualizer* hole_visualizer = getSelectedItem<Scene_hole_visualizer>();
|
||||||
if(!hole_visualizer) {
|
if(!hole_visualizer) {
|
||||||
print_message(no_selected_hole_visualizer_error_message());
|
print_message(no_selected_hole_visualizer_error_message());
|
||||||
return;
|
return;
|
||||||
|
|
@ -522,7 +522,7 @@ void Polyhedron_demo_hole_filling_plugin::on_Fill_selected_holes_button() {
|
||||||
|
|
||||||
// fills all holes and removes associated Scene_hole_visualizer if any
|
// fills all holes and removes associated Scene_hole_visualizer if any
|
||||||
void Polyhedron_demo_hole_filling_plugin::on_Select_all_holes_button() {
|
void Polyhedron_demo_hole_filling_plugin::on_Select_all_holes_button() {
|
||||||
Scene_hole_visualizer* hole_visualizer = get_selected_item<Scene_hole_visualizer>();
|
Scene_hole_visualizer* hole_visualizer = getSelectedItem<Scene_hole_visualizer>();
|
||||||
if(!hole_visualizer) {
|
if(!hole_visualizer) {
|
||||||
print_message(no_selected_hole_visualizer_error_message());
|
print_message(no_selected_hole_visualizer_error_message());
|
||||||
return;
|
return;
|
||||||
|
|
@ -531,7 +531,7 @@ void Polyhedron_demo_hole_filling_plugin::on_Select_all_holes_button() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Polyhedron_demo_hole_filling_plugin::on_Select_small_holes_button() {
|
void Polyhedron_demo_hole_filling_plugin::on_Select_small_holes_button() {
|
||||||
Scene_hole_visualizer* hole_visualizer = get_selected_item<Scene_hole_visualizer>();
|
Scene_hole_visualizer* hole_visualizer = getSelectedItem<Scene_hole_visualizer>();
|
||||||
if(!hole_visualizer) {
|
if(!hole_visualizer) {
|
||||||
print_message(no_selected_hole_visualizer_error_message());
|
print_message(no_selected_hole_visualizer_error_message());
|
||||||
return;
|
return;
|
||||||
|
|
@ -549,7 +549,7 @@ void Polyhedron_demo_hole_filling_plugin::on_Select_small_holes_button() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Polyhedron_demo_hole_filling_plugin::on_Deselect_all_holes_button() {
|
void Polyhedron_demo_hole_filling_plugin::on_Deselect_all_holes_button() {
|
||||||
Scene_hole_visualizer* hole_visualizer = get_selected_item<Scene_hole_visualizer>();
|
Scene_hole_visualizer* hole_visualizer = getSelectedItem<Scene_hole_visualizer>();
|
||||||
if(!hole_visualizer) {
|
if(!hole_visualizer) {
|
||||||
print_message(no_selected_hole_visualizer_error_message());
|
print_message(no_selected_hole_visualizer_error_message());
|
||||||
return;
|
return;
|
||||||
|
|
@ -559,7 +559,7 @@ void Polyhedron_demo_hole_filling_plugin::on_Deselect_all_holes_button() {
|
||||||
|
|
||||||
// Simply create polyline items and put them into scene - nothing related with other parts of the plugin
|
// Simply create polyline items and put them into scene - nothing related with other parts of the plugin
|
||||||
void Polyhedron_demo_hole_filling_plugin::on_Create_polyline_items_button(){
|
void Polyhedron_demo_hole_filling_plugin::on_Create_polyline_items_button(){
|
||||||
Scene_hole_visualizer* hole_visualizer = get_selected_item<Scene_hole_visualizer>();
|
Scene_hole_visualizer* hole_visualizer = getSelectedItem<Scene_hole_visualizer>();
|
||||||
if(!hole_visualizer) {
|
if(!hole_visualizer) {
|
||||||
print_message(no_selected_hole_visualizer_error_message());
|
print_message(no_selected_hole_visualizer_error_message());
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ public:
|
||||||
| QDockWidget::DockWidgetFloatable
|
| QDockWidget::DockWidgetFloatable
|
||||||
| QDockWidget::DockWidgetClosable);
|
| QDockWidget::DockWidgetClosable);
|
||||||
dockWidget->setWindowTitle("Mean Curvature Flow Skeleton");
|
dockWidget->setWindowTitle("Mean Curvature Flow Skeleton");
|
||||||
add_dock_widget(dockWidget);
|
addDockWidget(dockWidget);
|
||||||
|
|
||||||
connect(ui->pushButton_contract, SIGNAL(clicked()),
|
connect(ui->pushButton_contract, SIGNAL(clicked()),
|
||||||
this, SLOT(on_actionContract()));
|
this, SLOT(on_actionContract()));
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ public:
|
||||||
dock_widget->setVisible(false);
|
dock_widget->setVisible(false);
|
||||||
ui_widget.setupUi(dock_widget);
|
ui_widget.setupUi(dock_widget);
|
||||||
|
|
||||||
add_dock_widget(dock_widget);
|
addDockWidget(dock_widget);
|
||||||
|
|
||||||
connect(ui_widget.Select_button, SIGNAL(clicked()), this, SLOT(on_Select_button()));
|
connect(ui_widget.Select_button, SIGNAL(clicked()), this, SLOT(on_Select_button()));
|
||||||
connect(ui_widget.Sample_random_points_from_bbox, SIGNAL(clicked()), this, SLOT(on_Sample_random_points_from_bbox()));
|
connect(ui_widget.Sample_random_points_from_bbox, SIGNAL(clicked()), this, SLOT(on_Sample_random_points_from_bbox()));
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ void Polyhedron_demo_polyhedron_slicer_plugin::init(QMainWindow* mainWindow,
|
||||||
dock_widget->installEventFilter(this);
|
dock_widget->installEventFilter(this);
|
||||||
ui_widget.setupUi(dock_widget);
|
ui_widget.setupUi(dock_widget);
|
||||||
|
|
||||||
add_dock_widget(dock_widget);
|
addDockWidget(dock_widget);
|
||||||
|
|
||||||
connect(ui_widget.Generate_button, SIGNAL(clicked()), this, SLOT(on_Generate_button_clicked()));
|
connect(ui_widget.Generate_button, SIGNAL(clicked()), this, SLOT(on_Generate_button_clicked()));
|
||||||
connect(ui_widget.Update_plane_button, SIGNAL(clicked()), this, SLOT(on_Update_plane_button_clicked()));
|
connect(ui_widget.Update_plane_button, SIGNAL(clicked()), this, SLOT(on_Update_plane_button_clicked()));
|
||||||
|
|
@ -213,7 +213,7 @@ bool Polyhedron_demo_polyhedron_slicer_plugin::on_Update_plane_button_clicked()
|
||||||
// generate multiple cuts, until any cut does not intersect with bbox
|
// generate multiple cuts, until any cut does not intersect with bbox
|
||||||
void Polyhedron_demo_polyhedron_slicer_plugin::on_Generate_button_clicked()
|
void Polyhedron_demo_polyhedron_slicer_plugin::on_Generate_button_clicked()
|
||||||
{
|
{
|
||||||
Scene_polyhedron_item* item = get_selected_item<Scene_polyhedron_item>();
|
Scene_polyhedron_item* item = getSelectedItem<Scene_polyhedron_item>();
|
||||||
if(!item) {
|
if(!item) {
|
||||||
print_message("Error: There is no selected Scene_polyhedron_item!");
|
print_message("Error: There is no selected Scene_polyhedron_item!");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ public:
|
||||||
dock_widget->setVisible(false);
|
dock_widget->setVisible(false);
|
||||||
|
|
||||||
ui_widget.setupUi(dock_widget);
|
ui_widget.setupUi(dock_widget);
|
||||||
add_dock_widget(dock_widget);
|
addDockWidget(dock_widget);
|
||||||
|
|
||||||
connect(ui_widget.Select_all_button, SIGNAL(clicked()), this, SLOT(on_Select_all_button_clicked()));
|
connect(ui_widget.Select_all_button, SIGNAL(clicked()), this, SLOT(on_Select_all_button_clicked()));
|
||||||
connect(ui_widget.Clear_button, SIGNAL(clicked()), this, SLOT(on_Clear_button_clicked()));
|
connect(ui_widget.Clear_button, SIGNAL(clicked()), this, SLOT(on_Clear_button_clicked()));
|
||||||
|
|
@ -117,7 +117,7 @@ public Q_SLOTS:
|
||||||
dock_widget->show();
|
dock_widget->show();
|
||||||
dock_widget->raise();
|
dock_widget->raise();
|
||||||
if(scene->numberOfEntries() < 2) {
|
if(scene->numberOfEntries() < 2) {
|
||||||
Scene_polyhedron_item* poly_item = get_selected_item<Scene_polyhedron_item>();
|
Scene_polyhedron_item* poly_item = getSelectedItem<Scene_polyhedron_item>();
|
||||||
if(!poly_item || selection_item_map.find(poly_item) != selection_item_map.end()) { return; }
|
if(!poly_item || selection_item_map.find(poly_item) != selection_item_map.end()) { return; }
|
||||||
Scene_polyhedron_selection_item* new_item = new Scene_polyhedron_selection_item(poly_item, mw);
|
Scene_polyhedron_selection_item* new_item = new Scene_polyhedron_selection_item(poly_item, mw);
|
||||||
int item_id = scene->addItem(new_item);
|
int item_id = scene->addItem(new_item);
|
||||||
|
|
@ -129,7 +129,7 @@ public Q_SLOTS:
|
||||||
}
|
}
|
||||||
// Select all
|
// Select all
|
||||||
void on_Select_all_button_clicked() {
|
void on_Select_all_button_clicked() {
|
||||||
Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
|
Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
|
||||||
if(!selection_item) {
|
if(!selection_item) {
|
||||||
print_message("Error: there is no selected polyhedron selection item!");
|
print_message("Error: there is no selected polyhedron selection item!");
|
||||||
return;
|
return;
|
||||||
|
|
@ -139,7 +139,7 @@ public Q_SLOTS:
|
||||||
}
|
}
|
||||||
// Clear selection
|
// Clear selection
|
||||||
void on_Clear_button_clicked() {
|
void on_Clear_button_clicked() {
|
||||||
Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
|
Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
|
||||||
if(!selection_item) {
|
if(!selection_item) {
|
||||||
print_message("Error: there is no selected polyhedron selection item!");
|
print_message("Error: there is no selected polyhedron selection item!");
|
||||||
return;
|
return;
|
||||||
|
|
@ -167,7 +167,7 @@ public Q_SLOTS:
|
||||||
}
|
}
|
||||||
// Isolated component related functions
|
// Isolated component related functions
|
||||||
void on_Select_isolated_components_button_clicked() {
|
void on_Select_isolated_components_button_clicked() {
|
||||||
Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
|
Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
|
||||||
if(!selection_item) {
|
if(!selection_item) {
|
||||||
print_message("Error: there is no selected polyhedron selection item!");
|
print_message("Error: there is no selected polyhedron selection item!");
|
||||||
return;
|
return;
|
||||||
|
|
@ -180,7 +180,7 @@ public Q_SLOTS:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void on_Get_minimum_button_clicked() {
|
void on_Get_minimum_button_clicked() {
|
||||||
Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
|
Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
|
||||||
if(!selection_item) {
|
if(!selection_item) {
|
||||||
print_message("Error: there is no selected polyhedron selection item!");
|
print_message("Error: there is no selected polyhedron selection item!");
|
||||||
return;
|
return;
|
||||||
|
|
@ -192,7 +192,7 @@ public Q_SLOTS:
|
||||||
}
|
}
|
||||||
// Create selection item for selected polyhedron item
|
// Create selection item for selected polyhedron item
|
||||||
void on_Create_selection_item_button_clicked() {
|
void on_Create_selection_item_button_clicked() {
|
||||||
Scene_polyhedron_item* poly_item = get_selected_item<Scene_polyhedron_item>();
|
Scene_polyhedron_item* poly_item = getSelectedItem<Scene_polyhedron_item>();
|
||||||
if(!poly_item) {
|
if(!poly_item) {
|
||||||
print_message("Error: there is no selected polyhedron item!");
|
print_message("Error: there is no selected polyhedron item!");
|
||||||
return;
|
return;
|
||||||
|
|
@ -224,7 +224,7 @@ public Q_SLOTS:
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_Create_point_set_item_button_clicked() {
|
void on_Create_point_set_item_button_clicked() {
|
||||||
Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
|
Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
|
||||||
if(!selection_item) {
|
if(!selection_item) {
|
||||||
print_message("Error: there is no selected polyhedron selection item!");
|
print_message("Error: there is no selected polyhedron selection item!");
|
||||||
return;
|
return;
|
||||||
|
|
@ -244,7 +244,7 @@ public Q_SLOTS:
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_Create_polyline_item_button_clicked(){
|
void on_Create_polyline_item_button_clicked(){
|
||||||
Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
|
Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
|
||||||
if(!selection_item) {
|
if(!selection_item) {
|
||||||
print_message("Error: there is no selected polyhedron selection item!");
|
print_message("Error: there is no selected polyhedron selection item!");
|
||||||
return;
|
return;
|
||||||
|
|
@ -300,7 +300,7 @@ public Q_SLOTS:
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_Erase_selected_facets_button_clicked() {
|
void on_Erase_selected_facets_button_clicked() {
|
||||||
Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
|
Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
|
||||||
if(!selection_item) {
|
if(!selection_item) {
|
||||||
print_message("Error: there is no selected polyhedron selection item!");
|
print_message("Error: there is no selected polyhedron selection item!");
|
||||||
return;
|
return;
|
||||||
|
|
@ -309,7 +309,7 @@ public Q_SLOTS:
|
||||||
selection_item->erase_selected_facets();
|
selection_item->erase_selected_facets();
|
||||||
}
|
}
|
||||||
void on_Keep_connected_components_button_clicked() {
|
void on_Keep_connected_components_button_clicked() {
|
||||||
Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
|
Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
|
||||||
if (!selection_item) {
|
if (!selection_item) {
|
||||||
print_message("Error: there is no selected polyhedron selection item!");
|
print_message("Error: there is no selected polyhedron selection item!");
|
||||||
return;
|
return;
|
||||||
|
|
@ -317,7 +317,7 @@ public Q_SLOTS:
|
||||||
selection_item->keep_connected_components();
|
selection_item->keep_connected_components();
|
||||||
}
|
}
|
||||||
void on_Create_polyhedron_item_button_clicked() {
|
void on_Create_polyhedron_item_button_clicked() {
|
||||||
Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
|
Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
|
||||||
if(!selection_item) {
|
if(!selection_item) {
|
||||||
print_message("Error: there is no selected polyhedron selection item!");
|
print_message("Error: there is no selected polyhedron selection item!");
|
||||||
return;
|
return;
|
||||||
|
|
@ -337,7 +337,7 @@ public Q_SLOTS:
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_Select_sharp_edges_button_clicked() {
|
void on_Select_sharp_edges_button_clicked() {
|
||||||
Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
|
Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
|
||||||
if (!selection_item) {
|
if (!selection_item) {
|
||||||
print_message("Error: there is no selected polyhedron selection item!");
|
print_message("Error: there is no selected polyhedron selection item!");
|
||||||
return;
|
return;
|
||||||
|
|
@ -349,7 +349,7 @@ public Q_SLOTS:
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_Expand_reduce_button_clicked() {
|
void on_Expand_reduce_button_clicked() {
|
||||||
Scene_polyhedron_selection_item* selection_item = get_selected_item<Scene_polyhedron_selection_item>();
|
Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
|
||||||
if(!selection_item) {
|
if(!selection_item) {
|
||||||
print_message("Error: there is no selected polyhedron selection item!");
|
print_message("Error: there is no selected polyhedron selection item!");
|
||||||
return;
|
return;
|
||||||
|
|
@ -365,7 +365,7 @@ public Q_SLOTS:
|
||||||
qobject_cast<Scene_polyhedron_selection_item*>(scene->item(item_id));
|
qobject_cast<Scene_polyhedron_selection_item*>(scene->item(item_id));
|
||||||
if(!selection_item) { return; }
|
if(!selection_item) { return; }
|
||||||
|
|
||||||
Scene_polyhedron_item* poly_item = get_selected_item<Scene_polyhedron_item>();
|
Scene_polyhedron_item* poly_item = getSelectedItem<Scene_polyhedron_item>();
|
||||||
if(!poly_item) {
|
if(!poly_item) {
|
||||||
CGAL_assertion(selection_item->polyhedron_item() == NULL); // which means it is coming from selection_io loader
|
CGAL_assertion(selection_item->polyhedron_item() == NULL); // which means it is coming from selection_io loader
|
||||||
print_message("Error: please select corresponding polyhedron item from Geometric Objects list.");
|
print_message("Error: please select corresponding polyhedron item from Geometric Objects list.");
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ public:
|
||||||
return (m == Wireframe);
|
return (m == Wireframe);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_edges(CGAL::Three::Viewer_interface* viewer) const {
|
void drawEdges(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
viewer->glLineWidth(3.f);
|
viewer->glLineWidth(3.f);
|
||||||
polyline->setRbgColor(0, 255, 0);
|
polyline->setRbgColor(0, 255, 0);
|
||||||
polyline->draw_edges(viewer);
|
polyline->draw_edges(viewer);
|
||||||
|
|
@ -204,7 +204,7 @@ public:
|
||||||
dock_widget->setVisible(false);
|
dock_widget->setVisible(false);
|
||||||
|
|
||||||
ui_widget.setupUi(dock_widget);
|
ui_widget.setupUi(dock_widget);
|
||||||
add_dock_widget(dock_widget);
|
addDockWidget(dock_widget);
|
||||||
|
|
||||||
connect(ui_widget.Selection_tool_combo_box, SIGNAL(currentIndexChanged(int)),
|
connect(ui_widget.Selection_tool_combo_box, SIGNAL(currentIndexChanged(int)),
|
||||||
this, SLOT(on_Selection_tool_combo_box_changed(int)));
|
this, SLOT(on_Selection_tool_combo_box_changed(int)));
|
||||||
|
|
@ -312,7 +312,7 @@ protected:
|
||||||
|
|
||||||
void select_points()
|
void select_points()
|
||||||
{
|
{
|
||||||
Scene_points_with_normal_item* point_set_item = get_selected_item<Scene_points_with_normal_item>();
|
Scene_points_with_normal_item* point_set_item = getSelectedItem<Scene_points_with_normal_item>();
|
||||||
if(!point_set_item)
|
if(!point_set_item)
|
||||||
{
|
{
|
||||||
print_message("Error: no point set selected!");
|
print_message("Error: no point set selected!");
|
||||||
|
|
@ -405,7 +405,7 @@ public Q_SLOTS:
|
||||||
|
|
||||||
// Select all
|
// Select all
|
||||||
void on_Select_all_button_clicked() {
|
void on_Select_all_button_clicked() {
|
||||||
Scene_points_with_normal_item* point_set_item = get_selected_item<Scene_points_with_normal_item>();
|
Scene_points_with_normal_item* point_set_item = getSelectedItem<Scene_points_with_normal_item>();
|
||||||
if(!point_set_item)
|
if(!point_set_item)
|
||||||
{
|
{
|
||||||
print_message("Error: no point set selected!");
|
print_message("Error: no point set selected!");
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ Scene_polyhedron_shortest_path_item::~Scene_polyhedron_shortest_path_item()
|
||||||
deinitialize();
|
deinitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_polyhedron_shortest_path_item::compute_elements() const
|
void Scene_polyhedron_shortest_path_item::computeElements() const
|
||||||
{
|
{
|
||||||
|
|
||||||
vertices.resize(0);
|
vertices.resize(0);
|
||||||
|
|
@ -48,7 +48,7 @@ void Scene_polyhedron_shortest_path_item::compute_elements() const
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_polyhedron_shortest_path_item::initialize_buffers(CGAL::Three::Viewer_interface* viewer)const
|
void Scene_polyhedron_shortest_path_item::initializeBuffers(CGAL::Three::Viewer_interface* viewer)const
|
||||||
{
|
{
|
||||||
//vao containing the data for the selected lines
|
//vao containing the data for the selected lines
|
||||||
{
|
{
|
||||||
|
|
@ -89,20 +89,20 @@ void Scene_polyhedron_shortest_path_item::draw(CGAL::Three::Viewer_interface* vi
|
||||||
{
|
{
|
||||||
if (supportsRenderingMode(renderingMode()))
|
if (supportsRenderingMode(renderingMode()))
|
||||||
{
|
{
|
||||||
draw_points(viewer);
|
drawPoints(viewer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Scene_polyhedron_shortest_path_item::draw_points(CGAL::Three::Viewer_interface* viewer) const
|
void Scene_polyhedron_shortest_path_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
glPointSize(4.0f);
|
glPointSize(4.0f);
|
||||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
||||||
vaos[Selected_Edges]->bind();
|
vaos[Selected_Edges]->bind();
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", QColor(Qt::green));
|
program->setAttributeValue("colors", QColor(Qt::green));
|
||||||
|
|
@ -183,7 +183,7 @@ void Scene_polyhedron_shortest_path_item::poly_item_changed()
|
||||||
|
|
||||||
void Scene_polyhedron_shortest_path_item::invalidateOpenGLBuffers()
|
void Scene_polyhedron_shortest_path_item::invalidateOpenGLBuffers()
|
||||||
{
|
{
|
||||||
compute_elements();
|
computeElements();
|
||||||
compute_bbox();
|
compute_bbox();
|
||||||
are_buffers_filled = false;
|
are_buffers_filled = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,9 +111,9 @@ private:
|
||||||
mutable std::vector<float> vertices;
|
mutable std::vector<float> vertices;
|
||||||
mutable QOpenGLShaderProgram *program;
|
mutable QOpenGLShaderProgram *program;
|
||||||
|
|
||||||
using Scene_polyhedron_item_decorator::initialize_buffers;
|
using Scene_polyhedron_item_decorator::initializeBuffers;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const;
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer = 0) const;
|
||||||
void compute_elements(void) const;
|
void computeElements(void) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -131,7 +131,7 @@ public:
|
||||||
using Scene_polyhedron_item_decorator::draw;
|
using Scene_polyhedron_item_decorator::draw;
|
||||||
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
||||||
// Points OpenGL drawing
|
// Points OpenGL drawing
|
||||||
virtual void draw_points(CGAL::Three::Viewer_interface*) const;
|
virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
|
||||||
|
|
||||||
virtual Scene_polyhedron_shortest_path_item* clone() const;
|
virtual Scene_polyhedron_shortest_path_item* clone() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ public:
|
||||||
dock_widget->setVisible(false);
|
dock_widget->setVisible(false);
|
||||||
|
|
||||||
ui_widget.setupUi(dock_widget);
|
ui_widget.setupUi(dock_widget);
|
||||||
add_dock_widget(dock_widget);
|
addDockWidget(dock_widget);
|
||||||
|
|
||||||
connect(ui_widget.Selection_type_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(on_Selection_type_combo_box_changed(int)));
|
connect(ui_widget.Selection_type_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(on_Selection_type_combo_box_changed(int)));
|
||||||
connect(ui_widget.Primitives_type_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(on_Primitives_type_combo_box_changed(int)));
|
connect(ui_widget.Primitives_type_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(on_Primitives_type_combo_box_changed(int)));
|
||||||
|
|
@ -180,7 +180,7 @@ void Polyhedron_demo_shortest_path_plugin::new_item(int itemIndex)
|
||||||
|
|
||||||
if(item->polyhedron_item() == NULL)
|
if(item->polyhedron_item() == NULL)
|
||||||
{
|
{
|
||||||
Scene_polyhedron_item* polyhedronItem = get_selected_item<Scene_polyhedron_item>();
|
Scene_polyhedron_item* polyhedronItem = getSelectedItem<Scene_polyhedron_item>();
|
||||||
|
|
||||||
if(!polyhedronItem)
|
if(!polyhedronItem)
|
||||||
{
|
{
|
||||||
|
|
@ -224,7 +224,7 @@ void Polyhedron_demo_shortest_path_plugin::new_item(int itemIndex)
|
||||||
|
|
||||||
void Polyhedron_demo_shortest_path_plugin::on_actionMakeShortestPaths_triggered()
|
void Polyhedron_demo_shortest_path_plugin::on_actionMakeShortestPaths_triggered()
|
||||||
{
|
{
|
||||||
Scene_polyhedron_item* polyhedronItem = get_selected_item<Scene_polyhedron_item>();
|
Scene_polyhedron_item* polyhedronItem = getSelectedItem<Scene_polyhedron_item>();
|
||||||
if (polyhedronItem)
|
if (polyhedronItem)
|
||||||
{
|
{
|
||||||
if (m_shortestPathsMap.find(polyhedronItem) == m_shortestPathsMap.end())
|
if (m_shortestPathsMap.find(polyhedronItem) == m_shortestPathsMap.end())
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ Scene_edit_polyhedron_item::~Scene_edit_polyhedron_item()
|
||||||
}
|
}
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
/// For the Shader gestion///
|
/// For the Shader gestion///
|
||||||
void Scene_edit_polyhedron_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer =0) const
|
void Scene_edit_polyhedron_item::initializeBuffers(CGAL::Three::Viewer_interface *viewer =0) const
|
||||||
{
|
{
|
||||||
//vao for the facets
|
//vao for the facets
|
||||||
{
|
{
|
||||||
|
|
@ -580,12 +580,12 @@ bool Scene_edit_polyhedron_item::eventFilter(QObject* /*target*/, QEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "opengl_tools.h"
|
#include "opengl_tools.h"
|
||||||
void Scene_edit_polyhedron_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
|
void Scene_edit_polyhedron_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
vaos[Edges]->bind();
|
vaos[Edges]->bind();
|
||||||
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
attrib_buffers(viewer,PROGRAM_NO_SELECTION);
|
attribBuffers(viewer,PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", QColor(0,0,0));
|
program->setAttributeValue("colors", QColor(0,0,0));
|
||||||
viewer->glDrawElements(GL_LINES, (GLsizei) edges.size(), GL_UNSIGNED_INT, edges.data());
|
viewer->glDrawElements(GL_LINES, (GLsizei) edges.size(), GL_UNSIGNED_INT, edges.data());
|
||||||
|
|
@ -595,7 +595,7 @@ void Scene_edit_polyhedron_item::draw_edges(CGAL::Three::Viewer_interface* viewe
|
||||||
|
|
||||||
vaos[Frame_plane]->bind();
|
vaos[Frame_plane]->bind();
|
||||||
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
attrib_buffers(viewer,PROGRAM_NO_SELECTION);
|
attribBuffers(viewer,PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", QColor(0,0,0));
|
program->setAttributeValue("colors", QColor(0,0,0));
|
||||||
viewer->glDrawArrays(GL_LINE_LOOP, 0, (GLsizei)pos_frame_plane.size()/3);
|
viewer->glDrawArrays(GL_LINE_LOOP, 0, (GLsizei)pos_frame_plane.size()/3);
|
||||||
|
|
@ -609,17 +609,17 @@ void Scene_edit_polyhedron_item::draw_edges(CGAL::Three::Viewer_interface* viewe
|
||||||
}
|
}
|
||||||
void Scene_edit_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
void Scene_edit_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
vaos[Facets]->bind();
|
vaos[Facets]->bind();
|
||||||
program = getShaderProgram(PROGRAM_WITH_LIGHT);
|
program = getShaderProgram(PROGRAM_WITH_LIGHT);
|
||||||
attrib_buffers(viewer,PROGRAM_WITH_LIGHT);
|
attribBuffers(viewer,PROGRAM_WITH_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
QColor color = this->color();
|
QColor color = this->color();
|
||||||
program->setAttributeValue("colors", color);
|
program->setAttributeValue("colors", color);
|
||||||
viewer->glDrawElements(GL_TRIANGLES, (GLsizei) tris.size(), GL_UNSIGNED_INT, tris.data());
|
viewer->glDrawElements(GL_TRIANGLES, (GLsizei) tris.size(), GL_UNSIGNED_INT, tris.data());
|
||||||
program->release();
|
program->release();
|
||||||
vaos[Facets]->release();
|
vaos[Facets]->release();
|
||||||
draw_edges(viewer);
|
drawEdges(viewer);
|
||||||
draw_ROI_and_control_vertices(viewer);
|
draw_ROI_and_control_vertices(viewer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -661,7 +661,7 @@ void Scene_edit_polyhedron_item::draw_ROI_and_control_vertices(CGAL::Three::View
|
||||||
|
|
||||||
vaos[Roi_points]->bind();
|
vaos[Roi_points]->bind();
|
||||||
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
attrib_buffers(viewer,PROGRAM_NO_SELECTION);
|
attribBuffers(viewer,PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", QColor(0,255,0));
|
program->setAttributeValue("colors", QColor(0,255,0));
|
||||||
viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_ROI/3));
|
viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_ROI/3));
|
||||||
|
|
@ -676,13 +676,25 @@ void Scene_edit_polyhedron_item::draw_ROI_and_control_vertices(CGAL::Three::View
|
||||||
if(!ui_widget->ShowAsSphereCheckBox->isChecked() || !viewer->extension_is_found) {
|
if(!ui_widget->ShowAsSphereCheckBox->isChecked() || !viewer->extension_is_found) {
|
||||||
vaos[Control_points]->bind();
|
vaos[Control_points]->bind();
|
||||||
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
attrib_buffers(viewer,PROGRAM_NO_SELECTION);
|
attribBuffers(viewer,PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", QColor(255,0,0));
|
program->setAttributeValue("colors", QColor(255,0,0));
|
||||||
viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_control/3));
|
viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_control/3));
|
||||||
program->release();
|
program->release();
|
||||||
vaos[Control_points]->release();
|
vaos[Control_points]->release();
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
vaos[Control_spheres]->bind();
|
||||||
|
program = getShaderProgram(PROGRAM_INSTANCED);
|
||||||
|
attribBuffers(viewer,PROGRAM_INSTANCED);
|
||||||
|
program->bind();
|
||||||
|
program->setAttributeValue("colors", QColor(255,0,0));
|
||||||
|
viewer->glDrawArraysInstanced(GL_TRIANGLES, 0,
|
||||||
|
static_cast<GLsizei>(nb_sphere/3),
|
||||||
|
static_cast<GLsizei>(nb_control/3));
|
||||||
|
program->release();
|
||||||
|
vaos[Control_spheres]->release();
|
||||||
|
}
|
||||||
|
|
||||||
QGLViewer* viewerB = *QGLViewer::QGLViewerPool().begin();
|
QGLViewer* viewerB = *QGLViewer::QGLViewerPool().begin();
|
||||||
for(Ctrl_vertices_group_data_list::const_iterator hgb_data = ctrl_vertex_frame_map.begin(); hgb_data != ctrl_vertex_frame_map.end(); ++hgb_data)
|
for(Ctrl_vertices_group_data_list::const_iterator hgb_data = ctrl_vertex_frame_map.begin(); hgb_data != ctrl_vertex_frame_map.end(); ++hgb_data)
|
||||||
|
|
@ -697,7 +709,7 @@ void Scene_edit_polyhedron_item::draw_ROI_and_control_vertices(CGAL::Three::View
|
||||||
f_mat.data()[i] = (float)f_matrix[i];
|
f_mat.data()[i] = (float)f_matrix[i];
|
||||||
vaos[Axis]->bind();
|
vaos[Axis]->bind();
|
||||||
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
attrib_buffers(viewer, PROGRAM_NO_SELECTION);
|
attribBuffers(viewer, PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setUniformValue("f_matrix", f_mat);
|
program->setUniformValue("f_matrix", f_mat);
|
||||||
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(nb_axis/3));
|
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(nb_axis/3));
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ public:
|
||||||
// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
|
// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
|
||||||
void draw() const{}
|
void draw() const{}
|
||||||
void draw(CGAL::Three::Viewer_interface*) const;
|
void draw(CGAL::Three::Viewer_interface*) const;
|
||||||
void draw_edges(CGAL::Three::Viewer_interface*) const;
|
void drawEdges(CGAL::Three::Viewer_interface*) const;
|
||||||
void draw_bbox(const CGAL::Three::Scene_interface::Bbox&) const;
|
void draw_bbox(const CGAL::Three::Scene_interface::Bbox&) const;
|
||||||
void draw_ROI_and_control_vertices(CGAL::Three::Viewer_interface *viewer) const;
|
void draw_ROI_and_control_vertices(CGAL::Three::Viewer_interface *viewer) const;
|
||||||
void draw_frame_plane(QGLViewer *) const;
|
void draw_frame_plane(QGLViewer *) const;
|
||||||
|
|
@ -342,8 +342,8 @@ private:
|
||||||
NumberOfVaos
|
NumberOfVaos
|
||||||
};
|
};
|
||||||
mutable QOpenGLBuffer *in_bu;
|
mutable QOpenGLBuffer *in_bu;
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
|
||||||
void compute_normals_and_vertices(void);
|
void compute_normals_and_vertices(void);
|
||||||
void compute_bbox(const CGAL::Three::Scene_interface::Bbox&);
|
void compute_bbox(const CGAL::Three::Scene_interface::Bbox&);
|
||||||
void reset_drawing_data();
|
void reset_drawing_data();
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ Polyhedron_demo::Polyhedron_demo(int& argc, char **argv,
|
||||||
}
|
}
|
||||||
QFileInfo autostart_js("autostart.js");
|
QFileInfo autostart_js("autostart.js");
|
||||||
if(!parser.isSet(no_autostart) && autostart_js.exists()) {
|
if(!parser.isSet(no_autostart) && autostart_js.exists()) {
|
||||||
mainWindow.load_script(autostart_js);
|
mainWindow.loadScript(autostart_js);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Q_FOREACH(QString filename, parser.positionalArguments()) {
|
Q_FOREACH(QString filename, parser.positionalArguments()) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
|
|
||||||
|
|
||||||
void CGAL::Three::Polyhedron_demo_plugin_helper::add_dock_widget(QDockWidget* dock_widget)
|
void CGAL::Three::Polyhedron_demo_plugin_helper::addDockWidget(QDockWidget* dock_widget)
|
||||||
{
|
{
|
||||||
mw->addDockWidget(::Qt::LeftDockWidgetArea, dock_widget);
|
mw->addDockWidget(::Qt::LeftDockWidgetArea, dock_widget);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -444,9 +444,9 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
|
||||||
|
|
||||||
|
|
||||||
if(viewer)
|
if(viewer)
|
||||||
item.draw_edges(viewer);
|
item.drawEdges(viewer);
|
||||||
else
|
else
|
||||||
item.draw_edges();
|
item.drawEdges();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if( item.renderingMode() == PointsPlusNormals ){
|
if( item.renderingMode() == PointsPlusNormals ){
|
||||||
|
|
@ -464,9 +464,9 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
|
||||||
item.selection_changed(false);
|
item.selection_changed(false);
|
||||||
}
|
}
|
||||||
if(viewer)
|
if(viewer)
|
||||||
item.draw_edges(viewer);
|
item.drawEdges(viewer);
|
||||||
else
|
else
|
||||||
item.draw_edges();
|
item.drawEdges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((item.renderingMode() == Wireframe || item.renderingMode() == PointsPlusNormals )
|
if((item.renderingMode() == Wireframe || item.renderingMode() == PointsPlusNormals )
|
||||||
|
|
@ -503,9 +503,9 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
|
||||||
viewer->glLineWidth(1.0f);
|
viewer->glLineWidth(1.0f);
|
||||||
|
|
||||||
if(viewer)
|
if(viewer)
|
||||||
item.draw_points(viewer);
|
item.drawPoints(viewer);
|
||||||
else
|
else
|
||||||
item.draw_points();
|
item.drawPoints();
|
||||||
}
|
}
|
||||||
if(item.renderingMode() == Points && with_names) {
|
if(item.renderingMode() == Points && with_names) {
|
||||||
// read depth buffer at pick location;
|
// read depth buffer at pick location;
|
||||||
|
|
@ -547,12 +547,10 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
|
||||||
{ CGAL::Three::Scene_item& item = *m_entries[index];
|
{ CGAL::Three::Scene_item& item = *m_entries[index];
|
||||||
if(item.visible() && item.renderingMode() == Splatting)
|
if(item.visible() && item.renderingMode() == Splatting)
|
||||||
{
|
{
|
||||||
viewer->glColor4d(item.color().redF(), item.color().greenF(), item.color().blueF(), item.color().alphaF());
|
item.drawSplats(viewer);
|
||||||
if(viewer)
|
|
||||||
item.draw_splats(viewer);
|
|
||||||
else
|
|
||||||
item.draw_splats();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
item.drawSplats();
|
||||||
}
|
}
|
||||||
ms_splatting->finalize();
|
ms_splatting->finalize();
|
||||||
|
|
||||||
|
|
@ -1210,7 +1208,7 @@ QList<QModelIndex> Scene::getModelIndexFromId(int id) const
|
||||||
return index_map.keys(id);
|
return index_map.keys(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::add_group(Scene_group_item* group)
|
void Scene::addGroup(Scene_group_item* group)
|
||||||
{
|
{
|
||||||
//Find the indices of the selected items
|
//Find the indices of the selected items
|
||||||
QList<int> indices;
|
QList<int> indices;
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,7 @@ struct Scene_c3t3_item_priv {
|
||||||
is_aabb_tree_built = false;
|
is_aabb_tree_built = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void compute_intersection(const Primitive& facet);
|
void computeIntersection(const Primitive& facet);
|
||||||
|
|
||||||
void fill_aabb_tree() {
|
void fill_aabb_tree() {
|
||||||
if(item->isEmpty()) return;
|
if(item->isEmpty()) return;
|
||||||
|
|
@ -684,13 +684,13 @@ void Scene_c3t3_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
|
|
||||||
if (!are_buffers_filled)
|
if (!are_buffers_filled)
|
||||||
{
|
{
|
||||||
ncthis->compute_elements();
|
ncthis->computeElements();
|
||||||
ncthis->initialize_buffers(viewer);
|
ncthis->initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
vaos[Grid]->bind();
|
vaos[Grid]->bind();
|
||||||
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
attrib_buffers(viewer, PROGRAM_NO_SELECTION);
|
attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", QColor(Qt::black));
|
program->setAttributeValue("colors", QColor(Qt::black));
|
||||||
QMatrix4x4 f_mat;
|
QMatrix4x4 f_mat;
|
||||||
|
|
@ -703,7 +703,7 @@ void Scene_c3t3_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
|
|
||||||
vaos[Facets]->bind();
|
vaos[Facets]->bind();
|
||||||
program = getShaderProgram(PROGRAM_C3T3);
|
program = getShaderProgram(PROGRAM_C3T3);
|
||||||
attrib_buffers(viewer, PROGRAM_C3T3);
|
attribBuffers(viewer, PROGRAM_C3T3);
|
||||||
program->bind();
|
program->bind();
|
||||||
QVector4D cp(this->plane().a(),this->plane().b(),this->plane().c(),this->plane().d());
|
QVector4D cp(this->plane().a(),this->plane().b(),this->plane().c(),this->plane().d());
|
||||||
program->setUniformValue("cutplane", cp);
|
program->setUniformValue("cutplane", cp);
|
||||||
|
|
@ -718,7 +718,7 @@ void Scene_c3t3_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
{
|
{
|
||||||
if(!intersection->visible())
|
if(!intersection->visible())
|
||||||
intersection->setVisible(true);
|
intersection->setVisible(true);
|
||||||
ncthis->compute_intersections();
|
ncthis->computeIntersections();
|
||||||
intersection->initialize_buffers(viewer);
|
intersection->initialize_buffers(viewer);
|
||||||
are_intersection_buffers_filled = true;
|
are_intersection_buffers_filled = true;
|
||||||
}
|
}
|
||||||
|
|
@ -733,7 +733,7 @@ void Scene_c3t3_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
Scene_group_item::draw(viewer);
|
Scene_group_item::draw(viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_c3t3_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
|
void Scene_c3t3_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
if(renderingMode() == FlatPlusEdges)
|
if(renderingMode() == FlatPlusEdges)
|
||||||
{
|
{
|
||||||
GLint renderMode;
|
GLint renderMode;
|
||||||
|
|
@ -743,8 +743,8 @@ void Scene_c3t3_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
Scene_c3t3_item* ncthis = const_cast<Scene_c3t3_item*>(this);
|
Scene_c3t3_item* ncthis = const_cast<Scene_c3t3_item*>(this);
|
||||||
if (!are_buffers_filled)
|
if (!are_buffers_filled)
|
||||||
{
|
{
|
||||||
ncthis->compute_elements();
|
ncthis->computeElements();
|
||||||
ncthis->initialize_buffers(viewer);
|
ncthis->initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(renderingMode() == Wireframe)
|
if(renderingMode() == Wireframe)
|
||||||
|
|
@ -752,6 +752,8 @@ void Scene_c3t3_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
vaos[Grid]->bind();
|
vaos[Grid]->bind();
|
||||||
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
attrib_buffers(viewer, PROGRAM_NO_SELECTION);
|
attrib_buffers(viewer, PROGRAM_NO_SELECTION);
|
||||||
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
|
attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", QColor(Qt::black));
|
program->setAttributeValue("colors", QColor(Qt::black));
|
||||||
QMatrix4x4 f_mat;
|
QMatrix4x4 f_mat;
|
||||||
|
|
@ -764,7 +766,7 @@ void Scene_c3t3_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
}
|
}
|
||||||
vaos[Edges]->bind();
|
vaos[Edges]->bind();
|
||||||
program = getShaderProgram(PROGRAM_C3T3_EDGES);
|
program = getShaderProgram(PROGRAM_C3T3_EDGES);
|
||||||
attrib_buffers(viewer, PROGRAM_C3T3_EDGES);
|
attribBuffers(viewer, PROGRAM_C3T3_EDGES);
|
||||||
program->bind();
|
program->bind();
|
||||||
QVector4D cp(this->plane().a(),this->plane().b(),this->plane().c(),this->plane().d());
|
QVector4D cp(this->plane().a(),this->plane().b(),this->plane().c(),this->plane().d());
|
||||||
program->setUniformValue("cutplane", cp);
|
program->setUniformValue("cutplane", cp);
|
||||||
|
|
@ -778,7 +780,7 @@ void Scene_c3t3_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
{
|
{
|
||||||
if(!intersection->visible())
|
if(!intersection->visible())
|
||||||
intersection->setVisible(true);
|
intersection->setVisible(true);
|
||||||
ncthis->compute_intersections();
|
ncthis->computeIntersections();
|
||||||
intersection->initialize_buffers(viewer);
|
intersection->initialize_buffers(viewer);
|
||||||
are_intersection_buffers_filled = true;
|
are_intersection_buffers_filled = true;
|
||||||
}
|
}
|
||||||
|
|
@ -796,26 +798,69 @@ void Scene_c3t3_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
{
|
{
|
||||||
vaos[CNC]->bind();
|
vaos[CNC]->bind();
|
||||||
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
attrib_buffers(viewer, PROGRAM_NO_SELECTION);
|
attribBuffers(viewer, PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", QColor(Qt::black));
|
program->setAttributeValue("colors", QColor(Qt::black));
|
||||||
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines_not_in_complex_size / 3));
|
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines_not_in_complex_size / 3));
|
||||||
program->release();
|
program->release();
|
||||||
vaos[Edges]->release();
|
vaos[Edges]->release();
|
||||||
}
|
}
|
||||||
|
if(spheres_are_shown)
|
||||||
|
{
|
||||||
|
vaos[Wired_spheres]->bind();
|
||||||
|
program_sphere->bind();
|
||||||
|
//ModelViewMatrix used for the transformation of the camera.
|
||||||
|
QMatrix4x4 mvp_mat;
|
||||||
|
// ModelView Matrix used for the lighting system
|
||||||
|
QMatrix4x4 mv_mat;
|
||||||
|
GLdouble d_mat[16];
|
||||||
|
GLint is_both_sides = 0;
|
||||||
|
viewer->camera()->getModelViewProjectionMatrix(d_mat);
|
||||||
|
//Convert the GLdoubles matrices in GLfloats
|
||||||
|
for (int i=0; i<16; ++i){
|
||||||
|
mvp_mat.data()[i] = GLfloat(d_mat[i]);
|
||||||
|
}
|
||||||
|
viewer->camera()->getModelViewMatrix(d_mat);
|
||||||
|
for (int i=0; i<16; ++i)
|
||||||
|
mv_mat.data()[i] = GLfloat(d_mat[i]);
|
||||||
|
QVector4D position(0.0f,0.0f,1.0f, 1.0f );
|
||||||
|
QVector4D ambient(0.4f, 0.4f, 0.4f, 0.4f);
|
||||||
|
// Diffuse
|
||||||
|
QVector4D diffuse(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
// Specular
|
||||||
|
QVector4D specular(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
viewer->glGetIntegerv(GL_LIGHT_MODEL_TWO_SIDE, &is_both_sides);
|
||||||
|
|
||||||
|
|
||||||
|
program_sphere->setUniformValue("mvp_matrix", mvp_mat);
|
||||||
|
program_sphere->setUniformValue("mv_matrix", mv_mat);
|
||||||
|
program_sphere->setUniformValue("light_pos", position);
|
||||||
|
program_sphere->setUniformValue("light_diff",diffuse);
|
||||||
|
program_sphere->setUniformValue("light_spec", specular);
|
||||||
|
program_sphere->setUniformValue("light_amb", ambient);
|
||||||
|
program_sphere->setUniformValue("spec_power", 51.8f);
|
||||||
|
program_sphere->setUniformValue("is_two_side", is_both_sides);
|
||||||
|
|
||||||
|
viewer->glDrawArraysInstanced(GL_TRIANGLES, 0,
|
||||||
|
static_cast<GLsizei>(ws_vertex.size()/3),
|
||||||
|
static_cast<GLsizei>(s_radius.size()));
|
||||||
|
program_sphere->release();
|
||||||
|
vaos[Wired_spheres]->release();
|
||||||
|
>>>>>>> Plugin API made in CamelCase
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_c3t3_item::draw_points(CGAL::Three::Viewer_interface * viewer) const
|
void Scene_c3t3_item::drawPoints(CGAL::Three::Viewer_interface * viewer) const
|
||||||
{
|
{
|
||||||
Scene_c3t3_item* ncthis = const_cast<Scene_c3t3_item*>(this);
|
Scene_c3t3_item* ncthis = const_cast<Scene_c3t3_item*>(this);
|
||||||
if (!are_buffers_filled)
|
if (!are_buffers_filled)
|
||||||
{
|
{
|
||||||
ncthis->compute_elements();
|
ncthis->computeElements();
|
||||||
ncthis-> initialize_buffers(viewer);
|
ncthis-> initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
vaos[Edges]->bind();
|
vaos[Edges]->bind();
|
||||||
program = getShaderProgram(PROGRAM_C3T3_EDGES);
|
program = getShaderProgram(PROGRAM_C3T3_EDGES);
|
||||||
attrib_buffers(viewer, PROGRAM_C3T3_EDGES);
|
attribBuffers(viewer, PROGRAM_C3T3_EDGES);
|
||||||
program->bind();
|
program->bind();
|
||||||
QVector4D cp(this->plane().a(),this->plane().b(),this->plane().c(),this->plane().d());
|
QVector4D cp(this->plane().a(),this->plane().b(),this->plane().c(),this->plane().d());
|
||||||
program->setUniformValue("cutplane", cp);
|
program->setUniformValue("cutplane", cp);
|
||||||
|
|
@ -1127,7 +1172,7 @@ void Scene_c3t3_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Scene_c3t3_item_priv::compute_intersection(const Primitive& facet)
|
void Scene_c3t3_item_priv::computeIntersection(const Primitive& facet)
|
||||||
{
|
{
|
||||||
const Kernel::Point_3& pa = facet.id().first->vertex(0)->point();
|
const Kernel::Point_3& pa = facet.id().first->vertex(0)->point();
|
||||||
const Kernel::Point_3& pb = facet.id().first->vertex(1)->point();
|
const Kernel::Point_3& pb = facet.id().first->vertex(1)->point();
|
||||||
|
|
@ -1160,20 +1205,20 @@ void Scene_c3t3_item_priv::compute_intersection(const Primitive& facet)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Compute_intersection {
|
struct ComputeIntersection {
|
||||||
Scene_c3t3_item_priv& item_priv;
|
Scene_c3t3_item_priv& item_priv;
|
||||||
|
|
||||||
Compute_intersection(Scene_c3t3_item_priv& item_priv)
|
ComputeIntersection(Scene_c3t3_item_priv& item_priv)
|
||||||
: item_priv(item_priv)
|
: item_priv(item_priv)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void operator()(const Primitive& facet) const
|
void operator()(const Primitive& facet) const
|
||||||
{
|
{
|
||||||
item_priv.compute_intersection(facet);
|
item_priv.computeIntersection(facet);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void Scene_c3t3_item::compute_intersections()
|
void Scene_c3t3_item::computeIntersections()
|
||||||
{
|
{
|
||||||
if(!d->is_aabb_tree_built) d->fill_aabb_tree();
|
if(!d->is_aabb_tree_built) d->fill_aabb_tree();
|
||||||
|
|
||||||
|
|
@ -1183,10 +1228,10 @@ void Scene_c3t3_item::compute_intersections()
|
||||||
positions_lines.clear();
|
positions_lines.clear();
|
||||||
const Kernel::Plane_3& plane = this->plane();
|
const Kernel::Plane_3& plane = this->plane();
|
||||||
d->tree.all_intersected_primitives(plane,
|
d->tree.all_intersected_primitives(plane,
|
||||||
boost::make_function_output_iterator(Compute_intersection(*this->d)));
|
boost::make_function_output_iterator(ComputeIntersection(*this->d)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_c3t3_item::compute_spheres()
|
void Scene_c3t3_item::computeSpheres()
|
||||||
{
|
{
|
||||||
if(!spheres)
|
if(!spheres)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1225,7 +1270,7 @@ void Scene_c3t3_item::compute_spheres()
|
||||||
spheres->invalidateOpenGLBuffers();
|
spheres->invalidateOpenGLBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_c3t3_item::compute_elements()
|
void Scene_c3t3_item::computeElements()
|
||||||
{
|
{
|
||||||
positions_poly.clear();
|
positions_poly.clear();
|
||||||
normals.clear();
|
normals.clear();
|
||||||
|
|
@ -1372,7 +1417,7 @@ void Scene_c3t3_item::show_spheres(bool b)
|
||||||
scene->addItem(spheres);
|
scene->addItem(spheres);
|
||||||
scene->changeGroup(spheres, this);
|
scene->changeGroup(spheres, this);
|
||||||
lockChild(spheres);
|
lockChild(spheres);
|
||||||
compute_spheres();
|
computeSpheres();
|
||||||
}
|
}
|
||||||
else if (!b && spheres!=NULL)
|
else if (!b && spheres!=NULL)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -110,8 +110,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw(CGAL::Three::Viewer_interface* viewer) const;
|
void draw(CGAL::Three::Viewer_interface* viewer) const;
|
||||||
void draw_edges(CGAL::Three::Viewer_interface* viewer) const;
|
void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
|
||||||
void draw_points(CGAL::Three::Viewer_interface * viewer) const;
|
void drawPoints(CGAL::Three::Viewer_interface * viewer) const;
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool need_changed;
|
bool need_changed;
|
||||||
|
|
@ -244,12 +244,12 @@ private:
|
||||||
mutable std::vector<float> s_center;
|
mutable std::vector<float> s_center;
|
||||||
mutable QOpenGLShaderProgram *program;
|
mutable QOpenGLShaderProgram *program;
|
||||||
|
|
||||||
using Scene_item::initialize_buffers;
|
using Scene_item::initializeBuffers;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer);
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer);
|
||||||
void initialize_intersection_buffers(CGAL::Three::Viewer_interface *viewer);
|
void initialize_intersection_buffers(CGAL::Three::Viewer_interface *viewer);
|
||||||
void compute_spheres();
|
void computeSpheres();
|
||||||
void compute_elements();
|
void computeElements();
|
||||||
void compute_intersections();
|
void computeIntersections();
|
||||||
bool cnc_are_shown;
|
bool cnc_are_shown;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ bool is_nan(double d)
|
||||||
return !CGAL::Is_valid<double>()( d );
|
return !CGAL::Is_valid<double>()( d );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_implicit_function_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const
|
void Scene_implicit_function_item::initializeBuffers(CGAL::Three::Viewer_interface *viewer = 0) const
|
||||||
{
|
{
|
||||||
if(GLuint(-1) == textureId) {
|
if(GLuint(-1) == textureId) {
|
||||||
viewer->glGenTextures(1, &textureId);
|
viewer->glGenTextures(1, &textureId);
|
||||||
|
|
@ -385,7 +385,7 @@ void
|
||||||
Scene_implicit_function_item::draw(CGAL::Three::Viewer_interface* viewer) const
|
Scene_implicit_function_item::draw(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
|
|
||||||
if(frame_->isManipulated()) {
|
if(frame_->isManipulated()) {
|
||||||
if(need_update_) {
|
if(need_update_) {
|
||||||
|
|
@ -396,7 +396,7 @@ Scene_implicit_function_item::draw(CGAL::Three::Viewer_interface* viewer) const
|
||||||
vaos[Plane]->bind();
|
vaos[Plane]->bind();
|
||||||
viewer->glActiveTexture(GL_TEXTURE0);
|
viewer->glActiveTexture(GL_TEXTURE0);
|
||||||
viewer->glBindTexture(GL_TEXTURE_2D, textureId);
|
viewer->glBindTexture(GL_TEXTURE_2D, textureId);
|
||||||
attrib_buffers(viewer, PROGRAM_WITH_TEXTURE);
|
attribBuffers(viewer, PROGRAM_WITH_TEXTURE);
|
||||||
QMatrix4x4 f_mat;
|
QMatrix4x4 f_mat;
|
||||||
GLdouble d_mat[16];
|
GLdouble d_mat[16];
|
||||||
frame_->getMatrix(d_mat);
|
frame_->getMatrix(d_mat);
|
||||||
|
|
@ -416,13 +416,13 @@ Scene_implicit_function_item::draw(CGAL::Three::Viewer_interface* viewer) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Scene_implicit_function_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const
|
Scene_implicit_function_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
// draw_aux(viewer, true);
|
// draw_aux(viewer, true);
|
||||||
vaos[BBox]->bind();
|
vaos[BBox]->bind();
|
||||||
attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
||||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", QVector3D(0.f,0.f,0.f));
|
program->setAttributeValue("colors", QVector3D(0.f,0.f,0.f));
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public:
|
||||||
// actually draw() is also overloaded to detect when the cut plane is moved
|
// actually draw() is also overloaded to detect when the cut plane is moved
|
||||||
virtual void draw()const {}
|
virtual void draw()const {}
|
||||||
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
||||||
virtual void draw_edges(CGAL::Three::Viewer_interface*) const;
|
virtual void drawEdges(CGAL::Three::Viewer_interface*) const;
|
||||||
|
|
||||||
virtual QString toolTip() const;
|
virtual QString toolTip() const;
|
||||||
virtual void invalidateOpenGLBuffers();
|
virtual void invalidateOpenGLBuffers();
|
||||||
|
|
@ -121,8 +121,8 @@ private:
|
||||||
|
|
||||||
GLuint vao;
|
GLuint vao;
|
||||||
GLuint buffer[4];
|
GLuint buffer[4];
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
|
||||||
void compute_vertices_and_texmap(void);
|
void compute_vertices_and_texmap(void);
|
||||||
void compute_texture(int, int);
|
void compute_texture(int, int);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -167,10 +167,10 @@ void CGAL::Three::Scene_item::select(double /*orig_x*/,
|
||||||
}
|
}
|
||||||
|
|
||||||
// set-up the uniform attributes of the shader programs.
|
// set-up the uniform attributes of the shader programs.
|
||||||
void CGAL::Three::Scene_item::attrib_buffers(CGAL::Three::Viewer_interface* viewer,
|
void CGAL::Three::Scene_item::attribBuffers(CGAL::Three::Viewer_interface* viewer,
|
||||||
int program_name) const
|
int program_name) const
|
||||||
{
|
{
|
||||||
viewer->attrib_buffers(program_name);
|
viewer->attribBuffers(program_name);
|
||||||
viewer->getShaderProgram(program_name)->bind();
|
viewer->getShaderProgram(program_name)->bind();
|
||||||
if(is_selected)
|
if(is_selected)
|
||||||
viewer->getShaderProgram(program_name)->setUniformValue("is_selected", true);
|
viewer->getShaderProgram(program_name)->setUniformValue("is_selected", true);
|
||||||
|
|
@ -210,7 +210,7 @@ CGAL::Three::Scene_item::Header_data CGAL::Three::Scene_item::header() const
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CGAL::Three::Scene_item::compute_stats(int )
|
QString CGAL::Three::Scene_item::computeStats(int )
|
||||||
{
|
{
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ Scene_nef_polyhedron_item::~Scene_nef_polyhedron_item()
|
||||||
delete nef_poly;
|
delete nef_poly;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_nef_polyhedron_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer) const
|
void Scene_nef_polyhedron_item::initializeBuffers(CGAL::Three::Viewer_interface *viewer) const
|
||||||
{
|
{
|
||||||
//vao for the facets
|
//vao for the facets
|
||||||
{
|
{
|
||||||
|
|
@ -405,13 +405,13 @@ void Scene_nef_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) cons
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_normals_and_vertices();
|
compute_normals_and_vertices();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
vaos[Facets]->bind();
|
vaos[Facets]->bind();
|
||||||
|
|
||||||
// tells the GPU to use the program just created
|
// tells the GPU to use the program just created
|
||||||
program=getShaderProgram(PROGRAM_WITH_LIGHT);
|
program=getShaderProgram(PROGRAM_WITH_LIGHT);
|
||||||
attrib_buffers(viewer,PROGRAM_WITH_LIGHT);
|
attribBuffers(viewer,PROGRAM_WITH_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setUniformValue("is_two_side", 1);
|
program->setUniformValue("is_two_side", 1);
|
||||||
viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/3));
|
viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/3));
|
||||||
|
|
@ -421,21 +421,21 @@ void Scene_nef_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) cons
|
||||||
viewer->glGetFloatv(GL_POINT_SIZE, &point_size);
|
viewer->glGetFloatv(GL_POINT_SIZE, &point_size);
|
||||||
viewer->glPointSize(10.f);
|
viewer->glPointSize(10.f);
|
||||||
|
|
||||||
draw_points(viewer);
|
drawPoints(viewer);
|
||||||
viewer->glPointSize(point_size);
|
viewer->glPointSize(point_size);
|
||||||
|
|
||||||
}
|
}
|
||||||
void Scene_nef_polyhedron_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const
|
void Scene_nef_polyhedron_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_normals_and_vertices();
|
compute_normals_and_vertices();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
vaos[Edges]->bind();
|
vaos[Edges]->bind();
|
||||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
attrib_buffers(viewer ,PROGRAM_WITHOUT_LIGHT);
|
attribBuffers(viewer ,PROGRAM_WITHOUT_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
viewer->glDrawArrays(GL_LINES,0,static_cast<GLsizei>(nb_lines/3));
|
viewer->glDrawArrays(GL_LINES,0,static_cast<GLsizei>(nb_lines/3));
|
||||||
vaos[Edges]->release();
|
vaos[Edges]->release();
|
||||||
|
|
@ -446,20 +446,20 @@ void Scene_nef_polyhedron_item::draw_edges(CGAL::Three::Viewer_interface* viewer
|
||||||
viewer->glGetFloatv(GL_POINT_SIZE, &point_size);
|
viewer->glGetFloatv(GL_POINT_SIZE, &point_size);
|
||||||
viewer->glPointSize(10.f);
|
viewer->glPointSize(10.f);
|
||||||
|
|
||||||
draw_points(viewer);
|
drawPoints(viewer);
|
||||||
viewer->glPointSize(point_size);
|
viewer->glPointSize(point_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Scene_nef_polyhedron_item::draw_points(CGAL::Three::Viewer_interface* viewer) const
|
void Scene_nef_polyhedron_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_normals_and_vertices();
|
compute_normals_and_vertices();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
vaos[Points]->bind();
|
vaos[Points]->bind();
|
||||||
program=getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
program=getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
attrib_buffers(viewer ,PROGRAM_WITHOUT_LIGHT);
|
attribBuffers(viewer ,PROGRAM_WITHOUT_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", this->color());
|
program->setAttributeValue("colors", this->color());
|
||||||
viewer->glDrawArrays(GL_POINTS,0,static_cast<GLsizei>(nb_points/3));
|
viewer->glDrawArrays(GL_POINTS,0,static_cast<GLsizei>(nb_points/3));
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,9 @@ public:
|
||||||
void direct_draw() const;
|
void direct_draw() const;
|
||||||
|
|
||||||
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
||||||
virtual void draw_edges() const {}
|
virtual void drawEdges() const {}
|
||||||
virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const;
|
virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
|
||||||
virtual void draw_points(CGAL::Three::Viewer_interface*) const;
|
virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
|
||||||
// Wireframe OpenGL drawing
|
// Wireframe OpenGL drawing
|
||||||
|
|
||||||
bool isFinite() const { return true; }
|
bool isFinite() const { return true; }
|
||||||
|
|
@ -101,8 +101,8 @@ private:
|
||||||
|
|
||||||
mutable QOpenGLShaderProgram *program;
|
mutable QOpenGLShaderProgram *program;
|
||||||
|
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
|
||||||
void compute_normals_and_vertices(void) const;
|
void compute_normals_and_vertices(void) const;
|
||||||
|
|
||||||
void triangulate_facet();
|
void triangulate_facet();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Scene_plane_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer) const
|
void Scene_plane_item::initializeBuffers(CGAL::Three::Viewer_interface *viewer) const
|
||||||
{
|
{
|
||||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
|
||||||
program->bind();
|
program->bind();
|
||||||
|
|
@ -94,10 +94,10 @@ void Scene_plane_item::compute_normals_and_vertices(void)
|
||||||
void Scene_plane_item::draw(CGAL::Three::Viewer_interface* viewer)const
|
void Scene_plane_item::draw(CGAL::Three::Viewer_interface* viewer)const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
vaos[Facets]->bind();
|
vaos[Facets]->bind();
|
||||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
||||||
QMatrix4x4 f_matrix;
|
QMatrix4x4 f_matrix;
|
||||||
for(int i=0; i<16; i++)
|
for(int i=0; i<16; i++)
|
||||||
f_matrix.data()[i] = (float)frame->matrix()[i];
|
f_matrix.data()[i] = (float)frame->matrix()[i];
|
||||||
|
|
@ -111,13 +111,13 @@ void Scene_plane_item::draw(CGAL::Three::Viewer_interface* viewer)const
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_plane_item::draw_edges(CGAL::Three::Viewer_interface* viewer)const
|
void Scene_plane_item::drawEdges(CGAL::Three::Viewer_interface* viewer)const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
vaos[Edges]->bind();
|
vaos[Edges]->bind();
|
||||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
||||||
QMatrix4x4 f_matrix;
|
QMatrix4x4 f_matrix;
|
||||||
for(int i=0; i<16; i++)
|
for(int i=0; i<16; i++)
|
||||||
f_matrix.data()[i] = (float)frame->matrix()[i];
|
f_matrix.data()[i] = (float)frame->matrix()[i];
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ public:
|
||||||
return (m == Wireframe || m == Flat || m == FlatPlusEdges);
|
return (m == Wireframe || m == Flat || m == FlatPlusEdges);
|
||||||
}
|
}
|
||||||
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
||||||
virtual void draw_edges(CGAL::Three::Viewer_interface* viewer)const;
|
virtual void drawEdges(CGAL::Three::Viewer_interface* viewer)const;
|
||||||
Plane_3 plane() const {
|
Plane_3 plane() const {
|
||||||
const qglviewer::Vec& pos = frame->position();
|
const qglviewer::Vec& pos = frame->position();
|
||||||
const qglviewer::Vec& n =
|
const qglviewer::Vec& n =
|
||||||
|
|
@ -189,8 +189,8 @@ protected:
|
||||||
mutable bool smooth_shading;
|
mutable bool smooth_shading;
|
||||||
mutable QOpenGLShaderProgram *program;
|
mutable QOpenGLShaderProgram *program;
|
||||||
|
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface*)const;
|
void initializeBuffers(CGAL::Three::Viewer_interface*)const;
|
||||||
void compute_normals_and_vertices(void);
|
void compute_normals_and_vertices(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ Scene_points_with_normal_item::~Scene_points_with_normal_item()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Scene_points_with_normal_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer) const
|
void Scene_points_with_normal_item::initializeBuffers(CGAL::Three::Viewer_interface *viewer) const
|
||||||
{
|
{
|
||||||
compute_normals_and_vertices();
|
compute_normals_and_vertices();
|
||||||
//vao for the edges
|
//vao for the edges
|
||||||
|
|
@ -404,7 +404,7 @@ bool Scene_points_with_normal_item::supportsRenderingMode(RenderingMode m) const
|
||||||
( m==PointsPlusNormals || m==Splatting ) );
|
( m==PointsPlusNormals || m==Splatting ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_points_with_normal_item::draw_splats(CGAL::Three::Viewer_interface* viewer) const
|
void Scene_points_with_normal_item::drawSplats(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
// TODO add support for selection
|
// TODO add support for selection
|
||||||
viewer->glBegin(GL_POINTS);
|
viewer->glBegin(GL_POINTS);
|
||||||
|
|
@ -422,7 +422,7 @@ void Scene_points_with_normal_item::draw_splats(CGAL::Three::Viewer_interface* v
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_points_with_normal_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const
|
void Scene_points_with_normal_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
double ratio_displayed = 1.0;
|
double ratio_displayed = 1.0;
|
||||||
if (viewer->inFastDrawing () &&
|
if (viewer->inFastDrawing () &&
|
||||||
|
|
@ -430,10 +430,10 @@ void Scene_points_with_normal_item::draw_edges(CGAL::Three::Viewer_interface* vi
|
||||||
ratio_displayed = 6 * 300000. / (double)(nb_lines);
|
ratio_displayed = 6 * 300000. / (double)(nb_lines);
|
||||||
|
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
vaos[Edges]->bind();
|
vaos[Edges]->bind();
|
||||||
program=getShaderProgram(PROGRAM_NO_SELECTION);
|
program=getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
attrib_buffers(viewer,PROGRAM_NO_SELECTION);
|
attribBuffers(viewer,PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", this->color());
|
program->setAttributeValue("colors", this->color());
|
||||||
viewer->glDrawArrays(GL_LINES, 0,
|
viewer->glDrawArrays(GL_LINES, 0,
|
||||||
|
|
@ -441,10 +441,10 @@ void Scene_points_with_normal_item::draw_edges(CGAL::Three::Viewer_interface* vi
|
||||||
vaos[Edges]->release();
|
vaos[Edges]->release();
|
||||||
program->release();
|
program->release();
|
||||||
}
|
}
|
||||||
void Scene_points_with_normal_item::draw_points(CGAL::Three::Viewer_interface* viewer) const
|
void Scene_points_with_normal_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
|
|
||||||
double ratio_displayed = 1.0;
|
double ratio_displayed = 1.0;
|
||||||
if (viewer->inFastDrawing () &&
|
if (viewer->inFastDrawing () &&
|
||||||
|
|
@ -453,7 +453,7 @@ void Scene_points_with_normal_item::draw_points(CGAL::Three::Viewer_interface* v
|
||||||
|
|
||||||
vaos[ThePoints]->bind();
|
vaos[ThePoints]->bind();
|
||||||
program=getShaderProgram(PROGRAM_NO_SELECTION);
|
program=getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
attrib_buffers(viewer,PROGRAM_NO_SELECTION);
|
attribBuffers(viewer,PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", this->color());
|
program->setAttributeValue("colors", this->color());
|
||||||
viewer->glDrawArrays(GL_POINTS, 0,
|
viewer->glDrawArrays(GL_POINTS, 0,
|
||||||
|
|
@ -466,7 +466,7 @@ void Scene_points_with_normal_item::draw_points(CGAL::Three::Viewer_interface* v
|
||||||
|
|
||||||
vaos[Selected_points]->bind();
|
vaos[Selected_points]->bind();
|
||||||
program=getShaderProgram(PROGRAM_NO_SELECTION);
|
program=getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
attrib_buffers(viewer,PROGRAM_NO_SELECTION);
|
attribBuffers(viewer,PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", QColor(255,0,0));
|
program->setAttributeValue("colors", QColor(255,0,0));
|
||||||
viewer->glDrawArrays(GL_POINTS, 0,
|
viewer->glDrawArrays(GL_POINTS, 0,
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,10 @@ public:
|
||||||
// Indicate if rendering mode is supported
|
// Indicate if rendering mode is supported
|
||||||
virtual bool supportsRenderingMode(RenderingMode m) const;
|
virtual bool supportsRenderingMode(RenderingMode m) const;
|
||||||
|
|
||||||
virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const;
|
virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
|
||||||
virtual void draw_points(CGAL::Three::Viewer_interface*) const;
|
virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
|
||||||
|
|
||||||
virtual void draw_splats(CGAL::Three::Viewer_interface*) const;
|
virtual void drawSplats(CGAL::Three::Viewer_interface*) const;
|
||||||
|
|
||||||
// Gets wrapped point set
|
// Gets wrapped point set
|
||||||
Point_set* point_set();
|
Point_set* point_set();
|
||||||
|
|
@ -116,8 +116,8 @@ private:
|
||||||
|
|
||||||
mutable QOpenGLShaderProgram *program;
|
mutable QOpenGLShaderProgram *program;
|
||||||
|
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
void initialize_buffers(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;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ struct Polyhedron_to_polygon_soup_writer {
|
||||||
}; // end struct Polyhedron_to_soup_writer
|
}; // end struct Polyhedron_to_soup_writer
|
||||||
|
|
||||||
void
|
void
|
||||||
Scene_polygon_soup_item::initialize_buffers(CGAL::Three::Viewer_interface* viewer) const
|
Scene_polygon_soup_item::initializeBuffers(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
//vao containing the data for the facets
|
//vao containing the data for the facets
|
||||||
{
|
{
|
||||||
|
|
@ -576,13 +576,13 @@ Scene_polygon_soup_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_normals_and_vertices();
|
compute_normals_and_vertices();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
if(soup == 0) return;
|
if(soup == 0) return;
|
||||||
//Calls the buffer info again so that it's the right one used even if
|
//Calls the buffer info again so that it's the right one used even if
|
||||||
//there are several objects drawn
|
//there are several objects drawn
|
||||||
vaos[Facets]->bind();
|
vaos[Facets]->bind();
|
||||||
attrib_buffers(viewer,PROGRAM_WITH_LIGHT);
|
attribBuffers(viewer,PROGRAM_WITH_LIGHT);
|
||||||
//fills the arraw of colors with the current color
|
//fills the arraw of colors with the current color
|
||||||
|
|
||||||
QColor v_colors = this->color();
|
QColor v_colors = this->color();
|
||||||
|
|
@ -599,15 +599,15 @@ Scene_polygon_soup_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Scene_polygon_soup_item::draw_points(CGAL::Three::Viewer_interface* viewer) const {
|
Scene_polygon_soup_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_normals_and_vertices();
|
compute_normals_and_vertices();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
if(soup == 0) return;
|
if(soup == 0) return;
|
||||||
vaos[Edges]->bind();
|
vaos[Edges]->bind();
|
||||||
attrib_buffers(viewer,PROGRAM_WITHOUT_LIGHT);
|
attribBuffers(viewer,PROGRAM_WITHOUT_LIGHT);
|
||||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
QColor color = this->color();
|
QColor color = this->color();
|
||||||
|
|
@ -620,15 +620,15 @@ Scene_polygon_soup_item::draw_points(CGAL::Three::Viewer_interface* viewer) cons
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Scene_polygon_soup_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
|
Scene_polygon_soup_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_normals_and_vertices();
|
compute_normals_and_vertices();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
if(soup == 0) return;
|
if(soup == 0) return;
|
||||||
vaos[Edges]->bind();
|
vaos[Edges]->bind();
|
||||||
attrib_buffers(viewer,PROGRAM_WITHOUT_LIGHT);
|
attribBuffers(viewer,PROGRAM_WITHOUT_LIGHT);
|
||||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
QColor color = this->color().lighter(120);
|
QColor color = this->color().lighter(120);
|
||||||
|
|
@ -642,7 +642,7 @@ Scene_polygon_soup_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const
|
||||||
if(displayNonManifoldEdges())
|
if(displayNonManifoldEdges())
|
||||||
{
|
{
|
||||||
vaos[NM_Edges]->bind();
|
vaos[NM_Edges]->bind();
|
||||||
attrib_buffers(viewer,PROGRAM_WITHOUT_LIGHT);
|
attribBuffers(viewer,PROGRAM_WITHOUT_LIGHT);
|
||||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
QColor c = QColor(255,0,0,255);
|
QColor c = QColor(255,0,0,255);
|
||||||
|
|
|
||||||
|
|
@ -144,8 +144,8 @@ public:
|
||||||
// OpenGL drawing in a display list
|
// OpenGL drawing in a display list
|
||||||
virtual void draw() const {}
|
virtual void draw() const {}
|
||||||
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
||||||
virtual void draw_points(CGAL::Three::Viewer_interface*) const;
|
virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
|
||||||
virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const;
|
virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
|
||||||
void invalidateOpenGLBuffers();
|
void invalidateOpenGLBuffers();
|
||||||
bool isFinite() const { return true; }
|
bool isFinite() const { return true; }
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
|
|
@ -192,8 +192,8 @@ private:
|
||||||
mutable std::size_t nb_nm_edges;
|
mutable std::size_t nb_nm_edges;
|
||||||
mutable std::size_t nb_polys;
|
mutable std::size_t nb_polys;
|
||||||
mutable std::size_t nb_lines;
|
mutable std::size_t nb_lines;
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
|
||||||
void compute_normals_and_vertices(void) const;
|
void compute_normals_and_vertices(void) const;
|
||||||
void triangulate_polygon(Polygons_iterator ) const;
|
void triangulate_polygon(Polygons_iterator ) const;
|
||||||
mutable QOpenGLShaderProgram *program;
|
mutable QOpenGLShaderProgram *program;
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ Scene_polyhedron_item::triangulate_facet(Facet_iterator fit,
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Scene_polyhedron_item::initialize_buffers(CGAL::Three::Viewer_interface* viewer) const
|
Scene_polyhedron_item::initializeBuffers(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
//vao containing the data for the facets
|
//vao containing the data for the facets
|
||||||
{
|
{
|
||||||
|
|
@ -846,7 +846,7 @@ void Scene_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_normals_and_vertices();
|
compute_normals_and_vertices();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
compute_bbox();
|
compute_bbox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -856,7 +856,7 @@ void Scene_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
{
|
{
|
||||||
vaos[Gouraud_Facets]->bind();
|
vaos[Gouraud_Facets]->bind();
|
||||||
}
|
}
|
||||||
attrib_buffers(viewer, PROGRAM_WITH_LIGHT);
|
attribBuffers(viewer, PROGRAM_WITH_LIGHT);
|
||||||
program = getShaderProgram(PROGRAM_WITH_LIGHT);
|
program = getShaderProgram(PROGRAM_WITH_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
if(is_monochrome)
|
if(is_monochrome)
|
||||||
|
|
@ -876,12 +876,12 @@ void Scene_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
|
// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
|
||||||
void Scene_polyhedron_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const
|
void Scene_polyhedron_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if (!are_buffers_filled)
|
if (!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_normals_and_vertices();
|
compute_normals_and_vertices();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
compute_bbox();
|
compute_bbox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -889,7 +889,7 @@ void Scene_polyhedron_item::draw_edges(CGAL::Three::Viewer_interface* viewer) co
|
||||||
{
|
{
|
||||||
vaos[Edges]->bind();
|
vaos[Edges]->bind();
|
||||||
|
|
||||||
attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
||||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
//draw the edges
|
//draw the edges
|
||||||
|
|
@ -908,7 +908,7 @@ void Scene_polyhedron_item::draw_edges(CGAL::Three::Viewer_interface* viewer) co
|
||||||
|
|
||||||
//draw the feature edges
|
//draw the feature edges
|
||||||
vaos[Feature_edges]->bind();
|
vaos[Feature_edges]->bind();
|
||||||
attrib_buffers(viewer, PROGRAM_NO_SELECTION);
|
attribBuffers(viewer, PROGRAM_NO_SELECTION);
|
||||||
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
if(show_feature_edges_m || show_only_feature_edges_m)
|
if(show_feature_edges_m || show_only_feature_edges_m)
|
||||||
|
|
@ -926,16 +926,16 @@ void Scene_polyhedron_item::draw_edges(CGAL::Three::Viewer_interface* viewer) co
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Scene_polyhedron_item::draw_points(CGAL::Three::Viewer_interface* viewer) const {
|
Scene_polyhedron_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_normals_and_vertices();
|
compute_normals_and_vertices();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
compute_bbox();
|
compute_bbox();
|
||||||
}
|
}
|
||||||
|
|
||||||
vaos[Edges]->bind();
|
vaos[Edges]->bind();
|
||||||
attrib_buffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
attribBuffers(viewer, PROGRAM_WITHOUT_LIGHT);
|
||||||
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
//draw the points
|
//draw the points
|
||||||
|
|
@ -1145,7 +1145,7 @@ void Scene_polyhedron_item::invalidate_aabb_tree()
|
||||||
{
|
{
|
||||||
delete_aabb_tree(this);
|
delete_aabb_tree(this);
|
||||||
}
|
}
|
||||||
QString Scene_polyhedron_item::compute_stats(int type)
|
QString Scene_polyhedron_item::computeStats(int type)
|
||||||
{
|
{
|
||||||
double minl, maxl, meanl, midl;
|
double minl, maxl, meanl, midl;
|
||||||
switch (type)
|
switch (type)
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,9 @@ public:
|
||||||
MAX_ANGLE,
|
MAX_ANGLE,
|
||||||
MEAN_ANGLE
|
MEAN_ANGLE
|
||||||
};
|
};
|
||||||
QString compute_stats(int type);
|
|
||||||
bool has_stats()const {return true;}
|
bool has_stats()const {return true;}
|
||||||
|
QString computeStats(int type);
|
||||||
CGAL::Three::Scene_item::Header_data header() const;
|
CGAL::Three::Scene_item::Header_data header() const;
|
||||||
Scene_polyhedron_item();
|
Scene_polyhedron_item();
|
||||||
// Scene_polyhedron_item(const Scene_polyhedron_item&);
|
// Scene_polyhedron_item(const Scene_polyhedron_item&);
|
||||||
|
|
@ -71,9 +72,9 @@ public:
|
||||||
// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
|
// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
|
||||||
void draw() const {}
|
void draw() const {}
|
||||||
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
||||||
virtual void draw_edges() const {}
|
virtual void drawEdges() const {}
|
||||||
virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const;
|
virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
|
||||||
virtual void draw_points(CGAL::Three::Viewer_interface*) const;
|
virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
|
||||||
|
|
||||||
// Get wrapped polyhedron
|
// Get wrapped polyhedron
|
||||||
Polyhedron* polyhedron();
|
Polyhedron* polyhedron();
|
||||||
|
|
@ -173,8 +174,8 @@ private:
|
||||||
mutable unsigned int number_of_degenerated_faces;
|
mutable unsigned int number_of_degenerated_faces;
|
||||||
mutable bool self_intersect;
|
mutable bool self_intersect;
|
||||||
|
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const;
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer = 0) const;
|
||||||
void compute_normals_and_vertices(const bool colors_only = false) const;
|
void compute_normals_and_vertices(const bool colors_only = false) const;
|
||||||
template<typename FaceNormalPmap, typename VertexNormalPmap>
|
template<typename FaceNormalPmap, typename VertexNormalPmap>
|
||||||
void triangulate_facet(Facet_iterator,
|
void triangulate_facet(Facet_iterator,
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ void Scene_polyhedron_item_decorator::draw() const {
|
||||||
poly_item->draw();
|
poly_item->draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_polyhedron_item_decorator::draw_edges() const {
|
void Scene_polyhedron_item_decorator::drawEdges() const {
|
||||||
poly_item->draw_edges();
|
poly_item->drawEdges();
|
||||||
}
|
}
|
||||||
|
|
||||||
Polyhedron*
|
Polyhedron*
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,9 @@ public:
|
||||||
// Indicate if rendering mode is supported
|
// Indicate if rendering mode is supported
|
||||||
bool supportsRenderingMode(RenderingMode m) const { return (m!=PointsPlusNormals && m!=Splatting); }
|
bool supportsRenderingMode(RenderingMode m) const { return (m!=PointsPlusNormals && m!=Splatting); }
|
||||||
// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
|
// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
|
||||||
// dispatch to poly_item direct_draw and direct_draw_edges
|
// dispatch to poly_item direct_draw and direct_drawEdges
|
||||||
void draw() const;
|
void draw() const;
|
||||||
void draw_edges() const;
|
void drawEdges() const;
|
||||||
|
|
||||||
// Get wrapped polyhedron
|
// Get wrapped polyhedron
|
||||||
Polyhedron* polyhedron();
|
Polyhedron* polyhedron();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#include <CGAL/Polygon_mesh_processing/compute_normal.h>
|
#include <CGAL/Polygon_mesh_processing/compute_normal.h>
|
||||||
|
|
||||||
|
|
||||||
void Scene_polyhedron_selection_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer)const
|
void Scene_polyhedron_selection_item::initializeBuffers(CGAL::Three::Viewer_interface *viewer)const
|
||||||
{
|
{
|
||||||
//vao containing the data for the unselected facets
|
//vao containing the data for the unselected facets
|
||||||
{
|
{
|
||||||
|
|
@ -84,7 +84,7 @@ void Scene_polyhedron_selection_item::initialize_buffers(CGAL::Three::Viewer_int
|
||||||
are_buffers_filled = true;
|
are_buffers_filled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_polyhedron_selection_item::compute_elements()const
|
void Scene_polyhedron_selection_item::computeElements()const
|
||||||
{
|
{
|
||||||
positions_facets.clear();
|
positions_facets.clear();
|
||||||
positions_lines.clear();
|
positions_lines.clear();
|
||||||
|
|
@ -166,11 +166,11 @@ void Scene_polyhedron_selection_item::draw(CGAL::Three::Viewer_interface* viewer
|
||||||
|
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_elements();
|
computeElements();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_points(viewer);
|
drawPoints(viewer);
|
||||||
GLfloat offset_factor;
|
GLfloat offset_factor;
|
||||||
GLfloat offset_units;
|
GLfloat offset_units;
|
||||||
viewer->glGetFloatv( GL_POLYGON_OFFSET_FACTOR, &offset_factor);
|
viewer->glGetFloatv( GL_POLYGON_OFFSET_FACTOR, &offset_factor);
|
||||||
|
|
@ -179,30 +179,30 @@ void Scene_polyhedron_selection_item::draw(CGAL::Three::Viewer_interface* viewer
|
||||||
|
|
||||||
vaos[0]->bind();
|
vaos[0]->bind();
|
||||||
program = getShaderProgram(PROGRAM_WITH_LIGHT);
|
program = getShaderProgram(PROGRAM_WITH_LIGHT);
|
||||||
attrib_buffers(viewer,PROGRAM_WITH_LIGHT);
|
attribBuffers(viewer,PROGRAM_WITH_LIGHT);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors",this->color());
|
program->setAttributeValue("colors",this->color());
|
||||||
viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/3));
|
viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/3));
|
||||||
program->release();
|
program->release();
|
||||||
vaos[0]->release();
|
vaos[0]->release();
|
||||||
glPolygonOffset(offset_factor, offset_units);
|
glPolygonOffset(offset_factor, offset_units);
|
||||||
draw_edges(viewer);
|
drawEdges(viewer);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_polyhedron_selection_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const
|
void Scene_polyhedron_selection_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_elements();
|
computeElements();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer->glLineWidth(3.f);
|
viewer->glLineWidth(3.f);
|
||||||
vaos[1]->bind();
|
vaos[1]->bind();
|
||||||
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
attrib_buffers(viewer,PROGRAM_NO_SELECTION);
|
attribBuffers(viewer,PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
|
|
||||||
program->setAttributeValue("colors",edge_color);
|
program->setAttributeValue("colors",edge_color);
|
||||||
|
|
@ -212,17 +212,17 @@ void Scene_polyhedron_selection_item::draw_edges(CGAL::Three::Viewer_interface*
|
||||||
viewer->glLineWidth(1.f);
|
viewer->glLineWidth(1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_polyhedron_selection_item::draw_points(CGAL::Three::Viewer_interface* viewer) const
|
void Scene_polyhedron_selection_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_elements();
|
computeElements();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
viewer->glPointSize(5.f);
|
viewer->glPointSize(5.f);
|
||||||
vaos[2]->bind();
|
vaos[2]->bind();
|
||||||
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
program = getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
attrib_buffers(viewer,PROGRAM_NO_SELECTION);
|
attribBuffers(viewer,PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors",vertex_color);
|
program->setAttributeValue("colors",vertex_color);
|
||||||
viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_points/3));
|
viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(nb_points/3));
|
||||||
|
|
|
||||||
|
|
@ -278,9 +278,9 @@ public:
|
||||||
|
|
||||||
using Scene_polyhedron_item_decorator::draw;
|
using Scene_polyhedron_item_decorator::draw;
|
||||||
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
||||||
virtual void draw_edges() const { }
|
virtual void drawEdges() const { }
|
||||||
virtual void draw_edges(CGAL::Three::Viewer_interface*) const;
|
virtual void drawEdges(CGAL::Three::Viewer_interface*) const;
|
||||||
virtual void draw_points(CGAL::Three::Viewer_interface*) const;
|
virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
|
||||||
|
|
||||||
bool supportsRenderingMode(RenderingMode m) const { return (m==Flat); }
|
bool supportsRenderingMode(RenderingMode m) const { return (m==Flat); }
|
||||||
|
|
||||||
|
|
@ -947,9 +947,9 @@ private:
|
||||||
mutable std::size_t nb_points;
|
mutable std::size_t nb_points;
|
||||||
mutable std::size_t nb_lines;
|
mutable std::size_t nb_lines;
|
||||||
mutable QOpenGLShaderProgram *program;
|
mutable QOpenGLShaderProgram *program;
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
|
||||||
void compute_elements() const;
|
void computeElements() const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Scene_polylines_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const
|
Scene_polylines_item::initializeBuffers(CGAL::Three::Viewer_interface *viewer = 0) const
|
||||||
{
|
{
|
||||||
QOpenGLShaderProgram *program;
|
QOpenGLShaderProgram *program;
|
||||||
//vao for the lines
|
//vao for the lines
|
||||||
|
|
@ -48,7 +48,7 @@ Scene_polylines_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer =
|
||||||
are_buffers_filled = true;
|
are_buffers_filled = true;
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
Scene_polylines_item::compute_elements() const
|
Scene_polylines_item::computeElements() const
|
||||||
{
|
{
|
||||||
positions_lines.resize(0);
|
positions_lines.resize(0);
|
||||||
//Fills the VBO with the lines
|
//Fills the VBO with the lines
|
||||||
|
|
@ -76,7 +76,7 @@ Scene_polylines_item::compute_elements() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Scene_polylines_item::compute_spheres()
|
Scene_polylines_item::compute_Spheres()
|
||||||
{
|
{
|
||||||
// FIRST, count the number of incident cycles and polylines
|
// FIRST, count the number of incident cycles and polylines
|
||||||
// for all extremities.
|
// for all extremities.
|
||||||
|
|
@ -273,8 +273,8 @@ Scene_polylines_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
|
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_elements();
|
computeElements();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
if(d->draw_extremities)
|
if(d->draw_extremities)
|
||||||
{
|
{
|
||||||
|
|
@ -284,15 +284,15 @@ Scene_polylines_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
|
|
||||||
// Wireframe OpenGL drawing
|
// Wireframe OpenGL drawing
|
||||||
void
|
void
|
||||||
Scene_polylines_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
|
Scene_polylines_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_elements();
|
computeElements();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
vaos[Edges]->bind();
|
vaos[Edges]->bind();
|
||||||
attrib_buffers(viewer, PROGRAM_NO_SELECTION);
|
attribBuffers(viewer, PROGRAM_NO_SELECTION);
|
||||||
QOpenGLShaderProgram *program = getShaderProgram(PROGRAM_NO_SELECTION);
|
QOpenGLShaderProgram *program = getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
program->setAttributeValue("colors", this->color());
|
program->setAttributeValue("colors", this->color());
|
||||||
|
|
@ -307,15 +307,15 @@ Scene_polylines_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Scene_polylines_item::draw_points(CGAL::Three::Viewer_interface* viewer) const {
|
Scene_polylines_item::drawPoints(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_elements();
|
computeElements();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
vaos[Edges]->bind();
|
vaos[Edges]->bind();
|
||||||
attrib_buffers(viewer, PROGRAM_NO_SELECTION);
|
attribBuffers(viewer, PROGRAM_NO_SELECTION);
|
||||||
QOpenGLShaderProgram *program = getShaderProgram(PROGRAM_NO_SELECTION);
|
QOpenGLShaderProgram *program = getShaderProgram(PROGRAM_NO_SELECTION);
|
||||||
program->bind();
|
program->bind();
|
||||||
QColor temp = this->color();
|
QColor temp = this->color();
|
||||||
|
|
@ -403,7 +403,7 @@ void Scene_polylines_item::change_corner_radii(double r) {
|
||||||
scene->addItem(spheres);
|
scene->addItem(spheres);
|
||||||
scene->changeGroup(spheres, this);
|
scene->changeGroup(spheres, this);
|
||||||
lockChild(spheres);
|
lockChild(spheres);
|
||||||
compute_spheres();
|
compute_Spheres();
|
||||||
spheres->invalidateOpenGLBuffers();
|
spheres->invalidateOpenGLBuffers();
|
||||||
}
|
}
|
||||||
else if (r<=0 && spheres!=NULL)
|
else if (r<=0 && spheres!=NULL)
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,11 @@ public:
|
||||||
void draw(CGAL::Three::Viewer_interface*) const;
|
void draw(CGAL::Three::Viewer_interface*) const;
|
||||||
|
|
||||||
// Wireframe OpenGL drawing
|
// Wireframe OpenGL drawing
|
||||||
void draw_edges() const{}
|
void drawEdges() const{}
|
||||||
void draw_edges(CGAL::Three::Viewer_interface*) const;
|
void drawEdges(CGAL::Three::Viewer_interface*) const;
|
||||||
|
|
||||||
void draw_points() const{}
|
void drawPoints() const{}
|
||||||
void draw_points(CGAL::Three::Viewer_interface*) const;
|
void drawPoints(CGAL::Three::Viewer_interface*) const;
|
||||||
|
|
||||||
|
|
||||||
void smooth(std::vector<Point_3>& polyline){
|
void smooth(std::vector<Point_3>& polyline){
|
||||||
|
|
@ -111,12 +111,11 @@ private:
|
||||||
mutable std::size_t nb_lines;
|
mutable std::size_t nb_lines;
|
||||||
typedef std::map<Point_3, int> Point_to_int_map;
|
typedef std::map<Point_3, int> Point_to_int_map;
|
||||||
typedef Point_to_int_map::iterator iterator;
|
typedef Point_to_int_map::iterator iterator;
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
void computeSpheres();
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
using CGAL::Three::Scene_item::compute_elements;
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
|
||||||
void compute_elements() const;
|
using CGAL::Three::Scene_item::computeElements;
|
||||||
void compute_spheres();
|
void computeElements() const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -413,7 +413,7 @@ Scene_segmented_image_item::Scene_segmented_image_item(Image* im,
|
||||||
|
|
||||||
v_box = new std::vector<float>();
|
v_box = new std::vector<float>();
|
||||||
compile_shaders();
|
compile_shaders();
|
||||||
initialize_buffers();
|
initializeBuffers();
|
||||||
setRenderingMode(Flat);
|
setRenderingMode(Flat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -524,7 +524,7 @@ void Scene_segmented_image_item::compile_shaders()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_segmented_image_item::attrib_buffers(Viewer_interface* viewer) const
|
void Scene_segmented_image_item::attribBuffers(Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
QMatrix4x4 mvpMatrix;
|
QMatrix4x4 mvpMatrix;
|
||||||
QMatrix4x4 mvMatrix;
|
QMatrix4x4 mvMatrix;
|
||||||
|
|
@ -653,7 +653,7 @@ Scene_segmented_image_item::supportsRenderingMode(RenderingMode m) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Scene_segmented_image_item::initialize_buffers()
|
Scene_segmented_image_item::initializeBuffers()
|
||||||
{
|
{
|
||||||
internal::Image_accessor image_data_accessor (*m_image,
|
internal::Image_accessor image_data_accessor (*m_image,
|
||||||
m_voxel_scale,
|
m_voxel_scale,
|
||||||
|
|
@ -732,7 +732,7 @@ Scene_segmented_image_item::initialize_buffers()
|
||||||
void
|
void
|
||||||
Scene_segmented_image_item::draw_gl(Viewer_interface* viewer) const
|
Scene_segmented_image_item::draw_gl(Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
attrib_buffers(viewer);
|
attribBuffers(viewer);
|
||||||
rendering_program.bind();
|
rendering_program.bind();
|
||||||
vao[0].bind();
|
vao[0].bind();
|
||||||
viewer->glDrawElements(GL_TRIANGLES, m_ibo->size()/sizeof(GLuint), GL_UNSIGNED_INT, 0);
|
viewer->glDrawElements(GL_TRIANGLES, m_ibo->size()/sizeof(GLuint), GL_UNSIGNED_INT, 0);
|
||||||
|
|
@ -759,7 +759,7 @@ Scene_segmented_image_item::ibo_size() const
|
||||||
|
|
||||||
void Scene_segmented_image_item::changed()
|
void Scene_segmented_image_item::changed()
|
||||||
{
|
{
|
||||||
initialize_buffers();
|
initializeBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_segmented_image_item::draw_Bbox(Bbox bbox, std::vector<float> *vertices)
|
void Scene_segmented_image_item::draw_Bbox(Bbox bbox, std::vector<float> *vertices)
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,10 @@ public:
|
||||||
// draw
|
// draw
|
||||||
virtual void direct_draw(CGAL::Three::Viewer_interface* viewer) const
|
virtual void direct_draw(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{ draw(viewer); }
|
{ draw(viewer); }
|
||||||
virtual void direct_draw_edges(CGAL::Three::Viewer_interface* viewer) const
|
virtual void direct_drawEdges(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{ draw_edges(viewer); }
|
{ drawEdges(viewer); }
|
||||||
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
||||||
virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const
|
virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const
|
||||||
{ draw_gl(viewer); }
|
{ draw_gl(viewer); }
|
||||||
|
|
||||||
virtual QString toolTip() const;
|
virtual QString toolTip() const;
|
||||||
|
|
@ -49,7 +49,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void draw_gl(CGAL::Three::Viewer_interface* viewer) const;
|
void draw_gl(CGAL::Three::Viewer_interface* viewer) const;
|
||||||
|
|
||||||
void initialize_buffers();
|
void initializeBuffers();
|
||||||
GLint ibo_size() const;
|
GLint ibo_size() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -78,7 +78,7 @@ private:
|
||||||
mutable QOpenGLVertexArrayObject vao[vaoSize];
|
mutable QOpenGLVertexArrayObject vao[vaoSize];
|
||||||
mutable QOpenGLShaderProgram rendering_program;
|
mutable QOpenGLShaderProgram rendering_program;
|
||||||
void draw_bbox();
|
void draw_bbox();
|
||||||
void attrib_buffers(CGAL::Three::Viewer_interface*) const;
|
void attribBuffers(CGAL::Three::Viewer_interface*) const;
|
||||||
void compile_shaders();
|
void compile_shaders();
|
||||||
void draw_Bbox(Bbox bbox, std::vector<float> *vertices);
|
void draw_Bbox(Bbox bbox, std::vector<float> *vertices);
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
typedef EPIC_kernel::Point_3 Point;
|
typedef EPIC_kernel::Point_3 Point;
|
||||||
|
|
||||||
|
|
||||||
void Scene_textured_polyhedron_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const
|
void Scene_textured_polyhedron_item::initializeBuffers(CGAL::Three::Viewer_interface *viewer = 0) const
|
||||||
{
|
{
|
||||||
if(GLuint(-1) == textureId) {
|
if(GLuint(-1) == textureId) {
|
||||||
viewer->glGenTextures(1, &textureId);
|
viewer->glGenTextures(1, &textureId);
|
||||||
|
|
@ -293,13 +293,13 @@ void Scene_textured_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer)
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_normals_and_vertices();
|
compute_normals_and_vertices();
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
vaos[Facets]->bind();
|
vaos[Facets]->bind();
|
||||||
viewer->glActiveTexture(GL_TEXTURE0);
|
viewer->glActiveTexture(GL_TEXTURE0);
|
||||||
viewer->glBindTexture(GL_TEXTURE_2D, textureId);
|
viewer->glBindTexture(GL_TEXTURE_2D, textureId);
|
||||||
attrib_buffers(viewer, PROGRAM_WITH_TEXTURE);
|
attribBuffers(viewer, PROGRAM_WITH_TEXTURE);
|
||||||
program=getShaderProgram(PROGRAM_WITH_TEXTURE);
|
program=getShaderProgram(PROGRAM_WITH_TEXTURE);
|
||||||
program->bind();
|
program->bind();
|
||||||
viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/4));
|
viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/4));
|
||||||
|
|
@ -307,14 +307,14 @@ void Scene_textured_polyhedron_item::draw(CGAL::Three::Viewer_interface* viewer)
|
||||||
program->release();
|
program->release();
|
||||||
vaos[Facets]->release();
|
vaos[Facets]->release();
|
||||||
}
|
}
|
||||||
void Scene_textured_polyhedron_item::draw_edges(CGAL::Three::Viewer_interface* viewer) const {
|
void Scene_textured_polyhedron_item::drawEdges(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
|
|
||||||
vaos[Edges]->bind();
|
vaos[Edges]->bind();
|
||||||
viewer->glActiveTexture(GL_TEXTURE0);
|
viewer->glActiveTexture(GL_TEXTURE0);
|
||||||
viewer->glBindTexture(GL_TEXTURE_2D, textureId);
|
viewer->glBindTexture(GL_TEXTURE_2D, textureId);
|
||||||
attrib_buffers(viewer, PROGRAM_WITH_TEXTURED_EDGES);
|
attribBuffers(viewer, PROGRAM_WITH_TEXTURED_EDGES);
|
||||||
|
|
||||||
program=getShaderProgram(PROGRAM_WITH_TEXTURED_EDGES);
|
program=getShaderProgram(PROGRAM_WITH_TEXTURED_EDGES);
|
||||||
program->bind();
|
program->bind();
|
||||||
|
|
@ -358,7 +358,7 @@ Scene_textured_polyhedron_item::selection_changed(bool p_is_selected)
|
||||||
if(p_is_selected != is_selected)
|
if(p_is_selected != is_selected)
|
||||||
{
|
{
|
||||||
is_selected = p_is_selected;
|
is_selected = p_is_selected;
|
||||||
initialize_buffers();
|
initializeBuffers();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
is_selected = p_is_selected;
|
is_selected = p_is_selected;
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ public:
|
||||||
// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
|
// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
|
||||||
void draw() const {}
|
void draw() const {}
|
||||||
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
||||||
virtual void draw_edges() const {}
|
virtual void drawEdges() const {}
|
||||||
virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const;
|
virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const;
|
||||||
|
|
||||||
// Get wrapped textured_polyhedron
|
// Get wrapped textured_polyhedron
|
||||||
Textured_polyhedron* textured_polyhedron();
|
Textured_polyhedron* textured_polyhedron();
|
||||||
|
|
@ -78,8 +78,8 @@ private:
|
||||||
|
|
||||||
bool smooth_shading;
|
bool smooth_shading;
|
||||||
|
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer) const;
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer) const;
|
||||||
void compute_normals_and_vertices(void) const;
|
void compute_normals_and_vertices(void) const;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -426,7 +426,7 @@ QString Viewer::dumpCameraCoordinates()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::attrib_buffers(int program_name) const {
|
void Viewer::attribBuffers(int program_name) const {
|
||||||
GLint is_both_sides = 0;
|
GLint is_both_sides = 0;
|
||||||
//ModelViewMatrix used for the transformation of the camera.
|
//ModelViewMatrix used for the transformation of the camera.
|
||||||
QMatrix4x4 mvp_mat;
|
QMatrix4x4 mvp_mat;
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,8 @@ public:
|
||||||
bool inFastDrawing() const;
|
bool inFastDrawing() const;
|
||||||
//! Implementation of `Viewer_interface::inDrawWithNames()`
|
//! Implementation of `Viewer_interface::inDrawWithNames()`
|
||||||
bool inDrawWithNames() const;
|
bool inDrawWithNames() const;
|
||||||
//! Implementation of `Viewer_interface::attrib_buffers()`
|
//! Implementation of `Viewer_interface::attribBuffers()`
|
||||||
void attrib_buffers(int program_name) const;
|
void attribBuffers(int program_name) const;
|
||||||
//! Implementation of `Viewer_interface::getShaderProgram()`
|
//! Implementation of `Viewer_interface::getShaderProgram()`
|
||||||
QOpenGLShaderProgram* getShaderProgram(int name) const;
|
QOpenGLShaderProgram* getShaderProgram(int name) const;
|
||||||
|
|
||||||
|
|
@ -112,6 +112,7 @@ protected:
|
||||||
void keyPressEvent(QKeyEvent*);
|
void keyPressEvent(QKeyEvent*);
|
||||||
//!Deal with context menu events
|
//!Deal with context menu events
|
||||||
void contextMenuEvent(QContextMenuEvent*);
|
void contextMenuEvent(QContextMenuEvent*);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief makeArrow creates an arrow and stores it in a struct of vectors.
|
* \brief makeArrow creates an arrow and stores it in a struct of vectors.
|
||||||
* \param R the radius of the arrow.
|
* \param R the radius of the arrow.
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ private Q_SLOTS:
|
||||||
scene->changeGroup(item, group);
|
scene->changeGroup(item, group);
|
||||||
scene->changeGroup(new_item,group);
|
scene->changeGroup(new_item,group);
|
||||||
//adds it to the scene
|
//adds it to the scene
|
||||||
scene->add_group(group);
|
scene->addGroup(group);
|
||||||
//! [group]
|
//! [group]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include "ui_Basic_dock_widget.h"
|
#include "ui_Basic_dock_widget.h"
|
||||||
#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
|
#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
@ -22,7 +22,7 @@ public:
|
||||||
//This plugin crates an action in Operations that displays "Hello World" in the 'console' dockwidet.
|
//This plugin crates an action in Operations that displays "Hello World" in the 'console' dockwidet.
|
||||||
class BasicPlugin :
|
class BasicPlugin :
|
||||||
public QObject,
|
public QObject,
|
||||||
public CGAL::Three::Polyhedron_demo_plugin_interface
|
public CGAL::Three::Polyhedron_demo_plugin_helper
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||||
|
|
@ -60,7 +60,7 @@ public:
|
||||||
dock_widget = new DockWidget("Print a number", mw);
|
dock_widget = new DockWidget("Print a number", mw);
|
||||||
dock_widget->setVisible(false); // do not show at the beginning
|
dock_widget->setVisible(false); // do not show at the beginning
|
||||||
|
|
||||||
mw->addDockWidget(Qt::LeftDockWidgetArea, dock_widget);
|
add_dock_widget(dock_widget);
|
||||||
|
|
||||||
connect(dock_widget->pushButton, SIGNAL(clicked(bool)),
|
connect(dock_widget->pushButton, SIGNAL(clicked(bool)),
|
||||||
this, SLOT(on_dock_button_clicked()));
|
this, SLOT(on_dock_button_clicked()));
|
||||||
|
|
@ -99,10 +99,6 @@ private:
|
||||||
QList<QAction*> _actions;
|
QList<QAction*> _actions;
|
||||||
Messages_interface* messageInterface;
|
Messages_interface* messageInterface;
|
||||||
DockWidget* dock_widget;
|
DockWidget* dock_widget;
|
||||||
//The reference to the scene
|
|
||||||
CGAL::Three::Scene_interface* scene;
|
|
||||||
//The reference to the main window
|
|
||||||
QMainWindow* mw;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "Dock_widget_plugin.moc"
|
#include "Dock_widget_plugin.moc"
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ public :
|
||||||
void invalidateOpenGLBuffers();
|
void invalidateOpenGLBuffers();
|
||||||
|
|
||||||
//fills the std::vector
|
//fills the std::vector
|
||||||
void compute_elements(double ax,double ay, double az,
|
void computeElements(double ax,double ay, double az,
|
||||||
double bx,double by, double bz,
|
double bx,double by, double bz,
|
||||||
double cx,double cy, double cz) const;
|
double cx,double cy, double cz) const;
|
||||||
|
|
||||||
|
|
@ -45,9 +45,9 @@ private:
|
||||||
mutable std::vector<float> vertices;
|
mutable std::vector<float> vertices;
|
||||||
mutable int nb_pos;
|
mutable int nb_pos;
|
||||||
mutable QOpenGLShaderProgram *program;
|
mutable QOpenGLShaderProgram *program;
|
||||||
using CGAL::Three::Scene_item::initialize_buffers;
|
using CGAL::Three::Scene_item::initializeBuffers;
|
||||||
//Fills the buffers with data. The buffers allow us to give data to the shaders.
|
//Fills the buffers with data. The buffers allow us to give data to the shaders.
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer)const;
|
void initializeBuffers(CGAL::Three::Viewer_interface *viewer)const;
|
||||||
}; //end of class Scene_triangle_item
|
}; //end of class Scene_triangle_item
|
||||||
//! [itemdeclaration]
|
//! [itemdeclaration]
|
||||||
Scene_triangle_item::Scene_triangle_item(double ax,double ay, double az,
|
Scene_triangle_item::Scene_triangle_item(double ax,double ay, double az,
|
||||||
|
|
@ -60,7 +60,7 @@ Scene_triangle_item::Scene_triangle_item(double ax,double ay, double az,
|
||||||
is_monochrome = true;
|
is_monochrome = true;
|
||||||
nb_pos = 0;
|
nb_pos = 0;
|
||||||
are_buffers_filled = false;
|
are_buffers_filled = false;
|
||||||
compute_elements(ax, ay, az,
|
computeElements(ax, ay, az,
|
||||||
bx, by, bz,
|
bx, by, bz,
|
||||||
cx, cy, cz);
|
cx, cy, cz);
|
||||||
invalidateOpenGLBuffers();
|
invalidateOpenGLBuffers();
|
||||||
|
|
@ -68,7 +68,7 @@ Scene_triangle_item::Scene_triangle_item(double ax,double ay, double az,
|
||||||
|
|
||||||
//! [computeelements]
|
//! [computeelements]
|
||||||
//Fills the position vector with data.
|
//Fills the position vector with data.
|
||||||
void Scene_triangle_item::compute_elements(double ax, double ay, double az,
|
void Scene_triangle_item::computeElements(double ax, double ay, double az,
|
||||||
double bx, double by, double bz,
|
double bx, double by, double bz,
|
||||||
double cx, double cy, double cz)const
|
double cx, double cy, double cz)const
|
||||||
{
|
{
|
||||||
|
|
@ -86,10 +86,10 @@ void Scene_triangle_item::draw(CGAL::Three::Viewer_interface* viewer) const
|
||||||
//The filling of the buffers should be performed in this function, because it needs a valid openGL context, and we are certain to have one in this function.
|
//The filling of the buffers should be performed in this function, because it needs a valid openGL context, and we are certain to have one in this function.
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
{
|
{
|
||||||
compute_elements(0, 0, 0,
|
computeElements(0, 0, 0,
|
||||||
1, 0, 0,
|
1, 0, 0,
|
||||||
0.5, 0.5, 0);
|
0.5, 0.5, 0);
|
||||||
initialize_buffers(viewer);
|
initializeBuffers(viewer);
|
||||||
}
|
}
|
||||||
//Binds the vao corresponding to the type of data we are drawing.
|
//Binds the vao corresponding to the type of data we are drawing.
|
||||||
vaos[0]->bind();
|
vaos[0]->bind();
|
||||||
|
|
@ -97,7 +97,7 @@ void Scene_triangle_item::draw(CGAL::Three::Viewer_interface* viewer) const
|
||||||
//Here we want triangles with light effects.
|
//Here we want triangles with light effects.
|
||||||
program = getShaderProgram(PROGRAM_WITH_LIGHT);
|
program = getShaderProgram(PROGRAM_WITH_LIGHT);
|
||||||
//Gives most of the uniform values to the shaders.
|
//Gives most of the uniform values to the shaders.
|
||||||
attrib_buffers(viewer, PROGRAM_WITH_LIGHT);
|
attribBuffers(viewer, PROGRAM_WITH_LIGHT);
|
||||||
//Binds the program chosen before to use the right shaders.
|
//Binds the program chosen before to use the right shaders.
|
||||||
program->bind();
|
program->bind();
|
||||||
//Gives the wanted color to the fragment shader as uniform value.
|
//Gives the wanted color to the fragment shader as uniform value.
|
||||||
|
|
@ -119,7 +119,7 @@ void Scene_triangle_item::invalidateOpenGLBuffers()
|
||||||
|
|
||||||
|
|
||||||
//! [fillbuffers]
|
//! [fillbuffers]
|
||||||
void Scene_triangle_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer)const
|
void Scene_triangle_item::initializeBuffers(CGAL::Three::Viewer_interface *viewer)const
|
||||||
{
|
{
|
||||||
|
|
||||||
//vao containing the data for the facets
|
//vao containing the data for the facets
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ private Q_SLOTS:
|
||||||
//Then gives it its children
|
//Then gives it its children
|
||||||
scene->changeGroup(child, group);
|
scene->changeGroup(child, group);
|
||||||
//adds it to the scene
|
//adds it to the scene
|
||||||
scene->add_group(group);
|
scene->addGroup(group);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,156 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>Dock_example</class>
|
|
||||||
<widget class="QDockWidget" name="Dock_example">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>275</width>
|
|
||||||
<height>222</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>58</width>
|
|
||||||
<height>200</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>DockWidget</string>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="dockWidgetContents">
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>150</y>
|
|
||||||
<width>261</width>
|
|
||||||
<height>32</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="gridLayoutWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>10</y>
|
|
||||||
<width>261</width>
|
|
||||||
<height>121</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="3" column="3">
|
|
||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_Cz"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_Bx"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="2">
|
|
||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_By"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="3">
|
|
||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_Cy"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_Ay"/>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="2">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Point C</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Point A</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3">
|
|
||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_Cx"/>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_Az"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Point B</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="2">
|
|
||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_Bz"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_Ax"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>X</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>Y</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>Z</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="4">
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
||||||
|
|
@ -6,9 +6,9 @@ namespace CGAL {
|
||||||
\cgalAutoToc
|
\cgalAutoToc
|
||||||
\author Laurent Rineau, Sebastien Loriot, Andreas Fabri, Maxime Gimeno
|
\author Laurent Rineau, Sebastien Loriot, Andreas Fabri, Maxime Gimeno
|
||||||
|
|
||||||
|
This package regroups the files making the API for creating and adding a new plugin to the Polyhedron_demo. \n
|
||||||
\section intro Understanding the Polyhedron Demo
|
\section intro Understanding the Polyhedron Demo
|
||||||
|
|
||||||
These pages are not documenting the whole Polyhedron demo but only the API that is useful to create and add a new plugin.
|
|
||||||
|
|
||||||
There are several levels in this demo.
|
There are several levels in this demo.
|
||||||
|
|
||||||
|
|
@ -16,15 +16,15 @@ There are several levels in this demo.
|
||||||
|
|
||||||
- Among these elements is the `Viewer`, which is the drawable surface that handles all the drawing and all the keyboard and mouse events.
|
- Among these elements is the `Viewer`, which is the drawable surface that handles all the drawing and all the keyboard and mouse events.
|
||||||
|
|
||||||
- The `Viewer` has a reference to the `Scene`, which contains the `Scene_item` list, which is a list of the drawn elements.
|
- The `Viewer` has a reference to a `CGAL::Three::Scene_interface`, which contains a list of all the items (the drawn elements).
|
||||||
|
|
||||||
A plugin usually defines an object that inherits from `Scene_item` or uses some of them to demonstrate a \cgal feature, so it might have to deal with the above elements.
|
A plugin usually defines an object that inherits from `CGAL::Three::Scene_item` or uses some of them to demonstrate a \cgal feature, so it might have to deal with the above elements.
|
||||||
|
|
||||||
\section examplePlugin Creating a Simple Plugin
|
\section examplePlugin Creating a Simple Plugin
|
||||||
|
|
||||||
\subsection examplePluginItself The Plugin Itself
|
\subsection examplePluginItself The Plugin Itself
|
||||||
|
|
||||||
A basic plugin will inherit from `Polyhedron_demo_plugin_interface`. It must be created in a folder named Xxxx_yyyy_plugin containing all the files created for it, and a CMakeLists.txt file.
|
A basic plugin will inherit from `CGAL::Three::Polyhedron_demo_plugin_interface`. It must be created in a folder named Xxxx_yyyy_plugin containing all the files created for it, and a CMakeLists.txt file.
|
||||||
Its name must be of the form Xxxx_yyyy_plugin. \n
|
Its name must be of the form Xxxx_yyyy_plugin. \n
|
||||||
|
|
||||||
[init]: @ref CGAL::Three::Polyhedron_demo_plugin_interface#init(QMainWindow *, Scene_interface *)
|
[init]: @ref CGAL::Three::Polyhedron_demo_plugin_interface#init(QMainWindow *, Scene_interface *)
|
||||||
|
|
@ -32,9 +32,11 @@ Its name must be of the form Xxxx_yyyy_plugin. \n
|
||||||
[actions]: @ref CGAL::Three::Polyhedron_demo_plugin_interface#actions()
|
[actions]: @ref CGAL::Three::Polyhedron_demo_plugin_interface#actions()
|
||||||
The class must contain the following lines :\n
|
The class must contain the following lines :\n
|
||||||
|
|
||||||
Q_OBJECT\n
|
~~~~~~~~~~~~~{.cpp}
|
||||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)\n
|
Q_OBJECT
|
||||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")\n
|
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||||
|
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||||
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
Your plugin must override the three pure virtual functions inherited from Polyhedron_demo_plugin_interface : \n
|
Your plugin must override the three pure virtual functions inherited from Polyhedron_demo_plugin_interface : \n
|
||||||
- [actions] that will hold the actions of the plugin
|
- [actions] that will hold the actions of the plugin
|
||||||
|
|
@ -94,7 +96,7 @@ then add the following line to your plugin file:
|
||||||
#include "ui_Xxxx_yyyy_plugin.h"
|
#include "ui_Xxxx_yyyy_plugin.h"
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
You can then add a new class to your cpp file, inheriting from `QDialog` and your own dialog, accessible with "Ui::".
|
You can then add a new class to your cpp file, inheriting from `QDialog` and your own dialog, accessible with "Ui::". \n
|
||||||
Add the macro `Q_OBJECT` and the line
|
Add the macro `Q_OBJECT` and the line
|
||||||
`setupUi(this)`
|
`setupUi(this)`
|
||||||
in your constructor.
|
in your constructor.
|
||||||
|
|
@ -111,7 +113,9 @@ It is really simple to add a pop-up box with Qt. Use a QMessageBox and give it s
|
||||||
|
|
||||||
\subsection examplePluginDockWidget Adding a Dock Widget
|
\subsection examplePluginDockWidget Adding a Dock Widget
|
||||||
|
|
||||||
This section describes how to add a dock widget to the application.
|
This section describes how to add a dock widget to the application.\n
|
||||||
|
You can make your plugin inherit from CGAL::Three::Polyhedron_demo_plugin_helper, which gives acces to the function CGAL::Three::Polyhedron_demo_plugin_helper#addDockWidget.
|
||||||
|
This will manage automatically the position and tabification of a dock widget. \n
|
||||||
Just like with the Dialog, create a new Qt Designer form (file->New file or Project->Qt->Qt Designer Form), choose `QDockWidget in Widgets
|
Just like with the Dialog, create a new Qt Designer form (file->New file or Project->Qt->Qt Designer Form), choose `QDockWidget in Widgets
|
||||||
* \image html menu_6.png
|
* \image html menu_6.png
|
||||||
Add it to the project in the CMakeLists.txt :
|
Add it to the project in the CMakeLists.txt :
|
||||||
|
|
@ -164,7 +168,9 @@ This Scene_interface will give you access to the following functions :
|
||||||
- [item]
|
- [item]
|
||||||
- [item_id]
|
- [item_id]
|
||||||
|
|
||||||
that give you access to any item in the scene. Example of use :
|
that give you access to any item in the scene.
|
||||||
|
|
||||||
|
Example of use :
|
||||||
\snippet Three/Example_plugin/Basic_item_plugin.cpp use
|
\snippet Three/Example_plugin/Basic_item_plugin.cpp use
|
||||||
|
|
||||||
Don't forget to adapt your [applicable] function :
|
Don't forget to adapt your [applicable] function :
|
||||||
|
|
@ -202,13 +208,14 @@ An item is simply a graphic representation of a geometric data set. You need to
|
||||||
\snippet Three/Example_plugin/Example_plugin.cpp itemdeclaration
|
\snippet Three/Example_plugin/Example_plugin.cpp itemdeclaration
|
||||||
|
|
||||||
The minimalist item above is designed to draw a simple triangle. There are several steps that need to be followed when creating an item :
|
The minimalist item above is designed to draw a simple triangle. There are several steps that need to be followed when creating an item :
|
||||||
|
|
||||||
<b> - Computing the data </b>
|
<b> - Computing the data </b>
|
||||||
|
|
||||||
One way to store the data you computed is to use member std::vectors. It must be done every time a change occurs in the item's geometry, using the function invalidateOpenGLBuffers.
|
One way to store the data you computed is to use member std::vectors. It must be done every time a change occurs in the item's geometry (usually done in a function called invalidateOpenGLBuffers).
|
||||||
|
|
||||||
\snippet Three/Example_plugin/Example_plugin.cpp computeelements
|
\snippet Three/Example_plugin/Example_plugin.cpp computeelements
|
||||||
|
|
||||||
<b> - Filling the openGL buffers </b>
|
<b> - Filling the OpenGL buffers </b>
|
||||||
|
|
||||||
The application uses OpenGL VBOs to display the geometry. Those are buffers that will stream their data to the GPU. This step consists to put the data stored in the std::vectors in those buffers.
|
The application uses OpenGL VBOs to display the geometry. Those are buffers that will stream their data to the GPU. This step consists to put the data stored in the std::vectors in those buffers.
|
||||||
In this exemple, we only need one VBO and one VAO, as we are only storing one kind of data. But if we wanted to store normals and colors, for instance, we would need as much VBOs, and if there were
|
In this exemple, we only need one VBO and one VAO, as we are only storing one kind of data. But if we wanted to store normals and colors, for instance, we would need as much VBOs, and if there were
|
||||||
|
|
@ -222,14 +229,14 @@ The code above gets a ShaderProgram, that holds the characteristics of the displ
|
||||||
<b> - Displaying the data </b>
|
<b> - Displaying the data </b>
|
||||||
|
|
||||||
[draw]: @ref CGAL::Three::Scene_item#draw
|
[draw]: @ref CGAL::Three::Scene_item#draw
|
||||||
[draw_points]: @ref CGAL::Three::Scene_item#draw_points
|
[drawPoints]: @ref CGAL::Three::Scene_item#drawPoints
|
||||||
[draw_edges]: @ref CGAL::Three::Scene_item#draw_edges
|
[drawEdges]: @ref CGAL::Three::Scene_item#drawEdges
|
||||||
Originally, it's the viewer that requires displaying. It calls the scene, that calls each visible item's [draw],[draw_edges] and [draw_points] functions individually.
|
Originally, it's the viewer that requires displaying. It calls the scene, that calls each visible item's [draw],[drawEdges] and [drawPoints] functions individually.
|
||||||
Therefore, this is in those functions that the display of the data must be handled :
|
Therefore, this is in those functions that the display of the data must be handled :
|
||||||
|
|
||||||
\snippet Three/Example_plugin/Example_plugin.cpp draw
|
\snippet Three/Example_plugin/Example_plugin.cpp draw
|
||||||
|
|
||||||
to display, you need to call the same program that got configured previously, and to bind it before you call the OpenGL drawing function.
|
To display, you need to call the same program that got configured previously, and to bind it before you call the OpenGL drawing function.
|
||||||
|
|
||||||
|
|
||||||
\subsection exampleUsingAGroupItem Using a Scene_group_item
|
\subsection exampleUsingAGroupItem Using a Scene_group_item
|
||||||
|
|
@ -329,7 +336,7 @@ Configure CMake as you desire and fetch the right Qt5 packages :
|
||||||
COMPONENTS OpenGL Script Svg Xml
|
COMPONENTS OpenGL Script Svg Xml
|
||||||
OPTIONAL_COMPONENTS ScriptTools)
|
OPTIONAL_COMPONENTS ScriptTools)
|
||||||
|
|
||||||
You will probably have to fetch the libraries exported by the polyhedron_demo, like the scene_items.
|
You will probably have to fetch the libraries exported by the Polyhedron_demo, like the Scene_items.
|
||||||
|
|
||||||
find_package(CGAL_polyhedron_demo
|
find_package(CGAL_polyhedron_demo
|
||||||
HINTS "${CGAL_DIR}" "${CGAL_DIR}/Polyhedron/demo/Polyhedron-build"
|
HINTS "${CGAL_DIR}" "${CGAL_DIR}/Polyhedron/demo/Polyhedron-build"
|
||||||
|
|
@ -342,7 +349,7 @@ Finally, you can declare your plugin
|
||||||
|
|
||||||
Notice that an external plugin will not be automatically loaded in the Polyhedron demo. It must be built in its own project.
|
Notice that an external plugin will not be automatically loaded in the Polyhedron demo. It must be built in its own project.
|
||||||
|
|
||||||
<b> Complete CMakeLists </b>
|
<b> Complete CMakeLists :</b>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 219 KiB After Width: | Height: | Size: 148 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 203 KiB After Width: | Height: | Size: 138 KiB |
|
|
@ -54,7 +54,7 @@ public:
|
||||||
* \return NULL if none is found
|
* \return NULL if none is found
|
||||||
*/
|
*/
|
||||||
template<class SceneType>
|
template<class SceneType>
|
||||||
SceneType* get_selected_item() const{
|
SceneType* getSelectedItem() const{
|
||||||
int item_id = scene->mainSelectionIndex();
|
int item_id = scene->mainSelectionIndex();
|
||||||
SceneType* scene_item = qobject_cast<SceneType*>(scene->item(item_id));
|
SceneType* scene_item = qobject_cast<SceneType*>(scene->item(item_id));
|
||||||
if(!scene_item) {
|
if(!scene_item) {
|
||||||
|
|
@ -78,7 +78,7 @@ public:
|
||||||
*
|
*
|
||||||
* Adds a dock widget in the left section of the MainWindow. If the slot is already taken, the dock widgets will be tabified.
|
* Adds a dock widget in the left section of the MainWindow. If the slot is already taken, the dock widgets will be tabified.
|
||||||
*/
|
*/
|
||||||
void add_dock_widget(QDockWidget* dock);
|
void addDockWidget(QDockWidget* dock);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//!The reference to the scene
|
//!The reference to the scene
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ public:
|
||||||
* moment this function is called, they are added to the group.
|
* moment this function is called, they are added to the group.
|
||||||
* If all the selected items were in the same group, the new group
|
* If all the selected items were in the same group, the new group
|
||||||
* is added as a sub-group of this group.*/
|
* is added as a sub-group of this group.*/
|
||||||
virtual void add_group(Scene_group_item* group) = 0;
|
virtual void addGroup(Scene_group_item* group) = 0;
|
||||||
|
|
||||||
}; // end interface Scene_interface
|
}; // end interface Scene_interface
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,9 @@ class SCENE_ITEM_EXPORT Scene_item : public QObject {
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief The OpenGL_program_IDs enum
|
* \brief The OpenGL_program_IDs enum
|
||||||
* This enum holds the OpenGL programs IDs that are given to getShaderProgram() and attrib_buffers().
|
* This enum holds the OpenGL programs IDs that are given to getShaderProgram() and attribBuffers().
|
||||||
*@see getShaderProgram
|
*@see getShaderProgram
|
||||||
* @see attrib_buffers
|
* @see attribBuffers
|
||||||
*/
|
*/
|
||||||
enum OpenGL_program_IDs
|
enum OpenGL_program_IDs
|
||||||
{
|
{
|
||||||
|
|
@ -103,37 +103,37 @@ public:
|
||||||
virtual void draw() const {}
|
virtual void draw() const {}
|
||||||
/*! \brief The drawing function.
|
/*! \brief The drawing function.
|
||||||
* Draws the facets of the item in the viewer using OpenGL functions. The data
|
* Draws the facets of the item in the viewer using OpenGL functions. The data
|
||||||
* for the drawing is gathered in compute_elements(), and is sent
|
* for the drawing is gathered in computeElements(), and is sent
|
||||||
* to buffers in initialize_buffers().
|
* to buffers in initializeBuffers().
|
||||||
* @see compute_elements()
|
* @see computeElements()
|
||||||
* @see initialize_buffers()
|
* @see initializeBuffers()
|
||||||
*/
|
*/
|
||||||
virtual void draw(CGAL::Three::Viewer_interface*) const { draw(); }
|
virtual void draw(CGAL::Three::Viewer_interface*) const { draw(); }
|
||||||
//! Deprecated. Does nothing.
|
//! Deprecated. Does nothing.
|
||||||
virtual void draw_edges() const { draw(); }
|
virtual void drawEdges() const { draw(); }
|
||||||
/*! \brief The drawing function.
|
/*! \brief The drawing function.
|
||||||
* Draws the edges and lines of the item in the viewer using OpenGL functions. The data
|
* Draws the edges and lines of the item in the viewer using OpenGL functions. The data
|
||||||
* for the drawing is gathered in compute_elements(), and is sent
|
* for the drawing is gathered in computeElements(), and is sent
|
||||||
* to buffers in initialize_buffers().
|
* to buffers in initializeBuffers().
|
||||||
* @see compute_elements()
|
* @see computeElements()
|
||||||
* @see initialize_buffers()
|
* @see initializeBuffers()
|
||||||
*/
|
*/
|
||||||
virtual void draw_edges(CGAL::Three::Viewer_interface* viewer) const { draw(viewer); }
|
virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const { draw(viewer); }
|
||||||
//! Deprecated. Does nothing.
|
//! Deprecated. Does nothing.
|
||||||
virtual void draw_points() const { draw(); }
|
virtual void drawPoints() const { draw(); }
|
||||||
/*! \brief The drawing function.
|
/*! \brief The drawing function.
|
||||||
* Draws the points of the item in the viewer using OpenGL functions. The data
|
* Draws the points of the item in the viewer using OpenGL functions. The data
|
||||||
* for the drawing is gathered in compute_elements(), and is sent
|
* for the drawing is gathered in computeElements(), and is sent
|
||||||
* to buffers in initialize_buffers().
|
* to buffers in initializeBuffers().
|
||||||
* @see compute_elements()
|
* @see computeElements()
|
||||||
* @see initialize_buffers()
|
* @see initializeBuffers()
|
||||||
*/
|
*/
|
||||||
virtual void draw_points(CGAL::Three::Viewer_interface*) const { draw_points(); }
|
virtual void drawPoints(CGAL::Three::Viewer_interface*) const { drawPoints(); }
|
||||||
|
|
||||||
//! Draws the splats of the item in the viewer using GLSplat functions.
|
//! Draws the splats of the item in the viewer using GLSplat functions.
|
||||||
virtual void draw_splats() const {}
|
virtual void drawSplats() const {}
|
||||||
//! Draws the splats of the item in the viewer using GLSplat functions.
|
//! Draws the splats of the item in the viewer using GLSplat functions.
|
||||||
virtual void draw_splats(CGAL::Three::Viewer_interface*) const {draw_splats();}
|
virtual void drawSplats(CGAL::Three::Viewer_interface*) const {drawSplats();}
|
||||||
|
|
||||||
//! Called by the scene. If b is true, then this item is currently selected.
|
//! Called by the scene. If b is true, then this item is currently selected.
|
||||||
virtual void selection_changed(bool b);
|
virtual void selection_changed(bool b);
|
||||||
|
|
@ -230,12 +230,12 @@ public:
|
||||||
* | |_______|_____|
|
* | |_______|_____|
|
||||||
* |General Info | #Edges|12 |
|
* |General Info | #Edges|12 |
|
||||||
* |_____________|_______|_____|
|
* |_____________|_______|_____|
|
||||||
* compute stats(0) should return "Cube" and compute_stats(1) should return QString::number(12);
|
* compute stats(0) should return "Cube" and computeStats(1) should return QString::number(12);
|
||||||
* The numbers must be coherent with the order of declaration of the titles in the header.
|
* The numbers must be coherent with the order of declaration of the titles in the header.
|
||||||
* \endverbatim
|
* \endverbatim
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
virtual QString compute_stats(int i);
|
virtual QString computeStats(int i);
|
||||||
|
|
||||||
//!Contains the number of group and subgroups containing this item.
|
//!Contains the number of group and subgroups containing this item.
|
||||||
int has_group;
|
int has_group;
|
||||||
|
|
@ -345,11 +345,11 @@ protected:
|
||||||
//! Holds the number of vertices that are not linked to the polyhedron from the OFF
|
//! Holds the number of vertices that are not linked to the polyhedron from the OFF
|
||||||
//! file.
|
//! file.
|
||||||
std::size_t nb_isolated_vertices;
|
std::size_t nb_isolated_vertices;
|
||||||
/*! Decides if the draw function must call initialize_buffers() or not. It is set
|
/*! Decides if the draw function must call initializeBuffers() or not. It is set
|
||||||
* to true in the end of initialize_buffers() and to false in invalidateOpenGLBuffers(). The need of
|
* to true in the end of initializeBuffers() and to false in invalidateOpenGLBuffers(). The need of
|
||||||
* this boolean comes from the need of a context from the OpenGLFunctions used in
|
* this boolean comes from the need of a context from the OpenGLFunctions used in
|
||||||
* initialize_buffers().
|
* initializeBuffers().
|
||||||
* @see initialize_buffers()
|
* @see initializeBuffers()
|
||||||
* @see invalidateOpenGLBuffers()
|
* @see invalidateOpenGLBuffers()
|
||||||
*/
|
*/
|
||||||
mutable bool are_buffers_filled;
|
mutable bool are_buffers_filled;
|
||||||
|
|
@ -386,20 +386,27 @@ protected:
|
||||||
vaos[i] = n_vao;
|
vaos[i] = n_vao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! Fills the VBOs with data. Must be called after each call to #compute_elements().
|
/*! Fills the VBOs with data. Must be called after each call to #compute_elements().
|
||||||
* @see compute_elements()
|
* @see compute_elements()
|
||||||
|
//! Used pass data to the shader.
|
||||||
|
int vertexLoc;
|
||||||
|
//! Used pass data to the shader.
|
||||||
|
int normalLoc;
|
||||||
|
//! Used pass data to the shader.
|
||||||
|
int colorLoc;
|
||||||
|
/*! Fills the VBOs with data. Must be called after each call to #computeElements().
|
||||||
|
* @see computeElements()
|
||||||
*/
|
*/
|
||||||
void initialize_buffers(){}
|
void initializeBuffers(){}
|
||||||
|
|
||||||
/*! Collects all the data for the shaders. Must be called in #invalidateOpenGLBuffers().
|
/*! Collects all the data for the shaders. Must be called in #invalidateOpenGLBuffers().
|
||||||
* @see invalidateOpenGLBuffers().
|
* @see invalidateOpenGLBuffers().
|
||||||
*/
|
*/
|
||||||
void compute_elements(){}
|
void computeElements(){}
|
||||||
/*! Passes all the uniform data to the shaders.
|
/*! Passes all the uniform data to the shaders.
|
||||||
* According to program_name, this data may change.
|
* According to program_name, this data may change.
|
||||||
*/
|
*/
|
||||||
void attrib_buffers(CGAL::Three::Viewer_interface*, int program_name) const;
|
void attribBuffers(CGAL::Three::Viewer_interface*, int program_name) const;
|
||||||
|
|
||||||
/*! Compatibility function. Calls `viewer->getShaderProgram()`. */
|
/*! Compatibility function. Calls `viewer->getShaderProgram()`. */
|
||||||
virtual QOpenGLShaderProgram* getShaderProgram(int name , CGAL::Three::Viewer_interface *viewer = 0) const;
|
virtual QOpenGLShaderProgram* getShaderProgram(int name , CGAL::Three::Viewer_interface *viewer = 0) const;
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,9 @@ class VIEWER_EXPORT Viewer_interface : public QGLViewer, public QOpenGLFunctions
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief The OpenGL_program_IDs enum
|
* \brief The OpenGL_program_IDs enum
|
||||||
* This enum holds the OpenGL programs IDs that are given to getShaderProgram() and attrib_buffers().
|
* This enum holds the OpenGL programs IDs that are given to getShaderProgram() and attribBuffers().
|
||||||
*@see getShaderProgram
|
*@see getShaderProgram
|
||||||
* @see attrib_buffers
|
* @see attribBuffers
|
||||||
*/
|
*/
|
||||||
enum OpenGL_program_IDs
|
enum OpenGL_program_IDs
|
||||||
{
|
{
|
||||||
|
|
@ -89,7 +89,7 @@ public:
|
||||||
* According to program_name, this data may change.
|
* According to program_name, this data may change.
|
||||||
* @see OpenGL_program_IDs
|
* @see OpenGL_program_IDs
|
||||||
*/
|
*/
|
||||||
virtual void attrib_buffers(int program_name) const = 0;
|
virtual void attribBuffers(int program_name) const = 0;
|
||||||
|
|
||||||
/*! Returns a program according to name.
|
/*! Returns a program according to name.
|
||||||
* If the program does not exist yet, it is created and stored in shader_programs.
|
* If the program does not exist yet, it is created and stored in shader_programs.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue