]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/module.h
Split Module into a base class and format-specific class
[libs/gl.git] / source / core / module.h
index f65f739aeb1e2de9a6a8a640b473a9312655dc3d..78afcfc9823997161644c1d51e4eb5830a1c008f 100644 (file)
@@ -13,18 +13,37 @@ class Resources;
 
 class Module
 {
-private:
-       std::string prepared_source;
-       SL::SourceMap source_map;
+public:
+       enum Format
+       {
+               GLSL,
+       };
 
+protected:
+       Module() { }
 public:
-       Module();
+       virtual ~Module() { }
+
+       virtual Format get_format() const = 0;
 
        void set_source(const std::string &);
        void load_source(IO::Base &, Resources *, const std::string &);
        void load_source(IO::Base &, const std::string &);
 private:
-       void compile(SL::Compiler &);
+       virtual void compile(SL::Compiler &) = 0;
+};
+
+class GlslModule: public Module
+{
+private:
+       std::string prepared_source;
+       SL::SourceMap source_map;
+
+public:
+       virtual Format get_format() const { return GLSL; }
+
+private:
+       virtual void compile(SL::Compiler &);
 
 public:
        const std::string &get_prepared_source() const { return prepared_source; }