if (light.lightType == LightType.Spot)
{
// TODO: Add support of cosine inner and outer for spot light to get nicer spotlight...
float cosSpotOuterHalfAngle = 1.0f / light.invCosHalfSpotAngle;
float cosSpotInnerHalfAngle = cosSpotOuterHalfAngle;
float spotAngle = light.light.spotAngle;
AdditionalLightData additionalLightData = light.light.GetComponent<AdditionalLightData>();
float innerConePercent = AdditionalLightData.GetInnerSpotPercent01(additionalLightData);
float cosSpotOuterHalfAngle = Mathf.Clamp(Mathf.Cos(spotAngle * 0.5f * Mathf.Deg2Rad), 0.0f, 1.0f);
float cosSpotInnerHalfAngle = Mathf.Clamp(Mathf.Cos(spotAngle * 0.5f * innerConePercent * Mathf.Deg2Rad), 0.0f, 1.0f); // inner cone
float val = Mathf.Max(0.001f, (cosSpotInnerHalfAngle - cosSpotOuterHalfAngle));
l.angleScale = 1.0f / val;
// Do not use "in", only "out" or "inout" as califier, not "inline" keyword either, useless.
// The lighting code assume that 1 Unity unit (1uu) == 1 meters. This is very important regarding physically based light unit and inverse square attenuation
// Include language header
#if defined(SHADER_API_D3D11)