浏览代码

Remove unused function and improve lightbaking delegate

/main
egomeh 6 年前
当前提交
86c74f90
共有 2 个文件被更改,包括 19 次插入19 次删除
  1. 28
      com.unity.render-pipelines.lightweight/LWRP/LightweightPipeline.cs
  2. 10
      com.unity.render-pipelines.lightweight/LWRP/ShaderLibrary/Lighting.hlsl

28
com.unity.render-pipelines.lightweight/LWRP/LightweightPipeline.cs


public static Lightmapping.RequestLightsDelegate lightsDelegate = (Light[] requests, NativeArray<LightDataGI> lightsOutput) =>
{
DirectionalLight directionalLight = new DirectionalLight();
PointLight pointLight = new PointLight();
SpotLight spotLight = new SpotLight();
RectangleLight rectangleLight = new RectangleLight();
LightDataGI lightData = new LightDataGI();
for (int i = 0; i < requests.Length; i++)

{
case LightType.Directional: LightmapperUtils.Extract(light, ref directionalLight); lightData.Init(ref directionalLight); break;
case LightType.Point: LightmapperUtils.Extract(light, ref pointLight); lightData.Init(ref pointLight); break;
case LightType.Spot: LightmapperUtils.Extract(light, ref spotLight); lightData.Init(ref spotLight); break;
case LightType.Area: LightmapperUtils.Extract(light, ref rectangleLight); lightData.Init(ref rectangleLight); break;
default: lightData.InitNoBake(light.GetInstanceID()); break;
case LightType.Directional:
DirectionalLight directionalLight = new DirectionalLight();
LightmapperUtils.Extract(light, ref directionalLight); lightData.Init(ref directionalLight);
break;
case LightType.Point:
PointLight pointLight = new PointLight();
LightmapperUtils.Extract(light, ref pointLight); lightData.Init(ref pointLight);
break;
case LightType.Spot:
SpotLight spotLight = new SpotLight();
LightmapperUtils.Extract(light, ref spotLight); lightData.Init(ref spotLight);
break;
case LightType.Area:
RectangleLight rectangleLight = new RectangleLight();
LightmapperUtils.Extract(light, ref rectangleLight); lightData.Init(ref rectangleLight);
break;
default:
lightData.InitNoBake(light.GetInstanceID());
break;
}
lightData.falloff = FalloffType.InverseSquared;

10
com.unity.render-pipelines.lightweight/LWRP/ShaderLibrary/Lighting.hlsl


return directionAndAttenuation;
}
half4 GetMainLightDirectionAndAttenuation(LightInput lightInput, float3 positionWS)
{
half4 directionAndAttenuation = GetLightDirectionAndAttenuation(lightInput, positionWS);
// Cookies disabled for now due to amount of shader variants
// directionAndAttenuation.w *= CookieAttenuation(positionWS);
return directionAndAttenuation;
}
///////////////////////////////////////////////////////////////////////////////
// Light Abstraction //
///////////////////////////////////////////////////////////////////////////////

正在加载...
取消
保存