/** 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/buffer.cpp

*/

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

//
// Frame buffer handler
//
void CSGXGraphicsEngine::setBackgroundColor(const sgxColorRGB &col)
{
	m_BackgroundColor.setState(col);
}

void 
CSGXGraphicsEngine::clearFrameBuffer()
{
	m_ClearBufferColor.setState(m_BackgroundColor.getState());
	// Force the state to be considered dirty because we need
	// to clear the frame buffer, even if the color is identical.
	m_ClearBufferColor.ForceDirty();
}

void 
CSGXGraphicsEngine::clearZBuffer()
{
	SGX_ENGINE_STATS("zbuffer_clear");
	m_ClearZBuffer.setState(TRUE);
	m_ClearZBuffer.ForceDirty();
}

void 
CSGXGraphicsEngine::refreshZBuffer()
{
	// NOTE: More optimal drivers will override this
	SGX_ENGINE_STATS("zbuffer_refresh");
	clearZBuffer();
}

void 
CSGXGraphicsEngine::flushClearBuffer()
{
	m_ClearBufferColor.ForceClean();
	m_ClearZBuffer.ForceClean();
}

