Skip to content
Snippets Groups Projects
Commit b6342321 authored by Jan's avatar Jan
Browse files

Separate Repos

parent fe56512b
No related branches found
No related tags found
No related merge requests found
Showing
with 18 additions and 2495 deletions
[submodule "PluginCollection-FilePlugins/Plugin-Assimp"]
path = PluginCollection-FilePlugins/Plugin-Assimp
url = https://www.graphics.rwth-aachen.de:9000/OpenFlipper-Free/Plugin-Assimp.git
[submodule "Plugin-PoissonReconstruction"]
path = Plugin-PoissonReconstruction
url = https://www.graphics.rwth-aachen.de:9000/OpenFlipper-Free/Plugin-PoissonReconstruction.git
[submodule "PluginCollection-PostProcessors/Plugin-RadialBlur"]
path = PluginCollection-PostProcessors/Plugin-RadialBlur
url = https://www.graphics.rwth-aachen.de:9000/OpenFlipper-Free/Plugin-RadialBlur.git
......@@ -22,3 +19,18 @@
[submodule "PluginCollection-PostProcessors/Plugin-BilateralBlur"]
path = PluginCollection-PostProcessors/Plugin-BilateralBlur
url = https://www.graphics.rwth-aachen.de:9000/OpenFlipper-Free/Plugin-BilateralBlur.git
[submodule "PluginCollection-Renderers/Plugin-Render-DeferredShading"]
path = PluginCollection-Renderers/Plugin-Render-DeferredShading
url = https://www.graphics.rwth-aachen.de:9000/OpenFlipper-Free/Plugin-Render-DeferredShading.git
[submodule "PluginCollection-Renderers/Plugin-Render-OITLinkedList"]
path = PluginCollection-Renderers/Plugin-Render-OITLinkedList
url = https://www.graphics.rwth-aachen.de:9000/OpenFlipper-Free/Plugin-Render-OITLinkedList.git
[submodule "Type-SkyDome"]
path = Type-SkyDome
url = https://www.graphics.rwth-aachen.de:9000/OpenFlipper-Free/Type-SkyDome.git
[submodule "Plugin-PanoramaControl"]
path = Plugin-PanoramaControl
url = https://www.graphics.rwth-aachen.de:9000/OpenFlipper-Free/Plugin-PanoramaControl.git
[submodule "Plugin-TangentSpace"]
path = Plugin-TangentSpace
url = https://www.graphics.rwth-aachen.de:9000/OpenFlipper-Free/Plugin-TangentSpace.git
Subproject commit 7ba615e2564036de5da03c6582b0c853ab01a747
include (plugin)
openflipper_plugin (INSTALLDATA Icons)
Plugin-PanoramaControl/Icons/PanoControl.png

1.21 MiB

/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2014 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 13354 $ *
* $LastChangedBy: moebius $ *
* $Date: 2012-01-12 13:39:10 +0100 (Do, 12 Jan 2012) $ *
* *
\*===========================================================================*/
#include <ObjectTypes/SkyDome/SkyDome.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
#include "PanoramaToolbox.hh"
#include "PanoramaControlPlugin.hh"
PanoramaControlPlugin::PanoramaControlPlugin() :
tool_(0)
{
}
void PanoramaControlPlugin::initializePlugin(){
tool_ = new PanoramaToolBox();
connect(tool_->hFOV , SIGNAL( valueChanged(double) ), this, SLOT( slotValuesChanged(double) ) );
connect(tool_->vFOV , SIGNAL( valueChanged(double) ), this, SLOT( slotValuesChanged(double) ) );
connect(tool_->cutOff, SIGNAL( valueChanged(double) ), this, SLOT( slotValuesChanged(double) ) );
connect(tool_->loadButton, SIGNAL( clicked() ), this, SLOT( slotLoadImage() ) );
// Add icon and toolbox
QIcon* toolIcon_ = new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"PanoControl.png");
emit addToolbox( tr("Panorama Control") , tool_, toolIcon_);
}
void PanoramaControlPlugin::slotLoadImage() {
SkyDomeObject* domeObject = 0;
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,( DATA_SKYDOME )) ;o_it != PluginFunctions::objectsEnd(); ++o_it)
{
domeObject = PluginFunctions::skyDomeObject(*o_it);
// We only take the first one
if ( domeObject )
break;
}
// No dome object found, so we have to create one
if ( !domeObject ) {
// Add empty triangle mesh
int domeId = -1;
emit addEmptyObject ( DATA_SKYDOME, domeId );
domeObject = PluginFunctions::skyDomeObject(domeId);
}
if ( !domeObject ) {
emit log(LOGERR,"Unable to get or create new Sky Dome Object");
return;
}
// Ask user to load the file
QString file = QFileDialog::getOpenFileName ( 0, "Load Panorama Image", "", "Images (*.png *.xpm *.jpg)", 0, 0 );
// Update the texture file name
domeObject->getSkyDome().setTextureFileName(file);
// Update the object and its buffers
emit updatedObject(domeObject->id(), UPDATE_TEXTURE);
// Switch to shader pipeline renderer
emit setRenderer(PluginFunctions::activeExaminer(),"Shader Pipeline Renderer Plugin");
}
void PanoramaControlPlugin::slotValuesChanged(double) {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,( DATA_SKYDOME )) ;o_it != PluginFunctions::objectsEnd(); ++o_it)
{
SkyDomeObject* domeObject = PluginFunctions::skyDomeObject(*o_it);
if ( domeObject ) {
domeObject->getSkyDome().setHorizontalFOV( tool_->hFOV->value() );
domeObject->getSkyDome().setVerticalFOV(tool_->vFOV->value() );
domeObject->getSkyDome().setTopOffset(tool_->cutOff->value() );
// Only first object will be handled for now!
break;
}
}
// Only update the view, as only uniforms will change here
emit updateView();
}
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2( panoramacontrolplugin , PanoramaControlPlugin );
#endif
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2014 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 13354 $ *
* $LastChangedBy: moebius $ *
* $Date: 2012-01-12 13:39:10 +0100 (Do, 12 Jan 2012) $ *
* *
\*===========================================================================*/
#pragma once
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/BasePlugin/ToolboxInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/BasePlugin/LoadSaveInterface.hh>
#include <QObject>
#include <QtGui>
class PanoramaToolBox;
class PanoramaControlPlugin : public QObject, BaseInterface, ToolboxInterface, LoggingInterface, LoadSaveInterface
{
Q_OBJECT
Q_INTERFACES(BaseInterface)
Q_INTERFACES(ToolboxInterface)
Q_INTERFACES(LoggingInterface)
Q_INTERFACES(LoadSaveInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-PanoramaControl")
#endif
signals:
//BaseInterface
void updateView();
void updatedObject(int _identifier, const UpdateType& _type);
void setSlotDescription(QString _slotName, QString _slotDescription,
QStringList _parameters, QStringList _descriptions);
void setRenderer(unsigned int _viewer, QString _rendererName);
//LoggingInterface:
void log( Logtype _type, QString _message );
void log( QString _message );
// ToolboxInterface
void addToolbox( QString _name , QWidget* _widget , QIcon* _icon );
// Load/Save Interface
void addEmptyObject (DataType _type, int& _id);
private slots:
// BaseInterface
void initializePlugin();
private slots:
/// Button slot iterating over all targets and passing them to the correct functions
void slotLoadImage();
/// Spinboxes changed
void slotValuesChanged(double _unused);
public :
PanoramaControlPlugin();
~PanoramaControlPlugin() {};
QString name() { return (QString("Panorama Control Plugin")); };
QString description( ) { return (QString("Visualize panorama images via a sky dome")); };
private :
PanoramaToolBox* tool_;
public slots:
QString version() { return QString("1.0"); };
};
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2014 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 10745 $ *
* $LastChangedBy: moebius $ *
* $Date: 2011-01-26 10:23:50 +0100 (Mi, 26. Jan 2011) $ *
* *
\*===========================================================================*/
#include "PanoramaToolbox.hh"
#include <QtGui>
PanoramaToolBox::PanoramaToolBox(QWidget *parent)
: QWidget(parent)
{
setupUi(this);
}
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2014 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 10745 $ *
* $LastChangedBy: moebius $ *
* $Date: 2011-01-26 10:23:50 +0100 (Mi, 26. Jan 2011) $ *
* *
\*===========================================================================*/
#pragma once
#include <ui_panoramatoolbox.h>
class PanoramaToolBox : public QWidget, public Ui::PanoramaTool
{
Q_OBJECT
public:
PanoramaToolBox(QWidget *parent = 0);
};
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PanoramaTool</class>
<widget class="QWidget" name="PanoramaTool">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>278</width>
<height>135</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Increased Octree Depth results in higher resolution of the recontructed model showing more details but also the memory consumption will increase exponential.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string>Increased Octree Depth results in higher resolution of the recontructed model showing more details but also the memory consumption will increase exponential.</string>
</property>
<property name="whatsThis">
<string>Increased Octree Depth results in higher resolution of the recontructed model showing more details but also the memory consumption will increase exponential.</string>
</property>
<property name="text">
<string>Horizontal FOV</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="hFOV">
<property name="toolTip">
<string>Horizontal Field of View of the Panorama in Degrees</string>
</property>
<property name="statusTip">
<string>Horizontal Field of View of the Panorama in Degrees</string>
</property>
<property name="whatsThis">
<string>Horizontal Field of View of the Panorama in Degrees</string>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
<property name="value">
<double>360.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Increased Octree Depth results in higher resolution of the recontructed model showing more details but also the memory consumption will increase exponential.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string>Increased Octree Depth results in higher resolution of the recontructed model showing more details but also the memory consumption will increase exponential.</string>
</property>
<property name="whatsThis">
<string>Increased Octree Depth results in higher resolution of the recontructed model showing more details but also the memory consumption will increase exponential.</string>
</property>
<property name="text">
<string>Vertical FOV</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="vFOV">
<property name="toolTip">
<string>Vertical Field of View of the Panorama in Degrees</string>
</property>
<property name="statusTip">
<string>Vertical Field of View of the Panorama in Degrees</string>
</property>
<property name="whatsThis">
<string>Vertical Field of View of the Panorama in Degrees</string>
</property>
<property name="maximum">
<double>180.000000000000000</double>
</property>
<property name="value">
<double>90.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Increased Octree Depth results in higher resolution of the recontructed model showing more details but also the memory consumption will increase exponential.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string>Increased Octree Depth results in higher resolution of the recontructed model showing more details but also the memory consumption will increase exponential.</string>
</property>
<property name="whatsThis">
<string>Increased Octree Depth results in higher resolution of the recontructed model showing more details but also the memory consumption will increase exponential.</string>
</property>
<property name="text">
<string>Top Cutoff</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="cutOff">
<property name="toolTip">
<string>Missing part in degree at the top of the Panorama</string>
</property>
<property name="statusTip">
<string>Missing part in degree at the top of the Panorama</string>
</property>
<property name="whatsThis">
<string>Missing part in degree at the top of the Panorama</string>
</property>
<property name="maximum">
<double>180.000000000000000</double>
</property>
<property name="value">
<double>45.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Zoom with Ctrl + Mouse Wheel&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="loadButton">
<property name="toolTip">
<string>Enable slicing for the current scene</string>
</property>
<property name="statusTip">
<string>Enable slicing for the current scene</string>
</property>
<property name="text">
<string>Load Panorama Image</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<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>
</layout>
</widget>
<resources/>
<connections/>
</ui>
Subproject commit 931fb29e6ed438a1a47b7339a7664109660b4222
Plugin-TangentSpace @ ba2e1767
Subproject commit ba2e17671e17c7c41ec8def9415aee110e70e73b
include (plugin)
openflipper_plugin (OPTDEPS EIGEN3
INSTALLDATA Icons
TYPES POLYMESH)
Plugin-TangentSpace/Icons/tangent_space_icon.png

1.67 KiB

This diff is collapsed.
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2015 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
#ifndef TANGENTSPACEPLUGIN_HH
#define TANGENTSPACEPLUGIN_HH
#include <ObjectTypes/PolyMesh/PolyMesh.hh>
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
#include <OpenFlipper/common/Types.hh>
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/BasePlugin/ToolboxInterface.hh>
#include <QObject>
#include <QMenuBar>
#include <QLineEdit>
#include <QCheckBox>
#include <QComboBox>
#include <string>
class TangentSpace : public QObject, BaseInterface, ToolboxInterface
{
Q_OBJECT
Q_INTERFACES(BaseInterface)
Q_INTERFACES(ToolboxInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-TangentSpace")
#endif
signals:
void updatedObject(int, const UpdateType&);
// ToolboxInterface
void addToolbox( QString _name , QWidget* _widget, QIcon* _icon);
private slots:
void pluginsInitialized();
public :
TangentSpace();
~TangentSpace();
QString name() { return (QString("TangentSpace")); };
QString description( ) { return (QString("Compute tangent space properties")); };
// decomposition method: extract rotational part from tangent space matrix
enum
{
DECOMP_GRAM_SCHMIDT = 0, // QR decomposition with gram-schmidt process: n is unchanged, b has no influence
DECOMP_HALF_ANGLE, // QR decomposition with half angle rotation: n is unchanged, t and b equally weighted
DECOMP_POLAR // polar decomposition, t,b,n all equally weighted / requires eigen math lib
};
struct TangentBasis
{
ACG::Vec3f t,b,n;
float parity;
void setZero();
void orthonormalize(int method = 0);
void normalize();
void add(const TangentBasis& _r);
void computeParity();
};
// compute unnormalized triangle tangent, bitangent and normal vector
// returns parity
float computeTriTBN(const ACG::Vec3f* _pos, const ACG::Vec2f* _texc, ACG::Vec3f* _outT, ACG::Vec3f* _outB, ACG::Vec3f* _outN, bool _divByDet = true);
float computeTriTBN(TriMesh* mesh, TriMesh::FaceHandle _fh, ACG::Vec3f* _outT, ACG::Vec3f* _outB, ACG::Vec3f* _outN, bool _divByDet = true);
float computeFaceTBN(PolyMesh* mesh, PolyMesh::FaceHandle _fh, ACG::Vec3f* _outT, ACG::Vec3f* _outB, ACG::Vec3f* _outN, bool _divByDet = true);
// compute tangent matrix of triangle (optionally weighted by angle at incoming halfedge and/or area of triangle)
void computeWeightedTangentSpace(TriMesh* mesh, TriMesh::HalfedgeHandle _h, TangentBasis* _out);
void computeWeightedTangentSpace(PolyMesh* mesh, PolyMesh::HalfedgeHandle _h, TangentBasis* _out);
// parity of tangent space matrix = sign(det(TBN))
// returns +1: positive, -1: mirrored
float computeParity(const ACG::Vec3f& t, const ACG::Vec3f& b, const ACG::Vec3f& n);
// get pos array of triangle
void getTriPos(TriMesh* _mesh, TriMesh::FaceHandle _h, ACG::Vec3f* _outPos);
// area of triangle in texture space
float computeUVArea(TriMesh* _mesh, TriMesh::HalfedgeHandle _h);
void computePerVertexTangents(TriMesh* _mesh);
void computePerHalfedgeTangents(TriMesh* _mesh);
void getGUIConfig();
private:
// weighting of tangent space matrices within smoothing groups
bool weightByAngle_;
bool weightByArea_;
bool weightByUVArea_;
QCheckBox* weightByAngleGUI_; // qt checkbox widgets
QCheckBox* weightByAreaGUI_;
QCheckBox* weightByUVAreaGUI_;
// overwrite vertex normals with resulting normals from tangent basis
bool overwriteVertexNormals_;
QCheckBox* overwriteNormalsGUI_;
// detect and preserve sharp edges at texture seams
bool preserveTextureSeams_;
QCheckBox* preserveTextureSeamsGUI_;
// extraction method to get rotational part of tangent space matrix
int decompMethod_;
QComboBox* decompMethodGUI_; // qt combobox
// property name of tangent vectors
std::string propName_;
QLineEdit* propNameGUI_; // qt editbox
public slots:
void slotComputePerVertex();
void slotComputePerHalfedge();
QString version() { return QString("1.0"); };
};
#endif //TANGENTSPACEPLUGIN_HH
Subproject commit 98fbbb38bf0a162eb3ab9454419a2debcdc6ae97
include (plugin)
openflipper_plugin ( INSTALLDATA Shaders )
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2014 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 18127 $ *
* $LastChangedBy: moebius $ *
* $Date: 2014-02-05 10:12:54 +0100 (Wed, 05 Feb 2014) $ *
* *
\*===========================================================================*/
#include <ACG/GL/acg_glew.hh>
#include "DeferredShading.hh"
#include <OpenFlipper/common/GlobalOptions.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <ACG/GL/ShaderCache.hh>
#include <ACG/GL/ScreenQuad.hh>
#include <ACG/GL/GLError.hh>
#include <ACG/QtWidgets/QtColorChooserButton.hh>
#include <QAction>
// =================================================
#define GBUFFER_INCLUDE_FILE "DeferredShading/GBufferAccess.glsl"
#define SCREENQUAD_VERTEXSHADER_FILE "DeferredShading/screenquad.glsl"
#define PASS_EMISSIVE_FILE "DeferredShading/pass_emissive.glsl"
#define PASS_EMISSIVE_MS_FILE "DeferredShading/pass_emissiveMS.glsl"
#define PASS_DIRECTIONAL_FILE "DeferredShading/pass_directional.glsl"
#define PASS_DIRECTIONAL_MS_FILE "DeferredShading/pass_directionalMS.glsl"
#define PASS_POINT_FILE "DeferredShading/pass_point.glsl"
#define PASS_POINT_MS_FILE "DeferredShading/pass_pointMS.glsl"
#define PASS_SPOT_FILE "DeferredShading/pass_spot.glsl"
#define PASS_SPOT_MS_FILE "DeferredShading/pass_spotMS.glsl"
#define PASS_BACKGROUND_FILE "DeferredShading/pass_background.glsl"
class DeferredShadingInitPass : public ACG::ShaderModifier{
public:
void modifyVertexIO( ACG::ShaderGenerator* _shader ) {
_shader->addOutput("vec3 outVertexNormal");
_shader->addOutput("vec4 outVertexPosVS");
// force normal input
_shader->addInput("vec3 inNormal");
}
void modifyFragmentIO( ACG::ShaderGenerator* _shader ) {
// include GBuffer functions
_shader->addIncludeFile(ACG::ShaderProgGenerator::getShaderDir() + QDir::separator() + QString(GBUFFER_INCLUDE_FILE));
_shader->addInput("vec3 outVertexNormal");
_shader->addInput("vec4 outVertexPosVS");
// write position, normal and material to mrt fbo
_shader->addOutput("vec3 outNormal");
_shader->addUniform("float materialID");
}
void modifyVertexEndCode(QStringList* _code) {
_code->push_back("outVertexPosVS = sg_vPosVS;");
_code->push_back("outVertexNormal = g_mWVIT * inNormal;");
}
void modifyFragmentEndCode(QStringList* _code) {
_code->push_back("outFragment = WritePositionVS(outVertexPosVS, materialID);");
_code->push_back("outNormal = WriteNormalVS(outVertexNormal);");
}
// modifier replaces default lighting
bool replaceDefaultLightingCode() {return true;}
void modifyLightingCode(QStringList* _code, int _lightId, ACG::ShaderGenLightType _lightType) {
// do nothing, lighting is deferred
}
static DeferredShadingInitPass instance;
};
DeferredShadingInitPass DeferredShadingInitPass::instance;
// =================================================
DeferredShading::DeferredShading()
: progEmissive_(0), progEmissiveMS_(0),
progBackground_(0),
progDirectional_(0), progDirectionalMS_(0),
progPoint_(0), progPointMS_(0),
progSpot_(0), progSpotMS_(0)
{
numSamples_ = 0;
ACG::ShaderProgGenerator::registerModifier(&DeferredShadingInitPass::instance);
}
DeferredShading::~DeferredShading() {
delete progEmissive_;
delete progEmissiveMS_;
delete progDirectional_;
delete progDirectionalMS_;
delete progPoint_;
delete progPointMS_;
delete progSpot_;
delete progSpotMS_;
delete progBackground_;
}
void DeferredShading::initializePlugin() {
ACG::ShaderProgGenerator::setShaderDir(OpenFlipper::Options::shaderDirStr());
}
QString DeferredShading::renderObjectsInfo(bool _outputShaderInfo) {
std::vector<ACG::ShaderModifier*> modifiers;
modifiers.push_back(&DeferredShadingInitPass::instance);
return dumpCurrentRenderObjectsToString(&sortedObjects_[0], _outputShaderInfo, &modifiers);
}
void DeferredShading::render(ACG::GLState* _glState, Viewer::ViewerProperties& _properties) {
#ifdef GL_ARB_texture_buffer_object
// collect renderobjects + prepare OpenGL state
prepareRenderingPipeline(_glState, _properties.drawMode(), PluginFunctions::getSceneGraphRootNode());
// init/update fbos
ViewerResources* viewRes = &viewerRes_[_properties.viewerId()];
viewRes->resize(_glState->viewport_width(), _glState->viewport_height(), numSamples_);
// update material buffer
materialBufferData_.resize((getNumRenderObjects() + 1) * 5);
// material 0 is used for the background
materialBufferData_[0] = ACG::Vec3f(.0f,.0f,.0f);
materialBufferData_[1] = ACG::Vec3f(.0f,.0f,.0f);
materialBufferData_[2] = ACG::Vec3f(.0f,.0f,.0f);
materialBufferData_[3] = ACG::Vec3f(.0f,.0f,.0f);
materialBufferData_[4] = ACG::Vec3f(1.0f,1.0f,0.0f);
for (int i = 0; i < getNumRenderObjects(); ++i) {
int offset = (i + 1) * 5;
materialBufferData_[offset + 0] = sortedObjects_[i]->emissive;
materialBufferData_[offset + 1] = sortedObjects_[i]->ambient;
materialBufferData_[offset + 2] = sortedObjects_[i]->diffuse;
materialBufferData_[offset + 3] = sortedObjects_[i]->specular;
materialBufferData_[offset + 4] = ACG::Vec3f(sortedObjects_[i]->alpha, sortedObjects_[i]->shininess, 1.0f);
}
int matBufSize = (getNumRenderObjects() + 1) * 5 * 12;
if (matBufSize)
materialBuffer_.setBufferData(matBufSize, &materialBufferData_[0], GL_RGB32F, GL_DYNAMIC_DRAW);
// --------------------------------------------------
// 1st pass: draw scene to G-buffer
// enable color/depth write access
glDepthMask(1);
glColorMask(1,1,1,1);
// bind G-buffer fbo
viewRes->scene_->bind();
glViewport(0, 0, _glState->viewport_width(), _glState->viewport_height());
// attachment0: depth view space, material id
// attachment1: normals
const GLenum colorTarget[2] = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1};
// set G-buffer to zero
for (int i = 0; i < 2; ++i) {
glDrawBuffer(colorTarget[i]);
ACG::Vec4f clearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
// initialize G-buffer
glDrawBuffers(2, colorTarget);
ACG::GLMatrixd matProj;
matProj.clear();
// render every object
for (int i = 0; i < getNumRenderObjects(); ++i) {
// Take original shader and modify the output to output position, normal and material
GLSL::Program* prog = ACG::ShaderCache::getInstance()->getProgram(&sortedObjects_[i]->shaderDesc, DeferredShadingInitPass::instance);
int bRelink = 0;
if (prog->getFragDataLocation("outFragment") != 0) {
prog->bindFragDataLocation(0, "outFragment");
bRelink++;
}
if (prog->getFragDataLocation("outNormal") != 1) {
prog->bindFragDataLocation(1, "outNormal");
bRelink++;
}
if (bRelink)
prog->link();
prog->use();
prog->setUniform("materialID", GLfloat(i+1));
renderObject(sortedObjects_[i], prog);
std::string objName = sortedObjects_[i]->debugName;
if (matProj(0,0) == 0.0)
matProj = sortedObjects_[i]->proj;
// prefer to use the projection matrix of a mesh node
if (objName.compare("MeshNode") == 0)
matProj = sortedObjects_[i]->proj;
}
// extract near and far clipping planes
const ACG::Vec2f clipPlanes(float(matProj(2,3) / (matProj(2,2) - 1.0)), float(matProj(2,3) / (matProj(2,2) + 1.0)));
viewRes->scene_->unbind();
// ----------------------------------------------------------
// lighting passes
// enable/disable multisampling
if (numSamples_) {
ACG::MSFilterWeights filterWeights(numSamples_);
filterWeights.asTextureBuffer(filterWeightsBuffer_);
}
// load lighting shaders if not initialized
if (!progDirectional_)
reloadShaders();
// restore previous fbo
restoreInputFbo();
// enable color/depth write access
glDepthMask(1);
glColorMask(1,1,1,1);
// note: using glDisable(GL_DEPTH_TEST) not only disables depth testing,
// but actually discards any write operations to the depth buffer.
// However, we can provide scene depth for further post-processing.
// -> Enable depth testing with func=always
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_ALWAYS);
// enable additive blending
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
// set input fbo to zero, as we use additive blending from now on
clearInputFbo(ACG::Vec4f(0.0f, 0.0f, 0.0f, 0.0f));
// emission color pass
// maybe do check if necessary here, to avoid drawing black screenquad with no effect
{
GLSL::Program* passShader = numSamples_ ? progEmissiveMS_ : progEmissive_;
// setup emissive shader
passShader->use();
passShader->setUniform("samplerPos", 0);
passShader->setUniform("samplerMaterial", 6);
passShader->setUniform("projParams", ACG::Vec4f(matProj(0,0), matProj(1,1), matProj(2,2), matProj(2,3)) );
passShader->setUniform("clipPlanes", clipPlanes);
if (numSamples_) {
passShader->setUniform("numSamples", numSamples_);
passShader->setUniform("samplerFilterWeights", 7);
filterWeightsBuffer_.bind(GL_TEXTURE7);
}
materialBuffer_.bind(GL_TEXTURE6);
for (int i = 1; i >= 0; --i){
glActiveTexture(GL_TEXTURE0 + i);
glBindTexture(numSamples_ ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D, viewRes->scene_->getAttachment(GL_COLOR_ATTACHMENT0 + i));
}
ACG::ScreenQuad::draw(passShader);
passShader->disable();
}
for (int lightID = 0; lightID < numLights_; ++lightID) {
const LightData* lgt = lights_ + lightID;
// choose shader based on light type and multisampling
GLSL::Program* passShader = 0;
if (lgt->ltype == ACG::SG_LIGHT_DIRECTIONAL)
passShader = numSamples_ ? progDirectionalMS_ : progDirectional_;
else if (lgt->ltype == ACG::SG_LIGHT_SPOT)
passShader = numSamples_ ? progSpotMS_ : progSpot_;
else
passShader = numSamples_ ? progPointMS_ : progPoint_;
// setup lighting shader
passShader->use();
passShader->setUniform("samplerPos", 0);
passShader->setUniform("samplerNormal", 1);
passShader->setUniform("samplerMaterial", 6);
passShader->setUniform("lightDir", lgt->dir);
passShader->setUniform("lightPos", lgt->pos);
passShader->setUniform("lightAtten", lgt->atten);
if (lgt->ltype == ACG::SG_LIGHT_SPOT) {
passShader->setUniform("lightSpotDir", lgt->dir);
passShader->setUniform("lightSpotParam", lgt->spotCutoffExponent);
}
passShader->setUniform("lightAmbient", lgt->ambient);
passShader->setUniform("lightDiffuse", lgt->diffuse);
passShader->setUniform("lightSpecular", lgt->specular);
passShader->setUniform("projParams", ACG::Vec4f(matProj(0,0), matProj(1,1), matProj(2,2), matProj(2,3)) );
passShader->setUniform("clipPlanes", clipPlanes);
if (numSamples_) {
passShader->setUniform("numSamples", numSamples_);
passShader->setUniform("samplerFilterWeights", 7);
filterWeightsBuffer_.bind(GL_TEXTURE7);
}
materialBuffer_.bind(GL_TEXTURE6);
for (int i = 1; i >= 0; --i){
glActiveTexture(GL_TEXTURE0 + i);
glBindTexture(numSamples_ ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D, viewRes->scene_->getAttachment(GL_COLOR_ATTACHMENT0 + i));
}
ACG::ScreenQuad::draw(passShader);
passShader->disable();
}
// draw background color with z-culling
glDepthFunc(GL_LEQUAL);
progBackground_->use();
progBackground_->setUniform("bkColor", _properties.backgroundColor());
ACG::ScreenQuad::draw(progBackground_);
progBackground_->disable();
// reset depth func and blending to opengl default
glDepthFunc(GL_LESS);
glDisable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ZERO);
ACG::glCheckErrors();
// restore common opengl state
// log window remains hidden otherwise
finishRenderingPipeline();
#endif
}
void DeferredShading::reloadShaders() {
const int numShaders = 9;
GLSL::Program** ptrShaders[numShaders] =
{
&progEmissive_, &progEmissiveMS_,
&progBackground_,
&progDirectional_, &progDirectionalMS_,
&progPoint_, &progPointMS_,
&progSpot_, &progSpotMS_
};
const char* shaderFiles[numShaders] =
{
PASS_EMISSIVE_FILE, PASS_EMISSIVE_MS_FILE,
PASS_BACKGROUND_FILE,
PASS_DIRECTIONAL_FILE, PASS_DIRECTIONAL_MS_FILE,
PASS_POINT_FILE, PASS_POINT_MS_FILE,
PASS_SPOT_FILE, PASS_SPOT_MS_FILE,
};
for (int i = 0; i < numShaders; ++i){
GLSL::Program* prog = GLSL::loadProgram(SCREENQUAD_VERTEXSHADER_FILE, shaderFiles[i]);
if (prog){
delete *(ptrShaders[i]);
*(ptrShaders[i]) = prog;
}
}
}
void DeferredShading::ViewerResources::resize( int _newWidth, int _newHeight, int& _numSamples ) {
if (!_newHeight || !_newWidth) return;
// if (!scene_) {
if (!scene_ || scene_->getMultisamplingCount() != _numSamples) {
delete scene_;
// scene fbo with 2 color attachments + depth buffer
// attachment0: view space depth, material id (RG32F)
// attachment1: normals (r8g8b8 color coded normal texture)
scene_ = new ACG::FBO();
scene_->init();
scene_->setMultisampling(_numSamples, GL_TRUE);
scene_->attachTexture2D(GL_COLOR_ATTACHMENT0, _newWidth, _newHeight, GL_RG32F, GL_RG);
scene_->attachTexture2D(GL_COLOR_ATTACHMENT1, _newWidth, _newHeight, GL_RGB, GL_RGB);
// scene_->attachTexture2DDepth(_newWidth, _newHeight);
scene_->addDepthBuffer(_newWidth, _newHeight);
}
_numSamples = scene_->setMultisampling(_numSamples, GL_TRUE);
scene_->resize(_newWidth, _newHeight);
}
void DeferredShading::slotMSAASelection( QAction * _action) {
if ( _action->text() == "0x MSAA") {
numSamples_ = 0;
} else if ( _action->text() == "2x MSAA") {
numSamples_ = 2;
} else if ( _action->text() == "4x MSAA") {
numSamples_ = 4;
} else if ( _action->text() == "8x MSAA") {
numSamples_ = 8;
} else {
std::cerr << "Error : optionHandling unable to find MSAA selection!!! " << _action->text().toStdString() << std::endl;
numSamples_ = 0;
}
// also reload shaders
reloadShaders();
}
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2( deferredshading , DeferredShading );
#endif
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2014 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 18127 $ *
* $LastChangedBy: moebius $ *
* $Date: 2014-02-05 10:12:54 +0100 (Wed, 05 Feb 2014) $ *
* *
\*===========================================================================*/
#pragma once
#include <ACG/GL/acg_glew.hh>
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/BasePlugin/RenderInterface.hh>
#include <vector>
#include <ACG/GL/IRenderer.hh>
#include <ACG/GL/FBO.hh>
#include <ACG/GL/globjects.hh>
#include <ACG/GL/AntiAliasing.hh>
#include <QObject>
class DeferredShading : public QObject, BaseInterface, RenderInterface, ACG::IRenderer
{
Q_OBJECT
Q_INTERFACES(BaseInterface)
Q_INTERFACES(RenderInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-Deferred-Shading")
#endif
public:
DeferredShading();
~DeferredShading();
QString name() { return (QString("Deferred Shading Renderer")); };
QString description( ) { return (QString(tr("Render scene with deferred shading for each light"))); };
public slots:
QString version() { return QString("1.0"); };
QString renderObjectsInfo(bool _outputShaderInfo);
QAction* optionsAction();
private slots:
//BaseInterface
void initializePlugin();
void exit(){}
// RenderInterface
void render(ACG::GLState* _glState, Viewer::ViewerProperties& _properties);
QString rendererName() {return QString("Deferred_Shading");}
void supportedDrawModes(ACG::SceneGraph::DrawModes::DrawMode& _mode) {_mode = ACG::SceneGraph::DrawModes::DEFAULT;}
void reloadShaders();
QString checkOpenGL();
void slotMSAASelection( QAction * );
private:
void loadShader();
/// emissive color pass
GLSL::Program* progEmissive_;
/// emissive color pass with multisampling
GLSL::Program* progEmissiveMS_;
/// background color pass
GLSL::Program* progBackground_;
/// directional lighting pass
GLSL::Program* progDirectional_;
/// directional lighting pass with multisampling
GLSL::Program* progDirectionalMS_;
/// point lighting pass
GLSL::Program* progPoint_;
/// point lighting pass with multisampling
GLSL::Program* progPointMS_;
/// spot lighting pass
GLSL::Program* progSpot_;
/// spot lighting pass with multisampling
GLSL::Program* progSpotMS_;
/// Collection of fbos for each viewport
struct ViewerResources
{
ViewerResources() : scene_(0) {}
~ViewerResources() {delete scene_;}
void resize( int _newWidth, int _newHeight, int& _numSamples );
ACG::FBO* scene_;
};
int numSamples_;
// requires texture buffers and will not load without them
#ifdef GL_ARB_texture_buffer_object
ACG::TextureBuffer filterWeightsBuffer_;
ACG::TextureBuffer materialBuffer_;
#endif
std::vector<ACG::Vec3f> materialBufferData_;
/**
* Stores fbo resources for each viewport.
* Mapping: viewerID -> ViewerResources
*/
std::map<int, ViewerResources> viewerRes_;
};
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2014 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 18127 $ *
* $LastChangedBy: moebius $ *
* $Date: 2014-02-05 10:12:54 +0100 (Wed, 05 Feb 2014) $ *
* *
\*===========================================================================*/
/** @file
*
* Contains definitions of the DeferredShading Renderer that require qt headers
* which are incompatible with glew.h.
*/
#include <ACG/GL/acg_glew.hh>
#include "DeferredShading.hh"
#include <QGLFormat>
#include <QAction>
#include <QMenu>
QString DeferredShading::checkOpenGL() {
// Get version and check
QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
if ( !flags.testFlag(QGLFormat::OpenGL_Version_3_2) )
return QString("Insufficient OpenGL Version! OpenGL 3.2 or higher required");
// Check extensions
QString glExtensions = QString((const char*)glGetString(GL_EXTENSIONS));
QString missing("");
if ( !glExtensions.contains("GL_ARB_vertex_buffer_object") )
missing += "GL_ARB_vertex_buffer_object extension missing\n";
#ifndef __APPLE__
if ( !glExtensions.contains("GL_ARB_vertex_program") )
missing += "GL_ARB_vertex_program extension missing\n";
#endif
return missing;
}
QAction* DeferredShading::optionsAction() {
// QAction * action = new QAction("DeferredShading Renderer Options" , this );
//
// connect(action,SIGNAL(triggered( )),this,SLOT(reloadShaders( )));
//
// return action;
QMenu* menu = new QMenu("DeferredShading Renderer Options");
// Recreate actionGroup
QActionGroup* modeGroup = new QActionGroup( this );
modeGroup->setExclusive( true );
QAction * action = new QAction("0x MSAA" , modeGroup );
action->setCheckable( true );
action->setChecked(true);
action = new QAction("2x MSAA" , modeGroup );
action->setCheckable( true );
action = new QAction("4x MSAA" , modeGroup );
action->setCheckable( true );
action = new QAction("8x MSAA" , modeGroup );
action->setCheckable( true );
menu->addActions(modeGroup->actions());
connect(modeGroup,SIGNAL(triggered( QAction * )),this,SLOT(slotMSAASelection( QAction * )));
return menu->menuAction();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment