Fichier source en cours : FW - AbstractShaderSceneNode.cpp






Voici le code source cpp :




	#include "Framework.h"

using namespace fw;

AbstractShaderSceneNode::AbstractShaderSceneNode(
	const std::string& sName, 
	SceneNode* pParent,
	const D3DXVECTOR3& position,
	const D3DXVECTOR3& rotation,
	const D3DXVECTOR3& scale) :
SceneNode(pParent, position, rotation, scale),
m_bHasShaderParameter(false),
m_bCSPNeedToRefresh(true),
m_bEnableZBuffer(false),
m_pShader(nullptr),
m_sName(sName)
{
}

AbstractShaderSceneNode::~AbstractShaderSceneNode()
{
}

bool AbstractShaderSceneNode::HasCustomShaderParameter()
{
	return m_bHasShaderParameter;
}

ShaderTechnique::ShaderParameters& AbstractShaderSceneNode::GetCustomShaderParameter()
{
	return m_shaderParam;
}

void AbstractShaderSceneNode::EnableZBuffer(bool bEnable)
{
	m_bEnableZBuffer = bEnable;
}

bool AbstractShaderSceneNode::GetZBufferEnabled()
{
	return m_bEnableZBuffer;
}

bool AbstractShaderSceneNode::CSPNeedToRefresh() const
{
	return m_bCSPNeedToRefresh;
}

void AbstractShaderSceneNode::SetCSPNoNeedToRefresh()
{
	m_bCSPNeedToRefresh = false;
}

void AbstractShaderSceneNode::SetCSPNeedToRefresh() 
{
	m_bCSPNeedToRefresh = true;
}

void AbstractShaderSceneNode::PushCustomShaderParameter(ShaderTechnique::ShaderParameters& param)
{
	m_shaderParam += param;
	m_shaderParam.SetSceneNode(this);

	m_bHasShaderParameter = true;

	SetCSPNeedToRefresh();
}

void AbstractShaderSceneNode::SetShaderTechnique(ShaderTechnique* pShader)
{
	if (pShader == nullptr)
	{
		LogMessage("Passage d'un pointeur shader équivalent à nullptr : " << m_sName.c_str(), WARNING);
	}

	m_pShader = pShader;
}

std::string AbstractShaderSceneNode::GetName()
{
	return m_sName;
}

void AbstractShaderSceneNode::SetName(const std::string& sName)
{
	m_sName = sName;
}