Fix more errors in the use of the color metric.

Remove debug code from compress.cpp
This commit is contained in:
castano
2007-12-13 06:36:23 +00:00
parent 6b016dae96
commit a76e89d0d7
7 changed files with 24 additions and 23 deletions

View File

@ -184,16 +184,17 @@ void FastClusterFit::setMetric(float r, float g, float b)
#else
m_metric = Vec3(r, g, b);
#endif
m_metricSqr = m_metric * m_metric;
}
float FastClusterFit::bestError() const
{
#if SQUISH_USE_SIMD
Vec4 x = m_xxsum * m_metric;
Vec4 x = m_xxsum * m_metricSqr;
Vec4 error = m_besterror + x.SplatX() + x.SplatY() + x.SplatZ();
return error.GetVec3().X();
#else
return m_besterror + Dot(m_xxsum, m_metric);
return m_besterror + Dot(m_xxsum, m_metricSqr);
#endif
}
@ -252,7 +253,7 @@ void FastClusterFit::Compress3( void* block )
Vec4 e3 = MultiplyAdd( a*b*alphabeta_sum - e1, two, e2 );
// apply the metric to the error term
Vec4 e4 = e3 * m_metric;
Vec4 e4 = e3 * m_metricSqr;
Vec4 error = e4.SplatX() + e4.SplatY() + e4.SplatZ();
// keep the solution if it wins
@ -369,7 +370,7 @@ void FastClusterFit::Compress4( void* block )
Vec4 e3 = MultiplyAdd( a*b*alphabeta_sum - e1, two, e2 );
// apply the metric to the error term
Vec4 e4 = e3 * m_metric;
Vec4 e4 = e3 * m_metricSqr;
Vec4 error = e4.SplatX() + e4.SplatY() + e4.SplatZ();
// keep the solution if it wins
@ -489,7 +490,7 @@ void FastClusterFit::Compress3( void* block )
Vec3 e1 = a*a*alpha2_sum + b*b*beta2_sum + 2.0f*( a*b*alphabeta_sum - a*alphax_sum - b*betax_sum );
// apply the metric to the error term
float error = Dot( e1, m_metric );
float error = Dot( e1, m_metricSqr );
// keep the solution if it wins
if( error < besterror )
@ -601,7 +602,7 @@ void FastClusterFit::Compress4( void* block )
Vec3 e1 = a*a*alpha2_sum + b*b*beta2_sum + 2.0f*( a*b*alphabeta_sum - a*alphax_sum - b*betax_sum );
// apply the metric to the error term
float error = Dot( e1, m_metric );
float error = Dot( e1, m_metricSqr );
// keep the solution if it wins
if( error < besterror )