GlobeEngine
ShaderParser.h
Go to the documentation of this file.
1 
9 #ifndef GlobeEngine_ShaderParser_h
10 #define GlobeEngine_ShaderParser_h
11 
12 #include "OpenGL_Includes.h"
13 #include <string>
14 #include <vector>
15 #include <memory>
16 
17 namespace ge {
18 
19  struct ShaderProperty {
20  enum Type { FLOAT, INT, VEC3, VEC4, MAT4 };
22 
25  std::string _name;
26  };
27 
29  std::string name;
30  int value;
31  };
32 
37  std::vector<ShaderDefineProperty> defines;
41  std::vector<std::string> inAttributes;
42 
46  std::vector<std::string> outAttributes;
47 
51  std::vector<std::string> uniformAttributes;
52  };
53 
55  {
56  public:
57  ShaderParser();
58  ~ShaderParser();
59  void create();
60  void clear();
61 
62  static std::string readFile(std::string _repopath);
63  static std::vector<std::string> splitProgram(const std::string& _source, std::string _filepath);
64  static std::shared_ptr<ge::ShaderAttributes> getAttributesFromString(const std::string& _source);
65  static std::string getAttributePropertyFromLine(ShaderProperty::IOType _iotype, std::string _line);
66  static unsigned short getOffSetForType(ShaderProperty::IOType _iotype);
67  static ShaderDefineProperty getDefinePropertyFromLine(std::string _line);
68 
69  private:
70 
71 
72  };
73 
74 
75 }
76 #endif
Definition: ShaderParser.h:28
void create()
Definition: ShaderParser.cpp:29
Definition: ShaderParser.h:21
Definition: ShaderParser.h:20
static std::vector< std::string > splitProgram(const std::string &_source, std::string _filepath)
Definition: ShaderParser.cpp:73
Definition: ShaderParser.h:21
Definition: ShaderParser.h:20
Definition: ShaderParser.h:20
std::vector< std::string > outAttributes
Definition: ShaderParser.h:46
std::string name
Definition: ShaderParser.h:29
Definition: ShaderParser.h:21
static unsigned short getOffSetForType(ShaderProperty::IOType _iotype)
Definition: ShaderParser.cpp:57
Definition: ShaderParser.h:21
Definition: ShaderParser.h:33
std::string _name
Definition: ShaderParser.h:25
static std::string readFile(std::string _repopath)
Definition: ShaderParser.cpp:167
static std::string getAttributePropertyFromLine(ShaderProperty::IOType _iotype, std::string _line)
Definition: ShaderParser.cpp:48
static ShaderDefineProperty getDefinePropertyFromLine(std::string _line)
Definition: ShaderParser.cpp:38
Definition: ShaderParser.h:19
std::vector< std::string > inAttributes
Definition: ShaderParser.h:41
IOType
Definition: ShaderParser.h:21
std::vector< ShaderDefineProperty > defines
Definition: ShaderParser.h:37
Definition: ShaderParser.h:20
int value
Definition: ShaderParser.h:30
void clear()
Definition: ShaderParser.cpp:24
Definition: ShaderParser.h:20
Definition: AvalancheTrainingSimulationEngine.h:28
std::vector< std::string > uniformAttributes
Definition: ShaderParser.h:51
~ShaderParser()
Definition: ShaderParser.cpp:19
ShaderParser()
Definition: ShaderParser.cpp:14
IOType _iotype
Definition: ShaderParser.h:23
Definition: ShaderParser.h:54
static std::shared_ptr< ge::ShaderAttributes > getAttributesFromString(const std::string &_source)
Definition: ShaderParser.cpp:120
Type
Definition: ShaderParser.h:20
Type _type
Definition: ShaderParser.h:24