31 lines
1.0 KiB
C++
31 lines
1.0 KiB
C++
#include "CameraView.hpp"
|
|
|
|
TSE::EDITOR::CameraView::CameraView() : GuiWindow("Camera", ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar)
|
|
{
|
|
fb = IRenderTexture::factory->CreateTextureHeap({100,100});
|
|
}
|
|
|
|
void TSE::EDITOR::CameraView::Define()
|
|
{
|
|
if(currentCamera != Camera::mainCamera)
|
|
{
|
|
if(currentCamera != nullptr)
|
|
currentCamera->SetRenderTarget(nullptr);
|
|
currentCamera = Camera::mainCamera;
|
|
if(currentCamera != nullptr)
|
|
currentCamera->SetRenderTarget(fb);
|
|
}
|
|
|
|
ImGuiWindowFlags flags2 = ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar;
|
|
if(ImGui::BeginChild("##CameraChild", {0,0}, ImGuiChildFlags_None, flags2))
|
|
{
|
|
ImGui::Image(fb->GetTextureId(0), {fb->Width(), fb->Height()},{0,1}, {1,0});
|
|
auto vec2 = ImGui::GetWindowSize();
|
|
if(fb->Width() != vec2.x || fb->Height() != vec2.y)
|
|
{
|
|
fb->SetSize({vec2.x, vec2.y});
|
|
}
|
|
}
|
|
ImGui::EndChild();
|
|
}
|