Try 4-means.
This commit is contained in:
parent
11073171a1
commit
41f6e0ba73
@ -24,6 +24,7 @@
|
|||||||
#include <nvcore/Containers.h> // swap
|
#include <nvcore/Containers.h> // swap
|
||||||
|
|
||||||
#include <nvmath/Color.h>
|
#include <nvmath/Color.h>
|
||||||
|
#include <nvmath/Fitting.h>
|
||||||
|
|
||||||
#include <nvimage/ColorBlock.h>
|
#include <nvimage/ColorBlock.h>
|
||||||
#include <nvimage/BlockDXT.h>
|
#include <nvimage/BlockDXT.h>
|
||||||
@ -453,6 +454,7 @@ void QuickCompress::compressDXT1(const ColorBlock & rgba, BlockDXT1 * dxtBlock)
|
|||||||
Vector3 block[16];
|
Vector3 block[16];
|
||||||
extractColorBlockRGB(rgba, block);
|
extractColorBlockRGB(rgba, block);
|
||||||
|
|
||||||
|
#if 0
|
||||||
// find min and max colors
|
// find min and max colors
|
||||||
Vector3 maxColor, minColor;
|
Vector3 maxColor, minColor;
|
||||||
findMinMaxColorsBox(block, 16, &maxColor, &minColor);
|
findMinMaxColorsBox(block, 16, &maxColor, &minColor);
|
||||||
@ -460,6 +462,14 @@ void QuickCompress::compressDXT1(const ColorBlock & rgba, BlockDXT1 * dxtBlock)
|
|||||||
selectDiagonal(block, 16, &maxColor, &minColor);
|
selectDiagonal(block, 16, &maxColor, &minColor);
|
||||||
|
|
||||||
insetBBox(&maxColor, &minColor);
|
insetBBox(&maxColor, &minColor);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
float weights[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||||
|
Vector3 cluster[4];
|
||||||
|
Compute4Means(16, block, weights, Vector3(1, 1, 1), cluster);
|
||||||
|
|
||||||
|
Vector3 maxColor = cluster[0];
|
||||||
|
Vector3 minColor = cluster[3];
|
||||||
|
|
||||||
uint16 color0 = roundAndExpand(&maxColor);
|
uint16 color0 = roundAndExpand(&maxColor);
|
||||||
uint16 color1 = roundAndExpand(&minColor);
|
uint16 color1 = roundAndExpand(&minColor);
|
||||||
|
Loading…
Reference in New Issue
Block a user