X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftexture.cpp;h=54577aacd55e06f389361f0eda96305b42a63057;hb=be92396630a2065e43c21d9d1904e97014844cff;hp=85f5fb5836ebdcdb56af17191343a9c2f21be9ea;hpb=f19366d32cc29287a2730cfba90893e407754081;p=libs%2Fgl.git diff --git a/source/core/texture.cpp b/source/core/texture.cpp index 85f5fb58..54577aac 100644 --- a/source/core/texture.cpp +++ b/source/core/texture.cpp @@ -2,23 +2,25 @@ #include "error.h" #include "resourcemanager.h" #include "texture.h" +#include "texture1d.h" +#include "texture2d.h" +#include "texture2darray.h" +#include "texture3d.h" +#include "texturecube.h" using namespace std; namespace Msp { namespace GL { -Texture::Texture(unsigned t, ResourceManager *m): - TextureBackend(t, !m), +Texture::Texture(unsigned t): + TextureBackend(t), format(NO_PIXELFORMAT), storage_fmt(format), swizzle(NO_SWIZZLE), use_srgb_format(false), auto_gen_mipmap(false) -{ - if(m) - set_manager(m); -} +{ } void Texture::set_format(PixelFormat fmt) { @@ -64,6 +66,22 @@ void Texture::load_image(const string &fn, unsigned lv) image(img, lv); } +Texture::GenericLoader::TypeRegistry &Texture::get_texture_registry() +{ + static GenericLoader::TypeRegistry registry; + static bool initialized = false; + if(!initialized) + { + initialized = true; + registry.register_type("1d"); + registry.register_type("2d"); + registry.register_type("3d"); + registry.register_type("2d_array"); + registry.register_type("cube"); + } + return registry; +} + Texture::Loader::Loader(Texture &t, Collection *c): CollectionObjectLoader(t, c), @@ -122,11 +140,7 @@ void Texture::Loader::generate_mipmap(bool gm) void Texture::Loader::image_data(const string &data) { if(obj.manager) - { obj.set_manager(0); - if(!obj.id) - obj.generate_id(); - } Graphics::Image img; IO::Memory mem(data.data(), data.size());