made the editor work by debugging on windows
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
#include "PathHelper.hpp"
|
||||
#include "elements/Texture.hpp"
|
||||
#include "TextureHelperOpenGL.hpp"
|
||||
#include "interfaces/IRenderer.hpp"
|
||||
#include "BehaviourScripts/Camera.hpp"
|
||||
|
||||
TSE::GLFW::OpenGLRenderingBackend::OpenGLRenderingBackend(Color _backgroundColor, bool _vsync)
|
||||
: OpenGLRenderingBackend(_backgroundColor, _vsync, 0, false){ }
|
||||
@@ -140,7 +142,13 @@ void TSE::GLFW::OpenGLRenderingBackend::onUpdate() const
|
||||
|
||||
void TSE::GLFW::OpenGLRenderingBackend::onClear() const
|
||||
{
|
||||
//cameras
|
||||
for (int i = 0; i < IRenderer::camerasToRenderWith.size(); i++)
|
||||
{
|
||||
IRenderer::camerasToRenderWith[i]->Bind();
|
||||
IRenderer::camerasToRenderWith[i]->UpdateRenderTarget();
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
IRenderer::camerasToRenderWith[i]->Unbind();
|
||||
}
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
if(useseImGui)
|
||||
@@ -153,7 +161,12 @@ void TSE::GLFW::OpenGLRenderingBackend::onClear() const
|
||||
|
||||
void TSE::GLFW::OpenGLRenderingBackend::onClearDepthBuffer() const
|
||||
{
|
||||
//cameras
|
||||
for (int i = 0; i < IRenderer::camerasToRenderWith.size(); i++)
|
||||
{
|
||||
IRenderer::camerasToRenderWith[i]->Bind();
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
IRenderer::camerasToRenderWith[i]->Unbind();
|
||||
}
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ float TSE::GLFW::RenderTexture::height() const
|
||||
return buffer.GetSize().y;
|
||||
}
|
||||
|
||||
uint TSE::GLFW::RenderTexture::GetTextureId() const
|
||||
TSE::uint TSE::GLFW::RenderTexture::GetTextureId() const
|
||||
{
|
||||
return buffer.GetTextureId();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
TSE::GLFW::FrameBuffer::FrameBuffer(const Vector2 &size)
|
||||
{
|
||||
this->size = size;
|
||||
width = size.x;
|
||||
height = size.y;
|
||||
CreateFBTexture();
|
||||
for (auto const& i : objectsToResize)
|
||||
{
|
||||
@@ -14,16 +15,12 @@ TSE::GLFW::FrameBuffer::FrameBuffer(const Vector2 &size)
|
||||
|
||||
void TSE::GLFW::FrameBuffer::Bind()
|
||||
{
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, depthRboID);
|
||||
glBindTexture(GL_TEXTURE_2D, textureID);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, bufferID);
|
||||
}
|
||||
|
||||
void TSE::GLFW::FrameBuffer::Unbind()
|
||||
{
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
|
||||
TSE::GLFW::FrameBuffer::~FrameBuffer()
|
||||
@@ -35,7 +32,8 @@ TSE::GLFW::FrameBuffer::~FrameBuffer()
|
||||
|
||||
void TSE::GLFW::FrameBuffer::Resize(Vector2 size)
|
||||
{
|
||||
this->size = size;
|
||||
width = size.x;
|
||||
height = size.y;
|
||||
shouldResize = true;
|
||||
}
|
||||
|
||||
@@ -46,7 +44,7 @@ void TSE::GLFW::FrameBuffer::Update()
|
||||
CreateFBTexture();
|
||||
for (auto const& i : objectsToResize)
|
||||
{
|
||||
i->OnResize(size.x, size.y, this);
|
||||
i->OnResize(width, height, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +55,7 @@ TSE::uint TSE::GLFW::FrameBuffer::GetTextureId() const
|
||||
|
||||
TSE::Vector2 TSE::GLFW::FrameBuffer::GetSize() const
|
||||
{
|
||||
return size;
|
||||
return {width, height};
|
||||
}
|
||||
|
||||
void TSE::GLFW::FrameBuffer::Initialize()
|
||||
@@ -73,14 +71,12 @@ void TSE::GLFW::FrameBuffer::Initialize()
|
||||
TSE_LOG(std::to_string(glGetError()));
|
||||
}
|
||||
Unbind();
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
|
||||
void TSE::GLFW::FrameBuffer::LoadFBTexture()
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, textureID);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.x, size.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
@@ -88,12 +84,12 @@ void TSE::GLFW::FrameBuffer::LoadFBTexture()
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, depthRboID);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, size.x, size.y);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, width, height);
|
||||
}
|
||||
|
||||
void TSE::GLFW::FrameBuffer::CreateFBTexture()
|
||||
{
|
||||
glViewport(0,0, size.x, size.y);
|
||||
glViewport(0,0, width, height);
|
||||
//resize
|
||||
if(textureID == 0)
|
||||
glGenTextures(1, &textureID);
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace TSE::GLFW
|
||||
private:
|
||||
uint textureID = 0;
|
||||
uint depthRboID = 0;
|
||||
Vector2 size;
|
||||
bool shouldResize = false;
|
||||
|
||||
public:
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#define SHADER_PACKAGE_SIZE (sizeof(float) * (3 + 4 + 2 + 1))
|
||||
|
||||
TSE::GLFW::BasicTextureShader* TSE::GLFW::BasicTextureShader::instance = nullptr;
|
||||
std::map<uint, float> TSE::GLFW::BasicTextureShader::textureSlots;
|
||||
std::map<TSE::uint, float> TSE::GLFW::BasicTextureShader::textureSlots;
|
||||
|
||||
TSE::GLFW::BasicTextureShader *TSE::GLFW::BasicTextureShader::Instance()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user