X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftexture3d.cpp;h=496b5f1fbe80370fefda9e169ad428d98464d274;hb=e70662d7812464159f2e47f4bebb69d88f89ae93;hp=0fb26ccd6e2606eea34f24cc30fc5e9209ae08c8;hpb=160e9eea29bd10034733d59507fa1bcca36be401;p=libs%2Fgl.git diff --git a/source/core/texture3d.cpp b/source/core/texture3d.cpp index 0fb26ccd..496b5f1f 100644 --- a/source/core/texture3d.cpp +++ b/source/core/texture3d.cpp @@ -8,16 +8,7 @@ namespace Msp { namespace GL { Texture3D::Texture3D(unsigned t): - Texture3DBackend(t), - width(0), - height(0), - depth(0) -{ } - -Texture3D::Texture3D(): - width(0), - height(0), - depth(0) + Texture3DBackend(t) { } void Texture3D::storage(PixelFormat fmt, unsigned wd, unsigned ht, unsigned dp, unsigned lv) @@ -48,11 +39,11 @@ void Texture3D::image(unsigned level, const void *data) return sub_image(level, 0, 0, 0, size.x, size.y, size.z, data); } -void Texture3D::sub_image(unsigned level, int x, int y, int z, unsigned wd, unsigned ht, unsigned dp, const void *data) +void Texture3D::sub_image(unsigned level, unsigned x, unsigned y, unsigned z, unsigned wd, unsigned ht, unsigned dp, const void *data) { if(width==0 || height==0 || depth==0) throw invalid_operation("Texture3D::sub_image"); - if(level>=levels) + if(level>=levels || x>width || x+wd>width || y>height || y+ht>height || z>depth || z+dp>depth) throw out_of_range("Texture3D::sub_image"); Texture3DBackend::sub_image(level, x, y, z, wd, ht, dp, data); @@ -100,11 +91,6 @@ LinAl::Vector Texture3D::get_level_size(unsigned level) const return LinAl::Vector(w, h, d); } -uint64_t Texture3D::get_data_size() const -{ - return id ? width*height*depth*get_pixel_size(storage_fmt) : 0; -} - Texture3D::Loader::Loader(Texture3D &t): DataFile::DerivedObjectLoader(t) @@ -120,16 +106,10 @@ Texture3D::Loader::Loader(Texture3D &t, Collection &c): void Texture3D::Loader::init() { - add("raw_data", &Loader::raw_data); add("storage", &Loader::storage); add("storage", &Loader::storage_levels); } -void Texture3D::Loader::raw_data(const string &data) -{ - obj.image(0, data.data()); -} - void Texture3D::Loader::storage(PixelFormat fmt, unsigned w, unsigned h, unsigned d) { obj.storage(fmt, w, h, d);