mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-11 13:06:49 +03:00
Fixed Billboard Matrix
This commit is contained in:
parent
6aa679ab9a
commit
aff227e84a
2 changed files with 7 additions and 5 deletions
|
@ -35,12 +35,13 @@ vector<RendererVideoAdapter>* Renderer11::GetAdapters()
|
|||
|
||||
void Renderer11::createBillboardMatrix(Matrix* out, Vector3* particlePos, Vector3* cameraPos, float rotation)
|
||||
{
|
||||
/*
|
||||
Vector3 look = *particlePos;
|
||||
look = look - *cameraPos;
|
||||
look.Normalize();
|
||||
|
||||
Vector3 cameraUp = Vector3(0.0f, -1.0f, 0.0f);
|
||||
|
||||
*out = Matrix::CreateBillboard(*particlePos, *cameraPos, cameraUp);
|
||||
|
||||
Vector3 right;
|
||||
right = cameraUp.Cross(look);
|
||||
right.Normalize();
|
||||
|
@ -70,6 +71,7 @@ void Renderer11::createBillboardMatrix(Matrix* out, Vector3* particlePos, Vector
|
|||
out->_41 = particlePos->x;
|
||||
out->_42 = particlePos->y;
|
||||
out->_43 = particlePos->z;
|
||||
*/
|
||||
}
|
||||
|
||||
void Renderer11::updateAnimatedTextures()
|
||||
|
|
|
@ -838,9 +838,9 @@ bool Renderer11::drawSprites()
|
|||
{
|
||||
float halfWidth = spr->Width / 2.0f * spr->Scale;
|
||||
float halfHeight = spr->Height / 2.0f * spr->Scale;
|
||||
|
||||
Matrix billboardMatrix;
|
||||
createBillboardMatrix(&billboardMatrix, &spr->pos, &Vector3(Camera.pos.x, Camera.pos.y, Camera.pos.z), spr->Rotation);
|
||||
//Extract Camera Up Vector and create Billboard matrix.
|
||||
Vector3 cameraUp = Vector3(View._12, View._22, View._32);
|
||||
Matrix billboardMatrix = Matrix::CreateBillboard(spr->pos, Vector3(Camera.pos.x, Camera.pos.y, Camera.pos.z), cameraUp);
|
||||
|
||||
Vector3 p0 = Vector3(-halfWidth, -halfHeight, 0);
|
||||
Vector3 p1 = Vector3(halfWidth, -halfHeight, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue