diff --git a/LevelGenerator.cpp b/LevelGenerator.cpp new file mode 100644 index 0000000..c8084b8 --- /dev/null +++ b/LevelGenerator.cpp @@ -0,0 +1,43 @@ +#include "LevelGenerator.h" + +FastNoiseLite perlin, os, cellular; +int seed = 138; + +perlin.SetSeed(seed); +perlin.SetNoiseType(FastNoiseLite::NoiseType_Perlin); +perlin.SetFrequency(.01F); + +os.SetSeed(seed); +os.SetNoiseType(FastNoiseLite::NoiseType_OpenSimplex2); +os.SetFrequency(.01F); + +cellular.SetSeed(seed); +cellular.SetNoiseType(FastNoiseLite::NoiseType_Cellular); +cellular.SetFrequency(.1F); + +LevelGenerator::LevelGenerator() +{ + +} + +void LevelGenerator::generateBlock() +{ + for(int bx = 0; bx < 8; bx++) + { + for(int bz = 0; bz < 8; bz++) + { + for(int x = 0; x < 16; x++) + { + for(int z = 0; z < 16; z++) + { + float cX = (float)x + (16 * bx); + float cZ = (float)z + (16 * bz); + for(int y = 0; y < 48 * abs(perlin.GetNoise(cX, cZ)) / 2 + abs(cellular.GetNoise(cX, cZ)) * 2 + abs(os.GetNoise(cX, cZ)) * 4 + 10; y++) + { + blockManager.mapBlocks[bx][bz].addNode(y > 20 ? 1 : 2, 0, x, y, z); + } + } + } + } + } +} diff --git a/XtreemNodes.depend b/XtreemNodes.depend index 81c77e5..820c498 100644 --- a/XtreemNodes.depend +++ b/XtreemNodes.depend @@ -1,5 +1,9 @@ # depslib dependency file v1.0 +<<<<<<< HEAD 1672107417 source:c:\development\xtreemminer\main.cpp +======= +1672097148 source:c:\development\xtreemminer\main.cpp +>>>>>>> dcac2713f6b72f4d2252632a179b30a33fd827a8 "Utilities.h" @@ -9,11 +13,14 @@ "TextureHandler.h" - "FastNoiseLite.h" +<<<<<<< HEAD 1672201712 c:\development\xtreemminer\include\noderenderer.h +======= +1667160597 c:\development\xtreemminer\include\noderenderer.h +>>>>>>> dcac2713f6b72f4d2252632a179b30a33fd827a8 "Base.h" "MapBlock.h" @@ -29,7 +36,11 @@ "MapBlock.h" "Base.h" +<<<<<<< HEAD 1672341127 c:\development\xtreemminer\include\texturehandler.h +======= +1672105046 c:\development\xtreemminer\include\texturehandler.h +>>>>>>> dcac2713f6b72f4d2252632a179b30a33fd827a8 "stb_image.h" "Base.h" diff --git a/XtreemNodes.layout b/XtreemNodes.layout index 2364094..bd1173a 100644 --- a/XtreemNodes.layout +++ b/XtreemNodes.layout @@ -2,16 +2,23 @@ +<<<<<<< HEAD - - - +======= + - + +>>>>>>> dcac2713f6b72f4d2252632a179b30a33fd827a8 + + + + + +<<<<<<< HEAD @@ -33,16 +40,68 @@ +======= + +>>>>>>> dcac2713f6b72f4d2252632a179b30a33fd827a8 +<<<<<<< HEAD +======= + + + + + + + + + + + + + + + + + + + + + +>>>>>>> dcac2713f6b72f4d2252632a179b30a33fd827a8 - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/XtreemNodesLinux.cbp b/XtreemNodesLinux.cbp new file mode 100644 index 0000000..b7c8c00 --- /dev/null +++ b/XtreemNodesLinux.cbp @@ -0,0 +1,59 @@ + + + + + + diff --git a/XtreemNodes.cbp b/XtreemNodesWindows.cbp similarity index 93% rename from XtreemNodes.cbp rename to XtreemNodesWindows.cbp index 7678d56..1f7feae 100644 --- a/XtreemNodes.cbp +++ b/XtreemNodesWindows.cbp @@ -40,12 +40,15 @@ + + + diff --git a/data/img/cobble.png b/data/img/cobble.png deleted file mode 100644 index 0faee33..0000000 Binary files a/data/img/cobble.png and /dev/null differ diff --git a/data/img/gold.png b/data/img/gold.png deleted file mode 100644 index ca5853b..0000000 Binary files a/data/img/gold.png and /dev/null differ diff --git a/data/img/grass_side.png b/data/img/grass_side.png deleted file mode 100644 index 453c64d..0000000 Binary files a/data/img/grass_side.png and /dev/null differ diff --git a/data/img/iron.png b/data/img/iron.png deleted file mode 100644 index e3e6e84..0000000 Binary files a/data/img/iron.png and /dev/null differ diff --git a/data/img/oak.png b/data/img/oak.png deleted file mode 100644 index 76da003..0000000 Binary files a/data/img/oak.png and /dev/null differ diff --git a/data/img/test.png b/data/img/test.png deleted file mode 100644 index 8ace58b..0000000 Binary files a/data/img/test.png and /dev/null differ diff --git a/data/img/texturemap.png b/data/img/texturemap.png new file mode 100644 index 0000000..b9facd7 Binary files /dev/null and b/data/img/texturemap.png differ diff --git a/include/LevelGenerator.h b/include/LevelGenerator.h new file mode 100644 index 0000000..8f64374 --- /dev/null +++ b/include/LevelGenerator.h @@ -0,0 +1,18 @@ +#ifndef LEVELGENERATOR +#define LEVELGENERATOR +#include "FastNoiseLite.h" + +class LevelGenerator +{ + public: + LevelGenerator(); + void generateBlock(); + + protected: + + private: + FastNoiseLite perlin, os, cellular; + int seed = 138; +}; + +#endif diff --git a/include/TextureHandler.h b/include/TextureHandler.h index eeae9ab..01ba231 100644 --- a/include/TextureHandler.h +++ b/include/TextureHandler.h @@ -26,7 +26,7 @@ class TextureHandler void loadAllTextures() { int textureIndex = 0; - imageData = loadTexture("data/img/grass.png"); + imageData = loadTexture("data/img/texturemap.png"); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); diff --git a/main.cpp b/main.cpp index 5755306..37de996 100644 --- a/main.cpp +++ b/main.cpp @@ -7,12 +7,10 @@ #include "TextureHandler.h" #include #include -#include "FastNoiseLite.h" #include #include NodeRenderer renderer; -//BlockManager blockManager; BlockManager blockManager; TextureHandler textureHandler; @@ -163,38 +161,9 @@ int main(int argc, char **argv) // Load textures textureHandler.loadAllTextures(); - FastNoiseLite perlin, os, cellular; - int seed = 138; - perlin.SetSeed(seed); - perlin.SetNoiseType(FastNoiseLite::NoiseType_Perlin); - perlin.SetFrequency(.01F); - os.SetSeed(seed); - os.SetNoiseType(FastNoiseLite::NoiseType_OpenSimplex2); - os.SetFrequency(.01F); - cellular.SetSeed(seed); - cellular.SetNoiseType(FastNoiseLite::NoiseType_Cellular); - cellular.SetFrequency(.1F); - for(int bx = 0; bx < 8; bx++) - { - for(int bz = 0; bz < 8; bz++) - { - for(int x = 0; x < 16; x++) - { - for(int z = 0; z < 16; z++) - { - float cX = (float)x + (16 * bx); - float cZ = (float)z + (16 * bz); - for(int y = 0; y < 48 * abs(perlin.GetNoise(cX, cZ)) / 2 + abs(cellular.GetNoise(cX, cZ)) * 2 + abs(os.GetNoise(cX, cZ)) * 4 + 10; y++) - { - blockManager.mapBlocks[bx][bz].addNode(y > 20 ? 1 : 2, 0, x, y, z); - } - } - } - } - }