79 lines
1.7 KiB
C++
79 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <GL/glew.h>
|
|
#include <imgui.h>
|
|
#include "pass/MainProgram.hpp"
|
|
#include "pass/SkyProgram.hpp"
|
|
#include "pass/PassContext.hpp"
|
|
|
|
class Camera;
|
|
/// Handle rendering passes and params
|
|
class Renderer {
|
|
public:
|
|
struct options {
|
|
MainProgram::options main;
|
|
bool skybox = false;
|
|
bool wireframe = false;
|
|
std::string textures = "1024-realistic";
|
|
float mipMapLOD = -.5;
|
|
ImVec4 clear_color;
|
|
};
|
|
|
|
Renderer(const options&);
|
|
Renderer(Renderer &&) = delete;
|
|
Renderer(const Renderer &) = delete;
|
|
Renderer &operator=(Renderer &&) = delete;
|
|
Renderer &operator=(const Renderer &) = delete;
|
|
~Renderer();
|
|
|
|
glm::vec3 LightInvDir = glm::vec3(0.5f, 2, 2);
|
|
glm::vec3 FogColor;
|
|
GLfloat FogDepth;
|
|
|
|
bool SkyEnable;
|
|
|
|
glm::mat4 getProjectionMatrix() const {
|
|
return ProjectionMatrix;
|
|
}
|
|
glm::mat4 getViewMatrix() const {
|
|
return ViewMatrix;
|
|
}
|
|
|
|
GLuint getTextureAtlas() const {
|
|
return TextureAtlas;
|
|
}
|
|
GLuint getNormalAtlas() const {
|
|
return NormalAtlas;
|
|
}
|
|
GLuint getHOSAtlas() const {
|
|
return HOSAtlas;
|
|
}
|
|
GLuint getSkyTexture() const {
|
|
return Skybox;
|
|
}
|
|
|
|
PassContext getPass();
|
|
void postProcess();
|
|
|
|
void lookFrom(const Camera&);
|
|
void reloadShaders(const MainProgram::options&);
|
|
void reloadTextures(const std::string &, float mipMapLOD = 0);
|
|
|
|
private:
|
|
GLuint VertexArrayID;
|
|
|
|
MainProgram *MainPass;
|
|
SkyProgram *SkyPass;
|
|
|
|
glm::mat4 ProjectionMatrix;
|
|
glm::mat4 ViewMatrix;
|
|
|
|
GLuint TextureAtlas;
|
|
GLuint NormalAtlas;
|
|
GLuint HOSAtlas;
|
|
GLuint Skybox;
|
|
|
|
void loadTextures(const std::string &, float mipMapLOD = 0);
|
|
void unloadTextures();
|
|
};
|