浏览代码

clean up api refactor

/main
Paul Melamed 7 年前
当前提交
92ea94ec
共有 2 个文件被更改,包括 8 次插入24 次删除
  1. 21
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalProjectorComponent.cs
  2. 11
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalSystem.cs

21
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalProjectorComponent.cs


m_Material = hdrp != null ? hdrp.GetDefaultDecalMaterial() : null;
}
DecalSystem.instance.AddDecal(this);
}
public void Start()
{
DecalSystem.instance.AddDecal(this);
if(m_Handle != null)
DecalSystem.instance.RemoveDecal(m_Handle);
m_Handle = DecalSystem.instance.AddDecal(transform, m_DrawDistance, m_FadeScale, m_Material);
DecalSystem.instance.RemoveDecal(this);
DecalSystem.instance.RemoveDecal(m_Handle);
m_Handle = null;
}
// Declare the method signature of the delegate to call.

// handle material changes
if (m_OldMaterial != m_Material)
{
Material tempMaterial = m_Material;
m_Material = m_OldMaterial;
if(m_Material != null)
DecalSystem.instance.RemoveDecal(this);
m_Material = tempMaterial;
DecalSystem.instance.AddDecal(this);
if( m_Handle != null)
DecalSystem.instance.RemoveDecal(m_Handle);
m_Handle = DecalSystem.instance.AddDecal(transform, m_DrawDistance, m_FadeScale, m_Material);
m_OldMaterial = m_Material;
// notify the editor that material has changed so it can update the shader foldout

11
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalSystem.cs


return decalSet.AddDecal(transform, drawDistance, fadeScale, key);
}
public void AddDecal(DecalProjectorComponent decal)
{
decal.Handle = AddDecal(decal.transform, decal.m_DrawDistance, decal.m_FadeScale, decal.m_Material);
}
public void RemoveDecal(DecalHandle handle)
{
if (!DecalHandle.IsValid(handle))

m_DecalSets.Remove(key);
}
}
}
// for compatibility with old code
public void RemoveDecal(DecalProjectorComponent decal)
{
RemoveDecal(decal.Handle);
}
public void UpdateCachedData(Transform transform, float drawDistance, float fadeScale, DecalHandle handle)

正在加载...
取消
保存