mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-02 09:03:37 +00:00
Fix TransformVectorNormalize().
Fixed Mario's red eye caused by incorrect work of TransformVectorNormalize()
This commit is contained in:
parent
7d195d7202
commit
e8e1515fa6
20
3DMath.cpp
20
3DMath.cpp
|
@ -24,15 +24,17 @@ void TransformVectorNormalize(float vec[3], float mtx[4][4])
|
|||
{
|
||||
float len;
|
||||
|
||||
vec[0] = mtx[0][0] * vec[0]
|
||||
+ mtx[1][0] * vec[1]
|
||||
+ mtx[2][0] * vec[2];
|
||||
vec[1] = mtx[0][1] * vec[0]
|
||||
+ mtx[1][1] * vec[1]
|
||||
+ mtx[2][1] * vec[2];
|
||||
vec[2] = mtx[0][2] * vec[0]
|
||||
+ mtx[1][2] * vec[1]
|
||||
+ mtx[2][2] * vec[2];
|
||||
float vres[3];
|
||||
vres[0] = mtx[0][0] * vec[0]
|
||||
+ mtx[1][0] * vec[1]
|
||||
+ mtx[2][0] * vec[2];
|
||||
vres[1] = mtx[0][1] * vec[0]
|
||||
+ mtx[1][1] * vec[1]
|
||||
+ mtx[2][1] * vec[2];
|
||||
vres[2] = mtx[0][2] * vec[0]
|
||||
+ mtx[1][2] * vec[1]
|
||||
+ mtx[2][2] * vec[2];
|
||||
memcpy(vec, vres, sizeof(float)*3);
|
||||
len = vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2];
|
||||
if (len != 0.0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user