diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a85e8d..2c460a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/legacy/resources/shaders/simple.frag b/legacy/resources/shaders/simple.frag new file mode 100644 index 0000000..949c2ec --- /dev/null +++ b/legacy/resources/shaders/simple.frag @@ -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); + +} diff --git a/legacy/resources/shaders/simple.vert b/legacy/resources/shaders/simple.vert new file mode 100644 index 0000000..bad13e0 --- /dev/null +++ b/legacy/resources/shaders/simple.vert @@ -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 + ); + +} diff --git a/legacy/resources/textures/bedrock.png b/legacy/resources/textures/bedrock.png new file mode 100644 index 0000000..1643c99 Binary files /dev/null and b/legacy/resources/textures/bedrock.png differ diff --git a/legacy/resources/textures/cobblestone.png b/legacy/resources/textures/cobblestone.png new file mode 100644 index 0000000..da3498c Binary files /dev/null and b/legacy/resources/textures/cobblestone.png differ diff --git a/legacy/resources/textures/dirt.png b/legacy/resources/textures/dirt.png new file mode 100644 index 0000000..617d353 Binary files /dev/null and b/legacy/resources/textures/dirt.png differ diff --git a/legacy/resources/textures/grass_side.png b/legacy/resources/textures/grass_side.png new file mode 100644 index 0000000..9ceef3b Binary files /dev/null and b/legacy/resources/textures/grass_side.png differ diff --git a/legacy/resources/textures/grass_top.png b/legacy/resources/textures/grass_top.png new file mode 100644 index 0000000..9c4366c Binary files /dev/null and b/legacy/resources/textures/grass_top.png differ diff --git a/legacy/resources/textures/stone.png b/legacy/resources/textures/stone.png new file mode 100644 index 0000000..87e19ff Binary files /dev/null and b/legacy/resources/textures/stone.png differ diff --git a/src/common.hpp b/legacy/src/common.hpp similarity index 92% rename from src/common.hpp rename to legacy/src/common.hpp index fae97b2..d550ce5 100644 --- a/src/common.hpp +++ b/legacy/src/common.hpp @@ -3,6 +3,7 @@ #include #include +#define GLM_ENABLE_EXPERIMENTAL #include #include diff --git a/src/config.hpp b/legacy/src/config.hpp similarity index 100% rename from src/config.hpp rename to legacy/src/config.hpp diff --git a/src/game.cpp b/legacy/src/game.cpp similarity index 100% rename from src/game.cpp rename to legacy/src/game.cpp diff --git a/src/game.hpp b/legacy/src/game.hpp similarity index 100% rename from src/game.hpp rename to legacy/src/game.hpp diff --git a/src/main.cpp b/legacy/src/main.cpp similarity index 99% rename from src/main.cpp rename to legacy/src/main.cpp index 03951d5..6fc4fe4 100644 --- a/src/main.cpp +++ b/legacy/src/main.cpp @@ -2,7 +2,6 @@ #include "game.hpp" - int main(int argc, char** argv) { Game game; diff --git a/src/renderer/camera.cpp b/legacy/src/renderer/camera.cpp similarity index 100% rename from src/renderer/camera.cpp rename to legacy/src/renderer/camera.cpp diff --git a/src/renderer/camera.hpp b/legacy/src/renderer/camera.hpp similarity index 100% rename from src/renderer/camera.hpp rename to legacy/src/renderer/camera.hpp diff --git a/src/renderer/renderer.cpp b/legacy/src/renderer/renderer.cpp similarity index 100% rename from src/renderer/renderer.cpp rename to legacy/src/renderer/renderer.cpp diff --git a/src/renderer/renderer.hpp b/legacy/src/renderer/renderer.hpp similarity index 100% rename from src/renderer/renderer.hpp rename to legacy/src/renderer/renderer.hpp diff --git a/src/renderer/shader.cpp b/legacy/src/renderer/shader.cpp similarity index 100% rename from src/renderer/shader.cpp rename to legacy/src/renderer/shader.cpp diff --git a/src/renderer/shader.hpp b/legacy/src/renderer/shader.hpp similarity index 100% rename from src/renderer/shader.hpp rename to legacy/src/renderer/shader.hpp diff --git a/src/renderer/texture.cpp b/legacy/src/renderer/texture.cpp similarity index 100% rename from src/renderer/texture.cpp rename to legacy/src/renderer/texture.cpp diff --git a/src/renderer/texture.hpp b/legacy/src/renderer/texture.hpp similarity index 100% rename from src/renderer/texture.hpp rename to legacy/src/renderer/texture.hpp diff --git a/src/util/fastnoise.cpp b/legacy/src/util/fastnoise.cpp similarity index 100% rename from src/util/fastnoise.cpp rename to legacy/src/util/fastnoise.cpp diff --git a/src/util/fastnoise.hpp b/legacy/src/util/fastnoise.hpp similarity index 100% rename from src/util/fastnoise.hpp rename to legacy/src/util/fastnoise.hpp diff --git a/src/util/filereader.cpp b/legacy/src/util/filereader.cpp similarity index 100% rename from src/util/filereader.cpp rename to legacy/src/util/filereader.cpp diff --git a/src/util/filereader.hpp b/legacy/src/util/filereader.hpp similarity index 100% rename from src/util/filereader.hpp rename to legacy/src/util/filereader.hpp diff --git a/src/util/glad.c b/legacy/src/util/glad.c similarity index 100% rename from src/util/glad.c rename to legacy/src/util/glad.c diff --git a/src/util/stb_image.hpp b/legacy/src/util/stb_image.hpp similarity index 100% rename from src/util/stb_image.hpp rename to legacy/src/util/stb_image.hpp diff --git a/src/util/stb_image_write.hpp b/legacy/src/util/stb_image_write.hpp similarity index 100% rename from src/util/stb_image_write.hpp rename to legacy/src/util/stb_image_write.hpp diff --git a/src/world/block.cpp b/legacy/src/world/block.cpp similarity index 100% rename from src/world/block.cpp rename to legacy/src/world/block.cpp diff --git a/src/world/block.hpp b/legacy/src/world/block.hpp similarity index 100% rename from src/world/block.hpp rename to legacy/src/world/block.hpp diff --git a/src/world/chunk/chunk.cpp b/legacy/src/world/chunk/chunk.cpp similarity index 100% rename from src/world/chunk/chunk.cpp rename to legacy/src/world/chunk/chunk.cpp diff --git a/src/world/chunk/chunk.hpp b/legacy/src/world/chunk/chunk.hpp similarity index 100% rename from src/world/chunk/chunk.hpp rename to legacy/src/world/chunk/chunk.hpp diff --git a/src/world/chunk/face.hpp b/legacy/src/world/chunk/face.hpp similarity index 100% rename from src/world/chunk/face.hpp rename to legacy/src/world/chunk/face.hpp diff --git a/src/world/chunk/voxel.cpp b/legacy/src/world/chunk/voxel.cpp similarity index 100% rename from src/world/chunk/voxel.cpp rename to legacy/src/world/chunk/voxel.cpp diff --git a/src/world/chunk/voxel.hpp b/legacy/src/world/chunk/voxel.hpp similarity index 100% rename from src/world/chunk/voxel.hpp rename to legacy/src/world/chunk/voxel.hpp diff --git a/src/world/entity.cpp b/legacy/src/world/entity.cpp similarity index 100% rename from src/world/entity.cpp rename to legacy/src/world/entity.cpp diff --git a/src/world/entity.hpp b/legacy/src/world/entity.hpp similarity index 100% rename from src/world/entity.hpp rename to legacy/src/world/entity.hpp diff --git a/src/world/generator/chunkgenerator.cpp b/legacy/src/world/generator/chunkgenerator.cpp similarity index 100% rename from src/world/generator/chunkgenerator.cpp rename to legacy/src/world/generator/chunkgenerator.cpp diff --git a/src/world/generator/chunkgenerator.hpp b/legacy/src/world/generator/chunkgenerator.hpp similarity index 100% rename from src/world/generator/chunkgenerator.hpp rename to legacy/src/world/generator/chunkgenerator.hpp diff --git a/src/world/world.cpp b/legacy/src/world/world.cpp similarity index 100% rename from src/world/world.cpp rename to legacy/src/world/world.cpp diff --git a/src/world/world.hpp b/legacy/src/world/world.hpp similarity index 100% rename from src/world/world.hpp rename to legacy/src/world/world.hpp