axmol/extensions/Effekseer/EffekseerRendererCommon/EffekseerRenderer.RenderSta...

102 lines
3.3 KiB
C++

//----------------------------------------------------------------------------------
// Include
//----------------------------------------------------------------------------------
#include "EffekseerRenderer.RenderStateBase.h"
//-----------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------
namespace EffekseerRenderer
{
//-----------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------
RenderStateBase::State::State()
{
Reset();
}
//-----------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------
void RenderStateBase::State::Reset()
{
DepthTest = false;
DepthWrite = false;
AlphaBlend = ::Effekseer::AlphaBlendType::Blend;
CullingType = ::Effekseer::CullingType::Double;
TextureFilterTypes.fill(::Effekseer::TextureFilterType::Nearest);
TextureWrapTypes.fill(::Effekseer::TextureWrapType::Clamp);
TextureIDs.fill(0);
}
//-----------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------
void RenderStateBase::State::CopyTo(State& state)
{
state.DepthTest = DepthTest;
state.DepthWrite = DepthWrite;
state.AlphaBlend = AlphaBlend;
state.CullingType = CullingType;
state.TextureFilterTypes = TextureFilterTypes;
state.TextureWrapTypes = TextureWrapTypes;
state.TextureIDs = TextureIDs;
}
//-----------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------
RenderStateBase::RenderStateBase()
{
}
//-----------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------
RenderStateBase::~RenderStateBase()
{
}
//-----------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------
RenderStateBase::State& RenderStateBase::Push()
{
State newState;
m_next.CopyTo(newState);
m_stateStack.push(m_next);
m_next = newState;
return m_next;
}
//-----------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------
void RenderStateBase::Pop()
{
assert(!m_stateStack.empty());
State top = m_stateStack.top();
m_stateStack.pop();
m_next = top;
}
//-----------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------
RenderStateBase::State& RenderStateBase::GetActiveState()
{
return m_next;
}
//-----------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------
} // namespace EffekseerRenderer
//-----------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------