Started complete rewrite, i learned an awful lot but this is unsalvegable

This commit is contained in:
Ben
2020-05-15 14:59:51 +01:00
parent 1afe376fad
commit 1ce214bf7f
42 changed files with 57 additions and 5 deletions

View File

@@ -1,11 +1,10 @@
cmake_minimum_required(VERSION 3.7)
project(OpenGLPlayground)
project(MingeCraft)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} CMakeModules/)
cmake_policy(SET CMP0037 OLD)
set(CMAKE_BUILD_TYPE Debug)
# set(CMAKE_CXX_FLAGS "-Ofast")
# set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "-Ofast")
set(executable output)
set(SrcDIR ./src)

View 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);
}

View 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
);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

View File

@@ -3,6 +3,7 @@
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/hash.hpp>
#include <glm/glm.hpp>

View File

@@ -2,7 +2,6 @@
#include "game.hpp"
int main(int argc, char** argv) {
Game game;