CGI/exercise2/include/Viewer.h

51 lines
1.2 KiB
C++

// This source code is property of the Computer Graphics and Visualization
// chair of the TU Dresden. Do not distribute!
// 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>
#include "timer.h"
class Viewer : public nse::gui::AbstractViewer
{
public:
Viewer();
void LoadShaders();
void CreateGeometry();
void drawContents();
bool resizeEvent(const Eigen::Vector2i &);
private:
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;
GLint grass_texture_location;
GLint rock_texture_location;
GLint alpha_texture_location;
GLint road_texture_location;
GLint road_specular_location;
GLint road_normal_location;
GLint offset_buffer_location;
nse::gui::GLBuffer offsetBuffer;
GLuint backgroundFBO, backgroundTexture;
std::vector<Eigen::Vector2f> offsets;
};