push triste du quad qui marche pas

This commit is contained in:
Claudel-D-Roy
2023-11-14 22:17:00 -05:00
parent dfd2ddc8af
commit 9426af39e7
4 changed files with 123 additions and 34 deletions

View File

@@ -401,6 +401,10 @@ void Engine::LoadResource() {
LoadTexture(MenuOptionsTexture, MENU_ITEM_PATH "test.png");
LoadTexture(MenuStartTexture, MENU_ITEM_PATH "BasicPlay.png");
TextureAtlas::TextureIndex texDirtIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal3.png");
TextureAtlas::TextureIndex texIceIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal2.png");
TextureAtlas::TextureIndex texGrassIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "grass.png");
@@ -956,6 +960,7 @@ void Engine::PrintText(float x, float y, const std::string& t, float charSizeMul
}
}
int Engine::GetFps(float elapsedTime) const { return 1 / elapsedTime; }
int Engine::GetCountdown(float elapsedTime) {
@@ -996,6 +1001,7 @@ void Engine::Render(float elapsedTime) {
Transformation all;
Transformation skybox;
Transformation remotePlayer;
Vector3f vstep;
// Transformations initiales
@@ -1026,15 +1032,16 @@ void Engine::Render(float elapsedTime) {
pollTime = 0;
}
m_player.ApplyTransformation(all);
RenderRemotePlayers(m_remotePlayer, pollTime);
m_player.ApplyTransformation(all);
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!).
m_remotePlayer.Render(m_textureAtlas, m_shader01, elapsedTime);
//m_remotePlayer.ApplyTransformation(all);
if (m_mouseWU) bloc++;
else if (m_mouseWD) bloc--;
@@ -1090,12 +1097,14 @@ void Engine::Render(float elapsedTime) {
}
}
//m_renderer.RenderWorld(&m_world, m_renderCount, m_player.GetPosition(), m_player.GetDirection(), all, m_shader01, m_textureAtlas);
m_renderer.RenderWorld(&m_world, m_renderCount, m_player.GetPosition(), m_player.GetDirection(), all, m_shader01, m_textureAtlas);
m_world.Update(m_bullets, m_player.GetPosition(), m_blockinfo);
m_renderer.UpdateMesh(&m_world, m_player.GetPosition(), m_blockinfo);
if (m_isSkybox) m_skybox.Render(skybox);
DrawHud(elapsedTime, bloc);
DisplayPovGun();
ProcessNotificationQueue();
@@ -1134,6 +1143,8 @@ void Engine::Render(float elapsedTime) {
// TODO: Faire la gestion de la réception de paquets.
}
}
else if (m_gamestate == GameState::MAIN_MENU || m_gamestate == GameState::OPTIONS)
{
@@ -1146,6 +1157,9 @@ void Engine::Render(float elapsedTime) {
}
else if (m_gamestate == GameState::QUIT)
Stop();
}
void Engine::KeyPressEvent(unsigned char key) {
@@ -1406,3 +1420,7 @@ bool Engine::LoadTexture(Texture& texture, const std::string& filename, bool use
return true;
}
void Engine::RenderRemotePlayers(RemotePlayer& remoteplayer, float elapsedTime)
{
remoteplayer.Render(m_textureAtlas, m_shader01, elapsedTime);
}