made Editor non reliant on GLFW aka i added an IRenderTexture interface of use in non renderer specific aplications
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
TSE::EDITOR::EditorSubsystem::EditorSubsystem() : sv(nullptr), editorLayer("")
|
||||
{
|
||||
rt = new TSE::GLFW::RenderTexture({100,100});
|
||||
rt = IRenderTexture::factory->CreateTextureHeap({100,100});
|
||||
sv = SceneView(rt);
|
||||
|
||||
controller.AddGuiElement("Scene", &sv);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "UI/windows/HirearchieView.hpp"
|
||||
#include "UI/windows/PropertiesView.hpp"
|
||||
#include "UI/windows/SceneView.hpp"
|
||||
#include "RenderTexture.hpp"
|
||||
#include "interfaces/IRenderTexture.hpp"
|
||||
|
||||
namespace TSE::EDITOR
|
||||
{
|
||||
@@ -20,7 +20,7 @@ namespace TSE::EDITOR
|
||||
HirearchieView hv = HirearchieView(nullptr);
|
||||
PropertiesView pv;
|
||||
CameraView camv;
|
||||
TSE::GLFW::RenderTexture* rt;
|
||||
TSE::IRenderTexture* rt;
|
||||
SceneView sv;
|
||||
Layer editorLayer;
|
||||
|
||||
|
||||
@@ -882,7 +882,7 @@ namespace TSE::EDITOR
|
||||
ImVec2 field_size = ImVec2(field_width, 60);
|
||||
|
||||
Rect r = element->GetUVRect();
|
||||
float ymultiplyer = (element->GetTexture()->height() * r.height()) / (element->GetTexture()->width() * r.width());
|
||||
float ymultiplyer = (element->GetTexture()->Height() * r.height()) / (element->GetTexture()->Width() * r.width());
|
||||
|
||||
ImVec2 texSize (field_size.y - 2, (field_size.y - 2) * ymultiplyer);
|
||||
|
||||
@@ -916,7 +916,7 @@ namespace TSE::EDITOR
|
||||
}
|
||||
ImGui::Separator();
|
||||
float available_width = ImGui::GetContentRegionAvail().x;
|
||||
float ymultiplyer = (element->GetTexture()->height() * r.height()) / (element->GetTexture()->width() * r.width());
|
||||
float ymultiplyer = (element->GetTexture()->Height() * r.height()) / (element->GetTexture()->Width() * r.width());
|
||||
|
||||
ImVec2 texSize (available_width, (available_width) * ymultiplyer);
|
||||
ImGui::Image(element->GetTexture()->GetTextureId(), texSize, {r.p1.x,r.p2.y}, {r.p2.x,r.p1.y});
|
||||
@@ -931,7 +931,7 @@ namespace TSE::EDITOR
|
||||
|
||||
ImVec2 field_size = ImVec2(field_width, 60);
|
||||
|
||||
float ymultiplyer = element->height() / element->width();
|
||||
float ymultiplyer = element->Height() / element->Width();
|
||||
|
||||
ImVec2 texSize (field_size.y - 2, (field_size.y - 2) * ymultiplyer);
|
||||
|
||||
@@ -963,8 +963,8 @@ namespace TSE::EDITOR
|
||||
if(debug)
|
||||
{
|
||||
ImGui::Separator();
|
||||
ImGui::TextDisabled(("Width: " + std::to_string(element->width())).c_str());
|
||||
ImGui::TextDisabled(("Height: " + std::to_string(element->height())).c_str());
|
||||
ImGui::TextDisabled(("Width: " + std::to_string(element->Width())).c_str());
|
||||
ImGui::TextDisabled(("Height: " + std::to_string(element->Height())).c_str());
|
||||
ImGui::TextDisabled(("BPP: " + std::to_string(element->bpp())).c_str());
|
||||
ImGui::TextDisabled(("Chanels: " + std::to_string(element->Chanels())).c_str());
|
||||
ImGui::Separator();
|
||||
@@ -972,7 +972,7 @@ namespace TSE::EDITOR
|
||||
}
|
||||
ImGui::Separator();
|
||||
float available_width = ImGui::GetContentRegionAvail().x;
|
||||
float ymultiplyer = element->height() / element->width();
|
||||
float ymultiplyer = element->Height() / element->Width();
|
||||
|
||||
ImVec2 texSize (available_width, (available_width) * ymultiplyer);
|
||||
ImGui::Image(element->GetTextureId(), texSize, {0,1}, {1,0});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
TSE::EDITOR::CameraView::CameraView() : GuiWindow("Camera", ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar)
|
||||
{
|
||||
fb = new TSE::GLFW::RenderTexture({100,100});
|
||||
fb = IRenderTexture::factory->CreateTextureHeap({100,100});
|
||||
}
|
||||
|
||||
void TSE::EDITOR::CameraView::Define()
|
||||
@@ -19,9 +19,9 @@ void TSE::EDITOR::CameraView::Define()
|
||||
ImGuiWindowFlags flags2 = ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar;
|
||||
if(ImGui::BeginChild("##SceneChild", {0,0}, ImGuiChildFlags_None, flags2))
|
||||
{
|
||||
ImGui::Image(fb->GetTextureId(), {fb->width(), fb->height()},{0,1}, {1,0});
|
||||
ImGui::Image(fb->GetTextureId(), {fb->Width(), fb->Height()},{0,1}, {1,0});
|
||||
auto vec2 = ImGui::GetWindowSize();
|
||||
if(fb->width() != vec2.x || fb->height() != vec2.y)
|
||||
if(fb->Width() != vec2.x || fb->Height() != vec2.y)
|
||||
{
|
||||
fb->SetSize({vec2.x, vec2.y});
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "UI/base/GuiWindow.h"
|
||||
#include "RenderTexture.hpp"
|
||||
#include "interfaces/IRenderTexture.hpp"
|
||||
#include "BehaviourScripts/Camera.hpp"
|
||||
|
||||
namespace TSE::EDITOR
|
||||
@@ -10,7 +10,7 @@ namespace TSE::EDITOR
|
||||
{
|
||||
private:
|
||||
Camera* currentCamera = nullptr;
|
||||
TSE::GLFW::RenderTexture* fb;
|
||||
TSE::IRenderTexture* fb;
|
||||
public:
|
||||
CameraView();
|
||||
void Define() override;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "SceneView.hpp"
|
||||
|
||||
TSE::EDITOR::SceneView::SceneView(TSE::GLFW::RenderTexture *frameBuffer) : GuiWindow("Scene", ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar)
|
||||
TSE::EDITOR::SceneView::SceneView(TSE::IRenderTexture *frameBuffer) : GuiWindow("Scene", ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar)
|
||||
{
|
||||
fb = frameBuffer;
|
||||
}
|
||||
@@ -10,9 +10,9 @@ void TSE::EDITOR::SceneView::Define()
|
||||
ImGuiWindowFlags flags2 = ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar;
|
||||
if(ImGui::BeginChild("##SceneChild", {0,0}, ImGuiChildFlags_None, flags2))
|
||||
{
|
||||
ImGui::Image(fb->GetTextureId(), {fb->width(), fb->height()},{0,1}, {1,0});
|
||||
ImGui::Image(fb->GetTextureId(), {fb->Width(), fb->Height()},{0,1}, {1,0});
|
||||
auto vec2 = ImGui::GetWindowSize();
|
||||
if(fb->width() != vec2.x || fb->height() != vec2.y)
|
||||
if(fb->Width() != vec2.x || fb->Height() != vec2.y)
|
||||
{
|
||||
fb->SetSize({vec2.x, vec2.y});
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "UI/base/GuiWindow.h"
|
||||
#include "RenderTexture.hpp"
|
||||
#include "interfaces/IRenderTexture.hpp"
|
||||
|
||||
namespace TSE::EDITOR
|
||||
{
|
||||
class SceneView : public GuiWindow
|
||||
{
|
||||
private:
|
||||
TSE::GLFW::RenderTexture* fb;
|
||||
TSE::IRenderTexture* fb;
|
||||
public:
|
||||
SceneView(TSE::GLFW::RenderTexture* frameBuffer);
|
||||
SceneView(TSE::IRenderTexture* frameBuffer);
|
||||
void Define() override;
|
||||
};
|
||||
} // namespace TSE::EDITOR
|
||||
|
||||
Reference in New Issue
Block a user