initial commit
This commit is contained in:
parent
6715289efe
commit
788c3389af
37645 changed files with 2526849 additions and 80 deletions
|
@ -0,0 +1,52 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[GenerationAPI]
|
||||
internal class AdditionalCommandCollection : IEnumerable<AdditionalCommandCollection.Item>
|
||||
{
|
||||
public class Item
|
||||
{
|
||||
public AdditionalCommandDescriptor field { get; }
|
||||
|
||||
public Item(AdditionalCommandDescriptor field)
|
||||
{
|
||||
this.field = field;
|
||||
}
|
||||
}
|
||||
|
||||
readonly List<AdditionalCommandCollection.Item> m_Items;
|
||||
|
||||
public AdditionalCommandCollection()
|
||||
{
|
||||
m_Items = new List<AdditionalCommandCollection.Item>();
|
||||
}
|
||||
|
||||
public AdditionalCommandCollection Add(AdditionalCommandCollection fields)
|
||||
{
|
||||
foreach (AdditionalCommandCollection.Item item in fields)
|
||||
{
|
||||
m_Items.Add(item);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public AdditionalCommandCollection Add(AdditionalCommandDescriptor field)
|
||||
{
|
||||
m_Items.Add(new Item(field));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IEnumerator<AdditionalCommandCollection.Item> GetEnumerator()
|
||||
{
|
||||
return m_Items.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bb1187e3c30c4233ae250a361c54f26b
|
||||
timeCreated: 1607707593
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
// this class is used to track asset dependencies in shadergraphs and subgraphs
|
||||
// that is: it tracks files that the shadergraph or subgraph must access to generate the shader
|
||||
// this data is used to automatically re-import the shadergraphs or subgraphs when any of the tracked files change
|
||||
[GenerationAPI]
|
||||
internal class AssetCollection
|
||||
{
|
||||
[Flags]
|
||||
public enum Flags
|
||||
{
|
||||
SourceDependency = 1 << 0, // ShaderGraph directly reads the source file in the Assets directory
|
||||
ArtifactDependency = 1 << 1, // ShaderGraph reads the import result artifact (i.e. subgraph import)
|
||||
IsSubGraph = 1 << 2, // This asset is a SubGraph (used when we need to get multiple levels of dependencies)
|
||||
IncludeInExportPackage = 1 << 3 // This asset should be pulled into any .unitypackages built via "Export Package.."
|
||||
}
|
||||
|
||||
internal Dictionary<GUID, Flags> assets = new Dictionary<GUID, Flags>();
|
||||
|
||||
internal IEnumerable<GUID> assetGUIDs { get { return assets.Keys; } }
|
||||
|
||||
public AssetCollection()
|
||||
{
|
||||
}
|
||||
|
||||
internal void Clear()
|
||||
{
|
||||
assets.Clear();
|
||||
}
|
||||
|
||||
// these are assets that we read the source files directly (directly reading the file out of the Assets directory)
|
||||
public void AddAssetDependency(GUID assetGUID, Flags flags)
|
||||
{
|
||||
if (assets.TryGetValue(assetGUID, out Flags existingFlags))
|
||||
{
|
||||
assets[assetGUID] = existingFlags | flags;
|
||||
}
|
||||
else
|
||||
{
|
||||
assets.Add(assetGUID, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 08492a28bc5e6d34e866bd3805598835
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,81 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[GenerationAPI]
|
||||
internal class DefineCollection : IEnumerable<DefineCollection.Item>
|
||||
{
|
||||
public class Item : IConditional
|
||||
{
|
||||
public KeywordDescriptor descriptor { get; }
|
||||
public FieldCondition[] fieldConditions { get; }
|
||||
public string value => descriptor.ToDefineString(index);
|
||||
// KeywordType.Boolean, index 0: disable, 1: enable
|
||||
// KeywordType.Enum, index into enum entries
|
||||
public int index { get; }
|
||||
|
||||
public Item(KeywordDescriptor descriptor, int index, FieldCondition[] fieldConditions)
|
||||
{
|
||||
this.descriptor = descriptor;
|
||||
this.fieldConditions = fieldConditions;
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
|
||||
readonly List<Item> m_Items;
|
||||
|
||||
public DefineCollection()
|
||||
{
|
||||
m_Items = new List<Item>();
|
||||
}
|
||||
|
||||
public DefineCollection(DefineCollection defines)
|
||||
{
|
||||
m_Items = new List<Item>();
|
||||
|
||||
foreach (DefineCollection.Item item in defines)
|
||||
{
|
||||
m_Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public DefineCollection Add(DefineCollection defines)
|
||||
{
|
||||
foreach (DefineCollection.Item item in defines)
|
||||
{
|
||||
m_Items.Add(item);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefineCollection Add(KeywordDescriptor descriptor, int index)
|
||||
{
|
||||
m_Items.Add(new Item(descriptor, index, null));
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefineCollection Add(KeywordDescriptor descriptor, int index, FieldCondition fieldCondition)
|
||||
{
|
||||
m_Items.Add(new Item(descriptor, index, new FieldCondition[] { fieldCondition }));
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefineCollection Add(KeywordDescriptor descriptor, int index, FieldCondition[] fieldConditions)
|
||||
{
|
||||
m_Items.Add(new Item(descriptor, index, fieldConditions));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IEnumerator<Item> GetEnumerator()
|
||||
{
|
||||
return m_Items.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 22d07a5bc43d34f468679d4f73e89485
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,51 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[GenerationAPI]
|
||||
internal class DependencyCollection : IEnumerable<DependencyCollection.Item>
|
||||
{
|
||||
public class Item
|
||||
{
|
||||
public FieldDependency dependency { get; }
|
||||
|
||||
public Item(FieldDependency dependency)
|
||||
{
|
||||
this.dependency = dependency;
|
||||
}
|
||||
}
|
||||
|
||||
readonly List<DependencyCollection.Item> m_Items;
|
||||
|
||||
public DependencyCollection()
|
||||
{
|
||||
m_Items = new List<DependencyCollection.Item>();
|
||||
}
|
||||
|
||||
public DependencyCollection Add(DependencyCollection dependencies)
|
||||
{
|
||||
foreach (DependencyCollection.Item item in dependencies)
|
||||
{
|
||||
m_Items.Add(item);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public DependencyCollection Add(FieldDependency dependency)
|
||||
{
|
||||
m_Items.Add(new Item(dependency));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IEnumerator<DependencyCollection.Item> GetEnumerator()
|
||||
{
|
||||
return m_Items.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: df0a9e9f6e86147bfb6586e2784afce1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,52 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[GenerationAPI]
|
||||
internal class FieldCollection : IEnumerable<FieldCollection.Item>
|
||||
{
|
||||
public class Item
|
||||
{
|
||||
public FieldDescriptor field { get; }
|
||||
|
||||
public Item(FieldDescriptor field)
|
||||
{
|
||||
this.field = field;
|
||||
}
|
||||
}
|
||||
|
||||
readonly List<FieldCollection.Item> m_Items;
|
||||
|
||||
public FieldCollection()
|
||||
{
|
||||
m_Items = new List<FieldCollection.Item>();
|
||||
}
|
||||
|
||||
public FieldCollection Add(FieldCollection fields)
|
||||
{
|
||||
foreach (FieldCollection.Item item in fields)
|
||||
{
|
||||
m_Items.Add(item);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldCollection Add(FieldDescriptor field)
|
||||
{
|
||||
m_Items.Add(new Item(field));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IEnumerator<FieldCollection.Item> GetEnumerator()
|
||||
{
|
||||
return m_Items.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ac41755acee97d247a7121e25babbb6a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,90 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[GenerationAPI]
|
||||
[Serializable]
|
||||
internal class IncludeCollection : IEnumerable<IncludeDescriptor>
|
||||
{
|
||||
[SerializeField]
|
||||
List<IncludeDescriptor> includes;
|
||||
|
||||
public IncludeCollection()
|
||||
{
|
||||
includes = new List<IncludeDescriptor>();
|
||||
}
|
||||
|
||||
public IncludeCollection Add(IncludeCollection includes)
|
||||
{
|
||||
if (includes != null)
|
||||
{
|
||||
foreach (var include in includes)
|
||||
{
|
||||
AddInternal(include.guid, include.path, include.location, include.fieldConditions);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public IncludeCollection Add(string includePath, IncludeLocation location)
|
||||
{
|
||||
var guid = AssetDatabase.AssetPathToGUID(includePath);
|
||||
return AddInternal(guid, includePath, location);
|
||||
}
|
||||
|
||||
public IncludeCollection Add(string includePath, IncludeLocation location, FieldCondition fieldCondition)
|
||||
{
|
||||
var guid = AssetDatabase.AssetPathToGUID(includePath);
|
||||
return AddInternal(guid, includePath, location, new FieldCondition[] { fieldCondition });
|
||||
}
|
||||
|
||||
public IncludeCollection Add(string includePath, IncludeLocation location, FieldCondition[] fieldConditions)
|
||||
{
|
||||
var guid = AssetDatabase.AssetPathToGUID(includePath);
|
||||
return AddInternal(guid, includePath, location, fieldConditions);
|
||||
}
|
||||
|
||||
public IncludeCollection AddInternal(string includeGUID, string includePath, IncludeLocation location, FieldCondition[] fieldConditions = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(includeGUID))
|
||||
{
|
||||
// either the file doesn't exist, or this is a placeholder
|
||||
// de-duplicate by path
|
||||
int existing = includes.FindIndex(i => i.path == includePath);
|
||||
if (existing < 0)
|
||||
includes.Add(new IncludeDescriptor(null, includePath, location, fieldConditions));
|
||||
return this;
|
||||
}
|
||||
else
|
||||
{
|
||||
// de-duplicate by GUID
|
||||
int existing = includes.FindIndex(i => i.guid == includeGUID);
|
||||
if (existing < 0)
|
||||
{
|
||||
// no duplicates, just add it
|
||||
includes.Add(new IncludeDescriptor(includeGUID, includePath, location, fieldConditions));
|
||||
}
|
||||
else
|
||||
{
|
||||
// duplicate file -- we could double check they are the same...
|
||||
// they might have different field conditions that require merging, for example.
|
||||
// But for now we'll just assume they are the same and drop the new one
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public IEnumerator<IncludeDescriptor> GetEnumerator()
|
||||
{
|
||||
return includes.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1f40793f6012b40af9d512ae612819f0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,66 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[GenerationAPI]
|
||||
internal class KeywordCollection : IEnumerable<KeywordCollection.Item>
|
||||
{
|
||||
public class Item : IConditional
|
||||
{
|
||||
public KeywordDescriptor descriptor { get; }
|
||||
public FieldCondition[] fieldConditions { get; }
|
||||
|
||||
public Item(KeywordDescriptor descriptor, FieldCondition[] fieldConditions)
|
||||
{
|
||||
this.descriptor = descriptor;
|
||||
this.fieldConditions = fieldConditions;
|
||||
}
|
||||
}
|
||||
|
||||
readonly List<Item> m_Items;
|
||||
|
||||
public KeywordCollection()
|
||||
{
|
||||
m_Items = new List<Item>();
|
||||
}
|
||||
|
||||
public KeywordCollection Add(KeywordCollection keywords)
|
||||
{
|
||||
foreach (KeywordCollection.Item item in keywords)
|
||||
{
|
||||
m_Items.Add(item);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public KeywordCollection Add(KeywordDescriptor descriptor)
|
||||
{
|
||||
m_Items.Add(new Item(descriptor, null));
|
||||
return this;
|
||||
}
|
||||
|
||||
public KeywordCollection Add(KeywordDescriptor descriptor, FieldCondition fieldCondition)
|
||||
{
|
||||
m_Items.Add(new Item(descriptor, new FieldCondition[] { fieldCondition }));
|
||||
return this;
|
||||
}
|
||||
|
||||
public KeywordCollection Add(KeywordDescriptor descriptor, FieldCondition[] fieldConditions)
|
||||
{
|
||||
m_Items.Add(new Item(descriptor, fieldConditions));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IEnumerator<Item> GetEnumerator()
|
||||
{
|
||||
return m_Items.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 657c4c9b7ac7f46f8931f7d44835ed37
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,66 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[GenerationAPI]
|
||||
internal class PassCollection : IEnumerable<PassCollection.Item>
|
||||
{
|
||||
public class Item : IConditional
|
||||
{
|
||||
public PassDescriptor descriptor { get; }
|
||||
public FieldCondition[] fieldConditions { get; }
|
||||
|
||||
public Item(PassDescriptor descriptor, FieldCondition[] fieldConditions)
|
||||
{
|
||||
this.descriptor = descriptor;
|
||||
this.fieldConditions = fieldConditions;
|
||||
}
|
||||
}
|
||||
|
||||
readonly List<Item> m_Items;
|
||||
|
||||
public PassCollection()
|
||||
{
|
||||
m_Items = new List<Item>();
|
||||
}
|
||||
|
||||
public PassCollection Add(PassCollection passes)
|
||||
{
|
||||
foreach (PassCollection.Item item in passes)
|
||||
{
|
||||
m_Items.Add(item);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public PassCollection Add(PassDescriptor descriptor)
|
||||
{
|
||||
m_Items.Add(new Item(descriptor, null));
|
||||
return this;
|
||||
}
|
||||
|
||||
public PassCollection Add(PassDescriptor descriptor, FieldCondition fieldCondition)
|
||||
{
|
||||
m_Items.Add(new Item(descriptor, new FieldCondition[] { fieldCondition }));
|
||||
return this;
|
||||
}
|
||||
|
||||
public PassCollection Add(PassDescriptor descriptor, FieldCondition[] fieldConditions)
|
||||
{
|
||||
m_Items.Add(new Item(descriptor, fieldConditions));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IEnumerator<Item> GetEnumerator()
|
||||
{
|
||||
return m_Items.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: db334d8d6638d482fa8537623d00034a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,67 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[GenerationAPI]
|
||||
internal class PragmaCollection : IEnumerable<PragmaCollection.Item>
|
||||
{
|
||||
public class Item : IConditional
|
||||
{
|
||||
public PragmaDescriptor descriptor { get; }
|
||||
public FieldCondition[] fieldConditions { get; }
|
||||
public string value => $"#pragma {descriptor.value}";
|
||||
|
||||
public Item(PragmaDescriptor descriptor, FieldCondition[] fieldConditions)
|
||||
{
|
||||
this.descriptor = descriptor;
|
||||
this.fieldConditions = fieldConditions;
|
||||
}
|
||||
}
|
||||
|
||||
readonly List<Item> m_Items;
|
||||
|
||||
public PragmaCollection()
|
||||
{
|
||||
m_Items = new List<Item>();
|
||||
}
|
||||
|
||||
public PragmaCollection Add(PragmaCollection pragmas)
|
||||
{
|
||||
foreach (PragmaCollection.Item item in pragmas)
|
||||
{
|
||||
m_Items.Add(item);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public PragmaCollection Add(PragmaDescriptor descriptor)
|
||||
{
|
||||
m_Items.Add(new Item(descriptor, null));
|
||||
return this;
|
||||
}
|
||||
|
||||
public PragmaCollection Add(PragmaDescriptor descriptor, FieldCondition fieldCondition)
|
||||
{
|
||||
m_Items.Add(new Item(descriptor, new FieldCondition[] { fieldCondition }));
|
||||
return this;
|
||||
}
|
||||
|
||||
public PragmaCollection Add(PragmaDescriptor descriptor, FieldCondition[] fieldConditions)
|
||||
{
|
||||
m_Items.Add(new Item(descriptor, fieldConditions));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IEnumerator<Item> GetEnumerator()
|
||||
{
|
||||
return m_Items.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b6fd360d8ee574e7d85d34a382a182f0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,67 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[GenerationAPI]
|
||||
internal class RenderStateCollection : IEnumerable<RenderStateCollection.Item>
|
||||
{
|
||||
public class Item : IConditional
|
||||
{
|
||||
public RenderStateDescriptor descriptor { get; }
|
||||
public FieldCondition[] fieldConditions { get; }
|
||||
public string value => descriptor.value;
|
||||
|
||||
public Item(RenderStateDescriptor descriptor, FieldCondition[] fieldConditions)
|
||||
{
|
||||
this.descriptor = descriptor;
|
||||
this.fieldConditions = fieldConditions;
|
||||
}
|
||||
}
|
||||
|
||||
readonly List<Item> m_Items;
|
||||
|
||||
public RenderStateCollection()
|
||||
{
|
||||
m_Items = new List<Item>();
|
||||
}
|
||||
|
||||
public RenderStateCollection Add(RenderStateCollection renderStates)
|
||||
{
|
||||
foreach (RenderStateCollection.Item item in renderStates)
|
||||
{
|
||||
m_Items.Add(item);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public RenderStateCollection Add(RenderStateDescriptor descriptor)
|
||||
{
|
||||
m_Items.Add(new Item(descriptor, null));
|
||||
return this;
|
||||
}
|
||||
|
||||
public RenderStateCollection Add(RenderStateDescriptor descriptor, FieldCondition fieldCondition)
|
||||
{
|
||||
m_Items.Add(new Item(descriptor, new FieldCondition[] { fieldCondition }));
|
||||
return this;
|
||||
}
|
||||
|
||||
public RenderStateCollection Add(RenderStateDescriptor descriptor, FieldCondition[] fieldConditions)
|
||||
{
|
||||
m_Items.Add(new Item(descriptor, fieldConditions));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IEnumerator<Item> GetEnumerator()
|
||||
{
|
||||
return m_Items.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e36bca8c61396497dbd25f2091daa9c6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,66 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[GenerationAPI]
|
||||
internal class StructCollection : IEnumerable<StructCollection.Item>
|
||||
{
|
||||
public class Item : IConditional
|
||||
{
|
||||
public StructDescriptor descriptor { get; }
|
||||
public FieldCondition[] fieldConditions { get; }
|
||||
|
||||
public Item(StructDescriptor descriptor, FieldCondition[] fieldConditions)
|
||||
{
|
||||
this.descriptor = descriptor;
|
||||
this.fieldConditions = fieldConditions;
|
||||
}
|
||||
}
|
||||
|
||||
readonly List<StructCollection.Item> m_Items;
|
||||
|
||||
public StructCollection()
|
||||
{
|
||||
m_Items = new List<StructCollection.Item>();
|
||||
}
|
||||
|
||||
public StructCollection Add(StructCollection structs)
|
||||
{
|
||||
foreach (StructCollection.Item item in structs)
|
||||
{
|
||||
m_Items.Add(item);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public StructCollection Add(StructDescriptor descriptor)
|
||||
{
|
||||
m_Items.Add(new StructCollection.Item(descriptor, null));
|
||||
return this;
|
||||
}
|
||||
|
||||
public StructCollection Add(StructDescriptor descriptor, FieldCondition fieldCondition)
|
||||
{
|
||||
m_Items.Add(new StructCollection.Item(descriptor, new FieldCondition[] { fieldCondition }));
|
||||
return this;
|
||||
}
|
||||
|
||||
public StructCollection Add(StructDescriptor descriptor, FieldCondition[] fieldConditions)
|
||||
{
|
||||
m_Items.Add(new StructCollection.Item(descriptor, fieldConditions));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IEnumerator<StructCollection.Item> GetEnumerator()
|
||||
{
|
||||
return m_Items.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 22719ef12eb4042bfb2c5268c688f4bf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue