Éventuellement!

This commit is contained in:
Marc-Eric Martel 2021-10-01 08:00:37 -04:00
parent 2016577fed
commit bce97c3480
3 changed files with 65 additions and 47 deletions

View File

@ -68,49 +68,67 @@ void Engine::Render(float elapsedTime)
m_player.Move(m_keyW, m_keyS, m_keyA, m_keyD, elapsedTime);
m_player.ApplyTransformation(all);
m_player.ApplyTransformation(skybox, false); // Version d'ApplyTransformation qui ne tient compte que de la rotation (donc l'objet bouge relativement au joueur).
m_player.ApplyTransformation(skybox, false); // Version d'ApplyTransformation qui ne tient compte que de la rotation (donc l'objet ne bouge pas relativement au joueur, ce qui est pratique pour une skybox!).
// Skybox - Pas de normals pour avoir un éclairage flat.
// Skybox - Pas de normals pour avoir un éclairage flat?
skybox.Use();
m_textureSkybox.Bind();
glDisable(GL_DEPTH_TEST);
glDisable(GL_DEPTH_TEST); // Pour que tout ce qui est dessiné après soit dessiné par-dessus la skybox.
glBegin(GL_QUADS);
glTexCoord2f(0, 1);
glVertex3f(10.f, 10.f, 10.f);
glVertex3f(5.f, 5.f, 5.f);
glTexCoord2f(1, 1);
glVertex3f(-10.f, 10.f, 10.f);
glVertex3f(-5.f, 5.f, 5.f);
glTexCoord2f(1, 0);
glVertex3f(-10.f, -1.f, 10.f);
glVertex3f(-5.f, -5.f, 5.f);
glTexCoord2f(0, 0);
glVertex3f(10.f, -1.f, 10.f);
glVertex3f(5.f, -5.f, 5.f);
glTexCoord2f(1, 0);
glVertex3f(10.f, -1.f, -10.f);
glVertex3f(5.f, -5.f, -5.f);
glTexCoord2f(0, 0);
glVertex3f(-10.f, -1.f, -10.f);
glVertex3f(-5.f, -5.f, -5.f);
glTexCoord2f(0, 1);
glVertex3f(-10.f, 10.f, -10.f);
glVertex3f(-5.f, 5.f, -5.f);
glTexCoord2f(1, 1);
glVertex3f(10.f, 10.f, -10.f);
glVertex3f(5.f, 5.f, -5.f);
glTexCoord2f(0, 1);
glVertex3f(-10.f, 10.f, 10.f);
glVertex3f(-5.f, 5.f, 5.f);
glTexCoord2f(1, 1);
glVertex3f(-10.f, 10.f, -10.f);
glVertex3f(-5.f, 5.f, -5.f);
glTexCoord2f(1, 0);
glVertex3f(-10.f, -1.f, -10.f);
glVertex3f(-5.f, -5.f, -5.f);
glTexCoord2f(0, 0);
glVertex3f(-10.f, -1.f, 10.f);
glVertex3f(-5.f, -5.f, 5.f);
glTexCoord2f(0, 1);
glVertex3f(10.f, 10.f, -10.f);
glVertex3f(5.f, 5.f, -5.f);
glTexCoord2f(1, 1);
glVertex3f(10.f, 10.f, 10.f);
glVertex3f(5.f, 5.f, 5.f);
glTexCoord2f(1, 0);
glVertex3f(10.f, -1.f, 10.f);
glVertex3f(5.f, -5.f, 5.f);
glTexCoord2f(0, 0);
glVertex3f(10.f, -1.f, -10.f);
glVertex3f(5.f, -5.f, -5.f);
//glTexCoord2f(0, 0); // Pas besoin de cette face pour cette version de la skybox.
//glVertex3f(-5.f, 5.f, -5.f);
//glTexCoord2f(0, 1);
//glVertex3f(-5.f, 5.f, 5.f);
//glTexCoord2f(1, 1);
//glVertex3f(5.f, 5.f, 5.f);
//glTexCoord2f(1, 0);
//glVertex3f(5.f, 5.f, -5.f);
//glTexCoord2f(0, 0); // Pas besoin de cette face pour cette version de la skybox.
//glVertex3f(-5.f, -5.f, -5.f);
//glTexCoord2f(0, 1);
//glVertex3f(-5.f, -5.f, 5.f);
//glTexCoord2f(1, 1);
//glVertex3f(5.f, -5.f, 5.f);
//glTexCoord2f(1, 0);
//glVertex3f(5.f, -5.f, -5.f);
glEnd();
glEnable(GL_DEPTH_TEST);
@ -140,65 +158,65 @@ void Engine::Render(float elapsedTime)
all.Use();
m_textureCube.Bind();
glBegin(GL_QUADS);
glNormal3f(0, 0, -1);
glTexCoord2f(1, 0);
glVertex3f(-0.5f, -0.5f, -0.5f);
glTexCoord2f(0, 0);
glVertex3f(0.5f, -0.5f, -0.5f);
glTexCoord2f(0, 1);
glVertex3f(0.5f, 0.5f, -0.5f);
glTexCoord2f(1, 1);
glVertex3f(-0.5f, 0.5f, -0.5f);
glNormal3f(0, 0, 1);
glTexCoord2f(0, 0);
glVertex3f(-0.5f, -0.5f, 0.5f);
glTexCoord2f(1, 0);
glVertex3f(0.5f, -0.5f, 0.5f);
glTexCoord2f(1, 1);
glVertex3f(0.5f, 0.5f, 0.5f);
glTexCoord2f(0, 1);
glVertex3f(0.5f, 0.5f, 0.5f);
glTexCoord2f(1, 1);
glVertex3f(-0.5f, 0.5f, 0.5f);
glTexCoord2f(1, 0);
glVertex3f(-0.5f, -0.5f, 0.5f);
glTexCoord2f(0, 0);
glVertex3f(0.5f, -0.5f, 0.5f);
glNormal3f(-1, 0, 0);
glNormal3f(0, 0, -1);
glTexCoord2f(1, 0);
glVertex3f(0.5f, -0.5f, -0.5f);
glTexCoord2f(0, 0);
glVertex3f(-0.5f, -0.5f, -0.5f);
glTexCoord2f(0, 1);
glVertex3f(-0.5f, 0.5f, -0.5f);
glTexCoord2f(1, 1);
glVertex3f(0.5f, 0.5f, -0.5f);
glNormal3f(-1, 0, 0);
glTexCoord2f(0, 1);
glVertex3f(-0.5f, 0.5f, 0.5f);
glTexCoord2f(1, 1);
glVertex3f(-0.5f, 0.5f, -0.5f);
glTexCoord2f(1, 0);
glVertex3f(-0.5f, -0.5f, -0.5f);
glTexCoord2f(0, 0);
glVertex3f(-0.5f, -0.5f, 0.5f);
glNormal3f(1, 0, 0);
glTexCoord2f(1, 0);
glVertex3f(0.5f, -0.5f, -0.5f);
glTexCoord2f(1, 1);
glVertex3f(0.5f, 0.5f, -0.5f);
glTexCoord2f(0, 1);
glVertex3f(0.5f, 0.5f, -0.5f);
glTexCoord2f(1, 1);
glVertex3f(0.5f, 0.5f, 0.5f);
glTexCoord2f(0, 0);
glTexCoord2f(1, 0);
glVertex3f(0.5f, -0.5f, 0.5f);
glTexCoord2f(0, 0);
glVertex3f(0.5f, -0.5f, -0.5f);
glNormal3f(0, 1, 0);
glTexCoord2f(0, 0);
glTexCoord2f(0, 0);
glVertex3f(-0.5f, 0.5f, -0.5f);
glTexCoord2f(1, 0);
glTexCoord2f(0, 1);
glVertex3f(-0.5f, 0.5f, 0.5f);
glTexCoord2f(1, 1);
glVertex3f(0.5f, 0.5f, 0.5f);
glTexCoord2f(0, 1);
glTexCoord2f(1, 0);
glVertex3f(0.5f, 0.5f, -0.5f);
glNormal3f(0, -1, 0);
glTexCoord2f(0, 0);
glTexCoord2f(0, 0);
glVertex3f(-0.5f, -0.5f, -0.5f);
glTexCoord2f(1, 0);
glTexCoord2f(0, 1);
glVertex3f(-0.5f, -0.5f, 0.5f);
glTexCoord2f(1, 1);
glVertex3f(0.5f, -0.5f, 0.5f);
glTexCoord2f(0, 1);
glTexCoord2f(1, 0);
glVertex3f(0.5f, -0.5f, -0.5f);
glEnd();

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB