nodes: Added Image visualizer

Supports JPG, PNG, TGA, BMP, PSD, GIF, HDR and PIC via stb_image
This commit is contained in:
WerWolv
2022-02-06 01:32:15 +01:00
parent 16a9d0c0c6
commit 69c48edfdf
3 changed files with 33 additions and 2 deletions

View File

@@ -29,8 +29,8 @@ enum ImGuiCustomCol {
namespace ImGui {
struct Texture {
ImTextureID textureId;
int width, height;
ImTextureID textureId = nullptr;
int width = 0, height = 0;
[[nodiscard]] constexpr bool valid() const noexcept {
return this->textureId != nullptr;
@@ -43,6 +43,12 @@ namespace ImGui {
[[nodiscard]] auto size() const noexcept {
return ImVec2(this->width, this->height);
}
[[nodiscard]] constexpr auto aspectRatio() const noexcept {
if (this->height == 0) return 1.0F;
return float(this->width) / float(this->height);
}
};
int UpdateStringSizeCallback(ImGuiInputTextCallbackData *data);