EVA::Light::Light(DataObject data) 
	: Light(
	data.GetString("type", "directional") == "directional" ? Directional : Point,
	data.GetBool("shadows", true), 
	data.GetInt("shadowMapSize", DEFAULT_SHADOW_MAP_SIZE))
{
	color = data.GetVec3("color", color);
	ambientCoefficient = data.GetFloat("ambientCoefficient", ambientCoefficient);
	
	SetRotation(data.GetVec2("rotation", glm::vec2(0.0f)));

	directionalShadowDistance = data.GetFloat("directionalShadowDistance", directionalShadowDistance);

	directionalNearPlane = data.GetFloat("directionalNearPlane", directionalNearPlane);
	directionalFarPlane = data.GetFloat("directionalFarPlane", directionalFarPlane);

	SetPosition(data.GetVec3("position", glm::vec3(0.0f)));

	attenuation = data.GetFloat("attenuation", attenuation);

	pointNearPlane = data.GetFloat("pointNearPlane", pointNearPlane);
	pointFarPlane = data.GetFloat("pointFarPlane", pointFarPlane);
}