1/* -----------------------------------------------------------------------------
2
3 Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
4 Copyright (c) 2007 Ignacio Castano icastano@nvidia.com
5
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files (the
8 "Software"), to deal in the Software without restriction, including
9 without limitation the rights to use, copy, modify, merge, publish,
10 distribute, sublicense, and/or sell copies of the Software, and to
11 permit persons to whom the Software is furnished to do so, subject to
12 the following conditions:
13
14 The above copyright notice and this permission notice shall be included
15 in all copies or substantial portions of the Software.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
25 -------------------------------------------------------------------------- */
26
27#ifndef SQUISH_CLUSTERFIT_H
28#define SQUISH_CLUSTERFIT_H
29
30#include "squish.h"
31#include "maths.h"
32#include "simd.h"
33#include "colourfit.h"
34
35namespace squish {
36
37class ClusterFit : public ColourFit
38{
39public:
40 ClusterFit( ColourSet const* colours, int flags, float* metric );
41
42private:
43 bool ConstructOrdering( Vec3 const& axis, int iteration );
44
45 virtual void Compress3( void* block );
46 virtual void Compress4( void* block );
47
48 enum { kMaxIterations = 8 };
49
50 int m_iterationCount;
51 Vec3 m_principle;
52 u8 m_order[16*kMaxIterations];
53 Vec4 m_points_weights[16];
54 Vec4 m_xsum_wsum;
55 Vec4 m_metric;
56 Vec4 m_besterror;
57};
58
59} // namespace squish
60
61#endif // ndef SQUISH_CLUSTERFIT_H
62