diff --git a/SQCSim2021/define.h b/SQCSim2021/define.h index e5b65ae..106ea2b 100644 --- a/SQCSim2021/define.h +++ b/SQCSim2021/define.h @@ -10,10 +10,9 @@ #include #include #include - #endif -#define VIEW_DISTANCE 32 +#define VIEW_DISTANCE 64 #define CHUNK_SIZE_X 16 #define CHUNK_SIZE_Y 128 #define CHUNK_SIZE_Z 16 @@ -21,7 +20,6 @@ typedef uint8_t BlockType; enum BLOCK_TYPE { BTYPE_AIR, BTYPE_DIRT, BTYPE_GRASS, BTYPE_METAL, BTYPE_ICE, BTYPE_LAST }; - #define TEXTURE_PATH "../SQCSim2021/media/textures/" #define SHADER_PATH "../SQCSim2021/media/shaders/" #define AUDIO_PATH "../SQCSim2021/media/audio/" diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index 8690d19..df1d566 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -203,35 +203,21 @@ void Engine::Render(float elapsedTime) { glDisable(GL_LIGHT0); m_skybox.Render(skybox); - // Plancher - // Les vertex doivent etre affiches dans le sens anti-horaire (CCW) + + + // Chunks all.Use(); glEnable(GL_LIGHT0); m_shader01.Use(); - m_textureFloor.Bind(); - float nbRep = 10.f; - glBegin(GL_QUADS); - glNormal3f(0, 1, 0); // Normal vector - glTexCoord2f(0, 0); - glVertex3f(-100.f, -2.f, 100.f); - glTexCoord2f(nbRep, 0); - glVertex3f(100.f, -2.f, 100.f); - glTexCoord2f(nbRep, nbRep); - glVertex3f(100.f, -2.f, -100.f); - glTexCoord2f(0, nbRep); - glVertex3f(-100.f, -2.f, -100.f); - glEnd(); - - // Chunks m_textureAtlas.Bind(); for (int chx = 0; chx < VIEW_DISTANCE; chx++) for (int chy = 0; chy < VIEW_DISTANCE; chy++) { - all.ApplyTranslation(chx * CHUNK_SIZE_X, 0, chy * CHUNK_SIZE_Z); + all.ApplyTranslation(chx * CHUNK_SIZE_X - (VIEW_DISTANCE * CHUNK_SIZE_X / 2), -(CHUNK_SIZE_Y / 2), chy * CHUNK_SIZE_Z - (VIEW_DISTANCE * CHUNK_SIZE_Z / 2)); all.Use(); if (m_chunks.Get(chx, chy)->IsDirty()) m_chunks.Get(chx, chy)->Update(m_blockinfo); m_chunks.Get(chx, chy)->Render(); - all.ApplyTranslation(-(chx * CHUNK_SIZE_X), 0, -(chy * CHUNK_SIZE_Z)); + all.ApplyTranslation(-(chx * CHUNK_SIZE_X - (VIEW_DISTANCE * CHUNK_SIZE_X / 2)), CHUNK_SIZE_Y / 2, -(chy * CHUNK_SIZE_Z - (VIEW_DISTANCE * CHUNK_SIZE_Z / 2))); } m_shader01.Disable(); diff --git a/SQCSim2021/media/audio/music01.wav b/SQCSim2021/media/audio/music01.wav index 4ce8d2b..93725a7 100644 Binary files a/SQCSim2021/media/audio/music01.wav and b/SQCSim2021/media/audio/music01.wav differ