SQCSimulator2023/SQCSim2021/booster.cpp
MarcEricMartel 464ba131c4 Corrections merge de master
hell.
2023-12-05 13:44:54 -05:00

47 lines
2.0 KiB
C++

#include "booster.h"
void Booster::RenderBillboard(const Vector3f pos, TextureAtlas& textureAtlas, Shader& shader, Transformation tran)
{
//
//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());
float x = pos.x;
float y = pos.y;
float z = pos.z;
float width = 1.0f;
float height = 1.0f;
//Pt override les collisions.. a ce point la je sais pas quoi faire
//Matrix4 mat4 = tran.GetMatrix();
//mat4 VP = pMatrix * vMatrix;
//Vector3f CameraRight = Vector3f(mat4.Get11(), mat4.Get21(), mat4.Get31());
//Vector3f CameraUp = Vector3f(mat4.Get12(), mat4.Get22(), mat4.Get32());
//Vector3f v1 = (m_position + CameraRight * 0.5 * width + CameraUp * -0.5 * width);
//Vector3f v2 = (m_position + CameraRight * 0.5 * width + CameraUp * 0.5 * width);
//Vector3f v4 = (m_position + CameraRight * -0.5 * width + CameraUp * -0.5 * width);
//Vector3f v3 = (m_position + CameraRight * -0.5 * width + CameraUp * 0.5 * width);
//tran.ApplyTranslation(m_position);
float u, v, w, h;
//glDisable(GL_DEPTH_TEST);
shader.Use();
textureAtlas.Bind();
textureAtlas.TextureIndexToCoord(8, u, v, w, h);
//glLoadIdentity();
glLoadMatrixf(tran.GetMatrix().GetInternalValues());
glBegin(GL_QUADS);
glTexCoord2f(u, v); glVertex3f(x - width / 2., y - height, z); //glVertex3f(v4.x, v4.y, v4.z);//glVertex3f(0, 50, 0);
glTexCoord2f(u + w, v); glVertex3f(x + width / 2., y - height, z); //glVertex3f(v3.x, v3.y, v3.z); //glVertex3f(50,50, 0);
glTexCoord2f(u + w, v + h); glVertex3f(x + width / 2., y, z); //glVertex3f(v2.x, v2.y, v2.z); //glVertex3f(50, 0, 0);
glTexCoord2f(u, v + h); glVertex3f(x - width / 2., y, z); //glVertex3f(v1.x, v1.y, v1.z);// glVertex3f(0, 0, 0);
glEnd();
shader.Disable();
//tran.ApplyTranslation(-m_position);
//glEnable(GL_DEPTH_TEST);
}