terravisor/include/scene.h

66 lines
1.5 KiB
C
Raw Normal View History

2024-08-13 16:25:56 -04:00
#ifndef SCENE_H_
#define SCENE_H_
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
2024-08-15 00:56:29 -04:00
#include <vector>
#include <string>
2024-08-13 16:25:56 -04:00
#include "fbo.h"
2024-08-21 17:14:35 -04:00
#include "camera.h"
#include "interface.h"
2024-08-17 12:25:42 -04:00
struct Vertex {
glm::vec3 position;
glm::vec2 texCoord;
};
2024-08-13 16:25:56 -04:00
class Scene {
2024-08-13 18:09:49 -04:00
public:
Scene(int width, int height);
~Scene();
void Init();
2024-08-17 12:25:42 -04:00
void GenerateGrid(int divisions, std::vector<Vertex>& verts, std::vector<GLuint>& inds);
2024-08-13 18:09:49 -04:00
void Display(GLFWwindow* window);
void DrawGui(GLFWwindow* window);
void Idle();
void ReloadShader();
void UpdateCamera();
void OnScreenResize(Window* viewport);
void UpdateViewport();
2024-08-15 00:56:29 -04:00
std::vector<int16_t> LoadHGT(const std::string& filename, int width, int height);
2024-08-13 18:09:49 -04:00
int window_width;
int window_height;
std::vector<Window> windows_;
2024-08-13 18:09:49 -04:00
private:
void InitBuffers();
void InitQuadBuffers();
2024-08-13 18:09:49 -04:00
void InitShaders();
void InitUI();
2024-08-13 18:09:49 -04:00
2024-08-21 17:14:35 -04:00
Camera activeCamera_;
Framebuffer geo_fbo_;
Framebuffer lht_fbo_;
2024-08-13 18:09:49 -04:00
GLuint shader_program_;
GLuint quad_shader_program_;
2024-08-13 18:09:49 -04:00
GLuint vao_;
GLuint quad_vao_;
2024-08-13 18:09:49 -04:00
float angle_;
float scale_;
float aspect_;
float near_z_;
float far_z_;
float fov_;
glm::mat4 view_matrix_;
glm::mat4 projection_matrix_;
2024-08-15 01:09:37 -04:00
int16_t SwapEndian(int16_t val);
2024-08-15 00:56:29 -04:00
GLuint CreateHeightmapTexture(std::vector<int16_t> data, int width, int height);
2024-08-13 16:25:56 -04:00
};
#endif // SCENE_H_