Encore du zigonnage de skybox!
This commit is contained in:
parent
a7d83c4ea6
commit
6823abe94b
@ -70,19 +70,19 @@ void Engine::Render(float elapsedTime)
|
|||||||
m_player.ApplyTransformation(all);
|
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 bouge relativement au joueur).
|
||||||
|
|
||||||
// Skybox
|
// Skybox - Pas de normals pour avoir un éclairage flat.
|
||||||
skybox.Use();
|
skybox.Use();
|
||||||
m_textureSkybox.Bind();
|
m_textureSkybox.Bind();
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
|
||||||
glTexCoord2f(1, 1);
|
|
||||||
glVertex3f(10.f, 10.f, 10.f);
|
|
||||||
glTexCoord2f(0, 1);
|
glTexCoord2f(0, 1);
|
||||||
|
glVertex3f(10.f, 10.f, 10.f);
|
||||||
|
glTexCoord2f(1, 1);
|
||||||
glVertex3f(-10.f, 10.f, 10.f);
|
glVertex3f(-10.f, 10.f, 10.f);
|
||||||
glTexCoord2f(0, 0);
|
|
||||||
glVertex3f(-10.f, -10.f, 10.f);
|
|
||||||
glTexCoord2f(1, 0);
|
glTexCoord2f(1, 0);
|
||||||
|
glVertex3f(-10.f, -10.f, 10.f);
|
||||||
|
glTexCoord2f(0, 0);
|
||||||
glVertex3f(10.f, -10.f, 10.f);
|
glVertex3f(10.f, -10.f, 10.f);
|
||||||
|
|
||||||
glTexCoord2f(1, 0);
|
glTexCoord2f(1, 0);
|
||||||
@ -94,36 +94,28 @@ void Engine::Render(float elapsedTime)
|
|||||||
glTexCoord2f(1, 1);
|
glTexCoord2f(1, 1);
|
||||||
glVertex3f(10.f, 10.f, -10.f);
|
glVertex3f(10.f, 10.f, -10.f);
|
||||||
|
|
||||||
glTexCoord2f(1, 1);
|
|
||||||
glVertex3f(-10.f, 10.f, 10.f);
|
|
||||||
glTexCoord2f(0, 1);
|
glTexCoord2f(0, 1);
|
||||||
|
glVertex3f(-10.f, 10.f, 10.f);
|
||||||
|
glTexCoord2f(1, 1);
|
||||||
glVertex3f(-10.f, 10.f, -10.f);
|
glVertex3f(-10.f, 10.f, -10.f);
|
||||||
glTexCoord2f(0, 0);
|
|
||||||
glVertex3f(-10.f, -10.f, -10.f);
|
|
||||||
glTexCoord2f(1, 0);
|
glTexCoord2f(1, 0);
|
||||||
|
glVertex3f(-10.f, -10.f, -10.f);
|
||||||
|
glTexCoord2f(0, 0);
|
||||||
glVertex3f(-10.f, -10.f, 10.f);
|
glVertex3f(-10.f, -10.f, 10.f);
|
||||||
|
|
||||||
glTexCoord2f(1, 1);
|
|
||||||
glVertex3f(10.f, 10.f, -10.f);
|
|
||||||
glTexCoord2f(0, 1);
|
glTexCoord2f(0, 1);
|
||||||
|
glVertex3f(10.f, 10.f, -10.f);
|
||||||
|
glTexCoord2f(1, 1);
|
||||||
glVertex3f(10.f, 10.f, 10.f);
|
glVertex3f(10.f, 10.f, 10.f);
|
||||||
glTexCoord2f(0, 0);
|
|
||||||
glVertex3f(10.f, -10.f, 10.f);
|
|
||||||
glTexCoord2f(1, 0);
|
glTexCoord2f(1, 0);
|
||||||
|
glVertex3f(10.f, -10.f, 10.f);
|
||||||
|
glTexCoord2f(0, 0);
|
||||||
glVertex3f(10.f, -10.f, -10.f);
|
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();
|
glEnd();
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
all.Use();
|
all.Use();
|
||||||
|
|
||||||
// Plancher
|
// Plancher
|
||||||
// Les vertex doivent etre affiches dans le sens anti-horaire (CCW)
|
// Les vertex doivent etre affiches dans le sens anti-horaire (CCW)
|
||||||
m_textureFloor.Bind();
|
m_textureFloor.Bind();
|
||||||
@ -140,7 +132,6 @@ void Engine::Render(float elapsedTime)
|
|||||||
glVertex3f(-100.f, -2.f, -100.f);
|
glVertex3f(-100.f, -2.f, -100.f);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
|
|
||||||
// Cube
|
// Cube
|
||||||
all.ApplyTranslation(0.f, 0.f, -10.f);
|
all.ApplyTranslation(0.f, 0.f, -10.f);
|
||||||
all.ApplyRotation(gameTime * 100.f, 0.f, 1.f, 0.f);
|
all.ApplyRotation(gameTime * 100.f, 0.f, 1.f, 0.f);
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 137 KiB After Width: | Height: | Size: 212 KiB |
BIN
SQCSim2021/media/textures/sky.png
Normal file
BIN
SQCSim2021/media/textures/sky.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
@ -152,7 +152,7 @@ void OpenglContext::ShowCrossCursor() const
|
|||||||
|
|
||||||
void OpenglContext::InitWindow(int width, int height)
|
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
|
OpenglContext::MOUSE_BUTTON OpenglContext::ConvertMouseButton(sf::Mouse::Button button) const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user