66 lines
1.5 KiB
C++
66 lines
1.5 KiB
C++
#ifndef SCENE_H_
|
|
#define SCENE_H_
|
|
|
|
#include <GLFW/glfw3.h>
|
|
#include <glm/glm.hpp>
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
#include "fbo.h"
|
|
#include "camera.h"
|
|
#include "interface.h"
|
|
|
|
struct Vertex {
|
|
glm::vec3 position;
|
|
glm::vec2 texCoord;
|
|
};
|
|
|
|
class Scene {
|
|
public:
|
|
Scene(int width, int height);
|
|
~Scene();
|
|
|
|
void Init();
|
|
void GenerateGrid(int divisions, std::vector<Vertex>& verts, std::vector<GLuint>& inds);
|
|
void Display(GLFWwindow* window);
|
|
void DrawGui(GLFWwindow* window);
|
|
void Idle();
|
|
void ReloadShader();
|
|
void UpdateCamera();
|
|
void OnScreenResize(Window* viewport);
|
|
void UpdateViewport();
|
|
std::vector<int16_t> LoadHGT(const std::string& filename, int width, int height);
|
|
|
|
int window_width;
|
|
int window_height;
|
|
|
|
std::vector<Window> windows_;
|
|
|
|
private:
|
|
void InitBuffers();
|
|
void InitQuadBuffers();
|
|
void InitShaders();
|
|
void InitUI();
|
|
|
|
Camera activeCamera_;
|
|
Framebuffer geo_fbo_;
|
|
Framebuffer lht_fbo_;
|
|
GLuint shader_program_;
|
|
GLuint quad_shader_program_;
|
|
GLuint vao_;
|
|
GLuint quad_vao_;
|
|
float angle_;
|
|
float scale_;
|
|
float aspect_;
|
|
float near_z_;
|
|
float far_z_;
|
|
float fov_;
|
|
|
|
glm::mat4 view_matrix_;
|
|
glm::mat4 projection_matrix_;
|
|
|
|
int16_t SwapEndian(int16_t val);
|
|
GLuint CreateHeightmapTexture(std::vector<int16_t> data, int width, int height);
|
|
};
|
|
|
|
#endif // SCENE_H_
|