Work in progress.

Merging squish into nvtt. 
Using squish only to find endpoints, do discrete refinement afterwards.
This commit is contained in:
castano
2010-11-09 03:38:03 +00:00
parent c532ffb34e
commit 49482d1441
25 changed files with 1726 additions and 1008 deletions

View File

@ -38,21 +38,21 @@ void ColourFit::SetColourSet( ColourSet const* colours, int flags )
m_flags = flags;
}
void ColourFit::Compress( void* block )
void ColourFit::Compress( Vec3 * start, Vec3 * end )
{
bool isDxt1 = ( ( m_flags & kDxt1 ) != 0 );
if( isDxt1 )
{
Compress3( block );
Compress3( start, end );
if( !m_colours->IsTransparent() )
{
Compress4( block );
Compress4( start, end );
}
}
else
{
Compress4( block );
Compress4( start, end );
}
}

View File

@ -40,11 +40,11 @@ public:
void SetColourSet( ColourSet const* colours, int flags );
void Compress( void* block );
void Compress( Vec3 * start, Vec3 * end );
protected:
virtual void Compress3( void* block ) = 0;
virtual void Compress4( void* block ) = 0;
virtual bool Compress3( Vec3 * start, Vec3 * end ) = 0;
virtual bool Compress4( Vec3 * start, Vec3 * end ) = 0;
ColourSet const* m_colours;
int m_flags;

View File

@ -129,7 +129,7 @@ float WeightedClusterFit::GetBestError() const
#if SQUISH_USE_SIMD
void WeightedClusterFit::Compress3( void* block )
bool WeightedClusterFit::Compress3( Vec3 * start, Vec3 * end )
{
int const count = m_colours->GetCount();
Vec4 const one = VEC4_CONST(1.0f);
@ -212,7 +212,7 @@ void WeightedClusterFit::Compress3( void* block )
if( CompareAnyLessThan( besterror, m_besterror ) )
{
// compute indices from cluster sizes.
u8 bestindices[16];
/*u8 bestindices[16];
{
int i = 0;
for(; i < b0; i++) {
@ -233,16 +233,22 @@ void WeightedClusterFit::Compress3( void* block )
m_colours->RemapIndices( ordered, bestindices );
// save the block
WriteColourBlock3( beststart.GetVec3(), bestend.GetVec3(), bestindices, block );
WriteColourBlock3( beststart.GetVec3(), bestend.GetVec3(), bestindices, block );*/
*start = beststart.GetVec3();
*end = bestend.GetVec3();
// save the error
m_besterror = besterror;
return true;
}
return false;
}
void WeightedClusterFit::Compress4( void* block )
bool WeightedClusterFit::Compress4( Vec3 * start, Vec3 * end )
{
int const count = m_colours->GetCount();
Vec4 const one = VEC4_CONST(1.0f);
@ -334,7 +340,7 @@ void WeightedClusterFit::Compress4( void* block )
// save the block if necessary
if( CompareAnyLessThan( besterror, m_besterror ) )
{
// compute indices from cluster sizes.
/*// compute indices from cluster sizes.
u8 bestindices[16];
{
int i = 0;
@ -360,11 +366,18 @@ void WeightedClusterFit::Compress4( void* block )
m_colours->RemapIndices( ordered, bestindices );
// save the block
WriteColourBlock4( beststart.GetVec3(), bestend.GetVec3(), bestindices, block );
WriteColourBlock4( beststart.GetVec3(), bestend.GetVec3(), bestindices, block );*/
*start = beststart.GetVec3();
*end = bestend.GetVec3();
// save the error
m_besterror = besterror;
return true;
}
return false;
}
#else

View File

@ -45,8 +45,8 @@ public:
float GetBestError() const;
// Make them public
virtual void Compress3( void* block );
virtual void Compress4( void* block );
bool Compress3( Vec3 * start, Vec3 * end );
bool Compress4( Vec3 * start, Vec3 * end );
private: