merge conflict
This commit is contained in:
@@ -1,46 +1,81 @@
|
||||
#include "booster.h"
|
||||
|
||||
void Booster::RenderBillboard(const Vector3f pos, TextureAtlas& textureAtlas, Shader& shader, Transformation tran)
|
||||
Booster::Booster(Vector3f tpos, BOOST_TYPE ttype)
|
||||
{
|
||||
pos = tpos;
|
||||
type = ttype;
|
||||
}
|
||||
|
||||
Booster::~Booster()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Vector3f Booster::GetPosition()
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
BOOST_TYPE Booster::GetType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
bool Booster::GetAvailability()
|
||||
{
|
||||
return available;
|
||||
}
|
||||
|
||||
void Booster::SetAvailability(bool value)
|
||||
{
|
||||
available = value;
|
||||
}
|
||||
|
||||
void Booster::RenderBillboard(TextureAtlas& textureAtlas, Shader& shader, Transformation tran, Player player)
|
||||
{
|
||||
//
|
||||
//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
|
||||
float height = 1.7f;
|
||||
|
||||
//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());
|
||||
Matrix4 mat4 = tran.GetMatrix();
|
||||
|
||||
//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);
|
||||
Vector3f DiffCam = GetPosition() - player.GetPosition();
|
||||
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 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);
|
||||
|
||||
//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();
|
||||
textureAtlas.TextureIndexToCoord(0, u, v, w, h);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
|
||||
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);
|
||||
glTexCoord2f(u, v); glVertex3f(v1.x, v1.y, v1.z);
|
||||
glTexCoord2f(u + w, v); glVertex3f(v2.x, v2.y, v2.z);
|
||||
glTexCoord2f(u + w, v + h); glVertex3f(v3.x, v3.y, v3.z);
|
||||
glTexCoord2f(u, v + h); glVertex3f(v4.x, v4.y, v4.z);
|
||||
|
||||
glEnd();
|
||||
|
||||
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
|
||||
glBlendEquation(GL_FUNC_SUBTRACT);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
shader.Disable();
|
||||
//tran.ApplyTranslation(-m_position);
|
||||
//glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
Reference in New Issue
Block a user