浏览代码

Fixed shadowmap rendertargets getting lost upon scene change. Also added cleanup code for rendertargets.

/main
uygar 7 年前
当前提交
ce4c49e3
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 5
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Shadow/Shadow.cs

5
Assets/ScriptableRenderPipeline/HDRenderPipeline/Shadow/Shadow.cs


public class ShadowAtlas : ShadowmapBase, IDisposable
{
public const uint k_MaxCascadesInShader = 4;
protected readonly RenderTexture m_Shadowmap;
protected readonly RenderTargetIdentifier m_ShadowmapId;
protected readonly int m_TempDepthId;

public ShadowAtlas( ref AtlasInit init ) : base( ref init.baseInit )
{
m_Shadowmap = new RenderTexture( (int) m_Width, (int) m_Height, (int) m_ShadowmapBits, m_ShadowmapFormat, RenderTextureReadWrite.Linear );
m_Shadowmap.hideFlags = HideFlags.DontSaveInEditor | HideFlags.DontSaveInBuild;
m_Shadowmap.dimension = TextureDimension.Tex2DArray;
m_Shadowmap.volumeDepth = (int) m_Slices;
m_ShadowmapId = new RenderTargetIdentifier( m_Shadowmap );

public void Dispose()
{
// TODO: clean up resources if necessary
if( m_Shadowmap != null )
m_Shadowmap.Release();
}
override public bool Reserve( FrameId frameId, ref ShadowData shadowData, ShadowRequest sr, uint width, uint height, ref VectorArray<ShadowData> entries, ref VectorArray<ShadowPayload> payload, VisibleLight[] lights )

正在加载...
取消
保存