VR-Forces Development_Version Class 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) 2010 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();
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 
77  unsigned int myProgram;
78  unsigned int myVertexShader;
79  unsigned int myFragmentShader;
80 
81  std::string myVertexShaderSource;
84  };
85 
90  {
91  public:
92 
94  {
95  virtual ~CreateParameters()
96  {
97  }
98  };
99 
100  DtEffectCreator();
101  virtual ~DtEffectCreator();
102  virtual DtEffect* create(CreateParameters* params = 0) = 0;
103  };
104 
105 }
106 

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)