Add texture image support for imgui
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user