|
|
|
|
|
|
float specularDimmer = m_FrameSettings.specularGlobalDimmer * additionalData.lightDimmer; |
|
|
|
if (diffuseDimmer <= 0.0f && specularDimmer <= 0.0f) |
|
|
|
return false; |
|
|
|
|
|
|
|
// Light direction for directional is opposite to the forward direction
|
|
|
|
directionalLightData.forward = light.light.transform.forward; |
|
|
|
// Rescale for cookies and windowing.
|
|
|
|
|
|
|
int lightCount = Math.Min(cullResults.visibleLights.Count, k_MaxLightsOnScreen); |
|
|
|
var sortKeys = new uint[lightCount]; |
|
|
|
int sortCount = 0; |
|
|
|
|
|
|
|
for (int lightIndex = 0, numLights = cullResults.visibleLights.Count; (lightIndex < numLights) && (sortCount < lightCount); ++lightIndex) |
|
|
|
{ |
|
|
|
var light = cullResults.visibleLights[lightIndex]; |
|
|
|
|
|
|
// to allow the preceding code to work with the absolute world space coordinates.
|
|
|
|
if (ShaderConfig.s_CameraRelativeRendering != 0) |
|
|
|
{ |
|
|
|
int last = m_lightList.directionalLights.Count - 1; |
|
|
|
int last = m_lightList.directionalLights.Count - 1; |
|
|
|
DirectionalLightData lightData = m_lightList.directionalLights[last]; |
|
|
|
lightData.positionWS -= camPosWS; |
|
|
|
m_lightList.directionalLights[last] = lightData; |
|
|
|
|
|
|
// to allow the preceding code to work with the absolute world space coordinates.
|
|
|
|
if (ShaderConfig.s_CameraRelativeRendering != 0) |
|
|
|
{ |
|
|
|
int last = m_lightList.lights.Count - 1; |
|
|
|
int last = m_lightList.lights.Count - 1; |
|
|
|
LightData lightData = m_lightList.lights[last]; |
|
|
|
lightData.positionWS -= camPosWS; |
|
|
|
m_lightList.lights[last] = lightData; |
|
|
|