|
|
|
|
|
|
List<int> localLightIndices = lightData.localLightIndices; |
|
|
|
List<VisibleLight> visibleLights = lightData.visibleLights; |
|
|
|
|
|
|
|
// TODO: for now we just support 1 local shadow casting light
|
|
|
|
const int kMaxLocalShadowCastingLightsCount = 1; |
|
|
|
for (int i = 0; i < localLightIndices.Count; ++i) |
|
|
|
int localLightsCount = Math.Min(localLightIndices.Count, kMaxLocalPixelLightPerPass); |
|
|
|
for (int i = 0; i < localLightsCount; ++i) |
|
|
|
if (shadowLight.lightType == LightType.Spot && shadowLight.light.shadows != LightShadows.None && shadowCastingLightsCount < kMaxLocalShadowCastingLightsCount) |
|
|
|
if (shadowLight.lightType == LightType.Spot && shadowLight.light.shadows != LightShadows.None) |
|
|
|
shadowCastingLightsCount++; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CoreUtils.SetRenderTarget(cmd, m_LocalShadowmapTexture, ClearFlag.Depth); |
|
|
|
|
|
|
|
for (int i = 0; i < localLightIndices.Count; ++i) |
|
|
|
for (int i = 0; i < localLightsCount; ++i) |
|
|
|
{ |
|
|
|
int shadowLightIndex = localLightIndices[i]; |
|
|
|
VisibleLight shadowLight = visibleLights[shadowLightIndex]; |
|
|
|
|
|
|
m_LocalLightSlices[i].resolution = sliceResolution; |
|
|
|
m_LocalLightSlices[i].shadowTransform = GetShadowTransform(proj, view); |
|
|
|
|
|
|
|
if (shadowCastingLightsCount > 1) |
|
|
|
ApplySliceTransform(ref m_LocalLightSlices[i], atlasWidth, atlasHeight); |
|
|
|
|
|
|
|
|
|
|
|
// TODO: only one local shadow casting light is supported for now.
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|