File tree 14 files changed +29
-18
lines changed
14 files changed +29
-18
lines changed Original file line number Diff line number Diff line change 1
1
#include " camera.h"
2
2
#include " drawcontext.h"
3
- #include < QGLShaderProgram >
3
+ #include " Shader.h "
4
4
5
5
Camera::Camera ()
6
6
{
Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ class SceneObject;
39
39
class Scene ;
40
40
class CameraController ;
41
41
class Texture ;
42
- class QGLShaderProgram ;
43
42
class MeshRenderer ;
44
43
45
44
inline float randf () {
Original file line number Diff line number Diff line change 1
1
#include " directlight.h"
2
2
#include " drawcontext.h"
3
- #include < QGLShaderProgram >
3
+ #include " shader.h "
4
4
5
5
DirectLight::DirectLight (const vec3 &direction, const Color &color)
6
6
: direction_(direction),
Original file line number Diff line number Diff line change 4
4
#include " geometry.h"
5
5
#include " common.h"
6
6
#include " scene.h"
7
-
8
- class QGLShaderProgram ;
7
+ #include " shader.h"
9
8
10
9
class DrawContext
11
10
{
12
11
public:
13
12
Camera* camera = NULL ;
14
13
15
14
// Currently enabled shader
16
- QGLShaderProgram * shader = NULL ;
15
+ Shader * shader = NULL ;
17
16
18
17
// Time elapsed since last frame
19
18
float deltaTime = 0 ;
Original file line number Diff line number Diff line change @@ -35,7 +35,8 @@ SOURCES += main.cpp \
35
35
particlesystem.cpp \
36
36
meshrenderer.cpp \
37
37
phongmaterial.cpp \
38
- particlematerial.cpp
38
+ particlematerial.cpp \
39
+ shader.cpp
39
40
40
41
HEADERS += mainwindow.h \
41
42
view.h \
@@ -59,6 +60,7 @@ HEADERS += mainwindow.h \
59
60
particlesystem.h \
60
61
meshrenderer.h \
61
62
phongmaterial.h \
62
- particlematerial.h
63
+ particlematerial.h \
64
+ shader.h
63
65
64
66
FORMS += mainwindow.ui
Original file line number Diff line number Diff line change 2
2
#define MATERIAL_H
3
3
4
4
#include " common.h"
5
+ #include " shader.h"
5
6
6
7
class Material
7
8
{
@@ -11,7 +12,7 @@ class Material
11
12
virtual void endRender () {}
12
13
13
14
protected:
14
- QGLShaderProgram *shader_ = NULL ;
15
+ Shader *shader_ = NULL ;
15
16
};
16
17
17
18
#endif // MATERIAL_H
Original file line number Diff line number Diff line change 1
1
#include " particlematerial.h"
2
- #include < QGLShaderProgram >
2
+ #include " shader.h "
3
3
#include " shadercache.h"
4
4
#include " drawcontext.h"
5
5
#include " texture.h"
Original file line number Diff line number Diff line change 1
1
#include < GL/glew.h>
2
2
#include " PhongMaterial.h"
3
- #include < QGLShaderProgram >
3
+ #include " shader.h "
4
4
#include " shadercache.h"
5
5
#include " drawcontext.h"
6
6
#include " texture.h"
Original file line number Diff line number Diff line change 2
2
#include " drawcontext.h"
3
3
#include " camera.h"
4
4
#include " light.h"
5
- #include < QGLShaderProgram >
5
+ #include " shader.h "
6
6
7
7
SceneObject::SceneObject ()
8
8
{
Original file line number Diff line number Diff line change
1
+ #include " shader.h"
2
+
Original file line number Diff line number Diff line change
1
+ #ifndef SHADER_H
2
+ #define SHADER_H
3
+
4
+ #include <QGLShaderProgram>
5
+
6
+ typedef QGLShaderProgram Shader ;
7
+
8
+ #endif // SHADER_H
Original file line number Diff line number Diff line change @@ -17,15 +17,15 @@ ShaderCache::~ShaderCache()
17
17
delete g_instance;
18
18
}
19
19
20
- unique_ptr<QGLShaderProgram > ShaderCache::loadResource (string shader)
20
+ unique_ptr<Shader > ShaderCache::loadResource (string shader)
21
21
{
22
22
string path = " shaders/" ;
23
23
24
24
string vertexShader = path + shader + " .vs" ;
25
25
string geometryShader = path + shader + " .gs" ;
26
26
string fragmentShader = path + shader + " .fs" ;
27
27
28
- unique_ptr<QGLShaderProgram > p (new QGLShaderProgram );
28
+ unique_ptr<Shader > p (new Shader );
29
29
30
30
bool result;
31
31
Original file line number Diff line number Diff line change 2
2
#define SHADERCACHE_H
3
3
4
4
#include < resourcecache.h>
5
- #include < QGLShaderProgram >
5
+ #include " shader.h "
6
6
7
- class ShaderCache : public ResourceCache <QGLShaderProgram >
7
+ class ShaderCache : public ResourceCache <Shader >
8
8
{
9
9
public:
10
10
static ShaderCache* getInstance ();
11
11
12
12
private:
13
13
virtual ~ShaderCache ();
14
- virtual unique_ptr<QGLShaderProgram > loadResource (string name) override ;
14
+ virtual unique_ptr<Shader > loadResource (string name) override ;
15
15
};
16
16
17
17
#endif // SHADERCACHE_H
Original file line number Diff line number Diff line change 1
1
#include < GL/glew.h>
2
2
#include " texture.h"
3
3
#include " drawcontext.h"
4
- #include < QGLShaderProgram >
4
+ #include " shader.h "
5
5
#include < QImage>
6
6
#include < QFile>
7
7
You can’t perform that action at this time.
0 commit comments