X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fresources.cpp;h=48e986cea064b2742eadf3d2625f418ccf1cef24;hp=bba69315de900890e5c365a1c7a325e356394e63;hb=859015dce969a0d9ba2bc603d6dbb2685159e393;hpb=f1c6ef565577ac322693255d764eea1f2cab9e77 diff --git a/source/resources.cpp b/source/resources.cpp index bba69315..48e986ce 100644 --- a/source/resources.cpp +++ b/source/resources.cpp @@ -23,6 +23,8 @@ using namespace std; namespace Msp { namespace GL { +extern const char singlepass_glsl_data[]; + Resources::Resources(): default_tex_filter(SGIS_generate_mipmap ? LINEAR_MIPMAP_LINEAR : LINEAR), srgb_conversion(false), @@ -43,6 +45,22 @@ Resources::Resources(): add_type().base().suffix(".tex3d").keyword("texture3d"); add_type().base().suffix(".texcb").keyword("texture_cube"); add_type().base().suffix(".tex2da").keyword("texture2d_array"); + + add_source(get_builtins()); +} + +DataFile::BuiltinSource &Resources::get_builtins() +{ + static DataFile::BuiltinSource builtins; + bool init_done = false; + + if(!init_done) + { + builtins.add_object("singlepass.glsl", singlepass_glsl_data); + init_done = true; + } + + return builtins; } void Resources::set_default_texture_filter(TextureFilter tf) @@ -117,7 +135,7 @@ Program *Resources::create_program(const string &name) if(RefPtr io = open_from_sources(name)) { ProgramCompiler compiler; - compiler.compile(*io); + compiler.compile(*io, this); RefPtr program = new Program; compiler.add_shaders(*program); program->link();