mirror of
https://github.com/Nexoniarz/Fry3DX.git
synced 2026-11-03 04:24:26 +00:00
Pictures in the UI read as ImGui's colours are: an sRGB picture was turned linear and showed too dark (the logo in About, the Picture panel's paint) — a UNORM view on Vulkan, a skip-decode sampler on OpenGL 4.6 and 4.0, the texture's own setting before 3.3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4cc6d9e043
commit
ffaa5e8001
6 changed files with 79 additions and 5 deletions
|
|
@ -14,8 +14,20 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct ImDrawList;
|
||||
struct ImDrawCmd;
|
||||
|
||||
namespace keel {
|
||||
|
||||
// Draw callbacks round an sRGB picture drawn in the UI, so it's read as the plain numbers ImGui's
|
||||
// own colours are (read as sRGB it turns linear, and looks too dark). None when uiTexture already
|
||||
// gives such a view (Vulkan).
|
||||
struct UiRawRead {
|
||||
void (*begin)(const ImDrawList*, const ImDrawCmd*) = nullptr;
|
||||
void (*end)(const ImDrawList*, const ImDrawCmd*) = nullptr;
|
||||
void* data = nullptr;
|
||||
};
|
||||
|
||||
class Window;
|
||||
using TextureId = uint32_t;
|
||||
|
||||
|
|
@ -217,6 +229,7 @@ public:
|
|||
virtual void uploadModel(uint32_t model, const KmdlModel& kmdl) = 0;
|
||||
// A texture as Dear ImGui's ImTextureID, for drawing it in the UI (0 = none).
|
||||
virtual uint64_t uiTexture(TextureId slot) = 0;
|
||||
virtual UiRawRead uiRawRead(TextureId) { return {}; }
|
||||
// Starts a frame; false when nothing can be drawn (minimised). Sets the drawable size.
|
||||
virtual bool beginFrame(uint32_t& width, uint32_t& height) = 0;
|
||||
// Renders the packet, then ImGui's draw data, and presents.
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ public:
|
|||
|
||||
// A loaded texture for ImGui::Image (ImTextureID); 0 if it isn't one.
|
||||
uint64_t uiTexture(TextureId texture) { return backend_ ? backend_->uiTexture(texture) : 0; }
|
||||
UiRawRead uiRawRead(TextureId texture) { return backend_ ? backend_->uiRawRead(texture) : UiRawRead{}; }
|
||||
// Pixel size of a loaded texture.
|
||||
glm::ivec2 textureSize(TextureId texture) const {
|
||||
const auto it = textureSizes_.find(texture);
|
||||
|
|
|
|||
Loading…
Reference in a new issue