X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fprogrambuilder.h;h=053eb567487a9a03964235a5d04b3d84c555a68c;hp=30f1ef15738b3ab969c288442fe354c0ae7b7843;hb=HEAD;hpb=9034e81679eeeaa3d1d5d643d3f924d9edb45a68 diff --git a/source/programbuilder.h b/source/programbuilder.h deleted file mode 100644 index 30f1ef15..00000000 --- a/source/programbuilder.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef MSP_GL_PROGRAMBUILDER_H_ -#define MSP_GL_PROGRAMBUILDER_H_ - -#include -#include -#include -#include - -namespace Msp { -namespace GL { - -class Program; - -class ProgramBuilder -{ -public: - struct StandardFeatures - { - class Loader: public DataFile::ObjectLoader - { - 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; - }; - - enum VariableScope - { - NO_SCOPE, - UNIFORM, - ATTRIBUTE, - VERTEX, - FRAGMENT - }; - -private: - struct StandardVariable - { - VariableScope scope; - const char *name; - const char *type; - const char *expression; - const char *flags; - }; - - struct ShaderVariable - { - std::string name; - const StandardVariable *variable; - std::string resolved_name; - bool fuzzy_space; - std::string resolved_space; - std::list referenced_vars; - std::list referenced_by; - - ShaderVariable(const std::string &); - - void resolve(const StandardVariable &); - void resolve(ShaderVariable &); - void resolve_space(const std::string &); - void add_reference(ShaderVariable &); - void update_reference(ShaderVariable &, ShaderVariable &); - bool is_referenced_from(VariableScope) const; - std::string get_expression() const; - }; - - enum MatchLevel - { - NO_MATCH, - EXACT, - FUZZY - }; - - StandardFeatures features; - std::string feature_flags; - - static const StandardVariable standard_variables[]; - -public: - ProgramBuilder(const StandardFeatures &); - - Program *create_program() const; - void add_shaders(Program &) const; -private: - std::string create_source(const std::list &, VariableScope) const; - bool evaluate_flags(const char *) const; - static MatchLevel name_match(const char *, const char *, const char ** = 0); - static bool parse_identifier(const char *, unsigned &, unsigned &); - static std::vector extract_identifiers(const char *); - static std::string replace_identifiers(const char *, const std::map &); -}; - -} // namespace GL -} // namespace Msp - -#endif