summaryrefslogtreecommitdiffstats
path: root/old/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'old/graphics')
-rw-r--r--old/graphics/Gui.cpp1
-rw-r--r--old/graphics/Gui.hpp8
-rw-r--r--old/graphics/RenderSection.cpp356
-rw-r--r--old/graphics/RenderSection.hpp52
-rw-r--r--old/graphics/Shader.cpp115
-rw-r--r--old/graphics/Shader.hpp24
-rw-r--r--old/graphics/Texture.cpp37
-rw-r--r--old/graphics/Texture.hpp14
-rw-r--r--old/graphics/Widget.cpp1
-rw-r--r--old/graphics/Widget.hpp8
10 files changed, 0 insertions, 616 deletions
diff --git a/old/graphics/Gui.cpp b/old/graphics/Gui.cpp
deleted file mode 100644
index 9e18549..0000000
--- a/old/graphics/Gui.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "Gui.hpp" \ No newline at end of file
diff --git a/old/graphics/Gui.hpp b/old/graphics/Gui.hpp
deleted file mode 100644
index e22a0a7..0000000
--- a/old/graphics/Gui.hpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#pragma once
-
-class Gui {
-
-public:
- int WHY=0;
-
-};
diff --git a/old/graphics/RenderSection.cpp b/old/graphics/RenderSection.cpp
deleted file mode 100644
index 8ebd2c0..0000000
--- a/old/graphics/RenderSection.cpp
+++ /dev/null
@@ -1,356 +0,0 @@
-#include "RenderSection.hpp"
-#include <thread>
-
-const GLfloat vertices[] = {
- 0, 0, 0,
- 1, 0, 1,
- 1, 0, 0,
-
- 0, 0, 0,
- 0, 0, 1,
- 1, 0, 1,
-};
-
-const GLfloat uv_coords[] = {
- 0.0f, 0.0f,
- 1.0f, 1.0f,
- 0.0f, 1.0f,
-
- 0.0f, 0.0f,
- 1.0f, 0.0f,
- 1.0f, 1.0f,
-};
-
-void RenderState::SetActiveVao(GLuint Vao) {
- if (Vao != ActiveVao) {
- glBindVertexArray(Vao);
- ActiveVao = Vao;
- }
-}
-
-void RenderState::SetActiveShader(GLuint Shader) {
- if (Shader != ActiveShader) {
- glUseProgram(Shader);
- ActiveShader = Shader;
- }
-}
-
-const GLuint magicUniqueConstant = 88375;
-GLuint RenderSection::VboVertices = magicUniqueConstant;
-GLuint RenderSection::VboUvs = magicUniqueConstant;
-std::map<GLuint, int> RenderSection::refCounterVbo;
-std::map<GLuint, int> RenderSection::refCounterVao;
-
-
-RenderSection::RenderSection(World *world, Vector position) : sectionPosition(position), world(world) {
- if (VboVertices == magicUniqueConstant) {
- glGenBuffers(1, &VboVertices);
- glGenBuffers(1, &VboUvs);
-
- //Cube vertices
- glBindBuffer(GL_ARRAY_BUFFER, VboVertices);
- glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
-
- //Cube UVs
- glBindBuffer(GL_ARRAY_BUFFER, VboUvs);
- glBufferData(GL_ARRAY_BUFFER, sizeof(uv_coords), uv_coords, GL_STATIC_DRAW);
-
- LOG(INFO) << "Created VBOs with vertices (" << VboVertices << ") and UVs (" << VboUvs
- << ") for ordinary blocks";
- }
-
- glGenBuffers(1, &VboTextures);
- if (refCounterVbo.find(VboTextures) == refCounterVbo.end())
- refCounterVbo[VboTextures] = 0;
- refCounterVbo[VboTextures]++;
-
- glGenBuffers(1, &VboModels);
- if (refCounterVbo.find(VboModels) == refCounterVbo.end())
- refCounterVbo[VboModels] = 0;
- refCounterVbo[VboModels]++;
-
- glGenBuffers(1, &VboColors);
- if (refCounterVbo.find(VboColors) == refCounterVbo.end())
- refCounterVbo[VboColors] = 0;
- refCounterVbo[VboColors]++;
-
- glGenVertexArrays(1, &Vao);
- if (refCounterVao.find(Vao) == refCounterVao.end())
- refCounterVao[Vao] = 0;
- refCounterVao[Vao]++;
-
- glBindVertexArray(Vao);
- {
- //Cube vertices
- GLuint VertAttribPos = 0;
- glBindBuffer(GL_ARRAY_BUFFER, VboVertices);
- glVertexAttribPointer(VertAttribPos, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), nullptr);
- glEnableVertexAttribArray(VertAttribPos);
-
- //Cube UVs
- GLuint UvAttribPos = 2;
- glBindBuffer(GL_ARRAY_BUFFER, VboUvs);
- glVertexAttribPointer(UvAttribPos, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(GLfloat), nullptr);
- glEnableVertexAttribArray(UvAttribPos);
-
- //Textures
- GLuint textureAttribPos = 7;
- glBindBuffer(GL_ARRAY_BUFFER, VboTextures);
- glVertexAttribPointer(textureAttribPos, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), nullptr);
- glEnableVertexAttribArray(textureAttribPos);
- glVertexAttribDivisor(textureAttribPos, 1);
- glCheckError();
-
- //Blocks models
- GLuint matAttribPos = 8;
- size_t sizeOfMat4 = 4 * 4 * sizeof(GLfloat);
- glBindBuffer(GL_ARRAY_BUFFER, VboModels);
- glVertexAttribPointer(matAttribPos + 0, 4, GL_FLOAT, GL_FALSE, sizeOfMat4, nullptr);
- glVertexAttribPointer(matAttribPos + 1, 4, GL_FLOAT, GL_FALSE, sizeOfMat4, (void *) (1 * 4 * sizeof(GLfloat)));
- glVertexAttribPointer(matAttribPos + 2, 4, GL_FLOAT, GL_FALSE, sizeOfMat4, (void *) (2 * 4 * sizeof(GLfloat)));
- glVertexAttribPointer(matAttribPos + 3, 4, GL_FLOAT, GL_FALSE, sizeOfMat4, (void *) (3 * 4 * sizeof(GLfloat)));
- glEnableVertexAttribArray(matAttribPos + 0);
- glEnableVertexAttribArray(matAttribPos + 1);
- glEnableVertexAttribArray(matAttribPos + 2);
- glEnableVertexAttribArray(matAttribPos + 3);
- glVertexAttribDivisor(matAttribPos + 0, 1);
- glVertexAttribDivisor(matAttribPos + 1, 1);
- glVertexAttribDivisor(matAttribPos + 2, 1);
- glVertexAttribDivisor(matAttribPos + 3, 1);
-
- //Color
- GLuint colorAttribPos = 12;
- glBindBuffer(GL_ARRAY_BUFFER, VboColors);
- glVertexAttribPointer(colorAttribPos, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), nullptr);
- glEnableVertexAttribArray(colorAttribPos);
- glVertexAttribDivisor(colorAttribPos, 1);
-
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- }
- glBindVertexArray(0);
- glCheckError();
-}
-
-RenderSection::~RenderSection() {
- refCounterVbo[VboTextures]--;
- refCounterVbo[VboModels]--;
- refCounterVbo[VboColors]--;
- refCounterVao[Vao]--;
- if (refCounterVbo[VboTextures] <= 0)
- glDeleteBuffers(1, &VboTextures);
-
- if (refCounterVbo[VboModels] <= 0)
- glDeleteBuffers(1, &VboTextures);
- if (refCounterVbo[VboColors] <= 0)
- glDeleteBuffers(1, &VboColors);
-
- if (refCounterVao[Vao] <= 0)
- glDeleteVertexArrays(1, &Vao);
-}
-
-void RenderSection::UpdateState(const std::map<BlockTextureId, glm::vec4> &textureAtlas) {
- Section &section = world->GetSection(sectionPosition);
- models.clear();
- textures.clear();
- colors.clear();
- for (int y = 0; y < 16; y++) {
- for (int z = 0; z < 16; z++) {
- for (int x = 0; x < 16; x++) {
- Vector blockPos = Vector(x, y, z) + (sectionPosition * 16);
- Block &block = world->GetBlock(blockPos);
- if (block.id == 0)
- continue;
-
- auto checkBlockVisibility = [&](Vector block) -> bool {
- return section.GetBlock(block).id == 0 ||
- section.GetBlock(block).id == 31 ||
- section.GetBlock(block).id == 18;
- };
-
- unsigned char isVisible = 0;
- if (x == 0 || x == 15 || y == 0 || y == 15 || z == 0 || z == 15) {
- isVisible = 0b1111'1111; //All faces is visible
- } else {
- isVisible |= checkBlockVisibility(Vector(x - 1, y, z)) << 0;
- isVisible |= checkBlockVisibility(Vector(x + 1, y, z)) << 1;
- isVisible |= checkBlockVisibility(Vector(x, y + 1, z)) << 2;
- isVisible |= checkBlockVisibility(Vector(x, y - 1, z)) << 3;
- isVisible |= checkBlockVisibility(Vector(x, y, z - 1)) << 4;
- isVisible |= checkBlockVisibility(Vector(x, y, z + 1)) << 5;
- }
-
- if (isVisible == 0x00)
- continue;
-
- glm::mat4 transform;
- transform = glm::translate(transform, glm::vec3(sectionPosition.GetX() * 16,
- sectionPosition.GetY() * 16,
- sectionPosition.GetZ() * 16));
- transform = glm::translate(transform, glm::vec3(x, y, z));
- glm::vec3 biomeColor(0.275, 0.63, 0.1);
- glm::vec3 color(0.0f, 0.0f, 0.0f);
- if (block.id == 31 || block.id == 18)
- color = biomeColor;
-
- if (block.id == 31) { //X-cross like blocks rendering
- auto texture = textureAtlas.find(BlockTextureId(block.id, block.state, 2));
- for (int i = 0; i < 4; i++) {
- textures.push_back(texture->second);
- colors.push_back(color);
- }
- glm::mat4 faceTransform = glm::translate(transform, glm::vec3(0.15f, 0, 0.15f));
- faceTransform = glm::scale(faceTransform, glm::vec3(1.0f, 0.9f, 1.0f));
- faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(0, 0.0f, 1.0f));
- faceTransform = glm::rotate(faceTransform, glm::radians(45.0f), glm::vec3(1.0f, 0.0f, 0));
- for (int i = 0; i < 4; i++) {
- models.push_back(faceTransform);
- faceTransform = glm::translate(faceTransform, glm::vec3(0.0f, 0.0f, 0.5f));
- faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f));
- faceTransform = glm::translate(faceTransform, glm::vec3(0.0f, 0.0f, -0.5f));
- }
- continue;
- }
-
- if (isVisible >> 0 & 0x1) { //east side of block (X+)
- glm::mat4 faceTransform = glm::translate(transform, glm::vec3(0, 0, 0));
- faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(0, 0.0f, 1.0f));
- models.push_back(faceTransform);
- auto texture = textureAtlas.find(BlockTextureId(block.id, block.state, 2));
- if (texture != textureAtlas.end())
- textures.push_back(texture->second);
- else
- textures.push_back(glm::vec4(0.0546875, 0.00442477876106194690,
- 0.0078125, 0.00442477876106194690)); //Fallback TNT texture
- colors.push_back(color);
- }
- if (isVisible >> 1 & 0x1) { //west side X-
- glm::mat4 faceTransform = glm::translate(transform, glm::vec3(1, 0, 0));
- faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(0, 0.0f, 1.0f));
- faceTransform = glm::rotate(faceTransform, glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f));
- faceTransform = glm::translate(faceTransform, glm::vec3(0, 0, -1));
- models.push_back(faceTransform);
- auto texture = textureAtlas.find(BlockTextureId(block.id, block.state, 3));
- if (texture != textureAtlas.end())
- textures.push_back(texture->second);
- else
- textures.push_back(glm::vec4(0.0546875, 0.00442477876106194690,
- 0.0078125, 0.00442477876106194690)); //Fallback TNT texture
- colors.push_back(color);
- }
- if (isVisible >> 2 & 0x1) { //Top side Y+
- glm::mat4 faceTransform = glm::translate(transform, glm::vec3(0, 1, 0));
- models.push_back(faceTransform);
- auto texture = textureAtlas.find(BlockTextureId(block.id, block.state, 1));
- if (texture != textureAtlas.end())
- textures.push_back(texture->second);
- else
- textures.push_back(glm::vec4(0.0546875, 0.00442477876106194690,
- 0.0078125, 0.00442477876106194690)); //Fallback TNT texture
- if (block.id != 2)
- colors.push_back(color);
- else
- colors.push_back(biomeColor);
- }
- if (isVisible >> 3 & 0x1) { //Bottom side Y-
- glm::mat4 faceTransform = glm::translate(transform, glm::vec3(0, 0, 0));
- faceTransform = glm::rotate(faceTransform, glm::radians(180.0f), glm::vec3(1.0f, 0, 0));
- faceTransform = glm::translate(faceTransform, glm::vec3(0, 0, -1));
- models.push_back(faceTransform);
- auto texture = textureAtlas.find(BlockTextureId(block.id, block.state, 0));
- if (texture != textureAtlas.end())
- textures.push_back(texture->second);
- else
- textures.push_back(glm::vec4(0.0546875, 0.00442477876106194690,
- 0.0078125, 0.00442477876106194690)); //Fallback TNT texture
- colors.push_back(color);
- }
- if (isVisible >> 4 & 0x1) { //south side Z+
- glm::mat4 faceTransform = glm::translate(transform, glm::vec3(1, 0, 0));
- faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(-1.0f, 0.0f, 0.0f));
- faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(0.0f, -1.0f, 0.0f));
- models.push_back(faceTransform);
- auto texture = textureAtlas.find(BlockTextureId(block.id, block.state, 3));
- if (texture != textureAtlas.end())
- textures.push_back(texture->second);
- else
- textures.push_back(glm::vec4(0.0546875, 0.00442477876106194690,
- 0.0078125, 0.00442477876106194690)); //Fallback TNT texture
- colors.push_back(color);
- }
- if (isVisible >> 5 & 0x1) { //north side Z-
- glm::mat4 faceTransform = glm::translate(transform, glm::vec3(0, 0, 1));
- faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(-1.0f, 0.0f, 0.0f));
- faceTransform = glm::rotate(faceTransform, glm::radians(90.0f), glm::vec3(0.0f, -1.0f, 0.0f));
- faceTransform = glm::translate(faceTransform, glm::vec3(0, 0, -1));
- faceTransform = glm::rotate(faceTransform, glm::radians(180.0f), glm::vec3(1, 0, 0.0f));
- faceTransform = glm::translate(faceTransform, glm::vec3(0, 0, -1.0f));
- models.push_back(faceTransform);
- auto texture = textureAtlas.find(BlockTextureId(block.id, block.state, 4));
- if (texture != textureAtlas.end())
- textures.push_back(texture->second);
- else
- textures.push_back(glm::vec4(0.0546875, 0.00442477876106194690,
- 0.0078125, 0.00442477876106194690)); //Fallback TNT texture
- colors.push_back(color);
- }
- }
- }
- }
- numOfFaces = textures.size();
- hash = section.GetHash();
-}
-
-void RenderSection::Render(RenderState &state) {
- if (!isEnabled) return;
- if (!models.empty()) {
- glBindBuffer(GL_ARRAY_BUFFER, VboTextures);
- glBufferData(GL_ARRAY_BUFFER, textures.size() * sizeof(glm::vec4), textures.data(), GL_DYNAMIC_DRAW);
- textures.clear();
-
- glBindBuffer(GL_ARRAY_BUFFER, VboModels);
- glBufferData(GL_ARRAY_BUFFER, models.size() * sizeof(glm::mat4), models.data(), GL_DYNAMIC_DRAW);
- models.clear();
-
- glBindBuffer(GL_ARRAY_BUFFER, VboColors);
- glBufferData(GL_ARRAY_BUFFER, colors.size() * sizeof(glm::vec3), colors.data(), GL_DYNAMIC_DRAW);
- colors.clear();
-
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- }
- state.SetActiveVao(Vao);
- glDrawArraysInstanced(GL_TRIANGLES, 0, 6, numOfFaces);
- glCheckError();
-}
-
-Section *RenderSection::GetSection() {
- return &world->GetSection(sectionPosition);
-}
-
-RenderSection::RenderSection(const RenderSection &other) {
- this->world = other.world;
- this->VboModels = other.VboModels;
- this->VboTextures = other.VboTextures;
- this->VboColors = other.VboColors;
- this->sectionPosition = other.sectionPosition;
- this->Vao = other.Vao;
- this->numOfFaces = other.numOfFaces;
- this->models = other.models;
- this->textures = other.textures;
- this->colors = other.colors;
- this->hash = other.hash;
-
- refCounterVbo[VboTextures]++;
- refCounterVbo[VboModels]++;
- refCounterVbo[VboColors]++;
- refCounterVao[Vao]++;
-}
-
-void RenderSection::SetEnabled(bool isEnabled) {
- this->isEnabled = isEnabled;
-}
-
-bool RenderSection::IsNeedUpdate() {
- size_t currentHash = world->GetSection(sectionPosition).GetHash();
- bool isNeedUpdate = currentHash != hash;
- return isNeedUpdate;
-} \ No newline at end of file
diff --git a/old/graphics/RenderSection.hpp b/old/graphics/RenderSection.hpp
deleted file mode 100644
index 7f97624..0000000
--- a/old/graphics/RenderSection.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#pragma once
-
-#include <GL/glew.h>
-#include <glm/detail/type_mat.hpp>
-#include <glm/vec2.hpp>
-#include <glm/detail/type_mat4x4.hpp>
-#include <glm/gtx/transform.hpp>
-#include <easylogging++.h>
-
-#include "../core/AssetManager.hpp"
-#include "../world/Section.hpp"
-#include "../world/World.hpp"
-
-class RenderState {
- GLuint ActiveVao;
- GLuint ActiveShader;
-public:
- void SetActiveVao(GLuint Vao);
- void SetActiveShader(GLuint Shader);
-};
-
-class RenderSection {
- Vector sectionPosition;
- World *world;
- GLuint Vao, VboTextures, VboModels, VboColors;
- std::vector<glm::mat4> models;
- std::vector<glm::vec4> textures;
- std::vector<glm::vec3> colors;
-
- static GLuint VboVertices, VboUvs;
- static std::map<GLuint, int> refCounterVbo;
- static std::map<GLuint, int> refCounterVao;
-
- size_t numOfFaces = 0;
-
- bool isEnabled = true;
-
- size_t hash = 0;
-public:
- RenderSection(World *world, Vector position);
- RenderSection(const RenderSection &other);
- ~RenderSection();
-
- void UpdateState(const std::map<BlockTextureId, glm::vec4> &textureAtlas);
- void Render(RenderState &state);
-
- void SetEnabled(bool isEnabled);
-
- Section *GetSection();
-
- bool IsNeedUpdate();
-}; \ No newline at end of file
diff --git a/old/graphics/Shader.cpp b/old/graphics/Shader.cpp
deleted file mode 100644
index cf43115..0000000
--- a/old/graphics/Shader.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-#include "Shader.hpp"
-
-Shader::Shader(const GLchar *vertexPath, const GLchar *fragmentPath, const GLchar *geometryPath) {
- vertex = vertexPath;
- fragment = fragmentPath;
- // 1. Получаем исходный код шейдера из filePath
- std::string vertexCode;
- std::string fragmentCode;
- std::string geometryCode;
- std::ifstream vShaderFile;
- std::ifstream fShaderFile;
- std::ifstream gShaderFile;
- // Удостоверимся, что ifstream объекты могут выкидывать исключения
- vShaderFile.exceptions(std::ifstream::failbit);
- fShaderFile.exceptions(std::ifstream::failbit);
- gShaderFile.exceptions(std::ifstream::failbit);
- try {
- // Открываем файлы
- vShaderFile.open(vertexPath);
- fShaderFile.open(fragmentPath);
- if (geometryPath != nullptr)
- gShaderFile.open(geometryPath);
- std::stringstream vShaderStream, fShaderStream, gShaderStream;
- // Считываем данные в потоки
- vShaderStream << vShaderFile.rdbuf();
- fShaderStream << fShaderFile.rdbuf();
- if (geometryPath != nullptr)
- gShaderStream << gShaderFile.rdbuf();
- // Закрываем файлы
- vShaderFile.close();
- fShaderFile.close();
- if (geometryPath != nullptr)
- gShaderFile.close();
- // Преобразовываем потоки в массив GLchar
- vertexCode = vShaderStream.str();
- fragmentCode = fShaderStream.str();
- if (geometryPath != nullptr)
- geometryCode = gShaderStream.str();
- }
- catch (std::ifstream::failure e) {
- LOG(ERROR) << "ERROR::SHADER::FILE_NOT_SUCCESSFULLY_READ";
- }
- const GLchar *vShaderCode = vertexCode.c_str();
- const GLchar *fShaderCode = fragmentCode.c_str();
- const GLchar *gShaderCode = geometryCode.c_str();
-
- // 2. Сборка шейдеров
- GLuint vertex, fragment, geometry;
- GLint success;
- GLchar infoLog[512];
-
- // Вершинный шейдер
- vertex = glCreateShader(GL_VERTEX_SHADER);
- glShaderSource(vertex, 1, &vShaderCode, NULL);
- glCompileShader(vertex);
- // Если есть ошибки - вывести их
- glGetShaderiv(vertex, GL_COMPILE_STATUS, &success);
- if (!success) {
- glGetShaderInfoLog(vertex, 512, NULL, infoLog);
- LOG(ERROR) << "ERROR::SHADER::VERTEX::COMPILATION_FAILED\n" << infoLog;
- };
-
- // Вершинный шейдер
- fragment = glCreateShader(GL_FRAGMENT_SHADER);
- glShaderSource(fragment, 1, &fShaderCode, NULL);
- glCompileShader(fragment);
- // Если есть ошибки - вывести их
- glGetShaderiv(fragment, GL_COMPILE_STATUS, &success);
- if (!success) {
- glGetShaderInfoLog(fragment, 512, NULL, infoLog);
- LOG(ERROR) << "ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\n" << infoLog;
- };
-
- if (geometryPath != nullptr) {
- geometry = glCreateShader(GL_GEOMETRY_SHADER);
- glShaderSource(geometry, 1, &gShaderCode, NULL);
- glCompileShader(geometry);
- // Если есть ошибки - вывести их
- glGetShaderiv(geometry, GL_COMPILE_STATUS, &success);
- if (!success) {
- glGetShaderInfoLog(geometry, 512, NULL, infoLog);
- LOG(ERROR) << "ERROR::SHADER::GEOMETRY::COMPILATION_FAILED\n" << infoLog;
- };
- }
-
- // Шейдерная программа
- this->Program = glCreateProgram();
- glAttachShader(this->Program, vertex);
- glAttachShader(this->Program, fragment);
- if (geometryPath != nullptr)
- glAttachShader(this->Program, geometry);
- glLinkProgram(this->Program);
- //Если есть ошибки - вывести их
- glGetProgramiv(this->Program, GL_LINK_STATUS, &success);
- if (!success) {
- glGetProgramInfoLog(this->Program, 512, NULL, infoLog);
- LOG(FATAL) << "ERROR::SHADER::PROGRAM::LINKING_FAILED\n" << infoLog;
- }
-
- // Удаляем шейдеры, поскольку они уже в программу и нам больше не нужны.
- glDeleteShader(vertex);
- glDeleteShader(fragment);
-}
-
-void Shader::Use() {
- glUseProgram(this->Program);
-}
-
-void Shader::Reload() {
- const GLchar *vertexPath = vertex;
- const GLchar *fragmentPath = fragment;
- this->~Shader();
- new(this) Shader(vertexPath, fragmentPath);
- LOG(INFO) << "Shader is realoded!";
-}
diff --git a/old/graphics/Shader.hpp b/old/graphics/Shader.hpp
deleted file mode 100644
index 17a434e..0000000
--- a/old/graphics/Shader.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-
-#include <string>
-#include <fstream>
-#include <sstream>
-
-#include <easylogging++.h>
-#include <GL/glew.h>
-
-class Shader
-{
-private:
- const GLchar *vertex;
- const GLchar *fragment;
-public:
- // Идентификатор программы
- GLuint Program;
- // Конструктор считывает и собирает шейдер
- Shader(const GLchar* vertexPath, const GLchar* fragmentPath, const GLchar* geometryPath = nullptr);
- // Использование программы
- void Use();
-
- void Reload();
-}; \ No newline at end of file
diff --git a/old/graphics/Texture.cpp b/old/graphics/Texture.cpp
deleted file mode 100644
index 5d183c3..0000000
--- a/old/graphics/Texture.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "Texture.hpp"
-
-Texture::Texture(std::string filename, GLenum textureWrapping, GLenum textureFiltering) {
- glGenTextures(1, &texture);
- glBindTexture(GL_TEXTURE_2D, texture);
-
- //Texture options
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, textureWrapping);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, textureWrapping);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, textureFiltering);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-
- //Image load
- sf::Image image;
- if (!image.loadFromFile(filename)) {
- LOG(ERROR) << "Can't open image " << filename;
- throw 201;
- }
- if (image.getPixelsPtr() == nullptr) {
- LOG(ERROR) << "Image data is corrupted!";
- throw 202;
- }
- image.flipVertically();
-
-
- //Creating texture
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.getSize().x, image.getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE,
- (GLvoid *) image.getPixelsPtr());
- glGenerateMipmap(GL_TEXTURE_2D);
- glBindTexture(GL_TEXTURE_2D, 0);
-
-}
-
-Texture::~Texture() {
- glDeleteTextures(1, &texture);
-}
diff --git a/old/graphics/Texture.hpp b/old/graphics/Texture.hpp
deleted file mode 100644
index 5b2afcf..0000000
--- a/old/graphics/Texture.hpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#pragma once
-
-#include <easylogging++.h>
-#include <GL/glew.h>
-#include <SFML/Graphics.hpp>
-
-class Texture {
- Texture(Texture&);
- Texture&operator=(Texture&);
-public:
- GLuint texture;
- Texture(std::string filename, GLenum textureWrapping = GL_CLAMP_TO_BORDER, GLenum textureFiltering = GL_NEAREST);
- ~Texture();
-}; \ No newline at end of file
diff --git a/old/graphics/Widget.cpp b/old/graphics/Widget.cpp
deleted file mode 100644
index 278af55..0000000
--- a/old/graphics/Widget.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "Widget.hpp" \ No newline at end of file
diff --git a/old/graphics/Widget.hpp b/old/graphics/Widget.hpp
deleted file mode 100644
index c4d5dc1..0000000
--- a/old/graphics/Widget.hpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#pragma once
-
-class Widget {
- unsigned int x,y,w,h;
-public:
- Widget(Widget *parent);
- ~Widget();
-};