This commit is contained in:
Claudel-D-Roy 2023-12-04 16:45:46 -05:00
parent df0a142b12
commit e6e93ef6d0
2 changed files with 18 additions and 17 deletions

View File

@ -204,11 +204,11 @@ Player::Sound Player::ApplyPhysics(Vector3f input, World* world, float elapsedTi
void Player::ApplyTransformation(Transformation& transformation, bool rel, bool rot) const { void Player::ApplyTransformation(Transformation& transformation, bool rel, bool rot) const {
transformation.ApplyRotation(-m_rotX, 1, 0, 0); transformation.ApplyRotation(-m_rotX, 1, 0, 0);
transformation.ApplyRotation(-m_rotY, 0, 1, 0); transformation.ApplyRotation(-m_rotY, 0, 1, 0);
if (rel) transformation.ApplyTranslation(-GetPOV()); if (rel) transformation.ApplyTranslation(-GetPOV());
if (!rot) {
transformation.ApplyRotation(-m_rotX, 1, 0, 0);
transformation.ApplyRotation(-m_rotY, 0, 1, 0);
}
} }
void Player::GetBooster(Booster boosttype) void Player::GetBooster(Booster boosttype)

View File

@ -10,13 +10,13 @@
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)){ 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);
} }
RemotePlayer::RemotePlayer(netprot::PlayerInfo pinfo, const Vector3f& pos) : m_pinfo(pinfo), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), previous(), m_texture_front(), Player(pos) { RemotePlayer::RemotePlayer(netprot::PlayerInfo pinfo, const Vector3f& pos) : m_pinfo(pinfo), m_aminacc(0.0f), m_animstate(Anim::STILL), m_team_id(0), current(), previous(), m_texture_front(), Player(pos) {
LoadTexture(m_texture_front, TEXTURE_PATH "AssetOtherPlayer/FinalPNGStanding/BlueFrontRight.png", false, false);
} }
@ -92,20 +92,21 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr
Matrix4 mat4 = tran.GetMatrix(); Matrix4 mat4 = tran.GetMatrix();
Vector3f CameraRight = Vector3f(mat4.Get11(), mat4.Get21(), mat4.Get31()); Vector3f DiffCam = GetPosition() - camera.GetPosition();
Vector3f CameraUp = Vector3f(mat4.Get12(), mat4.Get22(), mat4.Get32()); Vector3f UpCam = Vector3f(mat4.Get12(), mat4.Get22(), mat4.Get32());
Vector3f CrossA = DiffCam.Cross(UpCam);
Vector3f CrossB = DiffCam.Cross(CrossA);
CrossA.Normalize();
CrossB.Normalize();
Vector3f playerPosition = GetPosition() + Vector3f(0.f, 0.f, 0.f); Vector3f playerPosition = GetPosition() + Vector3f(0.f, 0.f, 0.f);
//Vector3f postionCamera = camera.GetPosition();
Vector3f v3 = (playerPosition + CameraRight * -0.5 * width + CameraUp * -0.5 * height);
Vector3f v1 = (playerPosition + CameraRight * 0.5 * width + CameraUp * -0.5 * height);
Vector3f v2 = (playerPosition + CameraRight * 0.5 * width + CameraUp * 0.5 * height);
Vector3f v4 = (playerPosition + CameraRight * -0.5 * width + CameraUp * 0.5 * height);
Vector3f v1 = (playerPosition + CrossA * 0.5 * width + CrossB * 0.5 * height);
Vector3f v2 = (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);
float u, v, w, h; float u, v, w, h;