Les chunks ne sont plus une copie du même chunk!
This commit is contained in:
parent
eee251dabf
commit
65e56c8678
@ -1,6 +1,6 @@
|
||||
#include "chunk.h"
|
||||
|
||||
Chunk::Chunk() { m_blocks.Reset(BTYPE_AIR); }
|
||||
Chunk::Chunk(int x, int y) : m_posX(x), m_posY(y) { m_blocks.Reset(BTYPE_AIR); }
|
||||
|
||||
Chunk::~Chunk() { }
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define CHUNK_H__
|
||||
#include "define.h"
|
||||
#include "array3d.h"
|
||||
#include "array2d.h"
|
||||
#include "vertexbuffer.h"
|
||||
#include "blockinfo.h"
|
||||
|
||||
@ -11,10 +12,13 @@ class Chunk {
|
||||
VertexBuffer m_vertexBuffer;
|
||||
bool m_isDirty = true;
|
||||
|
||||
int m_posX; // Position du chunk dans l'array constituant le monde.
|
||||
int m_posY;
|
||||
|
||||
void AddBlockToMesh(VertexBuffer::VertexData* vd, int& count, BlockType bt, int x, int y, int z, float u, float v, float s);
|
||||
|
||||
public:
|
||||
Chunk();
|
||||
Chunk(int x, int y);
|
||||
~Chunk();
|
||||
|
||||
void RemoveBlock(int x, int y, int z);
|
||||
|
@ -48,16 +48,24 @@ void Engine::Init()
|
||||
m_audio.ToggleMusicState();
|
||||
|
||||
// Init Chunks
|
||||
for (int x = 0; x < CHUNK_SIZE_X; ++x)
|
||||
/*for (int x = 0; x < CHUNK_SIZE_X; ++x)
|
||||
for (int z = 0; z < CHUNK_SIZE_Z; ++z)
|
||||
for (int y = 0; y < 32; ++y)
|
||||
m_testChunk.SetBlock(x, y, z, BTYPE_DIRT);
|
||||
m_testChunk->SetBlock(x, y, z, BTYPE_DIRT);*/
|
||||
|
||||
for (int chx = 0; chx < VIEW_DISTANCE; ++chx)
|
||||
for (int chy = 0; chy < VIEW_DISTANCE; ++chy)
|
||||
m_chunks.Set(chx, chy, &m_testChunk);
|
||||
for (int chy = 0; chy < VIEW_DISTANCE; ++chy) {
|
||||
|
||||
m_chunks.Set(chx, chy, new Chunk(chx, chy));
|
||||
|
||||
//m_chunks.Set(0, 0, &m_testChunk);
|
||||
for (int x = 0; x < CHUNK_SIZE_X; ++x)
|
||||
for (int z = 0; z < CHUNK_SIZE_Z; ++z)
|
||||
for (int y = 0; y < 32; ++y)
|
||||
m_chunks.Get(chx,chy)->SetBlock(x, y, z, BTYPE_DIRT);
|
||||
|
||||
m_chunks.Get(chx,chy)->SetBlock(8, chx+32, 8, BTYPE_DIRT);
|
||||
|
||||
}
|
||||
|
||||
// Gestion de souris.
|
||||
CenterMouse();
|
||||
|
@ -50,7 +50,7 @@ private:
|
||||
|
||||
Skybox m_skybox;
|
||||
Shader m_shader01;
|
||||
Chunk m_testChunk;
|
||||
Chunk* m_testChunk;
|
||||
Audio m_audio = Audio(AUDIO_PATH "music01.wav");
|
||||
|
||||
Player m_player = Player(Vector3f(0, 0, 0));
|
||||
|
Loading…
Reference in New Issue
Block a user