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>
|
||||
NzVector4<T>& NzVector4<T>::Normalize(T* length)
|
||||
{
|
||||
x /= w;
|
||||
y /= w;
|
||||
z /= w;
|
||||
|
||||
w = F(1.0);
|
||||
T invLength = F(1.0)/w;
|
||||
x *= invLength; // Attention, briser cette logique casserait Frustum::Extract
|
||||
y *= invLength;
|
||||
z *= invLength;
|
||||
|
||||
if (length)
|
||||
*length = w;
|
||||
|
||||
w = F(1.0);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue