| 1 |
/****************************************************************************** |
| 2 |
This source file is part of the Avogadro project. |
| 3 |
This source code is released under the 3-Clause BSD License, (see "LICENSE"). |
| 4 |
******************************************************************************/ |
| 5 |
|
| 6 |
#ifndef AVOGADRO_QTPLUGINS_MESHES_H |
| 7 |
#define AVOGADRO_QTPLUGINS_MESHES_H |
| 8 |
|
| 9 |
#include <avogadro/core/vector.h> |
| 10 |
#include <avogadro/qtgui/sceneplugin.h> |
| 11 |
|
| 12 |
namespace Avogadro { |
| 13 |
namespace QtPlugins { |
| 14 |
|
| 15 |
/** |
| 16 |
* @brief Render one or more triangular meshes. |
| 17 |
* @author Marcus D. Hanwell |
| 18 |
*/ |
| 19 |
class SurfaceRender : public QtGui::ScenePlugin |
| 20 |
{ |
| 21 |
Q_OBJECT |
| 22 |
|
| 23 |
public: |
| 24 |
explicit SurfaceRender(QObject* parent = nullptr); |
| 25 |
~SurfaceRender() override; |
| 26 |
|
| 27 |
void process(const QtGui::Molecule& mol, Rendering::GroupNode& node) override; |
| 28 |
|
| 29 |
QString name() const override { return tr("Surfaces"); } |
| 30 |
|
| 31 |
QString description() const override |
| 32 |
{ |
| 33 |
return tr("Render molecular surfaces."); |
| 34 |
} |
| 35 |
|
| 36 |
QWidget* setupWidget() override; |
| 37 |
bool hasSetupWidget() const override { return true; } |
| 38 |
|
| 39 |
DefaultBehavior defaultBehavior() const override |
| 40 |
{ |
| 41 |
return DefaultBehavior::False; |
| 42 |
} |
| 43 |
|
| 44 |
enum Style |
| 45 |
{ |
| 46 |
Surface = 0, |
| 47 |
Wireframe = 1, |
| 48 |
Volume = 2 |
| 49 |
}; |
| 50 |
|
| 51 |
private slots: |
| 52 |
void setColor1(const QColor& color); |
| 53 |
void setColor2(const QColor& color); |
| 54 |
void setOpacity(int opacity); |
| 55 |
void setStyle(int style); |
| 56 |
void setLineWidth(double width); |
| 57 |
|
| 58 |
private: |
| 59 |
std::string m_name = "Surfaces"; |
| 60 |
|
| 61 |
QWidget* m_setupWidget; |
| 62 |
unsigned char m_opacity; |
| 63 |
Vector3ub m_color1; |
| 64 |
Vector3ub m_color2; |
| 65 |
unsigned char m_style; |
| 66 |
float m_lineWidth; |
| 67 |
}; |
| 68 |
|
| 69 |
} // end namespace QtPlugins |
| 70 |
} // end namespace Avogadro |
| 71 |
|
| 72 |
#endif // AVOGADRO_QTPLUGINS_MESHES_H |