]> git.tdb.fi Git - libs/gl.git/blobdiff - source/programbuilder.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / programbuilder.h
diff --git a/source/programbuilder.h b/source/programbuilder.h
deleted file mode 100644 (file)
index 9ca9c85..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-#ifndef MSP_GL_PROGRAMBUILDER_H_
-#define MSP_GL_PROGRAMBUILDER_H_
-
-#include <map>
-#include <string>
-#include <vector>
-#include <msp/datafile/objectloader.h>
-
-namespace Msp {
-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() { }
-};
-
-/**
-Generates shaders with common features.
-*/
-class ProgramBuilder
-{
-public:
-       /**
-       Describes the features of a standard shader program.
-       */
-       struct StandardFeatures
-       {
-               class Loader: public DataFile::ObjectLoader<StandardFeatures>
-               {
-               public:
-                       Loader(StandardFeatures &);
-               };
-
-               bool texture;
-               bool material;
-               bool lighting;
-               unsigned max_lights;
-               bool skylight;
-               bool specular;
-               bool normalmap;
-               bool shadow;
-               bool reflection;
-               bool legacy;
-               std::string custom;
-
-               StandardFeatures();
-
-               std::string create_flags() const;
-       };
-
-private:
-       enum VariableScope
-       {
-               NO_SCOPE,
-               TYPE,
-               UNIFORM,
-               ATTRIBUTE,
-               VERTEX,
-               FRAGMENT
-       };
-
-       enum InterfaceFlags
-       {
-               NO_INTERFACE = 0,
-               INPUT = 1,
-               OUTPUT = 2,
-               PASSTHROUGH = INPUT|OUTPUT,
-               GOAL = 4
-       };
-
-       struct VariableDefinition
-       {
-               VariableScope scope;
-               const char *name;
-               const char *type;
-               const char *expression;
-               const char *flags;
-       };
-
-       struct ShaderVariable
-       {
-               std::string name;
-               const VariableDefinition *variable;
-               const VariableDefinition *type;
-               std::string resolved_name;
-               std::string resolved_block;
-               bool fuzzy_space;
-               std::string resolved_space;
-               bool array_sum;
-               std::string array_subscript;
-               unsigned array_size;
-               std::list<ShaderVariable *> referenced_vars;
-               std::list<ShaderVariable *> referenced_by;
-               bool inlined;
-               bool inline_parens;
-               bool in_loop;
-
-               ShaderVariable(const std::string &);
-
-               void resolve(const VariableDefinition &);
-               void resolve(ShaderVariable &);
-               void resolve_type(const VariableDefinition &);
-               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_type_declaration() 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 MatchType
-       {
-               NO_MATCH,
-               EXACT,
-               FUZZY,
-               ARRAY
-       };
-
-       StandardFeatures features;
-       std::list<VariableDefinition> custom_variables;
-       std::string feature_flags;
-       std::map<std::string, std::string> aliases;
-       bool optimize;
-
-       static const VariableDefinition standard_variables[];
-       static const char interfaces[];
-
-public:
-       ProgramBuilder(const StandardFeatures &);
-
-       void set_optimize(bool);
-       Program *create_program() const;
-       void add_shaders(Program &) const;
-private:
-       std::string create_source(const std::list<ShaderVariable *> &, VariableScope) const;
-       bool evaluate_flags(const char *) const;
-       static const char *unqualified_name(const char *);
-       static MatchType name_match(const char *, const char *, const char ** = 0);
-       static bool parse_identifier(const char *, unsigned &, unsigned &);
-       static std::vector<std::string> extract_identifiers(const char *);
-       static std::string replace_identifiers(const char *, const std::map<std::string, std::string> &);
-       std::string create_expression(const ShaderVariable &, const char * = 0) const;
-};
-
-} // namespace GL
-} // namespace Msp
-
-#endif