X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogrambuilder.h;h=8275e4579556e91aabd3c1b6d39d63698146b34d;hb=cdd4ca79e38325a482f007d5d271d08b2d9bec6c;hp=6845f4a9450590b7ab5c01e37b3ab99fbd886086;hpb=dd6b80599116d6e61f3ea6c7a917586def15e3a3;p=libs%2Fgl.git diff --git a/source/programbuilder.h b/source/programbuilder.h index 6845f4a9..8275e457 100644 --- a/source/programbuilder.h +++ b/source/programbuilder.h @@ -11,6 +11,13 @@ namespace GL { class Program; +class invalid_variable_definition: public std::invalid_argument +{ +public: + invalid_variable_definition(const std::string &w): std::invalid_argument(w) { } + virtual ~invalid_variable_definition() throw() { } +}; + class ProgramBuilder { public: @@ -29,15 +36,15 @@ public: bool normalmap; bool shadow; bool reflection; - bool transform; - bool colorify; bool legacy; + std::string custom; StandardFeatures(); std::string create_flags() const; }; +private: enum VariableScope { NO_SCOPE, @@ -47,8 +54,7 @@ public: FRAGMENT }; -private: - struct StandardVariable + struct VariableDefinition { VariableScope scope; const char *name; @@ -60,7 +66,7 @@ private: struct ShaderVariable { std::string name; - const StandardVariable *variable; + const VariableDefinition *variable; std::string resolved_name; bool fuzzy_space; std::string resolved_space; @@ -71,12 +77,12 @@ private: ShaderVariable(const std::string &); - void resolve(const StandardVariable &); + void resolve(const VariableDefinition &); void resolve(ShaderVariable &); void resolve_space(const std::string &); void add_reference(ShaderVariable &); void update_reference(ShaderVariable &, ShaderVariable &); - void check_inline(bool); + void check_inline(bool, bool); bool is_referenced_from(VariableScope) const; std::string get_expression() const; }; @@ -89,10 +95,11 @@ private: }; StandardFeatures features; + std::list custom_variables; std::string feature_flags; bool optimize; - static const StandardVariable standard_variables[]; + static const VariableDefinition standard_variables[]; public: ProgramBuilder(const StandardFeatures &);