#include "dxstdafx.h"
#include "SimpleLighting.h"

#pragma once


//------------------------------------------------------------------------------------------------
// Constructor
// Makes the EffectCommon class to load the effect and setup the basics handles (world matrix,etc)
// And if the effect is correctly loaded, it initialize its own handles and variables
//------------------------------------------------------------------------------------------------
SimpleLighting::SimpleLighting() : RTEffectsCommon(L"./FXFiles/RealTime/SimpleLighting.fx")
{
	// If the effect is correctly loaded
	if(m_pEffect)
	{
		m_hDiffuseTexture = m_pEffect->GetParameterByName(NULL, "g_DiffuseTex");

		// Prepare the handle for the technique
		m_hMeshLighting = m_pEffect->GetTechniqueByName("MeshLighting");
	}
	else // If no effect
	{
		// Every handle is NULL
		m_hDiffuseTexture =
		m_hMeshLighting = NULL;
	}
}


//--------------------------------------------------------------------------------------
// Update the shader effect parameters and setup the technique
//--------------------------------------------------------------------------------------
void SimpleLighting::SetupCurrentEffectParameters() const
{
	// Use the mesh lighting Technique
	m_pEffect->SetTechnique(m_hMeshLighting);
}