:godmode: ENFIN SANT-CALISSE DE CRISS

This commit is contained in:
MarcEricMartel
2023-11-19 16:46:13 -05:00
parent 82cfc2d1b1
commit 8860593740
9 changed files with 106 additions and 78 deletions

View File

@@ -330,7 +330,7 @@ void Engine::Init() {
glEnable(GL_STENCIL_TEST);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_BLEND);
glEnable(GL_CULL_FACE);
//glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glMatrixMode(GL_PROJECTION);
@@ -351,7 +351,7 @@ void Engine::Init() {
//
// Objet de skybox avec sa propre texture et son propre shader!
m_skybox.Init(0.2f);
//m_skybox2.Init(1.f);
// Objet de musique!
//m_audio.ToggleMusicState();
@@ -415,7 +415,7 @@ void Engine::Init() {
m_startTime = std::chrono::high_resolution_clock::now();
m_remotePlayer.SetPosition(Vector3f(.5,CHUNK_SIZE_Y + 10., .5));
// Gestion de souris.
CenterMouse();
HideCursor();
@@ -425,6 +425,7 @@ void Engine::DeInit() {}
void Engine::LoadResource() {
LoadTexture(m_skybox.GetTexture(), TEXTURE_PATH "skybox.png", true);
//LoadTexture(m_skybox2.GetTexture(), TEXTURE_PATH "skybox.png", true);
LoadTexture(m_textureCrosshair, TEXTURE_PATH "cross.bmp", true);
LoadTexture(m_textureFont, TEXTURE_PATH "font.bmp", true);
LoadTexture(m_textureGun, TEXTURE_PATH "gun01.png", false);
@@ -772,17 +773,17 @@ void Engine::DisplayInfo(float elapsedTime, BlockType bloc) {
fPosY = fPosYJump;
fPosY -= charSize;
ss << " Velocity : " << m_player.GetVelocity();
ss << " Velocity : " << m_remotePlayer.GetVelocity();
PrintText(fPosX, fPosY, ss.str());
ss.str("");
fPosY -= charSize;
ss << " Direction : " << m_player.GetDirection();
ss << " Player Position : " << m_player.GetPosition();
PrintText(fPosX, fPosY, ss.str());
ss.str("");
fPosY -= charSize;
ss << " Position : " << m_player.GetPosition();
ss << " Remote Position : " << m_remotePlayer.GetPosition();//m_player.GetPosition();
PrintText(fPosX, fPosY, ss.str());
ss.str("");
fPosY -= charSize;
@@ -1083,10 +1084,7 @@ void Engine::Render(float elapsedTime) {
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.ApplyTransformation(all);
m_player.ApplyTransformation(remotePlayer, true, false);
if (m_mouseWU) bloc++;
else if (m_mouseWD) bloc--;
@@ -1142,19 +1140,21 @@ void Engine::Render(float elapsedTime) {
}
}
if (m_isSkybox) m_renderer.RenderWorld(&m_world, m_renderCount, m_player.GetPosition(), m_player.GetDirection(), all, m_shader01, m_textureAtlas);
m_remotePlayer.ApplyPhysics(Vector3f(0,0,0), &m_world, elapsedTime);
//m_remotePlayer.ApplyTransformation(remotePlayer, false);
m_world.Update(m_bullets, m_player.GetPosition(), m_blockinfo);
m_renderer.UpdateMesh(&m_world, m_player.GetPosition(), m_blockinfo);
m_remotePlayer.Render(m_textureAtlas, m_shader01, elapsedTime, m_player);
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
m_remotePlayer.Render(m_textureAtlas, m_shader01, all, elapsedTime);
if (m_isSkybox) m_renderer.RenderWorld(&m_world, m_renderCount, m_player.GetPosition(), m_player.GetDirection(), all, m_shader01, m_textureAtlas);
//glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
//m_remotePlayer.Render(m_textureAtlas, m_shader01, all, elapsedTime);
if (m_isSkybox) m_skybox.Render(skybox);
//if (m_isSkybox) m_skybox.Render(skybox);