From 6dfede21e4b4d0d2ca68e838b1a200f85bed7696 Mon Sep 17 00:00:00 2001 From: wz <wz_@users.sourceforge.net> Date: Wed, 20 Sep 2006 08:13:03 +0000 Subject: [PATCH] Added * dot product and ^ cross product aliases. Removed unused vars from UpdateTangentSpace(). --- include/nif_math.h | 10 ++++++++++ src/nif_math.cpp | 8 ++++++++ src/obj/NiTriBasedGeom.cpp | 4 ---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/nif_math.h b/include/nif_math.h index 36044cc1..2d253af9 100644 --- a/include/nif_math.h +++ b/include/nif_math.h @@ -197,6 +197,16 @@ struct NIFLIB_API Vector3 { */ Vector3 & operator*=( const float & rh ); + /* Multiplies a vector by a vector using the dot product + * \return The dot product of the two vectors. + */ + float operator*( const Vector3 & v ) const; + + /* Multiplies a vector by a vector using the cross product + * \return The cross product of the two vectors. + */ + Vector3 operator^( const Vector3 & v ) const; + /* Allows scaler division, that is dividing all components of the * vector, x, y and z, by the same number. * \return The result of the division. diff --git a/src/nif_math.cpp b/src/nif_math.cpp index 91023cf6..7ee458b2 100644 --- a/src/nif_math.cpp +++ b/src/nif_math.cpp @@ -88,6 +88,14 @@ Vector3 & Vector3::operator*=( const float & rh) { return *this; } +float Vector3::operator*( const Vector3 & v ) const { + return DotProduct(v); +} + +Vector3 Vector3::operator^( const Vector3 & v ) const { + return CrossProduct(v); +} + Vector3 Vector3::operator/( const float & rh ) const { Vector3 v(*this); v /= rh; diff --git a/src/obj/NiTriBasedGeom.cpp b/src/obj/NiTriBasedGeom.cpp index e3116f68..6cbc30a9 100644 --- a/src/obj/NiTriBasedGeom.cpp +++ b/src/obj/NiTriBasedGeom.cpp @@ -431,10 +431,6 @@ void NiTriBasedGeom::UpdateTangentSpace() { vector<Vector3> tangents( verts.size() ); vector<Vector3> binormals( verts.size() ); - int dups = 0; - - multimap<int, int> vmap; - for( int t = 0; t < (int)tris.size(); t++ ) { Triangle & tri = tris[t]; -- GitLab