Delete le monde infini et la sauvegarde de chunk.
This commit is contained in:
parent
2f8a5893f0
commit
3b5a56189e
@ -2,11 +2,11 @@
|
||||
#include "world.h"
|
||||
|
||||
Chunk::Chunk(unsigned int x, unsigned int y) : m_posX(x), m_posY(y) {
|
||||
std::ostringstream pos; // Vérifie l'existence d'un fichier .chunk avec sa position.
|
||||
pos << CHUNK_PATH << x << '_' << y << ".chunk";
|
||||
std::ifstream input(pos.str(), std::fstream::binary);
|
||||
//std::ostringstream pos; // Vérifie l'existence d'un fichier .chunk avec sa position.
|
||||
//pos << CHUNK_PATH << x << '_' << y << ".chunk";
|
||||
//std::ifstream input(pos.str(), std::fstream::binary);
|
||||
|
||||
if (input.fail()) {
|
||||
//if (input.fail()) {
|
||||
OpenSimplexNoise::Noise simplex = OpenSimplexNoise::Noise(SEED);
|
||||
m_blocks.Reset(BTYPE_AIR);
|
||||
|
||||
@ -61,7 +61,7 @@ Chunk::Chunk(unsigned int x, unsigned int y) : m_posX(x), m_posY(y) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
/* }
|
||||
else {
|
||||
input.seekg(0, std::ios_base::end);
|
||||
int size = input.tellg();
|
||||
@ -75,11 +75,11 @@ Chunk::Chunk(unsigned int x, unsigned int y) : m_posX(x), m_posY(y) {
|
||||
for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz)
|
||||
for (int iy = 0; iy < CHUNK_SIZE_Y; ++iy)
|
||||
m_blocks.Set(ix, iy, iz, data[ix + (iz * CHUNK_SIZE_X) + (iy * CHUNK_SIZE_Z * CHUNK_SIZE_X)]);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
Chunk::~Chunk() {
|
||||
if (m_isModified) {
|
||||
/*if (m_isModified) {
|
||||
char data[CHUNK_SIZE_X * CHUNK_SIZE_Y * CHUNK_SIZE_Z];
|
||||
|
||||
for (int x = 0; x < CHUNK_SIZE_X; ++x)
|
||||
@ -93,7 +93,7 @@ Chunk::~Chunk() {
|
||||
std::ofstream output(pos.str(), std::fstream::binary);
|
||||
output.write(data, sizeof(data));
|
||||
output.close();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void Chunk::RemoveBlock(int x, int y, int z, World* world) {
|
||||
|
@ -36,8 +36,8 @@
|
||||
#endif
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define WORLD_SIZE_X 128
|
||||
#define WORLD_SIZE_Y 128
|
||||
#define WORLD_SIZE_X 8
|
||||
#define WORLD_SIZE_Y 8
|
||||
|
||||
#define FRAMES_RENDER_CHUNKS 1
|
||||
#define FRAMES_UPDATE_CHUNKS 1
|
||||
|
@ -43,7 +43,7 @@ void Engine::Init() {
|
||||
m_skybox.Init(0.2f);
|
||||
|
||||
// Objet de musique!
|
||||
//m_audio.ToggleMusicState();
|
||||
m_audio.ToggleMusicState();
|
||||
|
||||
// Array pour les balles.
|
||||
for (int x = 0; x < MAX_BULLETS; ++x)
|
||||
|
@ -131,7 +131,7 @@ void World::Update(int& rendercount, Bullet* bullets[MAX_BULLETS], Player& playe
|
||||
atlas.Bind();
|
||||
RenderWorld(rendercount, player, world, shader);
|
||||
UpdateWorld(player, blockinfo);
|
||||
TransposeWorld(player, bullets);
|
||||
//TransposeWorld(player, bullets);
|
||||
shader.Disable();
|
||||
glStencilFunc(GL_GREATER, 1, 0xFF);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user