push triste du quad qui marche pas
This commit is contained in:
parent
dfd2ddc8af
commit
9426af39e7
@ -401,6 +401,10 @@ void Engine::LoadResource() {
|
|||||||
LoadTexture(MenuOptionsTexture, MENU_ITEM_PATH "test.png");
|
LoadTexture(MenuOptionsTexture, MENU_ITEM_PATH "test.png");
|
||||||
LoadTexture(MenuStartTexture, MENU_ITEM_PATH "BasicPlay.png");
|
LoadTexture(MenuStartTexture, MENU_ITEM_PATH "BasicPlay.png");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TextureAtlas::TextureIndex texDirtIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal3.png");
|
TextureAtlas::TextureIndex texDirtIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal3.png");
|
||||||
TextureAtlas::TextureIndex texIceIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal2.png");
|
TextureAtlas::TextureIndex texIceIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal2.png");
|
||||||
TextureAtlas::TextureIndex texGrassIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "grass.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::GetFps(float elapsedTime) const { return 1 / elapsedTime; }
|
||||||
|
|
||||||
int Engine::GetCountdown(float elapsedTime) {
|
int Engine::GetCountdown(float elapsedTime) {
|
||||||
@ -996,6 +1001,7 @@ void Engine::Render(float elapsedTime) {
|
|||||||
|
|
||||||
Transformation all;
|
Transformation all;
|
||||||
Transformation skybox;
|
Transformation skybox;
|
||||||
|
Transformation remotePlayer;
|
||||||
Vector3f vstep;
|
Vector3f vstep;
|
||||||
|
|
||||||
// Transformations initiales
|
// Transformations initiales
|
||||||
@ -1026,15 +1032,16 @@ void Engine::Render(float elapsedTime) {
|
|||||||
pollTime = 0;
|
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
|
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!).
|
// (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++;
|
if (m_mouseWU) bloc++;
|
||||||
else if (m_mouseWD) 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_world.Update(m_bullets, m_player.GetPosition(), m_blockinfo);
|
||||||
m_renderer.UpdateMesh(&m_world, m_player.GetPosition(), m_blockinfo);
|
m_renderer.UpdateMesh(&m_world, m_player.GetPosition(), m_blockinfo);
|
||||||
|
|
||||||
if (m_isSkybox) m_skybox.Render(skybox);
|
if (m_isSkybox) m_skybox.Render(skybox);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DrawHud(elapsedTime, bloc);
|
DrawHud(elapsedTime, bloc);
|
||||||
DisplayPovGun();
|
DisplayPovGun();
|
||||||
ProcessNotificationQueue();
|
ProcessNotificationQueue();
|
||||||
@ -1134,6 +1143,8 @@ void Engine::Render(float elapsedTime) {
|
|||||||
// TODO: Faire la gestion de la réception de paquets.
|
// TODO: Faire la gestion de la réception de paquets.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (m_gamestate == GameState::MAIN_MENU || m_gamestate == GameState::OPTIONS)
|
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)
|
else if (m_gamestate == GameState::QUIT)
|
||||||
Stop();
|
Stop();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::KeyPressEvent(unsigned char key) {
|
void Engine::KeyPressEvent(unsigned char key) {
|
||||||
@ -1406,3 +1420,7 @@ bool Engine::LoadTexture(Texture& texture, const std::string& filename, bool use
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
void Engine::RenderRemotePlayers(RemotePlayer& remoteplayer, float elapsedTime)
|
||||||
|
{
|
||||||
|
remoteplayer.Render(m_textureAtlas, m_shader01, elapsedTime);
|
||||||
|
}
|
||||||
|
@ -61,6 +61,9 @@ private:
|
|||||||
void DrawHud(float elapsedTime, BlockType bloc);
|
void DrawHud(float elapsedTime, BlockType bloc);
|
||||||
void PrintText(float x, float y, const std::string& t, float charSizeMultiplier = 1.0f);
|
void PrintText(float x, float y, const std::string& t, float charSizeMultiplier = 1.0f);
|
||||||
|
|
||||||
|
void RenderRemotePlayers(RemotePlayer& remoteplayer, float elapsedTime);
|
||||||
|
|
||||||
|
|
||||||
Connector m_conn;
|
Connector m_conn;
|
||||||
Shader m_shader01;
|
Shader m_shader01;
|
||||||
BlockInfo* m_blockinfo[BTYPE_LAST];
|
BlockInfo* m_blockinfo[BTYPE_LAST];
|
||||||
@ -104,6 +107,7 @@ private:
|
|||||||
Texture MenuOptionsTexture;
|
Texture MenuOptionsTexture;
|
||||||
Texture SplachScreenTexture;
|
Texture SplachScreenTexture;
|
||||||
|
|
||||||
|
|
||||||
float m_scale;
|
float m_scale;
|
||||||
float m_time = 0;
|
float m_time = 0;
|
||||||
float m_time_SplashScreen = 0;
|
float m_time_SplashScreen = 0;
|
||||||
|
@ -13,17 +13,13 @@ RemotePlayer::RemotePlayer(netprot::PlayerInfo pinfo) : m_pinfo(pinfo), m_aminac
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//RemotePlayer::RemotePlayer()
|
|
||||||
//{
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
|
|
||||||
RemotePlayer::~RemotePlayer()
|
RemotePlayer::~RemotePlayer()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemotePlayer::Init() {
|
void RemotePlayer::Init()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,8 +30,6 @@ void RemotePlayer::Feed(const netprot::Output out) {
|
|||||||
current.states = out.states;
|
current.states = out.states;
|
||||||
current.id = out.id;
|
current.id = out.id;
|
||||||
|
|
||||||
//a revoir pour le jump et le shoot en meme temps lorsque les test seront possible
|
|
||||||
|
|
||||||
if (current.position != previous.position)
|
if (current.position != previous.position)
|
||||||
{
|
{
|
||||||
Vector3f positionDelta = current.position - previous.position;
|
Vector3f positionDelta = current.position - previous.position;
|
||||||
@ -51,49 +45,125 @@ void RemotePlayer::Feed(const netprot::Output out) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (current.states.shooting) {
|
if (current.states.shooting) {
|
||||||
//true;
|
|
||||||
m_animstate = Anim::SHOOTING;
|
m_animstate = Anim::SHOOTING;
|
||||||
}
|
}
|
||||||
else if (current.states.jumping) {
|
else if (current.states.jumping) {
|
||||||
//true;
|
|
||||||
m_animstate = Anim::JUMPING;
|
m_animstate = Anim::JUMPING;
|
||||||
}
|
}
|
||||||
else if (current.states.dead) {
|
else if (current.states.dead) {
|
||||||
//true;
|
|
||||||
m_animstate = Anim::DEAD;
|
m_animstate = Anim::DEAD;
|
||||||
}
|
}
|
||||||
else if(current.states.powerup){
|
else if(current.states.powerup){
|
||||||
//true;
|
|
||||||
m_animstate = Anim::POWERUP;
|
m_animstate = Anim::POWERUP;
|
||||||
}
|
}
|
||||||
else if (current.states.still) {
|
else if (current.states.still) {
|
||||||
//true;
|
|
||||||
m_animstate = Anim::STILL;
|
m_animstate = Anim::STILL;
|
||||||
}
|
}
|
||||||
else if (current.states.running) {
|
else if (current.states.running) {
|
||||||
//true;
|
|
||||||
m_animstate = Anim::RUNNING;
|
m_animstate = Anim::RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
previous.direction = current.direction;
|
previous.direction = current.direction;
|
||||||
previous.position = current.position;
|
previous.position = current.position;
|
||||||
previous.states = current.states;
|
previous.states = current.states;
|
||||||
previous.id = current.id;
|
previous.id = current.id;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, float elapsedTime)
|
void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, float elapsedTime)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_texture_front.Bind();
|
m_texture_front.Bind();
|
||||||
|
shader.Use();
|
||||||
|
|
||||||
|
//float x = current.position.x;
|
||||||
|
//float y = current.position.y;
|
||||||
|
//float z = current.position.z;
|
||||||
|
|
||||||
|
float x = 128.0f;
|
||||||
|
float y = 21.0f;
|
||||||
|
float z = 128.0f;
|
||||||
|
|
||||||
|
float quadSize = 300.0f;
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(0, 0); glVertex2f(0, 500);
|
glNormal3f(0, 0, 1);
|
||||||
glTexCoord2f(1, 0); glVertex2f(500, 500);
|
|
||||||
glTexCoord2f(1, 1); glVertex2f(500, 0);
|
// Face avant
|
||||||
glTexCoord2f(0, 1); glVertex2f(0, 0);
|
glTexCoord2f(0, 0);
|
||||||
|
glVertex3f(x - quadSize / 2, y - quadSize / 2, z + quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(1, 0);
|
||||||
|
glVertex3f(x + quadSize / 2, y - quadSize / 2, z + quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(1, 1);
|
||||||
|
glVertex3f(x + quadSize / 2, y + quadSize / 2, z + quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(0, 1);
|
||||||
|
glVertex3f(x - quadSize / 2, y + quadSize / 2, z + quadSize / 2);
|
||||||
|
|
||||||
|
// Face arričre
|
||||||
|
glTexCoord2f(0, 0);
|
||||||
|
glVertex3f(x + quadSize / 2, y - quadSize / 2, z - quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(1, 0);
|
||||||
|
glVertex3f(x - quadSize / 2, y - quadSize / 2, z - quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(1, 1);
|
||||||
|
glVertex3f(x - quadSize / 2, y + quadSize / 2, z - quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(0, 1);
|
||||||
|
glVertex3f(x + quadSize / 2, y + quadSize / 2, z - quadSize / 2);
|
||||||
|
|
||||||
|
// Face droite
|
||||||
|
glTexCoord2f(0, 0);
|
||||||
|
glVertex3f(x + quadSize / 2, y - quadSize / 2, z + quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(1, 0);
|
||||||
|
glVertex3f(x + quadSize / 2, y - quadSize / 2, z - quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(1, 1);
|
||||||
|
glVertex3f(x + quadSize / 2, y + quadSize / 2, z - quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(0, 1);
|
||||||
|
glVertex3f(x + quadSize / 2, y + quadSize / 2, z + quadSize / 2);
|
||||||
|
|
||||||
|
// Face gauche
|
||||||
|
glTexCoord2f(0, 0);
|
||||||
|
glVertex3f(x - quadSize / 2, y - quadSize / 2, z - quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(1, 0);
|
||||||
|
glVertex3f(x - quadSize / 2, y - quadSize / 2, z + quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(1, 1);
|
||||||
|
glVertex3f(x - quadSize / 2, y + quadSize / 2, z + quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(0, 1);
|
||||||
|
glVertex3f(x - quadSize / 2, y + quadSize / 2, z - quadSize / 2);
|
||||||
|
|
||||||
|
// Face supérieure
|
||||||
|
glTexCoord2f(0, 0);
|
||||||
|
glVertex3f(x - quadSize / 2, y + quadSize / 2, z + quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(1, 0);
|
||||||
|
glVertex3f(x + quadSize / 2, y + quadSize / 2, z + quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(1, 1);
|
||||||
|
glVertex3f(x + quadSize / 2, y + quadSize / 2, z - quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(0, 1);
|
||||||
|
glVertex3f(x - quadSize / 2, y + quadSize / 2, z - quadSize / 2);
|
||||||
|
|
||||||
|
// Face inférieure
|
||||||
|
glTexCoord2f(0, 0);
|
||||||
|
glVertex3f(x - quadSize / 2, y - quadSize / 2, z - quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(1, 0);
|
||||||
|
glVertex3f(x + quadSize / 2, y - quadSize / 2, z - quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(1, 1);
|
||||||
|
glVertex3f(x + quadSize / 2, y - quadSize / 2, z + quadSize / 2);
|
||||||
|
|
||||||
|
glTexCoord2f(0, 1);
|
||||||
|
glVertex3f(x - quadSize / 2, y - quadSize / 2, z + quadSize / 2);
|
||||||
|
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,7 @@ class RemotePlayer : public Player {
|
|||||||
public:
|
public:
|
||||||
enum Anim: uint8_t { STILL = 1, RUNNING = 2, JUMPING = 4, SHOOTING = 8, POWERUP = 16, DEAD = 32 };
|
enum Anim: uint8_t { STILL = 1, RUNNING = 2, JUMPING = 4, SHOOTING = 8, POWERUP = 16, DEAD = 32 };
|
||||||
|
|
||||||
/*RemotePlayer();*/
|
|
||||||
|
|
||||||
RemotePlayer(netprot::PlayerInfo pinfo);
|
RemotePlayer(netprot::PlayerInfo pinfo);
|
||||||
|
|
||||||
~RemotePlayer();
|
~RemotePlayer();
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user