X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fprogram.h;h=b875ec79f089f28e6ec629cb426ee354d9d674b5;hp=63d43e0f800f65b9ac58b7df6017c6bf7b51588f;hb=f14435e58bfa0fa697a06ba9a454bb30cd37d9d8;hpb=42ace9ac1350d3ae009bdd2fb335ac1e57d1b36b diff --git a/source/program.h b/source/program.h index 63d43e0f..b875ec79 100644 --- a/source/program.h +++ b/source/program.h @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #ifndef MSP_GL_PROGRAM_H_ #define MSP_GL_PROGRAM_H_ @@ -21,12 +14,6 @@ class Shader; class Program: public Bindable { -private: - unsigned id; - std::list shaders; - bool del_shaders; - bool linked; - public: class Loader: public DataFile::ObjectLoader { @@ -34,13 +21,52 @@ public: Loader(Program &); private: - void vertex_shader(const std::string &); - void fragment_shader(const std::string &); - void attribute(unsigned, const std::string &); 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 + { + public: + Loader(StandardFeatures &); + }; + + bool texture; + bool material; + bool lighting; + bool specular; + bool normalmap; + bool shadow; + + StandardFeatures(); + + std::string create_flags() const; + }; + + struct UniformInfo + { + std::string name; + int location; + int size; + GLenum type; + }; + +private: + unsigned id; + std::list shaders; + bool del_shaders; + bool linked; + std::map uniforms; + +public: Program(); + Program(const StandardFeatures &); Program(const std::string &, const std::string &); private: void init(); @@ -49,12 +75,15 @@ public: void attach_shader(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 &get_shaders() const { return shaders; } void set_del_shaders(bool); void bind_attribute(unsigned, const std::string &); void link(); - int get_param(GLenum param) const; - bool get_linked() const { return linked; } + bool is_linked() const { return linked; } std::string get_info_log() const; void bind() const; int get_uniform_location(const std::string &) const;