pleurer en rotation

This commit is contained in:
Claudel-D-Roy
2023-11-18 14:16:24 -05:00
parent dc0d2d8148
commit 82cfc2d1b1
5 changed files with 47 additions and 16 deletions

View File

@@ -1,13 +1,14 @@
#include "remoteplayer.h"
#include <iostream>
#include <cstring>
#include "texture.h"
#include <thread>
#include <queue>
RemotePlayer::RemotePlayer(netprot::PlayerInfo pinfo) : m_pinfo(pinfo), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), previous(), m_texture_front(), Player(Vector3f(0, 0, 0), 0, 0) {
RemotePlayer::RemotePlayer(netprot::PlayerInfo pinfo) : m_pinfo(pinfo), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), previous(), m_texture_front(), Player(Vector3f(0, 0, 0)){
LoadTexture(m_texture_front, TEXTURE_PATH "AssetOtherPlayer/FinalPNGStanding/BlueFrontRight.png", false, false);
@@ -18,7 +19,7 @@ RemotePlayer::~RemotePlayer()
}
void RemotePlayer::Init()
void RemotePlayer::Init()
{
}
@@ -69,22 +70,36 @@ void RemotePlayer::Feed(const netprot::Output out) {
previous.id = current.id;
}
void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, float elapsedTime)
void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, float elapsedTime, Player m_player)
{
shader.Use();
//m_texture_front.Bind();
//
//Vector3f playerToQuad = m_player.GetPosition() - m_position;
//playerToQuad.Normalize();
//Vector3f targetPosition = m_player.GetPosition() + playerToQuad * 10.0f;
//Matrix4f rotationMatrix;
//rotationMatrix.SetLookAt(m_position, targetPosition, Vector3f(0, 1, 0));
//glMultMatrixf(rotationMatrix.GetInternalValues());
//Pt override les collisions.. a ce point la je sais pas quoi faire
shader.Use();
float x = 0;
float y = m_player.GetPosition().y;
float z = 0;
float size = 5.0f;
float u, v, w, h;
atlas.Bind();
atlas.TextureIndexToCoord(0, u, v, w, h);
glBegin(GL_QUADS);
glTexCoord2f(u, v); glVertex3f(0, 50., 0);
glTexCoord2f(u+w, v); glVertex3f(50., 50., 0);
glTexCoord2f(u+w, v+h); glVertex3f(50., 0, 0);
glTexCoord2f(u, v+h); glVertex3f(0, 0, 0);
atlas.TextureIndexToCoord(0, u, v, w, h);
glTexCoord2f(u, v); glVertex3f(x, y + size, z);
glTexCoord2f(u + w, v); glVertex3f(x + size, y + size, z);
glTexCoord2f(u + w, v + h); glVertex3f(x + size, y, z);
glTexCoord2f(u, v + h); glVertex3f(x, y, z);
glEnd();
shader.Disable();
}
bool RemotePlayer::LoadTexture(Texture& texture, const std::string& filename, bool useMipmaps, bool stopOnError)