Encore du zigonnage de skybox!

This commit is contained in:
Marc-Eric Martel 2021-09-28 15:33:49 -04:00
parent a7d83c4ea6
commit 6823abe94b
4 changed files with 15 additions and 24 deletions

View File

@ -70,19 +70,19 @@ void Engine::Render(float 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).
// Skybox
// Skybox - Pas de normals pour avoir un éclairage flat.
skybox.Use();
m_textureSkybox.Bind();
glDisable(GL_DEPTH_TEST);
glBegin(GL_QUADS);
glTexCoord2f(1, 1);
glVertex3f(10.f, 10.f, 10.f);
glTexCoord2f(0, 1);
glVertex3f(10.f, 10.f, 10.f);
glTexCoord2f(1, 1);
glVertex3f(-10.f, 10.f, 10.f);
glTexCoord2f(0, 0);
glVertex3f(-10.f, -10.f, 10.f);
glTexCoord2f(1, 0);
glVertex3f(-10.f, -10.f, 10.f);
glTexCoord2f(0, 0);
glVertex3f(10.f, -10.f, 10.f);
glTexCoord2f(1, 0);
@ -94,36 +94,28 @@ void Engine::Render(float elapsedTime)
glTexCoord2f(1, 1);
glVertex3f(10.f, 10.f, -10.f);
glTexCoord2f(1, 1);
glVertex3f(-10.f, 10.f, 10.f);
glTexCoord2f(0, 1);
glVertex3f(-10.f, 10.f, 10.f);
glTexCoord2f(1, 1);
glVertex3f(-10.f, 10.f, -10.f);
glTexCoord2f(0, 0);
glVertex3f(-10.f, -10.f, -10.f);
glTexCoord2f(1, 0);
glVertex3f(-10.f, -10.f, -10.f);
glTexCoord2f(0, 0);
glVertex3f(-10.f, -10.f, 10.f);
glTexCoord2f(1, 1);
glVertex3f(10.f, 10.f, -10.f);
glTexCoord2f(0, 1);
glVertex3f(10.f, 10.f, -10.f);
glTexCoord2f(1, 1);
glVertex3f(10.f, 10.f, 10.f);
glTexCoord2f(0, 0);
glVertex3f(10.f, -10.f, 10.f);
glTexCoord2f(1, 0);
glVertex3f(10.f, -10.f, 10.f);
glTexCoord2f(0, 0);
glVertex3f(10.f, -10.f, -10.f);
glTexCoord2f(0, 0);
glVertex3f(10.f, 10.f, -10.f);
glTexCoord2f(0, 0.1f);
glVertex3f(10.f, 10.f, 10.f);
glTexCoord2f(0, 0.1f);
glVertex3f(-10.f, 10.f, 10.f);
glTexCoord2f(0, 0);
glVertex3f(-10.f, 10.f, -10.f);
glEnd();
glEnable(GL_DEPTH_TEST);
all.Use();
// Plancher
// Les vertex doivent etre affiches dans le sens anti-horaire (CCW)
m_textureFloor.Bind();
@ -139,7 +131,6 @@ void Engine::Render(float elapsedTime)
glTexCoord2f(0, nbRep);
glVertex3f(-100.f, -2.f, -100.f);
glEnd();
// Cube
all.ApplyTranslation(0.f, 0.f, -10.f);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@ -152,7 +152,7 @@ void OpenglContext::ShowCrossCursor() const
void OpenglContext::InitWindow(int width, int height)
{
m_app.create(sf::VideoMode(width, height, 32), m_title.c_str(), m_fullscreen ? sf::Style::Fullscreen : (sf::Style::Resize|sf::Style::Close), sf::ContextSettings(32, 8, 0));
m_app.create(sf::VideoMode(width, height, 32), m_title.c_str(), m_fullscreen ? sf::Style::Fullscreen : (sf::Style::Resize|sf::Style::Close), sf::ContextSettings(32, 8, 4));
}
OpenglContext::MOUSE_BUTTON OpenglContext::ConvertMouseButton(sf::Mouse::Button button) const