clusterfit.h 2.1 KB

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