2024-12-25 21:44:33 +00:00
|
|
|
#pragma once
|
2024-12-25 23:01:05 +00:00
|
|
|
|
2024-12-25 21:44:33 +00:00
|
|
|
#include "../Rendering/FBO.h"
|
|
|
|
#include "../Rendering/Shader.h"
|
|
|
|
#include <glm/glm.hpp>
|
2024-12-25 23:01:05 +00:00
|
|
|
#include "../Engine/AssetManager.h"
|
|
|
|
|
|
|
|
|
|
|
|
// Forward-declare a texture loading function if you have it in a separate file.
|
|
|
|
// extern unsigned int LoadTexture(const char* filePath);
|
2024-12-25 21:44:33 +00:00
|
|
|
|
|
|
|
class RenderWindow
|
|
|
|
{
|
|
|
|
public:
|
2024-12-25 23:01:05 +00:00
|
|
|
void Show(); // Called each frame to draw the ImGui window with the rendered texture
|
2024-12-25 21:44:33 +00:00
|
|
|
|
|
|
|
private:
|
2024-12-25 23:01:05 +00:00
|
|
|
// Initialize VAO/VBO/EBO, load shaders/textures, etc.
|
|
|
|
void InitGLResources();
|
2024-12-25 21:44:33 +00:00
|
|
|
|
2024-12-25 23:01:05 +00:00
|
|
|
// Actually render the spinning cube into the FBO each frame
|
|
|
|
void RenderSceneToFBO();
|
2024-12-25 21:44:33 +00:00
|
|
|
|
2024-12-25 23:01:05 +00:00
|
|
|
// Offscreen render target
|
|
|
|
FBO m_FBO;
|
2024-12-25 21:44:33 +00:00
|
|
|
|
|
|
|
// Our unlit shader
|
|
|
|
Shader m_Shader;
|
2024-12-25 23:01:05 +00:00
|
|
|
|
|
|
|
// Keep track if we've initialized (so we only do so once)
|
2024-12-25 21:44:33 +00:00
|
|
|
bool m_Initialized = false;
|
2024-12-25 23:01:05 +00:00
|
|
|
|
|
|
|
// GL objects for the cube
|
|
|
|
unsigned int m_VAO = 0;
|
|
|
|
unsigned int m_VBO = 0;
|
|
|
|
unsigned int m_EBO = 0;
|
|
|
|
|
|
|
|
// Spin
|
|
|
|
float m_RotationAngle = 0.0f;
|
|
|
|
|
|
|
|
// Track last known size (to recreate FBO if user resizes ImGui window)
|
|
|
|
int m_LastWidth = 0;
|
|
|
|
int m_LastHeight = 0;
|
|
|
|
|
|
|
|
// The loaded texture handle
|
|
|
|
unsigned int m_TextureID = 0;
|
2024-12-25 21:44:33 +00:00
|
|
|
};
|