Remis la lumière, corrigé certaines textures.
@ -30,7 +30,7 @@ void Engine::Init()
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
// Light
|
||||
/*GLfloat light0Pos[4] = { 0.0f, CHUNK_SIZE_Y, 0.0f, 1.0f };
|
||||
GLfloat light0Pos[4] = { 0.0f, CHUNK_SIZE_Y, 0.0f, 1.0f };
|
||||
GLfloat light0Amb[4] = { 0.2f, 0.2f, 0.2f, 1.f };
|
||||
GLfloat light0Diff[4] = { 1.f, 1.f, 1.f, 1.f };
|
||||
GLfloat light0Spec[4] = { 0.2f, 0.2f, 0.2f, 1.0f };
|
||||
@ -39,7 +39,7 @@ void Engine::Init()
|
||||
glLightfv(GL_LIGHT0, GL_POSITION, light0Pos);
|
||||
glLightfv(GL_LIGHT0, GL_AMBIENT, light0Amb);
|
||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, light0Diff);
|
||||
glLightfv(GL_LIGHT0, GL_SPECULAR, light0Spec);*/
|
||||
glLightfv(GL_LIGHT0, GL_SPECULAR, light0Spec);
|
||||
|
||||
// Objet de skybox avec sa propre texture et son propre shader!
|
||||
m_skybox.Init(0.00013f);
|
||||
@ -48,7 +48,7 @@ void Engine::Init()
|
||||
m_audio.ToggleMusicState();
|
||||
|
||||
// Init Chunks
|
||||
for (int chx = 0; chx < VIEW_DISTANCE; ++chx)
|
||||
for (int chx = 0; chx < VIEW_DISTANCE; ++chx) // Un beau gros monde de VIEW_DISTANCE Chunks par VIEW_DISTANCE Chunks.
|
||||
for (int chy = 0; chy < VIEW_DISTANCE; ++chy)
|
||||
m_world.GetChunks().Set(chx, chy, new Chunk(chx, chy));
|
||||
|
||||
@ -230,7 +230,7 @@ void Engine::Render(float elapsedTime) {
|
||||
glLoadIdentity();
|
||||
|
||||
m_player.ApplyPhysics(m_player.GetInput(m_keyW, m_keyS, m_keyA, m_keyD, m_keySpace, m_keylshift, elapsedTime), m_world, elapsedTime);
|
||||
m_audio.Update3DAudio(m_player.GetPosition(), m_player.GetDirection(), m_player.GetVelocity()); // Ajustement du positionnement 3D avec les coordonnées du joueur et
|
||||
m_audio.Update3DAudio(m_player.GetPOV(), m_player.GetDirection(), m_player.GetVelocity()); // Ajustement du positionnement 3D avec les coordonnées du joueur et
|
||||
// son vecteur de vélocité (pour l'effet Doppler)
|
||||
m_player.ApplyTransformation(all);
|
||||
m_player.ApplyTransformation(skybox, false); // Version d'ApplyTransformation qui ne tient compte que de la rotation
|
||||
@ -249,7 +249,8 @@ void Engine::Render(float elapsedTime) {
|
||||
all.Use();
|
||||
if (m_world.GetChunks().Get(chx, chy)->IsDirty())
|
||||
m_world.GetChunks().Get(chx, chy)->Update(m_blockinfo, &m_world);
|
||||
m_world.GetChunks().Get(chx, chy)->Render();
|
||||
|
||||
m_world.GetChunks().Get(chx, chy)->Render();
|
||||
all.ApplyTranslation(-chx * CHUNK_SIZE_X, 0, -chy * CHUNK_SIZE_Z);
|
||||
}
|
||||
|
||||
@ -261,8 +262,7 @@ void Engine::Render(float elapsedTime) {
|
||||
if (m_wireframe)
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
|
||||
|
||||
if (m_player.GetPosition().y < -10.f) m_player = Player(Vector3f(VIEW_DISTANCE * CHUNK_SIZE_X / 2, CHUNK_SIZE_Y / 2, VIEW_DISTANCE * CHUNK_SIZE_Z / 2)); // Respawn si le bonho- joueur tombe en bas du monde.
|
||||
if (m_player.GetPosition().y < -20.f) m_player = Player(Vector3f(VIEW_DISTANCE * CHUNK_SIZE_X / 2, CHUNK_SIZE_Y / 2, VIEW_DISTANCE * CHUNK_SIZE_Z / 2)); // Respawn si le bonho- joueur tombe en bas du monde.
|
||||
}
|
||||
|
||||
void Engine::KeyPressEvent(unsigned char key)
|
||||
|
Before Width: | Height: | Size: 592 KiB After Width: | Height: | Size: 466 KiB |
Before Width: | Height: | Size: 461 KiB After Width: | Height: | Size: 362 KiB |
Before Width: | Height: | Size: 670 KiB After Width: | Height: | Size: 508 KiB |
Before Width: | Height: | Size: 611 KiB After Width: | Height: | Size: 522 KiB |
Before Width: | Height: | Size: 707 KiB After Width: | Height: | Size: 535 KiB |