public override void Execute(ScriptableRenderContext context, Camera camera, ref CullingResults cullingResults) { shadow.Init(context, camera, cullingResults); var visibleLights = cullingResults.visibleLights; int mainLightIndex = GetMainLightIndex(visibleLights); if (mainLightIndex >= 0) { var mainVisibleLight = visibleLights[mainLightIndex]; SetupMainLight(mainVisibleLight); shadow.DrawMainDirShadow(mainLightIndex); } additionalLightsCount = 0; for (int i = 0; i < visibleLights.Length; i++) { if (additionalLightsCount == Definitions.MaxAdditionalLightsCount) { break; } if (i == mainLightIndex) { continue; } var visibleLight = visibleLights[i]; if (visibleLight.light.lightmapBakeType == LightmapBakeType.Baked) { continue; } switch (visibleLight.lightType) { //case LightType.Directional: // { // //SetupDirectionalLight(additionalLightsCount, ref visibleLight); // } // break; case LightType.Point: { SetupPointLight(additionalLightsCount, ref visibleLight); if (visibleLight.light.shadows != LightShadows.None) { //shadow.DrawPointLightShadow(i);; } } break; case LightType.Spot: { SetupSpotLight(additionalLightsCount, ref visibleLight); if (visibleLight.light.shadows != LightShadows.None) { //shadow.DrawSpotLightShadow(i); } } break; default: continue; } additionalLightsCount++; } Submit(); context.ExecuteCommandBuffer(buffer); buffer.Clear(); }