VR-Vantage 2.3 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtEffect.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2017 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <string>
14 
15 namespace makVrv
16 {
20  {
21  public:
22 
24  {
25  VertexAttribPtrInfo(const void* p, unsigned int t, unsigned int s)
26  : pointer(p)
27  , type(t)
28  , size(s)
29  {
30  }
31 
32  const void* pointer; //Address
33  unsigned int type; //The OpenGL type of the attribute.
34  unsigned int size; //The OpenGL width of the attribute 1-4
35 
37  {
38  return pointer==rhs.pointer && type==rhs.type && size==rhs.size;
39  }
40  };
41 
43  DtEffect(const std::string& dataPath);
44 
46  virtual ~DtEffect();
47 
49  void releaseResources();
50 
52  bool enabled() const;
53 
54  //Start using the effect. Returns true if the effect is enabled.
55  bool enable();
56 
57  //Stop using the effect.
58  void disable();
59 
60  // Utility function
61  static std::string loadShaderSource(const std::string& strFileName);
62 
63  protected:
65  virtual void initializeShaderSource(void) = 0;
66  virtual void updateUniformLocations() = 0;
67  virtual void updateUniforms() = 0;
68 
69  protected:
70 
72  bool compileShaders(void);
73 
74  protected:
75 
78  unsigned int myProgram;
79  unsigned int myVertexShader;
80  unsigned int myFragmentShader;
81 
87 
89  };
90 
95  {
96  public:
97 
99  {
100  virtual ~CreateParameters()
101  {
102  }
103  };
104 
105  DtEffectCreator();
106  virtual ~DtEffectCreator();
107  virtual DtEffect* create(const std::string& dataPath, CreateParameters* params = 0) = 0;
108  };
109 
110 }
111 


Copyright © 2005-2018 VT MAK. All Rights Reserved (www.mak.com)