ShaderProgram is now a Resource.

All shaderprograms are now pointers and loaded with Resourcemanager.
This commit is contained in:
Tleety
2015-12-11 16:53:46 +01:00
parent 53d5736420
commit 45b87ed6b1
8 changed files with 45 additions and 36 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ private:
const IRenderer* m_Renderer;
ShaderProgram m_BasicForwardProgram;
ShaderProgram* m_BasicForwardProgram;
};
+2 -2
View File
@@ -22,7 +22,7 @@ public:
//Getters
const ShaderProgram& PickingProgram() const { return m_PickingProgram; }
const ShaderProgram& PickingProgram() const { return *m_PickingProgram; }
const std::unordered_map<glm::vec2, EntityID>& PickingColorsToEntity() const { return m_PickingColorsToEntity; }
GLuint PickingTexture() const { return m_PickingTexture; }
GLuint DepthBuffer() const { return m_DepthBuffer; }
@@ -36,7 +36,7 @@ private:
const IRenderer* m_Renderer;
ShaderProgram m_PickingProgram;
ShaderProgram* m_PickingProgram;
std::unordered_map<glm::vec2, EntityID> m_PickingColorsToEntity;
+4 -4
View File
@@ -114,10 +114,10 @@ private:
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type);
//--------------------ShaderPrograms-------------------//
ShaderProgram m_BasicForwardProgram;
ShaderProgram m_DrawScreenQuadProgram;
ShaderProgram m_CalculateFrustumProgram;
ShaderProgram m_LightCullProgram;
ShaderProgram* m_BasicForwardProgram;
ShaderProgram* m_DrawScreenQuadProgram;
ShaderProgram* m_CalculateFrustumProgram;
ShaderProgram* m_LightCullProgram;
};
+6 -3
View File
@@ -3,6 +3,7 @@
#include "../Common.h"
#include "../OpenGL.h"
#include "../Core/ResourceManager.h"
#include <fstream>
class Shader
@@ -62,11 +63,13 @@ public:
: ShaderType(fileName) { }
};
class ShaderProgram
class ShaderProgram : public Resource
{
public:
ShaderProgram()
friend class ResourceManager;
private:
ShaderProgram(std::string)
: m_ShaderProgramHandle(0) { }
public:
~ShaderProgram();
void AddShader(std::shared_ptr<Shader> shader);