Fixes for osgFX.

This commit is contained in:
Robert Osfield
2003-09-10 12:38:28 +00:00
parent a01903ac41
commit 6c22afa51c
9 changed files with 211 additions and 14 deletions

View File

@@ -150,8 +150,12 @@ class Vec2
inline float normalize()
{
float norm = Vec2::length();
_v[0] /= norm;
_v[1] /= norm;
if (norm>0.0f)
{
float inv = 1.0f/norm;
_v[0] *= inv;
_v[1] *= inv;
}
return( norm );
}

View File

@@ -170,9 +170,10 @@ class Vec3
float norm = Vec3::length();
if (norm>0.0f)
{
_v[0] /= norm;
_v[1] /= norm;
_v[2] /= norm;
float inv = 1.0f/norm;
_v[0] *= inv;
_v[1] *= inv;
_v[2] *= inv;
}
return( norm );
}

View File

@@ -207,10 +207,14 @@ class Vec4
inline float normalize()
{
float norm = Vec4::length();
_v[0] /= norm;
_v[1] /= norm;
_v[2] /= norm;
_v[3] /= norm;
if (norm>0.0f)
{
float inv = 1.0f/norm;
_v[0] *= inv;
_v[1] *= inv;
_v[2] *= inv;
_v[3] *= inv;
}
return( norm );
}