Modification de texture et de Skybox.

This commit is contained in:
Marc-Eric Martel 2021-09-27 14:45:59 -04:00
parent 4c77ebccb0
commit a7d83c4ea6
4 changed files with 26 additions and 26 deletions

View File

@ -25,8 +25,8 @@ void Engine::Init()
// Light
GLfloat light0Pos[4] = { 0.0f, CHUNK_SIZE_Y, 0.0f, 1.0f };
GLfloat light0Amb[4] = { 0.9f, 0.9f, 0.9f, 1.0f };
GLfloat light0Diff[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat light0Amb[4] = { 0.9f, 0.9f, 0.9f, 1.f };
GLfloat light0Diff[4] = { 1.f, 1.f, 1.f, 1.f };
GLfloat light0Spec[4] = { 0.2f, 0.2f, 0.2f, 1.0f };
glEnable(GL_LIGHT0);
@ -68,21 +68,21 @@ 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);
skybox.Use();
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.Use();
m_textureSkybox.Bind();
glDisable(GL_DEPTH_TEST);
glBegin(GL_QUADS);
glTexCoord2f(1, 0);
glVertex3f(10.f, 10.f, 10.f);
glTexCoord2f(0, 0);
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, 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(1, 0);
@ -94,29 +94,29 @@ void Engine::Render(float elapsedTime)
glTexCoord2f(1, 1);
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, 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(0, 0);
glVertex3f(-10.f, -10.f, -10.f);
glTexCoord2f(1, 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, 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(0, 0);
glVertex3f(10.f, -10.f, 10.f);
glTexCoord2f(1, 0);
glVertex3f(10.f, -10.f, -10.f);
glTexCoord2f(0, 0); // Les coordos de textures du plafond sont intentionnellement laissées à 0 pour que l'engine sample 1 pixel et ainsi me fait une couleur unie.
glTexCoord2f(0, 0);
glVertex3f(10.f, 10.f, -10.f);
glTexCoord2f(0, 0);
glTexCoord2f(0, 0.1f);
glVertex3f(10.f, 10.f, 10.f);
glTexCoord2f(0, 0);
glTexCoord2f(0, 0.1f);
glVertex3f(-10.f, 10.f, 10.f);
glTexCoord2f(0, 0);
glVertex3f(-10.f, 10.f, -10.f);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 660 KiB

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

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, 4));
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));
}
OpenglContext::MOUSE_BUTTON OpenglContext::ConvertMouseButton(sf::Mouse::Button button) const