Merge changes from the-witness.

This commit is contained in:
castano
2011-01-08 04:54:06 +00:00
parent 993e853a5f
commit 5f8cd22cdb
22 changed files with 401 additions and 194 deletions

View File

@ -27,6 +27,9 @@ namespace nv
/// Init ctor.
Box(Vector3::Arg mins, Vector3::Arg maxs) : minCorner(mins), maxCorner(maxs) { }
// Assignment operator.
Box & operator=(const Box & b) { minCorner = b.minCorner; maxCorner = b.maxCorner; return *this; }
// Cast operators.
operator const float * () const { return reinterpret_cast<const float *>(this); }

View File

@ -66,7 +66,7 @@ Vector3 nv::Fit::computeCentroid(int n, const Vector3 *__restrict points)
Vector3 nv::Fit::computeCentroid(int n, const Vector3 *__restrict points, const float *__restrict weights, Vector3::Arg metric)
{
Vector3 centroid(0.0f );
Vector3 centroid(0.0f);
float total = 0.0f;
for (int i = 0; i < n; i++)

View File

@ -496,10 +496,12 @@ nv::fast_half_to_float( uint16 h )
const uint32 h_f_s_pos_offset = _uint32_li( 0x00000010 );
const uint32 h_f_e_pos_offset = _uint32_li( 0x0000000d );
const uint32 h_f_bias_offset = _uint32_li( 0x0001c000 );
const uint32 f_e_mask = _uint32_li( 0x7f800000 );
const uint32 f_m_mask = _uint32_li( 0x007fffff );
const uint32 h_f_e_denorm_bias = _uint32_li( 0x0000007e );
const uint32 h_f_m_denorm_sa_bias = _uint32_li( 0x00000008 );
const uint32 f_e_pos = _uint32_li( 0x00000017 );
const uint32 h_e_mask_minus_one = _uint32_li( 0x00007bff );
const uint32 h_e = _uint32_and( h, h_e_mask );
const uint32 h_m = _uint32_and( h, h_m_mask );
const uint32 h_s = _uint32_and( h, h_s_mask );
@ -515,8 +517,10 @@ nv::fast_half_to_float( uint16 h )
const uint32 f_m_denorm = _uint32_and( h_f_m, f_m_mask );
const uint32 f_e_denorm = _uint32_sll( f_e_denorm_unpacked, f_e_pos );
const uint32 f_em_denorm = _uint32_or( f_e_denorm, f_m_denorm );
const uint32 f_em_nan = _uint32_or( f_e_mask, f_m );
const uint32 is_e_eqz_msb = _uint32_dec( h_e );
const uint32 is_m_nez_msb = _uint32_neg( h_m );
const uint32 is_e_flagged_msb = _uint32_sub( h_e_mask_minus_one, h_e );
const uint32 is_zero_msb = _uint32_andc( is_e_eqz_msb, is_m_nez_msb );
const uint32 is_denorm_msb = _uint32_and( is_m_nez_msb, is_e_eqz_msb );
const uint32 is_zero = _uint32_ext( is_zero_msb );

View File

@ -33,6 +33,8 @@ namespace nv
void operator+=(const Matrix3 & m);
void operator-=(const Matrix3 & m);
float determinant() const;
private:
scalar m_data[9];
};
@ -179,6 +181,17 @@ namespace nv
return mul(a, b);
}
inline float Matrix3::determinant() const
{
return
get(0,0) * get(1,1) * get(2,2) +
get(0,1) * get(1,2) * get(2,0) +
get(0,2) * get(1,0) * get(2,1) -
get(0,2) * get(1,1) * get(2,0) -
get(0,1) * get(1,0) * get(2,2) -
get(0,0) * get(1,2) * get(2,1);
}
/// 4x4 transformation matrix.