diff --git a/src/nvtt/squish/clusterfit.cpp b/src/nvtt/squish/clusterfit.cpp index b77dac2..186020c 100644 --- a/src/nvtt/squish/clusterfit.cpp +++ b/src/nvtt/squish/clusterfit.cpp @@ -30,9 +30,14 @@ namespace squish { -ClusterFit::ClusterFit( ColourSet const* colours, int flags ) - : ColourFit( colours, flags ) +ClusterFit::ClusterFit() { +} + +void ClusterFit::SetColourSet( ColourSet const* colours, int flags ) +{ + ColourFit::SetColourSet( colours, flags ); + // initialise the best error #if SQUISH_USE_SIMD m_besterror = VEC4_CONST( FLT_MAX ); @@ -91,7 +96,7 @@ ClusterFit::ClusterFit( ColourSet const* colours, int flags ) } -void ClusterFit::setMetric(float r, float g, float b) +void ClusterFit::SetMetric(float r, float g, float b) { #if SQUISH_USE_SIMD m_metric = Vec4(r, g, b, 0); @@ -101,7 +106,7 @@ void ClusterFit::setMetric(float r, float g, float b) m_metricSqr = m_metric * m_metric; } -float ClusterFit::bestError() const +float ClusterFit::GetBestError() const { #if SQUISH_USE_SIMD return m_besterror.GetVec3().X(); diff --git a/src/nvtt/squish/clusterfit.h b/src/nvtt/squish/clusterfit.h index e5da174..a870dc4 100644 --- a/src/nvtt/squish/clusterfit.h +++ b/src/nvtt/squish/clusterfit.h @@ -36,10 +36,12 @@ namespace squish { class ClusterFit : public ColourFit { public: - ClusterFit( ColourSet const* colours, int flags ); - - void setMetric(float r, float g, float b); - float bestError() const; + ClusterFit(); + + void SetColourSet( ColourSet const* colours, int flags ); + + void SetMetric(float r, float g, float b); + float GetBestError() const; private: virtual void Compress3( void* block ); diff --git a/src/nvtt/squish/colourfit.cpp b/src/nvtt/squish/colourfit.cpp index d10e2ee..55e2816 100644 --- a/src/nvtt/squish/colourfit.cpp +++ b/src/nvtt/squish/colourfit.cpp @@ -28,12 +28,16 @@ namespace squish { -ColourFit::ColourFit( ColourSet const* colours, int flags ) - : m_colours( colours ), - m_flags( flags ) +ColourFit::ColourFit() { } +void ColourFit::SetColourSet( ColourSet const* colours, int flags ) +{ + m_colours = colours; + m_flags = flags; +} + void ColourFit::Compress( void* block ) { bool isDxt1 = ( ( m_flags & kDxt1 ) != 0 ); diff --git a/src/nvtt/squish/colourfit.h b/src/nvtt/squish/colourfit.h index f79a311..23314d8 100644 --- a/src/nvtt/squish/colourfit.h +++ b/src/nvtt/squish/colourfit.h @@ -36,7 +36,9 @@ class ColourSet; class ColourFit { public: - ColourFit( ColourSet const* colours, int flags ); + ColourFit(); + + void SetColourSet( ColourSet const* colours, int flags ); void Compress( void* block ); diff --git a/src/nvtt/squish/fastclusterfit.cpp b/src/nvtt/squish/fastclusterfit.cpp index f063ca8..6ef2969 100644 --- a/src/nvtt/squish/fastclusterfit.cpp +++ b/src/nvtt/squish/fastclusterfit.cpp @@ -31,9 +31,14 @@ namespace squish { -FastClusterFit::FastClusterFit( ColourSet const* colours, int flags ) : - ColourFit( colours, flags ) +FastClusterFit::FastClusterFit() { +} + +void FastClusterFit::SetColourSet( ColourSet const* colours, int flags ) +{ + ColourFit::SetColourSet( colours, flags ); + // initialise the best error #if SQUISH_USE_SIMD m_besterror = VEC4_CONST( FLT_MAX ); @@ -102,7 +107,7 @@ struct Precomp { static Precomp s_threeElement[153]; static Precomp s_fourElement[969]; -void FastClusterFit::doPrecomputation() +void FastClusterFit::DoPrecomputation() { int i = 0; @@ -177,7 +182,7 @@ void FastClusterFit::doPrecomputation() //printf("%d four cluster elements\n", i); } -void FastClusterFit::setMetric(float r, float g, float b) +void FastClusterFit::SetMetric(float r, float g, float b) { #if SQUISH_USE_SIMD m_metric = Vec4(r, g, b, 0); @@ -187,7 +192,7 @@ void FastClusterFit::setMetric(float r, float g, float b) m_metricSqr = m_metric * m_metric; } -float FastClusterFit::bestError() const +float FastClusterFit::GetBestError() const { #if SQUISH_USE_SIMD Vec4 x = m_xxsum * m_metricSqr; diff --git a/src/nvtt/squish/fastclusterfit.h b/src/nvtt/squish/fastclusterfit.h index 7c8c435..5faf7ac 100644 --- a/src/nvtt/squish/fastclusterfit.h +++ b/src/nvtt/squish/fastclusterfit.h @@ -37,12 +37,14 @@ namespace squish { class FastClusterFit : public ColourFit { public: - FastClusterFit( ColourSet const* colours, int flags ); + FastClusterFit(); - void setMetric(float r, float g, float b); - float bestError() const; + void SetColourSet( ColourSet const* colours, int flags ); - static void doPrecomputation(); + void SetMetric(float r, float g, float b); + float GetBestError() const; + + static void DoPrecomputation(); // Make them public virtual void Compress3( void* block ); diff --git a/src/nvtt/squish/weightedclusterfit.cpp b/src/nvtt/squish/weightedclusterfit.cpp index 563e329..2ebe078 100644 --- a/src/nvtt/squish/weightedclusterfit.cpp +++ b/src/nvtt/squish/weightedclusterfit.cpp @@ -32,9 +32,14 @@ namespace squish { -WeightedClusterFit::WeightedClusterFit( ColourSet const* colours, int flags ) : - ColourFit( colours, flags ) +WeightedClusterFit::WeightedClusterFit() { +} + +void WeightedClusterFit::SetColourSet( ColourSet const* colours, int flags ) +{ + ColourFit::SetColourSet( colours, flags ); + // initialise the best error #if SQUISH_USE_SIMD m_besterror = VEC4_CONST( FLT_MAX ); @@ -100,7 +105,7 @@ WeightedClusterFit::WeightedClusterFit( ColourSet const* colours, int flags ) : } -void WeightedClusterFit::setMetric(float r, float g, float b) +void WeightedClusterFit::SetMetric(float r, float g, float b) { #if SQUISH_USE_SIMD m_metric = Vec4(r, g, b, 0); @@ -110,7 +115,7 @@ void WeightedClusterFit::setMetric(float r, float g, float b) m_metricSqr = m_metric * m_metric; } -float WeightedClusterFit::bestError() const +float WeightedClusterFit::GetBestError() const { #if SQUISH_USE_SIMD Vec4 x = m_xxsum * m_metricSqr; diff --git a/src/nvtt/squish/weightedclusterfit.h b/src/nvtt/squish/weightedclusterfit.h index 9aba189..a8f6eea 100644 --- a/src/nvtt/squish/weightedclusterfit.h +++ b/src/nvtt/squish/weightedclusterfit.h @@ -37,12 +37,12 @@ namespace squish { class WeightedClusterFit : public ColourFit { public: - WeightedClusterFit( ColourSet const* colours, int flags ); - - void setMetric(float r, float g, float b); - float bestError() const; + WeightedClusterFit(); - static void doPrecomputation(); + void SetColourSet( ColourSet const* colours, int flags ); + + void SetMetric(float r, float g, float b); + float GetBestError() const; // Make them public virtual void Compress3( void* block );