浏览代码

Added more utility methods to VolumeProfile

/main
Thomas 7 年前
当前提交
4a72bd35
共有 1 个文件被更改,包括 50 次插入0 次删除
  1. 50
      ScriptableRenderPipeline/Core/CoreRP/Volume/VolumeProfile.cs

50
ScriptableRenderPipeline/Core/CoreRP/Volume/VolumeProfile.cs


using System;
using System.Collections.Generic;
using UnityEngine.Assertions;
namespace UnityEngine.Experimental.Rendering
{

return false;
}
public bool HasSubclassOf(Type type)
{
foreach (var component in components)
{
if (component.GetType().IsSubclassOf(type))
return true;
}
return false;
}
return TryGet(type, out component);
}
public bool TryGet<T>(Type type, out T component)
where T : VolumeComponent
{
component = null;
foreach (var comp in components)

}
return false;
}
public bool TryGetSubclassOf<T>(Type type, out T component)
where T : VolumeComponent
{
component = null;
foreach (var comp in components)
{
if (comp.GetType().IsSubclassOf(type))
{
component = (T)comp;
return true;
}
}
return false;
}
public bool TryGetAllSubclassOf<T>(Type type, List<T> component)
where T : VolumeComponent
{
Assert.IsNotNull(components);
int count = component.Count;
foreach (var comp in components)
{
if (comp.GetType().IsSubclassOf(type))
components.Add(comp);
}
return count != component.Count;
}
}
}
正在加载...
取消
保存