AO4MO
 All Classes Functions Variables Enumerations Enumerator
moleculerenderer.h
1 #ifndef MOLECULERENDERER_H
2 #define MOLECULERENDERER_H
3 
4 #include "gl\glew.h"
5 #include <QGLWidget>
6 #include <PDBLoader.h>
7 #include <qglbuffer.h>
8 #include <VertexArrayObject.h>
9 #include <GLBuffer.h>
10 #include <qglshaderprogram.h>
11 #include <qglframebufferobject.h>
12 #include <Texture.h>
13 #include <FrameBuffer.h>
14 #include <Matrix4x4.h>
15 
16 class MoleculeRenderer : public QGLWidget
17 {
18  Q_OBJECT
19 
20 public:
21  MoleculeRenderer(QWidget *parent);
23 
24 public slots:
28  void loadData();
33  void inAtomScale(int scale);
38  void inAOTextureSize(int id);
43  void inBorderThickness(int value);
48  void inBorderDepth(int value);
53  void inLightAO(int value);
58  void inLightDiff(int);
63  void inLightSpecRad(int);
68  void inLightSpecPow(int);
73  void inColorSelect(int);
74 
75 
76 protected:
80  void initializeGL();
86  void resizeGL(int w, int h);
90  void paintGL();
91  void mouseMoveEvent(QMouseEvent* event);
92  void mousePressEvent(QMouseEvent* event);
93  void mouseReleaseEvent (QMouseEvent* event);
94  void wheelEvent(QWheelEvent* event);
95 
96 private:
100  enum RenderMode{
101  SPHERE,
102  CYLINDER
103  };
108  void setAOTextureSize(int size);
112  void prepareData(void);
119  void render(QGLShaderProgram *sp,Matrix4x4 * modelMatrix,RenderMode rm);
123  void calcAO(void);
127  void calcAODirrections();
134  void setGlobalScale(float rawScale,float atomScale,float zoom);
138  struct direction{
139  float directionVector[3];
140  };
141  int atomScale;
142  direction *directions;
143  int directionsCount;
144  bool renderBonds;
145  Matrix4x4 moleculeRotation;
146  Matrix4x4 lastMoleculeRotation;
147  float moleculeScale;
148  float rawMoleculeScale;
149  int atomCount;
150  int bondCount;
151  QPoint lastClick;
152  bool manipulationInProgrese;
153  MolecularData mData;
154  GLBuffer vertexBuffer;
155  GLBuffer indexBuffer;
156  VertexArrayObject vao;
157  int aoTextureSize;
158  Texture aoTexture;
159  Texture shadowmap;
160  FrameBuffer fbo;
161  QGLShaderProgram sphereShader;
162  QGLShaderProgram sphereShaderShadow;
163  QGLShaderProgram sphereShaderAO;
164  QGLShaderProgram cylinderShader;
165  QGLShaderProgram cylinderShaderShadow;
166  QGLShaderProgram cylinderShaderAO;
167  int viewPortWidth;
168  int viewPortHeight;
169  bool aoInProgress;
170  float zoom;
172 };
173 
174 #endif // MOLECULERENDERER_H