From fb5ca4dbba257d3eb7fa15800d9663b774e41e7e Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 31 Jan 2021 02:24:14 +0200 Subject: [PATCH] Allow texture mipmap levels to be specified in datafiles This appears to have been missed in 03d3984 which removed the filtering heuristic from storage/allocate. --- source/texture1d.cpp | 6 ++++++ source/texture1d.h | 1 + source/texture2d.cpp | 6 ++++++ source/texture2d.h | 1 + source/texture3d.cpp | 6 ++++++ source/texture3d.h | 1 + source/texturecube.cpp | 6 ++++++ source/texturecube.h | 1 + 8 files changed, 28 insertions(+) diff --git a/source/texture1d.cpp b/source/texture1d.cpp index 38dc8a8b..7163aa7a 100644 --- a/source/texture1d.cpp +++ b/source/texture1d.cpp @@ -151,6 +151,7 @@ void Texture1D::Loader::init() { add("raw_data", &Loader::raw_data); add("storage", &Loader::storage); + add("storage", &Loader::storage_levels); } void Texture1D::Loader::raw_data(const string &data) @@ -163,5 +164,10 @@ void Texture1D::Loader::storage(PixelFormat fmt, unsigned w) obj.storage(fmt, w); } +void Texture1D::Loader::storage_levels(PixelFormat fmt, unsigned w, unsigned l) +{ + obj.storage(fmt, w, l); +} + } // namespace GL } // namespace Msp diff --git a/source/texture1d.h b/source/texture1d.h index 52a76875..eb16696f 100644 --- a/source/texture1d.h +++ b/source/texture1d.h @@ -19,6 +19,7 @@ public: void raw_data(const std::string &); void storage(PixelFormat, unsigned); + void storage_levels(PixelFormat, unsigned, unsigned); }; private: diff --git a/source/texture2d.cpp b/source/texture2d.cpp index abdfe0d1..72c84428 100644 --- a/source/texture2d.cpp +++ b/source/texture2d.cpp @@ -210,6 +210,7 @@ void Texture2D::Loader::init() { add("raw_data", &Loader::raw_data); add("storage", &Loader::storage); + add("storage", &Loader::storage_levels); } void Texture2D::Loader::raw_data(const string &data) @@ -222,6 +223,11 @@ void Texture2D::Loader::storage(PixelFormat fmt, unsigned w, unsigned h) obj.storage(fmt, w, h); } +void Texture2D::Loader::storage_levels(PixelFormat fmt, unsigned w, unsigned h, unsigned l) +{ + obj.storage(fmt, w, h, l); +} + Texture2D::AsyncLoader::AsyncLoader(Texture2D &t, IO::Seekable &i): texture(t), diff --git a/source/texture2d.h b/source/texture2d.h index aec31678..092f12ba 100644 --- a/source/texture2d.h +++ b/source/texture2d.h @@ -26,6 +26,7 @@ public: void raw_data(const std::string &); void storage(PixelFormat, unsigned, unsigned); + void storage_levels(PixelFormat, unsigned, unsigned, unsigned); }; private: diff --git a/source/texture3d.cpp b/source/texture3d.cpp index 48b358c2..c8f59a09 100644 --- a/source/texture3d.cpp +++ b/source/texture3d.cpp @@ -247,6 +247,7 @@ 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) @@ -259,5 +260,10 @@ void Texture3D::Loader::storage(PixelFormat fmt, unsigned w, unsigned h, unsigne obj.storage(fmt, w, h, d); } +void Texture3D::Loader::storage_levels(PixelFormat fmt, unsigned w, unsigned h, unsigned d, unsigned l) +{ + obj.storage(fmt, w, h, d, l); +} + } // namespace GL } // namespace Msp diff --git a/source/texture3d.h b/source/texture3d.h index 7847c2fc..ce63a55e 100644 --- a/source/texture3d.h +++ b/source/texture3d.h @@ -24,6 +24,7 @@ public: void raw_data(const std::string &); void storage(PixelFormat, unsigned, unsigned, unsigned); + void storage_levels(PixelFormat, unsigned, unsigned, unsigned, unsigned); }; private: diff --git a/source/texturecube.cpp b/source/texturecube.cpp index bac60ffd..0613a39a 100644 --- a/source/texturecube.cpp +++ b/source/texturecube.cpp @@ -271,6 +271,7 @@ void TextureCube::Loader::init() add("image_data", &Loader::image_data); add("raw_data", &Loader::raw_data); add("storage", &Loader::storage); + add("storage", &Loader::storage_levels); } void TextureCube::Loader::external_image(TextureCubeFace face, const string &fn) @@ -301,6 +302,11 @@ void TextureCube::Loader::storage(PixelFormat fmt, unsigned s) obj.storage(fmt, s); } +void TextureCube::Loader::storage_levels(PixelFormat fmt, unsigned s, unsigned l) +{ + obj.storage(fmt, s, l); +} + void operator>>(const LexicalConverter &conv, TextureCubeFace &face) { diff --git a/source/texturecube.h b/source/texturecube.h index dabf2b88..7659917d 100644 --- a/source/texturecube.h +++ b/source/texturecube.h @@ -46,6 +46,7 @@ public: void image_data(TextureCubeFace, const std::string &); void raw_data(TextureCubeFace, const std::string &); void storage(PixelFormat, unsigned); + void storage_levels(PixelFormat, unsigned, unsigned); }; private: -- 2.43.0