Improved Vector4::Normalize
Fixed length output Former-commit-id: 2ff9aeca4e125965251187a1b7e2a4c6e0c08e5a
This commit is contained in:
parent
b6940e9d8b
commit
0051b76b9b
|
|
@ -130,15 +130,16 @@ NzVector4<T>& NzVector4<T>::Minimize(const NzVector4& vec)
|
||||||
template<typename T>
|
template<typename T>
|
||||||
NzVector4<T>& NzVector4<T>::Normalize(T* length)
|
NzVector4<T>& NzVector4<T>::Normalize(T* length)
|
||||||
{
|
{
|
||||||
x /= w;
|
T invLength = F(1.0)/w;
|
||||||
y /= w;
|
x *= invLength; // Attention, briser cette logique casserait Frustum::Extract
|
||||||
z /= w;
|
y *= invLength;
|
||||||
|
z *= invLength;
|
||||||
w = F(1.0);
|
|
||||||
|
|
||||||
if (length)
|
if (length)
|
||||||
*length = w;
|
*length = w;
|
||||||
|
|
||||||
|
w = F(1.0);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue