示例#1
0
/**
* Sets the value currently stored in the parameter
*
* @date Created Apr 01, 2006
* @return Reference to the left parameter; Useful to assigning lines of 
*		  parameters at once.
* @{
*/
CShaderVariant& CShaderVariant::operator= (const CShaderVariant& oVal)
{
	// Get description from both parameters.
	LPD3DXEFFECT pEffect = m_pParent->getD3DXEffect();
	D3DXPARAMETER_DESC desc;
	HRESULT hRetval = pEffect->GetParameterDesc(m_hParam, &desc);
	HRESULT hRetOval = pEffect->GetParameterDesc(oVal.m_hParam, &desc);
	if(FAILED(hRetval) | FAILED(hRetOval))
		return *this;

	// Copy parameter values
	unsigned char *pData = new unsigned char[desc.Bytes];
	if (!pData)
		return *this;

	pEffect->GetValue(oVal.m_hParam, pData, desc.Bytes);
	pEffect->SetValue(m_hParam, pData, desc.Bytes);
	delete [] pData;
	return *this;
}