From e88e3899d2967d33149e673d803e3c01bccfa571 Mon Sep 17 00:00:00 2001 From: Meoweg Date: Fri, 13 Nov 2015 15:02:01 +0000 Subject: [PATCH] Program is a resource --- src/main.cpp | 2 +- src/program.cpp | 4 ++-- src/program.hpp | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 5f4753b..2bf6a14 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -73,7 +73,7 @@ int main() glfwSetKeyCallback(on_key); emscripten_set_mousemove_callback(nullptr, nullptr, false, on_em_mousemove); - exe = Program(store, "textured").build( + exe = store.load("textured")->build( __attrib_count, attribs, __uniform_count, uniforms ); diff --git a/src/program.cpp b/src/program.cpp index 16235b0..9e5fae7 100644 --- a/src/program.cpp +++ b/src/program.cpp @@ -6,7 +6,7 @@ const std::string Program::filename(const std::string &name) { - return "/data/shaders/" + name; + return "/data/programs/" + name; } Program::Program(Store &store, const std::string &name): @@ -16,7 +16,7 @@ Program::Program(Store &store, const std::string &name): const Executable *Program::build( GLuint attrib_count, const GLchar *const attribs[], - unsigned uniform_count, const GLchar *const uniforms[]) + unsigned uniform_count, const GLchar *const uniforms[]) const { Executable *exe = new Executable(); diff --git a/src/program.hpp b/src/program.hpp index 7d248e5..b50dc13 100644 --- a/src/program.hpp +++ b/src/program.hpp @@ -1,22 +1,22 @@ #ifndef _PROGRAM_HPP_ #define _PROGRAM_HPP_ +#include "resource.hpp" #include "shader.hpp" #include "executable.hpp" #include -struct Program +struct Program: + Resource { - Program(Store &store, const std::string &name); + RESOURCE(Program) const Executable *build( GLuint attrib_count, const GLchar *const attribs[], - unsigned uniform_count, const GLchar *const uniforms[]); + unsigned uniform_count, const GLchar *const uniforms[]) const; private: - static const std::string filename(const std::string &name); - const Shader *vertex_shader; const Shader *fragment_shader; };