Program is a resource
This commit is contained in:
parent
7631a8d26e
commit
e88e3899d2
|
@ -73,7 +73,7 @@ int main()
|
||||||
glfwSetKeyCallback(on_key);
|
glfwSetKeyCallback(on_key);
|
||||||
emscripten_set_mousemove_callback(nullptr, nullptr, false, on_em_mousemove);
|
emscripten_set_mousemove_callback(nullptr, nullptr, false, on_em_mousemove);
|
||||||
|
|
||||||
exe = Program(store, "textured").build(
|
exe = store.load<Program>("textured")->build(
|
||||||
__attrib_count, attribs,
|
__attrib_count, attribs,
|
||||||
__uniform_count, uniforms
|
__uniform_count, uniforms
|
||||||
);
|
);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
const std::string Program::filename(const std::string &name)
|
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):
|
Program::Program(Store &store, const std::string &name):
|
||||||
|
@ -16,7 +16,7 @@ Program::Program(Store &store, const std::string &name):
|
||||||
|
|
||||||
const Executable *Program::build(
|
const Executable *Program::build(
|
||||||
GLuint attrib_count, const GLchar *const attribs[],
|
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();
|
Executable *exe = new Executable();
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
#ifndef _PROGRAM_HPP_
|
#ifndef _PROGRAM_HPP_
|
||||||
#define _PROGRAM_HPP_
|
#define _PROGRAM_HPP_
|
||||||
|
|
||||||
|
#include "resource.hpp"
|
||||||
#include "shader.hpp"
|
#include "shader.hpp"
|
||||||
#include "executable.hpp"
|
#include "executable.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
struct Program
|
struct Program:
|
||||||
|
Resource
|
||||||
{
|
{
|
||||||
Program(Store &store, const std::string &name);
|
RESOURCE(Program)
|
||||||
|
|
||||||
const Executable *build(
|
const Executable *build(
|
||||||
GLuint attrib_count, const GLchar *const attribs[],
|
GLuint attrib_count, const GLchar *const attribs[],
|
||||||
unsigned uniform_count, const GLchar *const uniforms[]);
|
unsigned uniform_count, const GLchar *const uniforms[]) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const std::string filename(const std::string &name);
|
|
||||||
|
|
||||||
const Shader *vertex_shader;
|
const Shader *vertex_shader;
|
||||||
const Shader *fragment_shader;
|
const Shader *fragment_shader;
|
||||||
};
|
};
|
||||||
|
|
Reference in New Issue