+++ /dev/null
-#ifndef MSP_GL_PROGRAM_H_
-#define MSP_GL_PROGRAM_H_
-
-#include <list>
-#include <string>
-#include <msp/datafile/objectloader.h>
-#include "bindable.h"
-#include "gl.h"
-
-namespace Msp {
-namespace GL {
-
-class Shader;
-
-class Program: public Bindable<Program>
-{
-public:
- class Loader: public DataFile::ObjectLoader<Program>
- {
- public:
- Loader(Program &);
-
- private:
- virtual void finish();
-
- void attribute(unsigned, const std::string &);
- void fragment_shader(const std::string &);
- void standard();
- void vertex_shader(const std::string &);
- };
-
- struct StandardFeatures
- {
- class Loader: public DataFile::ObjectLoader<StandardFeatures>
- {
- public:
- Loader(StandardFeatures &);
- };
-
- bool texture;
- bool material;
- bool lighting;
- bool specular;
- bool normalmap;
- bool shadow;
- bool reflection;
- bool transform;
-
- StandardFeatures();
-
- std::string create_flags() const;
- };
-
- struct UniformInfo
- {
- std::string name;
- int location;
- int size;
- GLenum type;
- };
-
-private:
- unsigned id;
- std::list<Shader *> shaders;
- std::list<Shader *> owned_data;
- bool linked;
- std::map<std::string, UniformInfo> uniforms;
- unsigned uniform_layout_hash;
-
-public:
- Program();
- Program(const StandardFeatures &);
- Program(const std::string &, const std::string &);
-private:
- void init();
-public:
- virtual ~Program();
-
- void attach_shader(Shader &shader);
- void attach_shader_owned(Shader *shader);
- void detach_shader(Shader &shader);
- void add_standard_shaders(const StandardFeatures &);
-private:
- static std::string process_standard_source(const char **, const std::string &);
-public:
- const std::list<Shader *> &get_shaders() const { return shaders; }
- void bind_attribute(unsigned, const std::string &);
- void link();
- bool is_linked() const { return linked; }
- std::string get_info_log() const;
- void bind() const;
- unsigned get_uniform_layout_hash() const { return uniform_layout_hash; }
- int get_uniform_location(const std::string &) const;
-
- static void unbind();
-};
-
-} // namespace GL
-} // namespace Msp
-
-#endif