|
|
|
|
|
|
int m_refCounting; |
|
|
|
|
|
|
|
// For image based lighting
|
|
|
|
Material m_InitPreFGD; |
|
|
|
Material m_PreIntegratedFGDMaterial; |
|
|
|
RenderTexture m_PreIntegratedFGD; |
|
|
|
|
|
|
|
PreIntegratedFGD() |
|
|
|
|
|
|
|
|
|
|
if (m_refCounting == 0) |
|
|
|
{ |
|
|
|
m_InitPreFGD = CoreUtils.CreateEngineMaterial("Hidden/HDRenderPipeline/PreIntegratedFGD"); |
|
|
|
var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset; |
|
|
|
m_PreIntegratedFGDMaterial = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.preIntegratedFGD); |
|
|
|
|
|
|
|
m_PreIntegratedFGD = new RenderTexture(128, 128, 0, RenderTextureFormat.ARGB2101010, RenderTextureReadWrite.Linear); |
|
|
|
m_PreIntegratedFGD.hideFlags = HideFlags.HideAndDontSave; |
|
|
|
|
|
|
if (m_isInit) |
|
|
|
return; |
|
|
|
|
|
|
|
using (new ProfilingSample(cmd, "Init PreFGD")) |
|
|
|
using (new ProfilingSample(cmd, "PreIntegratedFGD Material Generation")) |
|
|
|
CoreUtils.DrawFullScreen(cmd, m_InitPreFGD, new RenderTargetIdentifier(m_PreIntegratedFGD)); |
|
|
|
CoreUtils.DrawFullScreen(cmd, m_PreIntegratedFGDMaterial, new RenderTargetIdentifier(m_PreIntegratedFGD)); |
|
|
|
} |
|
|
|
|
|
|
|
m_isInit = true; |
|
|
|
|
|
|
|
|
|
|
if (m_refCounting == 0) |
|
|
|
{ |
|
|
|
CoreUtils.Destroy(m_InitPreFGD); |
|
|
|
CoreUtils.Destroy(m_PreIntegratedFGDMaterial); |
|
|
|
CoreUtils.Destroy(m_PreIntegratedFGD); |
|
|
|
|
|
|
|
m_isInit = false; |
|
|
|