initial commit
This commit is contained in:
parent
6715289efe
commit
788c3389af
37645 changed files with 2526849 additions and 80 deletions
|
@ -0,0 +1,30 @@
|
|||
using UnityEditor.ShaderGraph.Internal;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
static class FieldExtensions
|
||||
{
|
||||
public static bool HasPreprocessor(this FieldDescriptor descriptor)
|
||||
{
|
||||
return (descriptor.preprocessor?.Length > 0);
|
||||
}
|
||||
|
||||
public static bool HasSemantic(this FieldDescriptor descriptor)
|
||||
{
|
||||
return (descriptor.semantic?.Length > 0);
|
||||
}
|
||||
|
||||
public static bool HasFlag(this FieldDescriptor descriptor, StructFieldOptions options)
|
||||
{
|
||||
return (descriptor.subscriptOptions & options) == options;
|
||||
}
|
||||
|
||||
public static string ToFieldString(this FieldDescriptor descriptor)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(descriptor.tag))
|
||||
return $"{descriptor.tag}.{descriptor.name}";
|
||||
else
|
||||
return descriptor.name;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 72e350503c76f40baac54cde32e52f97
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,36 @@
|
|||
using System.Linq;
|
||||
using UnityEditor.ShaderGraph.Internal;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
static class IConditionalExtensions
|
||||
{
|
||||
public static bool TestActive(this IConditional conditional, ActiveFields fields)
|
||||
{
|
||||
// Test FieldCondition against current active Fields
|
||||
bool TestFieldCondition(FieldCondition fieldCondition)
|
||||
{
|
||||
// Required active field is not active
|
||||
if (fieldCondition.condition == true && !fields.baseInstance.Contains(fieldCondition.field))
|
||||
return false;
|
||||
|
||||
// Required non-active field is active
|
||||
else if (fieldCondition.condition == false && fields.baseInstance.Contains(fieldCondition.field))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// No FieldConditions
|
||||
if (conditional.fieldConditions == null)
|
||||
return true;
|
||||
|
||||
// One or more FieldConditions failed
|
||||
if (conditional.fieldConditions.Where(x => !TestFieldCondition(x)).Any())
|
||||
return false;
|
||||
|
||||
// All FieldConditions passed
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1a22b696fd5d94fa4bd8972d644e4b97
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,42 @@
|
|||
using UnityEditor.ShaderGraph.Internal;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
static class StencilExtensions
|
||||
{
|
||||
public static string ToShaderString(this StencilDescriptor descriptor)
|
||||
{
|
||||
ShaderStringBuilder builder = new ShaderStringBuilder();
|
||||
builder.AppendLine("Stencil");
|
||||
using (builder.BlockScope())
|
||||
{
|
||||
string compBack = descriptor.CompBack != null && descriptor.CompBack.Length > 0 ? descriptor.CompBack : descriptor.Comp;
|
||||
string zFailBack = descriptor.ZFailBack != null && descriptor.ZFailBack.Length > 0 ? descriptor.ZFailBack : descriptor.ZFail;
|
||||
string failBack = descriptor.FailBack != null && descriptor.FailBack.Length > 0 ? descriptor.FailBack : descriptor.Fail;
|
||||
string passBack = descriptor.PassBack != null && descriptor.PassBack.Length > 0 ? descriptor.PassBack : descriptor.Pass;
|
||||
|
||||
if (descriptor.WriteMask != null && descriptor.WriteMask.Length > 0)
|
||||
builder.AppendLine($"WriteMask {descriptor.WriteMask}");
|
||||
if (descriptor.Ref != null && descriptor.Ref.Length > 0)
|
||||
builder.AppendLine($"Ref {descriptor.Ref}");
|
||||
if (descriptor.Comp != null && descriptor.Comp.Length > 0)
|
||||
builder.AppendLine($"CompFront {descriptor.Comp}");
|
||||
if (descriptor.ZFail != null && descriptor.ZFail.Length > 0)
|
||||
builder.AppendLine($"ZFailFront {descriptor.ZFail}");
|
||||
if (descriptor.Fail != null && descriptor.Fail.Length > 0)
|
||||
builder.AppendLine($"FailFront {descriptor.Fail}");
|
||||
if (descriptor.Pass != null && descriptor.Pass.Length > 0)
|
||||
builder.AppendLine($"PassFront {descriptor.Pass}");
|
||||
if (compBack != null && compBack.Length > 0)
|
||||
builder.AppendLine($"CompBack {compBack}");
|
||||
if (zFailBack != null && zFailBack.Length > 0)
|
||||
builder.AppendLine($"ZFailBack {zFailBack}");
|
||||
if (failBack != null && failBack.Length > 0)
|
||||
builder.AppendLine($"FailBack {failBack}");
|
||||
if (passBack != null && passBack.Length > 0)
|
||||
builder.AppendLine($"PassBack {passBack}");
|
||||
}
|
||||
return builder.ToCodeBlock();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 327469625c8594217818d346f9b91dd6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue