]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texturecube.cpp
Remove the deprecated ProgramBuilder class
[libs/gl.git] / source / texturecube.cpp
index 824ff2cc14d29743bf3e8adadd4709936a5f712d..6ec3662523dea02903e024bb9113b91125e4b711 100644 (file)
@@ -165,7 +165,7 @@ void TextureCube::sub_image(TextureCubeFace face, unsigned level, int x, int y,
        sub_image(face, level, x, y, wd, ht, data);
 }
 
-void TextureCube::image(TextureCubeFace face, const Graphics::Image &img, bool srgb)
+void TextureCube::image(TextureCubeFace face, const Graphics::Image &img)
 {
        unsigned w = img.get_width();
        unsigned h = img.get_height();
@@ -175,7 +175,7 @@ void TextureCube::image(TextureCubeFace face, const Graphics::Image &img, bool s
                if(w!=h)
                        throw incompatible_data("TextureCube::image");
 
-               storage(make_pixelformat(get_components(fmt), get_component_type(fmt), srgb), w);
+               storage(make_pixelformat(get_components(fmt), get_component_type(fmt), use_srgb_format), w);
        }
        else if(w!=size || h!=size)
                throw incompatible_data("TextureCube::image");
@@ -183,10 +183,15 @@ void TextureCube::image(TextureCubeFace face, const Graphics::Image &img, bool s
        PixelStore pstore = PixelStore::from_image(img);
        BindRestore _bind_ps(pstore);
 
-       image(face, 0, img.get_data());
+       image(face, 0, img.get_pixels());
 }
 
-void TextureCube::image(const Graphics::Image &img, unsigned lv, bool srgb)
+void TextureCube::image(TextureCubeFace face, const Graphics::Image &img, bool)
+{
+       image(face, img);
+}
+
+void TextureCube::image(const Graphics::Image &img, unsigned lv)
 {
        unsigned w = img.get_width();
        unsigned h = img.get_height();
@@ -197,17 +202,17 @@ void TextureCube::image(const Graphics::Image &img, unsigned lv, bool srgb)
 
        PixelFormat fmt = pixelformat_from_image(img);
        if(size==0)
-               storage(make_pixelformat(get_components(fmt), get_component_type(fmt), srgb), w, lv);
+               storage(make_pixelformat(get_components(fmt), get_component_type(fmt), use_srgb_format), w, lv);
        else if(w!=size || h!=size)
                throw incompatible_data("TextureCube::image");
 
        PixelStore pstore = PixelStore::from_image(img);
        BindRestore _bind_ps(pstore);
 
-       const char *cdata = reinterpret_cast<const char *>(img.get_data());
+       const char *pixels = reinterpret_cast<const char *>(img.get_pixels());
        unsigned face_size = img.get_stride()*size;
        for(unsigned i=0; i<6; ++i)
-               image(enumerate_faces(i), 0, cdata+i*face_size);
+               image(enumerate_faces(i), 0, pixels+i*face_size);
 }
 
 unsigned TextureCube::get_n_levels() const
@@ -301,7 +306,7 @@ void TextureCube::Loader::external_image(TextureCubeFace face, const string &fn)
        RefPtr<IO::Seekable> io = get_collection().open_raw(fn);
        img.load_io(*io);
 
-       obj.image(face, img, srgb);
+       obj.image(face, img);
 }
 
 void TextureCube::Loader::image_data(TextureCubeFace face, const string &data)
@@ -310,7 +315,7 @@ void TextureCube::Loader::image_data(TextureCubeFace face, const string &data)
        IO::Memory mem(data.data(), data.size());
        img.load_io(mem);
 
-       obj.image(face, img, srgb);
+       obj.image(face, img);
 }
 
 void TextureCube::Loader::raw_data(TextureCubeFace face, const string &data)