浏览代码

Merge pull request #1816 from Unity-Technologies/HDRP/decals/v2_1/ghost_fix

Hdrp/decals/v2 1/ghost fix
/main
GitHub 6 年前
当前提交
664f7384
共有 2 个文件被更改,包括 17 次插入10 次删除
  1. 1
      com.unity.render-pipelines.high-definition/CHANGELOG.md
  2. 26
      com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalProjectorComponent.cs

1
com.unity.render-pipelines.high-definition/CHANGELOG.md


### Fixed
- Fix HDReflectionProbe offset displayed in gizmo different than what is affected.
- Fix decals getting into a state where they could not be removed or disabled.
## [3.1.0-preview]

26
com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalProjectorComponent.cs


public event OnMaterialChangeDelegate OnMaterialChange;
public void OnValidate()
{
// handle material changes
if (m_OldMaterial != m_Material)
{
if (m_Handle != null) // don't do anything if OnEnable hasn't been called yet when scene is loading.
if (m_Handle != null)
DecalSystem.instance.RemoveDecal(m_Handle);
m_Handle = DecalSystem.instance.AddDecal(transform, sizeOffset, m_DrawDistance, m_FadeScale, uvScaleBias, m_AffectsTransparency, m_Material);
m_OldMaterial = m_Material;
// handle material changes, because decals are stored as sets sorted by material, if material changes decal needs to be removed and re-added to that it goes into correct set
if (m_OldMaterial != m_Material)
{
DecalSystem.instance.RemoveDecal(m_Handle);
m_Handle = DecalSystem.instance.AddDecal(transform, sizeOffset, m_DrawDistance, m_FadeScale, uvScaleBias, m_AffectsTransparency, m_Material);
m_OldMaterial = m_Material;
// notify the editor that material has changed so it can update the shader foldout
if (OnMaterialChange != null)
// notify the editor that material has changed so it can update the shader foldout
if (OnMaterialChange != null)
{
OnMaterialChange();
}
}
else // no material change, just update whatever else changed
OnMaterialChange();
DecalSystem.instance.UpdateCachedData(transform, sizeOffset, m_DrawDistance, m_FadeScale, uvScaleBias, m_AffectsTransparency, m_Handle);
}
}

正在加载...
取消
保存