SQC-15_online #1
@ -462,14 +462,14 @@ void Engine::LoadResource() {
|
||||
//AJOUTER LES TEXTURES DANS L'ORDRE DE L'ÉNUM
|
||||
|
||||
//STILL//STANDING
|
||||
TextureAtlas::TextureIndex StillFront = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueFrontRight.png");
|
||||
//TextureAtlas::TextureIndex StillQuarterFrontLeft = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueLeft.png");
|
||||
//TextureAtlas::TextureIndex StillQuarterFrontRight = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueRight.png");
|
||||
//TextureAtlas::TextureIndex StillProfiltLeft = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueProfilLeft.png");
|
||||
//TextureAtlas::TextureIndex StillProfiltRight = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueProfilRight.png");
|
||||
//TextureAtlas::TextureIndex StillQuarterBackLeft = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueLeftBack.png");
|
||||
//TextureAtlas::TextureIndex StillQuarterBackRight = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueRightBack.png");
|
||||
//TextureAtlas::TextureIndex StillBack = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueBackRight.png");
|
||||
TextureAtlas::TextureIndex StillFront = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueFrontRight.png"); //0
|
||||
TextureAtlas::TextureIndex StillQuarterFrontLeft = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueLeft.png"); //1
|
||||
TextureAtlas::TextureIndex StillQuarterFrontRight = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueRight.png"); //2
|
||||
TextureAtlas::TextureIndex StillProfiltLeft = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueProfilLeft.png"); //3
|
||||
TextureAtlas::TextureIndex StillProfiltRight = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueProfilRight.png"); //4
|
||||
TextureAtlas::TextureIndex StillQuarterBackLeft = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueLeftBack.png"); //5
|
||||
TextureAtlas::TextureIndex StillQuarterBackRight = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueRightBack.png"); //6
|
||||
TextureAtlas::TextureIndex StillBack = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueBackRight.png"); //7
|
||||
|
||||
//SHOOTINGSTILL SANS TIRER
|
||||
//TextureAtlas::TextureIndex StillFrontShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueFrontRightShootingRight.png");
|
||||
|
@ -89,30 +89,55 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr
|
||||
|
||||
float width = 1.f;
|
||||
float height = 1.7f;
|
||||
|
||||
Matrix4 mat4 = tran.GetMatrix();
|
||||
|
||||
|
||||
Vector3f DiffCam = GetPosition() - camera.GetPosition();
|
||||
Vector3f UpCam = Vector3f(0.f, 1.f, 0.f);
|
||||
|
||||
Vector3f CrossA = DiffCam.Cross(UpCam);
|
||||
Vector3f CrossB = DiffCam.Cross(CrossA);
|
||||
CrossA.Normalize();
|
||||
CrossB.Normalize();
|
||||
|
||||
Vector3f playerPosition = GetPosition() + Vector3f(0.f, -.75f, 0.f);
|
||||
|
||||
|
||||
Vector3f v2 = (playerPosition + CrossA * 0.5 * width + CrossB * 0.5 * height);
|
||||
Vector3f v1 = (playerPosition - CrossA * 0.5 * width + CrossB * 0.5 * height);
|
||||
Vector3f v3 = (playerPosition + CrossA * 0.5 * width - CrossB * 0.5 * height);
|
||||
Vector3f v4 = (playerPosition - CrossA * 0.5 * width - CrossB * 0.5 * height);
|
||||
|
||||
Vector3f angleRemote = GetDirection();
|
||||
Vector3f angleCam = Vector3f(v2.z, 0, -v2.x);
|
||||
angleCam.y = 0;
|
||||
angleRemote.y = 0;
|
||||
angleCam.Normalize();
|
||||
angleRemote.Normalize();
|
||||
|
||||
float angle = angleRemote.Dot(angleCam);
|
||||
angle *= 100;
|
||||
int index = 0;
|
||||
|
||||
if (angle >= -0.125 && angle <= 0.125)
|
||||
index = 0;
|
||||
else if (angle >= 0.125 && angle <= 0.375)
|
||||
index = 1;
|
||||
else if (angle >= 0.375 && angle <= 0.625)
|
||||
index = 3;
|
||||
else if (angle >= 0.625 && angle <= 0.875)
|
||||
index = 5;
|
||||
else if (angle >= 0.875 && angle <= -0.875)
|
||||
index = 7;
|
||||
else if (angle >= -0.875 && angle <= -0.625)
|
||||
index = 6;
|
||||
else if (angle >= -0.625 && angle <= -0.375)
|
||||
index = 4;
|
||||
else if (angle >= -0.375 && angle <= -0.125)
|
||||
index = 2;
|
||||
|
||||
|
||||
std::cout << "angle: " << angle << std::endl;
|
||||
|
||||
float u, v, w, h;
|
||||
|
||||
shader.Use();
|
||||
atlas.Bind();
|
||||
atlas.TextureIndexToCoord(0, u, v, w, h);
|
||||
atlas.TextureIndexToCoord(index, u, v, w, h);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
Loading…
Reference in New Issue
Block a user