Started complete rewrite, i learned an awful lot but this is unsalvegable
This commit is contained in:
@@ -1,11 +1,10 @@
|
|||||||
cmake_minimum_required(VERSION 3.7)
|
cmake_minimum_required(VERSION 3.7)
|
||||||
project(OpenGLPlayground)
|
project(MingeCraft)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} CMakeModules/)
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} CMakeModules/)
|
||||||
cmake_policy(SET CMP0037 OLD)
|
|
||||||
|
|
||||||
set(CMAKE_BUILD_TYPE Debug)
|
# set(CMAKE_BUILD_TYPE Debug)
|
||||||
# set(CMAKE_CXX_FLAGS "-Ofast")
|
set(CMAKE_CXX_FLAGS "-Ofast")
|
||||||
|
|
||||||
set(executable output)
|
set(executable output)
|
||||||
set(SrcDIR ./src)
|
set(SrcDIR ./src)
|
||||||
|
|||||||
27
legacy/resources/shaders/simple.frag
Normal file
27
legacy/resources/shaders/simple.frag
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#version 450
|
||||||
|
|
||||||
|
vec3 SkyColour = vec3(186.0f / 255.0f, 214.0f / 255.0f, 254.0f / 255.0f);
|
||||||
|
|
||||||
|
in vec3 TexCoord;
|
||||||
|
in float Distance;
|
||||||
|
|
||||||
|
out vec4 outColour;
|
||||||
|
|
||||||
|
uniform sampler2DArray tex;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
|
||||||
|
outColour = texture(tex, TexCoord);
|
||||||
|
//outColour = vec4(.9, .9, .9, 1);
|
||||||
|
|
||||||
|
if (outColour.w == .0)
|
||||||
|
discard;
|
||||||
|
|
||||||
|
float fogMax = 60000;
|
||||||
|
|
||||||
|
vec3 colour = mix(outColour.xyz, SkyColour, min(1.0f, Distance / fogMax));
|
||||||
|
|
||||||
|
// Retain fragment transparency
|
||||||
|
outColour = vec4(colour, outColour.w);
|
||||||
|
|
||||||
|
}
|
||||||
26
legacy/resources/shaders/simple.vert
Normal file
26
legacy/resources/shaders/simple.vert
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#version 450
|
||||||
|
|
||||||
|
layout (location = 0) in vec3 position;
|
||||||
|
layout (location = 1) in vec3 texcoord;
|
||||||
|
|
||||||
|
out vec3 TexCoord;
|
||||||
|
out float Distance;
|
||||||
|
|
||||||
|
uniform mat4 model;
|
||||||
|
uniform mat4 view;
|
||||||
|
uniform mat4 proj;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
|
||||||
|
TexCoord = texcoord;
|
||||||
|
|
||||||
|
gl_Position = proj * view * model * vec4(position, 1.0);
|
||||||
|
|
||||||
|
// Makes no sense but it works
|
||||||
|
Distance = (
|
||||||
|
gl_Position.x * gl_Position.x +
|
||||||
|
gl_Position.y * gl_Position.y +
|
||||||
|
gl_Position.z * gl_Position.z
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
BIN
legacy/resources/textures/bedrock.png
Normal file
BIN
legacy/resources/textures/bedrock.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 225 B |
BIN
legacy/resources/textures/cobblestone.png
Normal file
BIN
legacy/resources/textures/cobblestone.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 568 B |
BIN
legacy/resources/textures/dirt.png
Normal file
BIN
legacy/resources/textures/dirt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 266 B |
BIN
legacy/resources/textures/grass_side.png
Normal file
BIN
legacy/resources/textures/grass_side.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 660 B |
BIN
legacy/resources/textures/grass_top.png
Normal file
BIN
legacy/resources/textures/grass_top.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 766 B |
BIN
legacy/resources/textures/stone.png
Normal file
BIN
legacy/resources/textures/stone.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 223 B |
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
#define GLM_ENABLE_EXPERIMENTAL
|
||||||
#include <glm/gtx/hash.hpp>
|
#include <glm/gtx/hash.hpp>
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include "game.hpp"
|
#include "game.hpp"
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
|
||||||
Game game;
|
Game game;
|
||||||
Reference in New Issue
Block a user