浏览代码

Store material ID instead of material reference in the DecalHandle

/main
Paul Melamed 7 年前
当前提交
bd99fade
共有 1 个文件被更改,包括 8 次插入10 次删除
  1. 18
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalSystem.cs

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


public class DecalHandle
{
public DecalHandle(int index, Material material)
public DecalHandle(int index, int materialID)
m_Material = material;
m_MaterialID = materialID;
m_Index = index;
}

return false;
if (handle.m_Material == null)
return false;
public Material m_Material; // identifies decal set
public int m_MaterialID; // identifies decal set
public int m_Index; // identifies decal within the set
}

m_BoundingSpheres[index] = GetDecalProjectBoundingSphere(m_CachedDecalToWorld[index]);
}
public DecalHandle AddDecal(Transform transform, float drawDistance, float fadeScale, Material material)
public DecalHandle AddDecal(Transform transform, float drawDistance, float fadeScale, int materialID)
{
// increase array size if no space left
if (m_DecalsCount == m_Handles.Length)

m_CachedDrawDistances = newCachedDrawDistances;
}
DecalHandle decalHandle = new DecalHandle(m_DecalsCount, material);
DecalHandle decalHandle = new DecalHandle(m_DecalsCount, materialID);
m_Handles[m_DecalsCount] = decalHandle;
UpdateCachedData(transform, drawDistance, fadeScale, decalHandle);
m_DecalsCount++;

decalSet = new DecalSet(material);
m_DecalSets.Add(key, decalSet);
}
return decalSet.AddDecal(transform, drawDistance, fadeScale, material);
return decalSet.AddDecal(transform, drawDistance, fadeScale, key);
}
public void AddDecal(DecalProjectorComponent decal)

return;
DecalSet decalSet = null;
int key = handle.m_Material.GetInstanceID();
int key = handle.m_MaterialID;
if (m_DecalSets.TryGetValue(key, out decalSet))
{
decalSet.RemoveDecal(handle);

return;
DecalSet decalSet = null;
int key = handle.m_Material.GetInstanceID();
int key = handle.m_MaterialID;
if (m_DecalSets.TryGetValue(key, out decalSet))
{
decalSet.UpdateCachedData(transform, drawDistance, fadeScale, handle);

正在加载...
取消
保存