mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-14 08:34:37 +00:00
RenderPlugins
This commit is contained in:
parent
4361941aaf
commit
b43a05eb32
@ -31,7 +31,7 @@ set(HEADERS
|
||||
plugins/interfaces/filter_plugin.h
|
||||
plugins/interfaces/iomesh_plugin.h
|
||||
plugins/interfaces/ioraster_plugin.h
|
||||
plugins/interfaces/render_plugin_interface.h
|
||||
plugins/interfaces/render_plugin.h
|
||||
plugins/meshlab_plugin_type.h
|
||||
plugins/plugin_manager.h
|
||||
ml_document/helpers/mesh_document_state_data.h
|
||||
|
||||
@ -50,7 +50,7 @@ HEADERS += \
|
||||
plugins/interfaces/filter_plugin.h \
|
||||
plugins/interfaces/iomesh_plugin.h \
|
||||
plugins/interfaces/ioraster_plugin.h \
|
||||
plugins/interfaces/render_plugin_interface.h \
|
||||
plugins/interfaces/render_plugin.h \
|
||||
plugins/meshlab_plugin_type.h \
|
||||
plugins/plugin_manager.h \
|
||||
ml_document/helpers/mesh_document_state_data.h \
|
||||
|
||||
@ -32,12 +32,12 @@ void RenderPluginContainer::clear()
|
||||
renderPlugins.clear();
|
||||
}
|
||||
|
||||
void RenderPluginContainer::pushRenderPlugin(RenderPluginInterface* iRender)
|
||||
void RenderPluginContainer::pushRenderPlugin(RenderPlugin* iRender)
|
||||
{
|
||||
renderPlugins.push_back(iRender);
|
||||
}
|
||||
|
||||
void RenderPluginContainer::eraseRenderPlugin(RenderPluginInterface* iRender)
|
||||
void RenderPluginContainer::eraseRenderPlugin(RenderPlugin* iRender)
|
||||
{
|
||||
renderPlugins.erase(std::find(renderPlugins.begin(), renderPlugins.end(), iRender));
|
||||
}
|
||||
@ -47,14 +47,14 @@ RenderPluginContainer::RenderPluginRangeIterator RenderPluginContainer::renderPl
|
||||
return RenderPluginRangeIterator(this, iterateAlsoDisabledPlugins);
|
||||
}
|
||||
|
||||
ConstPluginIterator<RenderPluginInterface> RenderPluginContainer::RenderPluginRangeIterator::begin()
|
||||
ConstPluginIterator<RenderPlugin> RenderPluginContainer::RenderPluginRangeIterator::begin()
|
||||
{
|
||||
return ConstPluginIterator<RenderPluginInterface>(pm->renderPlugins, pm->renderPlugins.begin(), b);
|
||||
return ConstPluginIterator<RenderPlugin>(pm->renderPlugins, pm->renderPlugins.begin(), b);
|
||||
}
|
||||
|
||||
ConstPluginIterator<RenderPluginInterface> RenderPluginContainer::RenderPluginRangeIterator::end()
|
||||
ConstPluginIterator<RenderPlugin> RenderPluginContainer::RenderPluginRangeIterator::end()
|
||||
{
|
||||
return ConstPluginIterator<RenderPluginInterface>(pm->renderPlugins, pm->renderPlugins.end(), b);
|
||||
return ConstPluginIterator<RenderPlugin>(pm->renderPlugins, pm->renderPlugins.end(), b);
|
||||
}
|
||||
|
||||
RenderPluginContainer::RenderPluginRangeIterator::RenderPluginRangeIterator(
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
#ifndef MESHLAB_RENDER_PLUGIN_CONTAINER_H
|
||||
#define MESHLAB_RENDER_PLUGIN_CONTAINER_H
|
||||
|
||||
#include "../interfaces/render_plugin_interface.h"
|
||||
#include "../interfaces/render_plugin.h"
|
||||
#include "generic_container_iterator.h"
|
||||
|
||||
/**
|
||||
@ -41,20 +41,20 @@ public:
|
||||
RenderPluginContainer();
|
||||
|
||||
void clear();
|
||||
void pushRenderPlugin(RenderPluginInterface* iRender);
|
||||
void eraseRenderPlugin(RenderPluginInterface* iRender);
|
||||
void pushRenderPlugin(RenderPlugin* iRender);
|
||||
void eraseRenderPlugin(RenderPlugin* iRender);
|
||||
|
||||
RenderPluginRangeIterator renderPluginIterator(bool iterateAlsoDisabledPlugins = false) const;
|
||||
private:
|
||||
std::vector<RenderPluginInterface*> renderPlugins;
|
||||
std::vector<RenderPlugin*> renderPlugins;
|
||||
};
|
||||
|
||||
class RenderPluginContainer::RenderPluginRangeIterator
|
||||
{
|
||||
friend class RenderPluginContainer;
|
||||
public:
|
||||
ConstPluginIterator<RenderPluginInterface> begin();
|
||||
ConstPluginIterator<RenderPluginInterface> end();
|
||||
ConstPluginIterator<RenderPlugin> begin();
|
||||
ConstPluginIterator<RenderPlugin> end();
|
||||
private:
|
||||
RenderPluginRangeIterator(
|
||||
const RenderPluginContainer* pm,
|
||||
|
||||
@ -21,39 +21,39 @@
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef MESHLAB_RENDER_PLUGIN_INTERFACE_H
|
||||
#define MESHLAB_RENDER_PLUGIN_INTERFACE_H
|
||||
#ifndef MESHLAB_RENDER_PLUGIN_H
|
||||
#define MESHLAB_RENDER_PLUGIN_H
|
||||
|
||||
#include "meshlab_plugin.h"
|
||||
#include "../../ml_shared_data_context/ml_scene_gl_shared_data_context.h"
|
||||
|
||||
/**
|
||||
RenderPluginInterface
|
||||
Used to customized the rendering process.
|
||||
Rendering plugins are now responsible of the rendering of the whole MeshDocument and not only of a single MeshModel.
|
||||
|
||||
The Render function is called in with the ModelView and Projection Matrices already set up, screen cleared and background drawn.
|
||||
After the Render call the MeshLab frawework draw on the opengl context other decorations and the trackball, so it there is the
|
||||
requirement for a rendering plugin is that it should leave the z-buffer in a coherent state.
|
||||
|
||||
The typical rendering loop of a Render plugin is something like, :
|
||||
|
||||
<your own opengl setup>
|
||||
|
||||
foreach(MeshModel * mp, meshDoc.meshList)
|
||||
{
|
||||
if(mp->visible) mp->Render(rm.drawMode,rm.colorMode,rm.textureMode);
|
||||
}
|
||||
|
||||
*/
|
||||
* @brief The RenderPlugin class is used to customize the rendering
|
||||
* process of the whole MeshDocument.
|
||||
*
|
||||
* The Render function is called in with the ModelView and Projection Matrices
|
||||
* already set up, screen cleared and background drawn.
|
||||
* After the Render call the MeshLab frawework draw on the opengl context other
|
||||
* decorations and the trackball, so it there is the requirement for a rendering
|
||||
* plugin is that it should leave the z-buffer in a coherent state.
|
||||
*
|
||||
* The typical rendering loop of a Render plugin is something like, :
|
||||
*
|
||||
* <your own opengl setup>
|
||||
*
|
||||
* foreach(MeshModel * mp, meshDoc.meshList)
|
||||
* {
|
||||
* if(mp->visible) mp->Render(rm.drawMode,rm.colorMode,rm.textureMode);
|
||||
* }
|
||||
*/
|
||||
|
||||
class GLArea;
|
||||
|
||||
class RenderPluginInterface : virtual public MeshLabPlugin
|
||||
class RenderPlugin : virtual public MeshLabPlugin
|
||||
{
|
||||
public:
|
||||
RenderPluginInterface() :MeshLabPlugin() {}
|
||||
virtual ~RenderPluginInterface() {}
|
||||
RenderPlugin() :MeshLabPlugin() {}
|
||||
virtual ~RenderPlugin() {}
|
||||
|
||||
virtual bool isSupported() = 0;
|
||||
virtual QList<QAction *> actions() = 0;
|
||||
@ -72,7 +72,7 @@ public:
|
||||
virtual void refreshActions() {}
|
||||
};
|
||||
|
||||
#define RENDER_PLUGIN_INTERFACE_IID "vcg.meshlab.RenderPluginInterface/1.0"
|
||||
Q_DECLARE_INTERFACE(RenderPluginInterface, RENDER_PLUGIN_INTERFACE_IID)
|
||||
#define RENDER_PLUGIN_IID "vcg.meshlab.RenderPlugin/1.0"
|
||||
Q_DECLARE_INTERFACE(RenderPlugin, RENDER_PLUGIN_IID)
|
||||
|
||||
#endif // MESHLAB_RENDER_PLUGIN_INTERFACE_H
|
||||
@ -28,7 +28,7 @@
|
||||
#include "interfaces/filter_plugin.h"
|
||||
#include "interfaces/iomesh_plugin.h"
|
||||
#include "interfaces/ioraster_plugin.h"
|
||||
#include "interfaces/render_plugin_interface.h"
|
||||
#include "interfaces/render_plugin.h"
|
||||
|
||||
MeshLabPluginType::MeshLabPluginType(const MeshLabPluginFile* fpi) : type(0)
|
||||
{
|
||||
@ -59,7 +59,7 @@ MeshLabPluginType::MeshLabPluginType(const MeshLabPluginFile* fpi) : type(0)
|
||||
}
|
||||
|
||||
//Render
|
||||
const RenderPluginInterface *iRender = dynamic_cast<const RenderPluginInterface *>(fpi);
|
||||
const RenderPlugin *iRender = dynamic_cast<const RenderPlugin *>(fpi);
|
||||
if (iRender) {
|
||||
type |= RENDER;
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ void PluginManager::loadPlugin(const QString& fileName)
|
||||
ioRasterPlugins.pushIORasterPlugin(qobject_cast<IORasterPlugin*>(plugin));
|
||||
}
|
||||
if (type.isRenderPlugin()){
|
||||
renderPlugins.pushRenderPlugin(qobject_cast<RenderPluginInterface *>(plugin));
|
||||
renderPlugins.pushRenderPlugin(qobject_cast<RenderPlugin *>(plugin));
|
||||
}
|
||||
|
||||
//set the QFileInfo to the plugin, and add it to the continer
|
||||
@ -240,7 +240,7 @@ void PluginManager::unloadPlugin(MeshLabPluginFile* ifp)
|
||||
ioRasterPlugins.eraseIORasterPlugin(dynamic_cast<IORasterPlugin*>(ifp));
|
||||
}
|
||||
if (type.isRenderPlugin()){
|
||||
renderPlugins.eraseRenderPlugin(dynamic_cast<RenderPluginInterface *>(ifp));
|
||||
renderPlugins.eraseRenderPlugin(dynamic_cast<RenderPlugin *>(ifp));
|
||||
}
|
||||
allPlugins.erase(it);
|
||||
delete ifp;
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
#include <common/plugins/interfaces/filter_plugin.h>
|
||||
#include <common/plugins/interfaces/iomesh_plugin.h>
|
||||
#include <common/plugins/interfaces/decorate_plugin.h>
|
||||
#include <common/plugins/interfaces/render_plugin_interface.h>
|
||||
#include <common/plugins/interfaces/render_plugin.h>
|
||||
#include <common/plugins/interfaces/edit_plugin.h>
|
||||
#include <common/globals.h>
|
||||
#include <common/mlexception.h>
|
||||
@ -191,7 +191,7 @@ void PluginInfoDialog::populateTreeWidget()
|
||||
}
|
||||
}
|
||||
if (type.isRenderPlugin()){
|
||||
RenderPluginInterface* rpi = dynamic_cast<RenderPluginInterface*>(fp);
|
||||
RenderPlugin* rpi = dynamic_cast<RenderPlugin*>(fp);
|
||||
for(QAction *a: rpi->actions())
|
||||
tmplist.push_back(a->text());
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
#include <QTimer>
|
||||
#include <QTime>
|
||||
|
||||
#include <common/plugins/interfaces/render_plugin_interface.h>
|
||||
#include <common/plugins/interfaces/render_plugin.h>
|
||||
#include <common/plugins/interfaces/decorate_plugin.h>
|
||||
#include <common/plugins/interfaces/edit_plugin.h>
|
||||
#include <common/ml_shared_data_context/ml_shared_data_context.h>
|
||||
@ -194,8 +194,8 @@ public:
|
||||
QList<QAction *> iPerDocDecoratorlist;
|
||||
QList<QAction *> &iCurPerMeshDecoratorList() { assert(this->md()->mm()) ; return iPerMeshDecoratorsListMap[this->md()->mm()->id()]; }
|
||||
|
||||
void setRenderer(RenderPluginInterface *rend, QAction *shader){ iRenderer = rend; currentShader = shader;}
|
||||
RenderPluginInterface * getRenderer() { return iRenderer; }
|
||||
void setRenderer(RenderPlugin *rend, QAction *shader){ iRenderer = rend; currentShader = shader;}
|
||||
RenderPlugin * getRenderer() { return iRenderer; }
|
||||
QAction* getCurrentShaderAction() {return currentShader;}
|
||||
|
||||
|
||||
@ -447,7 +447,7 @@ private:
|
||||
vcg::Point2i pointToPick;
|
||||
|
||||
//shader support
|
||||
RenderPluginInterface *iRenderer;
|
||||
RenderPlugin *iRenderer;
|
||||
QAction *currentShader;
|
||||
const QAction *lastFilterRef; // reference to last filter applied
|
||||
QFont qFont; //font settings
|
||||
|
||||
@ -856,7 +856,7 @@ void MainWindow::fillShadersMenu()
|
||||
qaNone->setCheckable(false);
|
||||
shadersMenu->addAction(qaNone);
|
||||
connect(qaNone, SIGNAL(triggered()), this, SLOT(applyRenderMode()));
|
||||
for(RenderPluginInterface *iRender: PM.renderPluginIterator()) {
|
||||
for(RenderPlugin *iRender: PM.renderPluginIterator()) {
|
||||
addToMenu(iRender->actions(), shadersMenu, SLOT(applyRenderMode()));
|
||||
}
|
||||
shadersMenu->addSeparator();
|
||||
|
||||
@ -1413,7 +1413,7 @@ void MainWindow::applyRenderMode()
|
||||
GLA()->setRenderer(NULL,NULL);
|
||||
}
|
||||
// Make the call to the plugin core
|
||||
RenderPluginInterface *iRenderTemp = qobject_cast<RenderPluginInterface *>(action->parent());
|
||||
RenderPlugin *iRenderTemp = qobject_cast<RenderPlugin *>(action->parent());
|
||||
bool initsupport = false;
|
||||
|
||||
if (currentViewContainer() == NULL)
|
||||
@ -1561,7 +1561,7 @@ void MainWindow::addShaders()
|
||||
}
|
||||
|
||||
//refresh actions of render plugins -> needed to update the shaders menu
|
||||
for (RenderPluginInterface* renderPlugin : PM.renderPluginIterator()){
|
||||
for (RenderPlugin* renderPlugin : PM.renderPluginIterator()){
|
||||
renderPlugin->refreshActions();
|
||||
}
|
||||
fillRenderMenu(); //clean and refill menu
|
||||
|
||||
@ -25,17 +25,17 @@
|
||||
#define SHADERRENDERPLUGIN_H
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <common/plugins/interfaces/render_plugin_interface.h>
|
||||
#include <common/plugins/interfaces/render_plugin.h>
|
||||
#include "textfile.h"
|
||||
#include "shaderStructs.h"
|
||||
#include "shaderDialog.h"
|
||||
|
||||
|
||||
class MeshShaderRenderPlugin : public QObject, public RenderPluginInterface
|
||||
class MeshShaderRenderPlugin : public QObject, public RenderPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
MESHLAB_PLUGIN_IID_EXPORTER(RENDER_PLUGIN_INTERFACE_IID)
|
||||
Q_INTERFACES(RenderPluginInterface)
|
||||
MESHLAB_PLUGIN_IID_EXPORTER(RENDER_PLUGIN_IID)
|
||||
Q_INTERFACES(RenderPlugin)
|
||||
public:
|
||||
|
||||
MeshShaderRenderPlugin();
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
#define RADIANCESCALINGRENDERER_H
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <common/plugins/interfaces/render_plugin_interface.h>
|
||||
#include <common/plugins/interfaces/render_plugin.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QString>
|
||||
@ -35,10 +35,10 @@
|
||||
#include "framebufferObject.h"
|
||||
#include "texture2D.h"
|
||||
|
||||
class RadianceScalingRendererPlugin : public QObject, public RenderPluginInterface {
|
||||
class RadianceScalingRendererPlugin : public QObject, public RenderPlugin {
|
||||
Q_OBJECT
|
||||
MESHLAB_PLUGIN_IID_EXPORTER(RENDER_PLUGIN_INTERFACE_IID)
|
||||
Q_INTERFACES(RenderPluginInterface)
|
||||
MESHLAB_PLUGIN_IID_EXPORTER(RENDER_PLUGIN_IID)
|
||||
Q_INTERFACES(RenderPlugin)
|
||||
|
||||
bool _supported;
|
||||
QList<QAction *> _actionList;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user