X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fprogrambuilder.h;fp=source%2Fprogrambuilder.h;h=cca0c14912165616eecc7f9838e59671a9a2ebb1;hp=69170e02ef979f543b16f1fc53ef0c9adbc0c2d1;hb=825a334729ded60f7b554af4b2d5ab57122efbe9;hpb=d542522823423f9ed2a5d412de9250ee8367334b diff --git a/source/programbuilder.h b/source/programbuilder.h index 69170e02..cca0c149 100644 --- a/source/programbuilder.h +++ b/source/programbuilder.h @@ -32,6 +32,7 @@ public: bool texture; bool material; bool lighting; + unsigned max_lights; bool specular; bool normalmap; bool shadow; @@ -79,31 +80,37 @@ private: std::string resolved_name; bool fuzzy_space; std::string resolved_space; + bool array_sum; + std::string array_subscript; + unsigned array_size; std::list referenced_vars; std::list referenced_by; bool inlined; bool inline_parens; + bool in_loop; ShaderVariable(const std::string &); void resolve(const VariableDefinition &); void resolve(ShaderVariable &); void resolve_space(const std::string &); + void resolve_array(const StandardFeatures &, unsigned = 0); void add_reference(ShaderVariable &); void update_reference(ShaderVariable &, ShaderVariable &); void check_inline(bool, bool); bool is_referenced_from(VariableScope) const; InterfaceFlags get_interface_flags(VariableScope) const; - std::string create_declaration(char = 0) const; - std::string create_replacement(VariableScope) const; - std::string create_expression() const; + std::string create_declaration(char = 0, bool = false) const; + std::string create_replacement(VariableScope, const char * = 0) const; + std::string create_expression(const char * = 0) const; }; - enum MatchLevel + enum MatchType { NO_MATCH, EXACT, - FUZZY + FUZZY, + ARRAY }; StandardFeatures features; @@ -123,7 +130,7 @@ public: 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 MatchType 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 &);