Molecule Visualizer
 All Classes Namespaces Files Functions Enumerations Enumerator Macros Groups Pages
ModelLoader.hpp
Go to the documentation of this file.
1 
7 #pragma once
8 #ifndef MODELLOADER_HPP
9 #define MODELLOADER_HPP
10 
11 #include "GL/glew.h"
12 #include "Atom.hpp"
13 #include <glm/glm.hpp>
14 #include <string>
15 #include <map>
16 #include <vector>
17 #include <GL/glew.h>
18 
20 {
21 public:
25  ModelLoader();
26 
30  ~ModelLoader();
31 
37  bool load(const std::string absoluteFilePath);
38 
44  void setTextureSize(int size);
45 
50  GLuint getVao() const;
51 
56  int getAtomCount();
57  float m_boundingSphere;
58 
59 private:
60 
76  enum ColorMode
77  {
78  ATOMCOLOR,
79  CHAINCOLOR,
80  WHITE
81  };
82 
87  void initialize();
88 
93  void clearVertexObjects();
94 
99  void generateVao();
100 
107  void setupColorMode(enum ColorMode colorMode, bool isLoading);
108 
109  std::vector<glm::vec4> m_bufferVertexPos;
110  std::vector<glm::vec3> m_bufferColors;
111  std::vector<GLfloat> m_bufferRadii;
112  std::vector<glm::vec3> m_bufferChainColors;
113  std::vector<glm::vec4> m_bufferTextureQuads;
114 
115  GLuint m_vao;
116  GLuint m_vbo[4];
117  double m_sizeTexture;
118 
119  bool m_bIsLoaded;
120  int m_chainCount;
121  enum ColorMode m_colorMode;
122 
123  std::vector<Atom*> m_atoms;
124  std::map<std::string, glm::vec3> m_colors;
125  std::map<std::string, glm::vec3> m_chainColors;
126  std::vector<glm::vec3> m_existingChainColors;
127 
128  std::map<std::string, float> m_radius;
129 };
130 
131 #endif
GLuint getVao() const
A member function to get the vertex array object.
Definition: ModelLoader.cpp:268
Class for an Atom.
Definition: ModelLoader.hpp:19
ModelLoader()
Default constructor.
Definition: ModelLoader.cpp:17
bool load(const std::string absoluteFilePath)
A member function to load a model given by an absolute file path.
Definition: ModelLoader.cpp:43
void setTextureSize(int size)
A member function to set the texture size.
Definition: ModelLoader.cpp:38
int getAtomCount()
A member function to get the atom count.
Definition: ModelLoader.cpp:309
~ModelLoader()
Destructor.
Definition: ModelLoader.cpp:34