Tmpl8::Color Tmpl8::Core::SetShading( const vector3& a_WorldPos, const vector3& a_Normal, const vector2& a_UV, int a_ShadingType )
{
 	Color tempcol;
 	vector3 light = SceneManager::Get()->GetScene()->GetInsetCamera()->GetMatrixInv().Transform(vector3(100, 100, -1000));
 	Color diffuse = Color(0.8f, 0.8f, 0.8f);
 	Color specular = Color(0.8f, 0.8f, 0.8f);
 	Color ambient = Color(0.2f, 0.2f, 0.2f);
 	vector3 position = SceneManager::Get()->GetScene()->GetInsetCamera()->GetPosition();

	if(a_ShadingType == 1)
	{
	  	Color texcol = m_Texture ? tempcol.FromPixel(GetUVColor(a_UV.u, a_UV.v)) : GetColor();
	  	vector3 L = (light - a_WorldPos).Normalized();
	  	vector3 N = a_Normal;
	  	N.Normalize();
	  	vector3 V = position - a_WorldPos;
	  	float dst = 1.0f / DOT(V, V);
	  	vector3 H = (L + V).Normalized();
	  
	  	float diff = 0.25f * DOT(N, L);
	  	float spec = 0.8f * powf(DOT(N, H), 32);
	  
	  	Color tmpcol;
	  	tmpcol += diff * (diffuse * texcol);
	  	tmpcol += spec * (specular * texcol);
	  	tmpcol += ambient * texcol;
	  	return tmpcol;
	}
	else if(a_ShadingType == 2)
 	{
 		Color texcol = m_Texture ? tempcol.FromPixel(GetUVColor(a_UV.u, a_UV.v)) : GetColor();
 		vector3 L = (light - a_WorldPos).Normalized();
 		vector3 N = a_Normal;
 		N.Normalize();
 		vector3 V = position - a_WorldPos;
 		float dst = 1.0f / DOT(V, V);
 		float diff = DOT(N, L);
 
 		diff = CLAMP(diff, 0.01f, 1.0f);
 
 		Color tmpcol;
 		tmpcol += diff * (diffuse * texcol);
 		tmpcol += ambient * texcol;
 		return tmpcol;
 	}
}