summaryrefslogtreecommitdiffhomepage
path: root/loader
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-05-23 13:55:54 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-05-23 13:55:54 +0200
commitd06dcbaba14ab511eedf30ae39418989f0139499 (patch)
treeaade509e608830d41bc2bdc5a99d90691efe3f53 /loader
parent50750ecf026d3fd382869b446d9a799525694a64 (diff)
b
Diffstat (limited to 'loader')
-rw-r--r--loader/error-tex.cpp9
-rw-r--r--loader/impl.hpp1
-rw-r--r--loader/loader.hpp1
3 files changed, 9 insertions, 2 deletions
diff --git a/loader/error-tex.cpp b/loader/error-tex.cpp
index dac5992c..bcb53898 100644
--- a/loader/error-tex.cpp
+++ b/loader/error-tex.cpp
@@ -9,13 +9,18 @@ namespace floormat::loader_detail {
Trade::ImageData2D loader_impl::make_error_texture(Vector2ui size)
{
- fm_assert(size.product() != 0);
constexpr auto magenta = Vector4ub{255, 0, 255, 255};
+ return make_error_texture(size, magenta);
+}
+
+Trade::ImageData2D loader_impl::make_error_texture(Vector2ui size, Vector4ub color)
+{
+ fm_assert(size.product() != 0);
auto array = Array<char>{NoInit, 4uz * size.product()};
auto data = array.data(), end = data + array.size();
while (data != end)
{
- *(Vector4ub*)data = magenta;
+ *(Vector4ub*)data = color;
data += 4;
}
auto img = Trade::ImageData2D{PixelFormat::RGBA8Unorm, Vector2i(size), move(array)};
diff --git a/loader/impl.hpp b/loader/impl.hpp
index 007392fe..b873ba82 100644
--- a/loader/impl.hpp
+++ b/loader/impl.hpp
@@ -39,6 +39,7 @@ struct loader_impl final : loader_
StringView shader(StringView filename) noexcept override;
Trade::ImageData2D make_error_texture(Vector2ui size) override;
+ Trade::ImageData2D make_error_texture(Vector2ui size, Vector4ub color) override;
Trade::ImageData2D texture(StringView prefix, StringView filename) noexcept(false) override;
// >-----> ground >----->
diff --git a/loader/loader.hpp b/loader/loader.hpp
index 3f945614..cf2bbc8a 100644
--- a/loader/loader.hpp
+++ b/loader/loader.hpp
@@ -32,6 +32,7 @@ struct loader_
static loader_& default_loader() noexcept;
virtual StringView shader(StringView filename) noexcept = 0;
virtual Trade::ImageData2D make_error_texture(Vector2ui size) = 0;
+ virtual Trade::ImageData2D make_error_texture(Vector2ui size, Vector4ub color) = 0;
virtual Trade::ImageData2D texture(StringView prefix, StringView filename) noexcept(false) = 0;
virtual const std::shared_ptr<class ground_atlas>& ground_atlas(StringView filename, loader_policy policy = loader_policy::DEFAULT) noexcept(false) = 0;