mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-17 10:04:38 +00:00
cleaned up the shadow decoration to comply to the new global params
This commit is contained in:
parent
9ecb2756cf
commit
d270bef898
@ -22,11 +22,8 @@
|
||||
****************************************************************************/
|
||||
#ifndef DECORATE_SHADER_H
|
||||
#define DECORATE_SHADER_H
|
||||
#include <cassert>
|
||||
#include <QImage>
|
||||
#include <QFile>
|
||||
#include <GL/glew.h>
|
||||
#include <meshlab/meshmodel.h>
|
||||
#include <QObject>
|
||||
#include <common/interfaces.h>
|
||||
#include <meshlab/glarea.h>
|
||||
|
||||
#define BLUR_COEF 0.4
|
||||
|
||||
@ -25,23 +25,31 @@
|
||||
|
||||
using namespace vcg;
|
||||
|
||||
const QString DecorateShadowPlugin::Info(QAction *action)
|
||||
QString DecorateShadowPlugin::filterInfo(QAction *action) const
|
||||
{
|
||||
switch(ID(action)){
|
||||
case DP_SHOW_SHADOW : return tr("Enable shadow mapping");
|
||||
case DP_SHOW_SSAO: return tr("Enable Screen Space Ambient Occlusion");
|
||||
}
|
||||
assert(0);
|
||||
return QString();
|
||||
default: assert(0); return QString();
|
||||
}
|
||||
}
|
||||
|
||||
void DecorateShadowPlugin::initGlobalParameterSet(QAction *action, RichParameterSet *parset)
|
||||
|
||||
QString DecorateShadowPlugin::filterName(FilterIDType id) const
|
||||
{
|
||||
switch(id){
|
||||
case DP_SHOW_SHADOW : return tr("Enable shadow mapping");
|
||||
case DP_SHOW_SSAO: return tr("Enable Screen Space Ambient Occlusion");
|
||||
default: assert(0); return QString();
|
||||
}
|
||||
}
|
||||
|
||||
void DecorateShadowPlugin::initGlobalParameterSet(QAction *action, RichParameterSet &parset)
|
||||
{
|
||||
switch(ID(action)){
|
||||
case DP_SHOW_SHADOW : {
|
||||
assert(!(parset->hasParameter(this->DecorateShadowMethod())));
|
||||
assert(!(parset.hasParameter(this->DecorateShadowMethod())));
|
||||
int method = SH_MAP_VSM_BLUR;
|
||||
parset->addParam(
|
||||
parset.addParam(
|
||||
new RichEnum(
|
||||
this->DecorateShadowMethod(),
|
||||
method,
|
||||
@ -53,9 +61,9 @@ void DecorateShadowPlugin::initGlobalParameterSet(QAction *action, RichParameter
|
||||
}
|
||||
|
||||
case DP_SHOW_SSAO : {
|
||||
assert(!(parset->hasParameter(this->DecorateShadowSSAORadius())));
|
||||
assert(!(parset.hasParameter(this->DecorateShadowSSAORadius())));
|
||||
float radius = 0.25f;
|
||||
parset->addParam(
|
||||
parset.addParam(
|
||||
new RichFloat(this->DecorateShadowSSAORadius(),
|
||||
radius,
|
||||
"Uniform parameter for SSAO shader",
|
||||
@ -67,17 +75,6 @@ void DecorateShadowPlugin::initGlobalParameterSet(QAction *action, RichParameter
|
||||
}
|
||||
}
|
||||
|
||||
const QString DecorateShadowPlugin::ST(FilterIDType filter) const
|
||||
{
|
||||
switch(filter)
|
||||
{
|
||||
case DP_SHOW_SHADOW : return QString("Shadow mapping");
|
||||
case DP_SHOW_SSAO : return QString("SSAO");
|
||||
default: assert(0);
|
||||
}
|
||||
return QString("error!");
|
||||
}
|
||||
|
||||
bool DecorateShadowPlugin::StartDecorate(QAction* action, MeshModel& m, RichParameterSet * parset, GLArea* gla){
|
||||
bool result;
|
||||
switch(ID(action)){
|
||||
|
||||
@ -24,11 +24,7 @@
|
||||
#define SAMPLE_DECORATE_PLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QAction>
|
||||
#include <QList>
|
||||
|
||||
#include <meshlab/interfaces.h>
|
||||
#include <meshlab/meshmodel.h>
|
||||
#include <common/interfaces.h>
|
||||
|
||||
#include "decorate_shader.h"
|
||||
#include "shadow_mapping.h"
|
||||
@ -60,8 +56,8 @@ class DecorateShadowPlugin : public QObject, public MeshDecorateInterface
|
||||
<<"Variance shadow mapping with blur";
|
||||
}
|
||||
|
||||
virtual QString Info(QAction *);
|
||||
virtual QString ST(FilterIDType filter) const;
|
||||
virtual QString filterInfo(QAction *) const;
|
||||
virtual QString filterName(FilterIDType filter) const;
|
||||
|
||||
public:
|
||||
|
||||
@ -72,7 +68,7 @@ public:
|
||||
|
||||
FilterIDType tt;
|
||||
foreach(tt , types()){
|
||||
actionList << new QAction(ST(tt), this);
|
||||
actionList << new QAction(filterName(tt), this);
|
||||
}
|
||||
QAction *ap;
|
||||
foreach(ap,actionList){
|
||||
@ -83,7 +79,7 @@ public:
|
||||
QList<QAction *> actions () const {return actionList;}
|
||||
virtual bool StartDecorate(QAction * /*mode*/, MeshModel &/*m*/, RichParameterSet * /*parent*/ par, GLArea * /*parent*/);
|
||||
virtual void Decorate(QAction *a, MeshModel &m, GLArea *gla,QFont qf);
|
||||
virtual void initGlobalParameterSet(QAction *, RichParameterSet * /*globalparam*/);
|
||||
virtual void initGlobalParameterSet(QAction *, RichParameterSet & globalparam);
|
||||
private:
|
||||
DecorateShader* _decoratorSH, *_decoratorSSAO;
|
||||
inline const QString DecorateShadowSSAORadius() { return "MeshLab::Decoration::SSAORadius" ; }
|
||||
|
||||
@ -1,18 +1,20 @@
|
||||
include (../../shared.pri)
|
||||
|
||||
QT += opengl
|
||||
HEADERS = decorate_shadow.h \
|
||||
|
||||
HEADERS += decorate_shadow.h \
|
||||
shadow_mapping.h \
|
||||
../../../../vcglib/wrap/gui/trackball.h \
|
||||
$$VCGDIR/wrap/gui/trackball.h \
|
||||
decorate_shader.h \
|
||||
variance_shadow_mapping.h \
|
||||
variance_shadow_mapping_blur.h \
|
||||
ssao.h
|
||||
SOURCES = decorate_shadow.cpp \
|
||||
shadow_mapping.cpp
|
||||
../../../../vcglib/wrap/gui/trackball.cpp \
|
||||
../../../../vcglib/wrap/gui/trackmode.cpp \
|
||||
SOURCES += decorate_shadow.cpp \
|
||||
shadow_mapping.cpp \
|
||||
$$VCGDIR/wrap/gui/trackball.cpp \
|
||||
$$VCGDIR/wrap/gui/trackmode.cpp \
|
||||
variance_shadow_mapping.cpp \
|
||||
variance_shadow_mapping_blur.cpp \
|
||||
ssao.cpp
|
||||
TARGET = decorate_shadow
|
||||
RESOURCES += noise.qrc
|
||||
RESOURCES += noise.qrc
|
||||
|
||||
@ -21,8 +21,9 @@
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include "decorate_shader.h"
|
||||
#include "shadow_mapping.h"
|
||||
#include <common/pluginmanager.h>
|
||||
|
||||
ShadowMapping::ShadowMapping():DecorateShader()
|
||||
{
|
||||
@ -54,7 +55,7 @@ bool ShadowMapping::init()
|
||||
this->_shadowMappingProgram,
|
||||
this->_shadowMappingVert,
|
||||
this->_shadowMappingFrag,
|
||||
MainWindowInterface::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/sm/object")));
|
||||
PluginManager::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/sm/object")));
|
||||
}
|
||||
|
||||
void ShadowMapping::renderingFromLightSetup(MeshModel& m, GLArea* gla){
|
||||
|
||||
@ -24,8 +24,6 @@
|
||||
#ifndef SHADOW_MAPPING_H_
|
||||
#define SHADOW_MAPPING_H_
|
||||
|
||||
#include <decorate_shader.h>
|
||||
|
||||
class ShadowMapping : public DecorateShader
|
||||
{
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "ssao.h"
|
||||
|
||||
#include <common/pluginmanager.h>
|
||||
SSAO::SSAO(float radius):DecorateShader()
|
||||
{
|
||||
this->_radius = radius;
|
||||
@ -90,17 +90,17 @@ bool SSAO::init()
|
||||
this->_ssaoShaderProgram,
|
||||
this->_ssaoVert,
|
||||
this->_ssaoFrag,
|
||||
MainWindowInterface::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/ssao/ssao"))) ||
|
||||
PluginManager::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/ssao/ssao"))) ||
|
||||
!compileAndLink(
|
||||
this->_normalMapShaderProgram,
|
||||
this->_normalMapVert,
|
||||
this->_normalMapFrag,
|
||||
MainWindowInterface::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/ssao/normalMap"))) ||
|
||||
PluginManager::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/ssao/normalMap"))) ||
|
||||
!compileAndLink(
|
||||
this->_blurShaderProgram,
|
||||
this->_blurVert,
|
||||
this->_blurFrag,
|
||||
MainWindowInterface::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/ssao/blur"))))
|
||||
PluginManager::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/ssao/blur"))))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -24,14 +24,6 @@
|
||||
#ifndef SSAO_H
|
||||
#define SSAO_H
|
||||
|
||||
#include <cassert>
|
||||
#include <QString>
|
||||
#include <QImage>
|
||||
#include <QFile>
|
||||
#include <GL/glew.h>
|
||||
#include <meshlab/interfaces.h>
|
||||
#include <meshlab/meshmodel.h>
|
||||
#include <meshlab/glarea.h>
|
||||
#include <decorate_shader.h>
|
||||
|
||||
class SSAO : public DecorateShader
|
||||
|
||||
@ -21,7 +21,9 @@
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#include "decorate_shader.h"
|
||||
#include "variance_shadow_mapping.h"
|
||||
#include <common/pluginmanager.h>
|
||||
|
||||
VarianceShadowMapping::VarianceShadowMapping():ShadowMapping()
|
||||
{
|
||||
@ -52,12 +54,12 @@ bool VarianceShadowMapping::init()
|
||||
this->_depthShaderProgram,
|
||||
this->_depthVert,
|
||||
this->_depthFrag,
|
||||
MainWindowInterface::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/vsm/depthVSM"))) ||
|
||||
PluginManager::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/vsm/depthVSM"))) ||
|
||||
!compileAndLink(
|
||||
this->_shadowMappingProgram,
|
||||
this->_shadowMappingVert,
|
||||
this->_shadowMappingFrag,
|
||||
MainWindowInterface::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/vsm/objectVSM"))))
|
||||
PluginManager::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/vsm/objectVSM"))))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@ -21,7 +21,9 @@
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#include "decorate_shader.h"
|
||||
#include "variance_shadow_mapping_blur.h"
|
||||
#include <common/pluginmanager.h>
|
||||
|
||||
VarianceShadowMappingBlur::VarianceShadowMappingBlur():VarianceShadowMapping()
|
||||
{
|
||||
@ -53,17 +55,17 @@ bool VarianceShadowMappingBlur::init()
|
||||
this->_depthShaderProgram,
|
||||
this->_depthVert,
|
||||
this->_depthFrag,
|
||||
MainWindowInterface::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/vsmb/depthVSM"))) ||
|
||||
PluginManager::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/vsmb/depthVSM"))) ||
|
||||
!compileAndLink(
|
||||
this->_shadowMappingProgram,
|
||||
this->_shadowMappingVert,
|
||||
this->_shadowMappingFrag,
|
||||
MainWindowInterface::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/vsmb/objectVSM"))) ||
|
||||
PluginManager::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/vsmb/objectVSM"))) ||
|
||||
!compileAndLink(
|
||||
this->_blurShaderProgram,
|
||||
this->_blurVert,
|
||||
this->_blurFrag,
|
||||
MainWindowInterface::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/vsmb/blurVSM"))))
|
||||
PluginManager::getBaseDirPath().append(QString("/../fgt/decorate_shadow/shader/vsmb/blurVSM"))))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user