2018-11-26 12:11:05 +00:00
|
|
|
// This source code is property of the Computer Graphics and Visualization
|
|
|
|
// chair of the TU Dresden. Do not distribute!
|
2018-11-13 08:35:18 +00:00
|
|
|
// Copyright (C) CGV TU Dresden - All Rights Reserved
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <gui/AbstractViewer.h>
|
|
|
|
#include <gui/GLShader.h>
|
|
|
|
#include <gui/GLBuffer.h>
|
|
|
|
#include <gui/GLVertexArray.h>
|
2018-11-28 11:19:51 +00:00
|
|
|
#include "timer.h"
|
2018-11-13 08:35:18 +00:00
|
|
|
class Viewer : public nse::gui::AbstractViewer
|
|
|
|
{
|
2018-11-26 12:11:05 +00:00
|
|
|
public:
|
2018-11-13 08:35:18 +00:00
|
|
|
Viewer();
|
|
|
|
|
|
|
|
void LoadShaders();
|
|
|
|
void CreateGeometry();
|
|
|
|
|
2018-11-26 12:11:05 +00:00
|
|
|
void drawContents();
|
|
|
|
bool resizeEvent(const Eigen::Vector2i &);
|
2018-11-13 08:35:18 +00:00
|
|
|
|
2018-11-26 12:11:05 +00:00
|
|
|
private:
|
2018-11-13 08:35:18 +00:00
|
|
|
void RenderSky();
|
|
|
|
|
|
|
|
Eigen::Matrix4f view, proj;
|
|
|
|
|
|
|
|
nse::gui::GLShader skyShader;
|
|
|
|
nse::gui::GLVertexArray emptyVAO;
|
|
|
|
|
|
|
|
nse::gui::GLShader terrainShader;
|
|
|
|
nse::gui::GLVertexArray terrainVAO;
|
|
|
|
nse::gui::GLBuffer terrainPositions;
|
|
|
|
nse::gui::GLBuffer terrainIndices;
|
|
|
|
|
|
|
|
GLuint grassTexture, rockTexture, roadColorTexture, roadNormalMap, roadSpecularMap, alphaMap;
|
|
|
|
|
2018-11-26 12:11:05 +00:00
|
|
|
GLint grass_texture_location;
|
2018-11-26 16:58:30 +00:00
|
|
|
GLint rock_texture_location;
|
|
|
|
GLint alpha_texture_location;
|
|
|
|
GLint road_texture_location;
|
|
|
|
GLint road_specular_location;
|
2018-11-29 11:16:21 +00:00
|
|
|
GLint road_normal_location;
|
|
|
|
GLint offset_buffer_location;
|
2018-11-26 12:11:05 +00:00
|
|
|
|
2018-11-13 08:35:18 +00:00
|
|
|
nse::gui::GLBuffer offsetBuffer;
|
|
|
|
|
|
|
|
GLuint backgroundFBO, backgroundTexture;
|
2018-11-29 11:16:21 +00:00
|
|
|
|
|
|
|
std::vector<Eigen::Vector2f> offsets;
|
2018-11-13 08:35:18 +00:00
|
|
|
};
|