Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarImage.hpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-03-20 01:53:34 +1100
committerKae <80987908+Novaenia@users.noreply.github.com>2024-03-20 01:53:34 +1100
commit6d76a11e256cd96c9cdd7ae5a10c0276e6347277 (patch)
treed52459889408115d1e0eb657a05dc58e098e50eb /source/core/StarImage.hpp
parent58a346e563df12af9194c198c7ffe974411abb28 (diff)
experiment: unclamped lighting
Diffstat (limited to 'source/core/StarImage.hpp')
-rw-r--r--source/core/StarImage.hpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/source/core/StarImage.hpp b/source/core/StarImage.hpp
index 6f186df..478d074 100644
--- a/source/core/StarImage.hpp
+++ b/source/core/StarImage.hpp
@@ -6,11 +6,13 @@
namespace Star {
-enum class PixelFormat {
+enum class PixelFormat : uint8_t {
RGB24,
RGBA32,
BGR24,
- BGRA32
+ BGRA32,
+ RGB_F,
+ RGBA_F
};
uint8_t bitsPerPixel(PixelFormat pf);
@@ -148,8 +150,12 @@ inline uint8_t bitsPerPixel(PixelFormat pf) {
return 32;
case PixelFormat::BGR24:
return 24;
- default:
+ case PixelFormat::BGRA32:
return 32;
+ case PixelFormat::RGB_F:
+ return 96;
+ default:
+ return 128;
}
}
@@ -161,8 +167,12 @@ inline uint8_t bytesPerPixel(PixelFormat pf) {
return 4;
case PixelFormat::BGR24:
return 3;
- default:
+ case PixelFormat::BGRA32:
return 4;
+ case PixelFormat::RGB_F:
+ return 12;
+ default:
+ return 16;
}
}
@@ -307,4 +317,14 @@ void Image::forEachPixel(CallbackType&& callback) {
}
}
+struct ImageView {
+ inline bool empty() const { return size.x() == 0 || size.y() == 0; }
+ ImageView() = default;
+ ImageView(Image const& image);
+
+ Vec2U size{0, 0};
+ uint8_t const* data = nullptr;
+ PixelFormat format = PixelFormat::RGB24;
+};
+
}