浏览代码
Abstracted the volume stack to allow for custom stack management; simplified the domain reload code
/namespace
Abstracted the volume stack to allow for custom stack management; simplified the domain reload code
/namespace
Thomas
7 年前
当前提交
fe53c258
共有 3 个文件被更改,包括 92 次插入 和 60 次删除
-
87ScriptableRenderPipeline/Core/Volume/VolumeManager.cs
-
54ScriptableRenderPipeline/Core/Volume/VolumeStack.cs
-
11ScriptableRenderPipeline/Core/Volume/VolumeStack.cs.meta
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering |
|||
{ |
|||
public sealed class VolumeStack : IDisposable |
|||
{ |
|||
// Holds the state of _all_ component types you can possibly add on volumes
|
|||
public readonly Dictionary<Type, VolumeComponent> components; |
|||
|
|||
internal VolumeStack(IEnumerable<Type> baseTypes) |
|||
{ |
|||
components = new Dictionary<Type, VolumeComponent>(); |
|||
|
|||
foreach (var type in baseTypes) |
|||
{ |
|||
var inst = (VolumeComponent)ScriptableObject.CreateInstance(type); |
|||
components.Add(type, inst); |
|||
} |
|||
} |
|||
|
|||
public bool HasComponent<T>() |
|||
{ |
|||
return HasComponent(typeof(T)); |
|||
} |
|||
|
|||
public bool HasComponent(Type type) |
|||
{ |
|||
return components.ContainsKey(type); |
|||
} |
|||
|
|||
public T GetComponent<T>() |
|||
where T : VolumeComponent |
|||
{ |
|||
var comp = GetComponent(typeof(T)); |
|||
return (T)comp; |
|||
} |
|||
|
|||
public VolumeComponent GetComponent(Type type) |
|||
{ |
|||
VolumeComponent comp; |
|||
components.TryGetValue(type, out comp); |
|||
return comp; |
|||
} |
|||
|
|||
public void Dispose() |
|||
{ |
|||
foreach (var component in components) |
|||
CoreUtils.Destroy(component.Value); |
|||
|
|||
components.Clear(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7af226ce5122db0409963decbabf9d9b |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue