|
|
|
|
|
|
public const int MaxLights = 32; |
|
|
|
public const int MaxProbes = 32; |
|
|
|
|
|
|
|
//[SerializeField]
|
|
|
|
//ShadowSettings m_ShadowSettings = ShadowSettings.Default;
|
|
|
|
//ShadowRenderPass m_ShadowPass;
|
|
|
|
[SerializeField] |
|
|
|
ShadowSettings m_ShadowSettings = ShadowSettings.Default; |
|
|
|
ShadowRenderPass m_ShadowPass; |
|
|
|
|
|
|
|
[SerializeField] |
|
|
|
TextureSettings m_TextureSettings = TextureSettings.Default; |
|
|
|
|
|
|
// Debug
|
|
|
|
m_DebugViewMaterialGBuffer = CreateEngineMaterial("Hidden/Unity/DebugViewMaterialGBuffer"); |
|
|
|
|
|
|
|
// m_ShadowPass = new ShadowRenderPass (m_ShadowSettings);
|
|
|
|
m_ShadowPass = new ShadowRenderPass (m_ShadowSettings); |
|
|
|
|
|
|
|
m_cubeReflTexArray = new TextureCacheCubemap(); |
|
|
|
m_cubeReflTexArray.AllocTextureArray(32, (int)m_TextureSettings.reflectionCubemapSize, TextureFormat.BC6H, true); |
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void UpdatePunctualLights(VisibleLight[] visibleLights) |
|
|
|
void UpdatePunctualLights(VisibleLight[] visibleLights, ref ShadowOutput shadow) |
|
|
|
{ |
|
|
|
var lights = new List<PunctualLightData>(); |
|
|
|
|
|
|
|
|
|
|
if (!CullResults.GetCullingParameters(camera, out cullingParams)) |
|
|
|
continue; |
|
|
|
|
|
|
|
//m_ShadowPass.UpdateCullingParameters (ref cullingParams);
|
|
|
|
m_ShadowPass.UpdateCullingParameters (ref cullingParams); |
|
|
|
//ShadowOutput shadows;
|
|
|
|
//m_ShadowPass.Render (renderLoop, cullResults, out shadows);
|
|
|
|
|
|
|
|
//UpdateLightConstants(cullResults.visibleLights /*, ref shadows */);
|
|
|
|
|
|
|
|
UpdatePunctualLights(cullResults.visibleLights); |
|
|
|
UpdateReflectionProbes(cullResults.visibleReflectionProbes); |
|
|
|
|
|
|
|
InitAndClearBuffer(camera, renderLoop); |
|
|
|
|
|
|
|
RenderGBuffer(cullResults, camera, renderLoop); |
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
ShadowOutput shadows; |
|
|
|
m_ShadowPass.Render(renderLoop, cullResults, out shadows); |
|
|
|
UpdatePunctualLights(cullResults.visibleLights, ref shadows); |
|
|
|
UpdateReflectionProbes(cullResults.visibleReflectionProbes); |
|
|
|
|
|
|
|
RenderDeferredLighting(camera, renderLoop); |
|
|
|
|
|
|
|
RenderForward(cullResults, camera, renderLoop); |
|
|
|