Base content package + ContentLoader

This commit is contained in:
MihailRis
2023-12-01 16:26:42 +03:00
parent 6708e1ef86
commit c8a283c645
33 changed files with 317 additions and 111 deletions
+8 -2
View File
@@ -1,6 +1,12 @@
#include "Block.h"
Block::Block(std::string name)
: name(name),
textureFaces({"notfound","notfound","notfound",
"notfound","notfound","notfound",}) {
}
Block::Block(std::string name, std::string texture) : name(name),
textureFaces{texture,texture,texture,texture,texture,texture},
emission{0,0,0}{
textureFaces{texture,texture,texture,texture,texture,texture} {
}
+2 -1
View File
@@ -27,7 +27,7 @@ public:
std::string const name;
// 0 1 2 3 4 5
std::string textureFaces[6]; // -x,x, -y,y, -z,z
unsigned char emission[4];
unsigned char emission[4] {0, 0, 0, 0};
unsigned char drawGroup = 0;
BlockModel model = BlockModel::block;
bool lightPassing = false;
@@ -46,6 +46,7 @@ public:
bool hitboxGrid[BLOCK_AABB_GRID][BLOCK_AABB_GRID][BLOCK_AABB_GRID];
} rt;
Block(std::string name);
Block(std::string name, std::string texture);
};
+2 -2
View File
@@ -106,7 +106,7 @@ WorldGenerator::WorldGenerator(const Content* content)
idLeaves(content->require("base:leaves")->rt.id),
idGrass(content->require("base:grass")->rt.id),
idFlower(content->require("base:flower")->rt.id),
idBedrock(content->require("base:bedrock")->rt.id) {;
idBazalt(content->require("base:bazalt")->rt.id) {;
}
int generate_tree(fnl_state *noise,
@@ -213,7 +213,7 @@ void WorldGenerator::generate(voxel* voxels, int cx, int cz, int seed){
id = idSand;
}
if (real_y <= 2)
id = idBedrock;
id = idBazalt;
randomgrass.setSeed(real_x,real_z);
if ((id == 0) && (height > SEA_LEVEL+0.5) && ((int)(height + 1) == real_y) && ((unsigned short)randomgrass.rand() > 56000)){
+1 -1
View File
@@ -16,7 +16,7 @@ class WorldGenerator {
blockid_t const idLeaves;
blockid_t const idGrass;
blockid_t const idFlower;
blockid_t const idBedrock;
blockid_t const idBazalt;
public:
WorldGenerator(const Content* content);
void generate(voxel* voxels, int x, int z, int seed);