//	Darkstar Engine  (c) UnderWorld Interactive Studio (all coding by Svarog    2007)
//
//      Данный файл является частью Darkstar Engine. Любое использование кода файла
//      без согласия компании, является нарушением закона об авторском праве (в слу-
//      чае если не оговорено обратное).
//
//      Имя файла: depth_render_state.cpp
//      Краткое описание: Depth state block
//

#include <Darkstar/Graphic System/Render State/depth_render_state.hpp>
#include <Darkstar/Graphic System/Render State/render_state_manager.hpp>

using gs::DepthRenderState;
using gs::DRSCMPFUNC;
using gs::RenderStateManager;
using gs::DEDEPTHWRITEMASK;

DepthRenderState::DepthRenderState()
{
	depth_enable = true;
	depth_func = DRSCMP_LESS;
	depth_write_enable = DEDWM_ALL;
};

DepthRenderState::DepthRenderState(const DepthRenderState& ds)
{
	depth_enable = ds.getIsDepthEnable();
	depth_func = ds.getDepthFunction();
	depth_write_enable = ds.getDepthWriteMask();
};

DepthRenderState::DepthRenderState(const bool depth_enable, const DEDEPTHWRITEMASK& depth_write_enable, const DRSCMPFUNC& depth_func)
{
	this->depth_enable = depth_enable;
	this->depth_write_enable = depth_write_enable;
	this->depth_func = depth_func;
};

DepthRenderState::~DepthRenderState()
{

};

bool DepthRenderState::operator ==(const DepthRenderState& state) const
{
	return (depth_enable == state.getIsDepthEnable() && depth_func == state.getDepthFunction() &&
		depth_write_enable == state.getDepthWriteMask());
};

void DepthRenderState::setDepthEnable(const bool depth_enable)
{
	this->depth_enable = depth_enable;
};

void DepthRenderState::setDepthWriteMask(const DEDEPTHWRITEMASK& depth_write_enable)
{
	this->depth_write_enable = depth_write_enable;
};

void DepthRenderState::setDepthFunction(const DRSCMPFUNC& depth_func)
{
	this->depth_func = depth_func;
};

bool DepthRenderState::getIsDepthEnable() const
{
	return depth_enable;
};

const DEDEPTHWRITEMASK& DepthRenderState::getDepthWriteMask() const
{
	return depth_write_enable;
};

const DRSCMPFUNC& DepthRenderState::getDepthFunction() const
{
	return depth_func;
};

void DepthRenderState::set()
{
	RenderStateManager::ptr()->setDepthRenderState(*this);
};