X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftexture1d.cpp;h=a0ab79b943aef573e192edcc36e1e011fffb77c7;hb=93fa68debcd6e416a1b20f43077f7a79525aaecb;hp=accd0e0c06c76a4bfe0b91f828cc840c5becff49;hpb=7d7a8f9e77a526fd5f2920b9005805e56a4b686c;p=libs%2Fgl.git diff --git a/source/texture1d.cpp b/source/texture1d.cpp index accd0e0c..a0ab79b9 100644 --- a/source/texture1d.cpp +++ b/source/texture1d.cpp @@ -34,7 +34,8 @@ void Texture1D::allocate(unsigned level) if(allocated&(1<>level; @@ -66,5 +93,36 @@ UInt64 Texture1D::get_data_size() const return id ? width*get_pixel_size(ifmt) : 0; } + +Texture1D::Loader::Loader(Texture1D &t): + DataFile::DerivedObjectLoader(t) +{ + init(); +} + +Texture1D::Loader::Loader(Texture1D &t, Collection &c): + DataFile::DerivedObjectLoader(t, c) +{ + init(); +} + +void Texture1D::Loader::init() +{ + add("raw_data", &Loader::raw_data); + add("storage", &Loader::storage); +} + +void Texture1D::Loader::raw_data(const string &data) +{ + obj.image(0, get_base_pixelformat(obj.ifmt), UNSIGNED_BYTE, data.data()); +} + +void Texture1D::Loader::storage(PixelFormat fmt, unsigned w) +{ + if(srgb) + fmt = get_srgb_pixelformat(fmt); + obj.storage(fmt, w); +} + } // namespace GL } // namespace Msp