

#ifndef SQUISH_CLUSTERFIT_H
#define SQUISH_CLUSTERFIT_H

#include "squish.h"
#include "maths.h"
#include "simd.h"
#include "colourfit.h"

namespace squish {

class ClusterFit : public ColourFit
{
public:
    ClusterFit( ColourSet const* colours, int flags, float* metric );

private:
    bool ConstructOrdering( Vec3 const& axis, int iteration );

    virtual void Compress3( void* block );
    virtual void Compress4( void* block );

    enum { kMaxIterations = 8 };

    int m_iterationCount;
    Vec3 m_principle;
    u8 m_order[16*kMaxIterations];
    Vec4 m_points_weights[16];
    Vec4 m_xsum_wsum;
    Vec4 m_metric;
    Vec4 m_besterror;
};

} // namespace squish

#endif // ndef SQUISH_CLUSTERFIT_H
