]> git.tdb.fi Git - libs/gl.git/blobdiff - source/resources/resources.cpp
Compile SPIR-V modules from GLSL if needed
[libs/gl.git] / source / resources / resources.cpp
index b5093932c2516f44d7fd93c660aafe1e734eb93f..11dc2d329dd29cfca2ec9385b72361f6260e54b8 100644 (file)
@@ -5,6 +5,7 @@
 #include "camera.h"
 #include "font.h"
 #include "keyframe.h"
+#include "light.h"
 #include "lighting.h"
 #include "material.h"
 #include "mesh.h"
@@ -43,6 +44,7 @@ Resources::Resources():
        add_type<Camera>().keyword("camera");
        add_type<Font>().keyword("font");
        add_type<KeyFrame>().suffix(".kframe").keyword("keyframe");
+       add_type<Light>().keyword("light");
        add_type<Lighting>().suffix(".lightn").keyword("lighting");
        add_type<Material>().suffix(".mat").creator(&Resources::create_material);
        add_type<Mesh>().keyword("mesh").creator(&Resources::create_mesh);
@@ -208,6 +210,15 @@ Module *Resources::create_module(const string &name)
                        return module.release();
                }
        }
+       else if(ext==".spv")
+       {
+               if((io = open_raw(FS::basepart(name)+".glsl")))
+               {
+                       RefPtr<SpirVModule> module = new SpirVModule;
+                       module->load_source(*io, this, name);
+                       return module.release();
+               }
+       }
 
        return 0;
 }