/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2008.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: src/sgx/graphics/alphasorter.cpp

*/

#include "sgx/core/core.hpp"
#include "sgx/graphics/graphics.hpp"

CFaceEntry::CFaceEntry() : pAlphaData(NULL)
{
}

// TODO: If texture is masked is doesn't need sorting
// so distinguish between translucent & transparent.
tBOOL CSGXGraphicsEngine::isAlphaSortable(const CSGXTexture *pTexture)
{
	if (pTexture && pTexture->isTranslucent()) {
		return TRUE;
	}

	return FALSE;
}

tBOOL CSGXGraphicsEngine::isAlphaSortable(const sgxColorRGBA &col)
{
    if (col.a != 1.0f) {
		return TRUE;
	}

	return FALSE;
}

tBOOL CSGXGraphicsEngine::isAlphaSortable(const sgxGfxPolygon &poly)
{
    if (m_PrimitiveColor.getState().a != 1.0f) {
		return TRUE;
	}

	if (isAlphaSortable(poly.pTexture)) {
		return TRUE;
	}


	return FALSE;
}
