Files
OpenVulkano/openVulkanoCpp/Scene/UI/ImGuiExtensions/ImGuiTextureImage.cpp
2025-11-20 17:05:11 +01:00

24 lines
906 B
C++

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include "ImGuiTextureImage.hpp"
#include "Vulkan/Scene/VulkanTexture.hpp"
namespace ImGui
{
void TextureImage(const OpenVulkano::Scene::Texture& texture, ImVec2 size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tintColor, const ImVec4& borderColor)
{
OpenVulkano::Vulkan::VulkanTexture* renderTexture = texture.GetRenderResource();
if (!renderTexture)
{
renderTexture = OpenVulkano::Vulkan::ResourceManager::INSTANCE->PrepareTexture(const_cast<OpenVulkano::Scene::Texture*>(&texture));
}
if (size.x < 0) size.x = texture.resolution.x;
if (size.y < 0) size.y = texture.resolution.y;
Image(renderTexture->m_descriptorSet, size, uv0, uv1, tintColor, borderColor);
}
}