This repository has been archived on 2025-03-10. You can view files and clone it, but cannot push or open issues or pull requests.
2021-11-15 14:05:44 -06:00

80 lines
1.6 KiB
C++

#pragma once
#include <vector>
#include <Windows.h>
#include "Assets.h"
#include "Text.h"
namespace nf {
class Application;
class Shader;
class Entity;
class UIElement;
class Light;
class Cubemap;
class Camera;
class GBuffer;
class VertexArray;
class IndexBuffer;
class Renderer {
public:
Renderer(Application* app);
void setFade(bool in, bool out, bool text = true);
bool isFadeOutComplete();
void render(Entity& in);
void render(UIElement& in);
void render(Light& in);
void render(Cubemap& in);
void doFrame(Camera* camera, float dT);
void setAmbient(float am);
~Renderer();
private:
void loadBaseAssets();
void createShadowMaps();
void renderShadowMaps(size_t count);
void instancedRenderShadows(Shader* shader);
Application* m_app;
HDC m_hdc;
HGLRC m_hglrc;
AssetPack m_baseAP;
GBuffer* m_gBuffer;
unsigned int m_shadowMapFBO;
int m_directionalDepthTexSize;
int m_pointDepthTexSize;
unsigned int m_directionalShadowMap;
std::vector<unsigned int> m_pointShadowMaps;
unsigned int m_texSlots;
std::vector<Light*> m_lights;
std::vector<Entity*> m_lGame;
Cubemap* m_cubemap;
std::vector<UIElement*> m_lUI;
Shader* m_gBufferShader;
Shader* m_lightingShader;
Shader* m_textShader;
Shader* m_uiTextureShader;
Shader* m_cubemapShader;
Shader* m_fadeShader;
Shader* m_directionalShadowShader;
Shader* m_pointShadowShader;
bool m_fadeIn, m_fadeOut;
float m_fadeInOpacity, m_fadeOutOpacity;
bool m_fadeText;
bool m_fadeOutComplete;
Text m_loadingText;
VertexArray* m_quadVAO;
IndexBuffer* m_quadIB;
};
}