initial commit

This commit is contained in:
Jo 2025-01-07 02:06:59 +01:00
parent 6715289efe
commit 788c3389af
37645 changed files with 2526849 additions and 80 deletions

View file

@ -0,0 +1,13 @@
namespace UnityEditor.ShaderGraph
{
enum GenerationMode
{
Preview,
ForReals,
VFX
}
static class GenerationModeExtensions
{
public static bool IsPreview(this GenerationMode mode) { return mode == GenerationMode.Preview; }
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 588ff2dc785e37f408eb9e48a18127d0
timeCreated: 1480587334
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 20d63795c62940409089af61496db945
timeCreated: 1513348939

View file

@ -0,0 +1,27 @@
using System;
using UnityEngine;
namespace UnityEditor.Graphing
{
[Serializable]
struct DrawState
{
[SerializeField]
private bool m_Expanded;
[SerializeField]
private Rect m_Position;
public bool expanded
{
get { return m_Expanded; }
set { m_Expanded = value; }
}
public Rect position
{
get { return m_Position; }
set { m_Position = value; }
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c85b5b63a005833438cd315d952735de
timeCreated: 1464272094
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace UnityEditor.Graphing
{
[Serializable]
class GraphDrawingData : ISerializationCallbackReceiver
{
[SerializeField]
private List<string> m_SerializableSelection = new List<string>();
[NonSerialized]
private List<Guid> m_Selection = new List<Guid>();
public IEnumerable<Guid> selection
{
get { return m_Selection; }
set
{
m_Selection.Clear();
m_Selection.AddRange(value);
}
}
public void OnBeforeSerialize()
{
m_SerializableSelection.Clear();
m_SerializableSelection.AddRange(m_Selection.Select(x => x.ToString()));
}
public void OnAfterDeserialize()
{
selection = m_SerializableSelection.Select(x => new Guid(x));
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4bc9112caeee14b29b0a521463985007
timeCreated: 1482330187
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,10 @@
using System;
namespace UnityEditor.Graphing
{
interface IEdge : IEquatable<IEdge>
{
SlotReference outputSlot { get; }
SlotReference inputSlot { get; }
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2f67813c9628ef14a839d0c546f6ab25
timeCreated: 1464264924
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using UnityEditor.ShaderGraph;
namespace UnityEditor.Graphing
{
enum ModificationScope
{
Nothing = 0,
Node = 1,
Graph = 2,
Topological = 3,
Layout = 4
}
delegate void OnNodeModified(AbstractMaterialNode node, ModificationScope scope);
static class NodeExtensions
{
public static IEnumerable<T> GetSlots<T>(this AbstractMaterialNode node) where T : MaterialSlot
{
var slots = new List<T>();
node.GetSlots(slots);
return slots;
}
public static IEnumerable<T> GetInputSlots<T>(this AbstractMaterialNode node) where T : MaterialSlot
{
var slots = new List<T>();
node.GetInputSlots(slots);
return slots;
}
public static IEnumerable<T> GetInputSlots<T>(this AbstractMaterialNode node, MaterialSlot startingSlot) where T : MaterialSlot
{
var slots = new List<T>();
node.GetInputSlots(startingSlot, slots);
return slots;
}
public static IEnumerable<T> GetOutputSlots<T>(this AbstractMaterialNode node) where T : MaterialSlot
{
var slots = new List<T>();
node.GetOutputSlots(slots);
return slots;
}
public static IEnumerable<T> GetOutputSlots<T>(this AbstractMaterialNode node, MaterialSlot startingSlot) where T : MaterialSlot
{
var slots = new List<T>();
node.GetOutputSlots(startingSlot, slots);
return slots;
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b16d3bd20d4d2c644969258425ff071a
timeCreated: 1464264925
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,7 @@
namespace UnityEditor.Graphing
{
interface IOnAssetEnabled
{
void OnEnable();
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ed722b1f9c66a7441b3893cec3e3ff4d
timeCreated: 1468409044
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,58 @@
using System;
using UnityEditor.ShaderGraph;
using UnityEditor.ShaderGraph.Serialization;
using UnityEngine;
namespace UnityEditor.Graphing
{
[Serializable]
struct SlotReference : IEquatable<SlotReference>, IComparable<SlotReference>
{
[SerializeField]
JsonRef<AbstractMaterialNode> m_Node;
[SerializeField]
int m_SlotId;
public SlotReference(AbstractMaterialNode node, int slotId)
{
m_Node = node;
m_SlotId = slotId;
}
public AbstractMaterialNode node => m_Node;
// public Guid nodeGuid => m_Node.value.guid;
public int slotId => m_SlotId;
public MaterialSlot slot => m_Node.value?.FindSlot<MaterialSlot>(m_SlotId);
public bool Equals(SlotReference other) => m_SlotId == other.m_SlotId && m_Node.value == other.m_Node.value;
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
return obj.GetType() == GetType() && Equals((SlotReference)obj);
}
public override int GetHashCode()
{
unchecked
{
return (m_SlotId * 397) ^ m_Node.GetHashCode();
}
}
public int CompareTo(SlotReference other)
{
var nodeIdComparison = m_Node.value.objectId.CompareTo(other.m_Node.value.objectId);
if (nodeIdComparison != 0)
{
return nodeIdComparison;
}
return m_SlotId.CompareTo(other.m_SlotId);
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a7b6f306850f6cc449bc71d8d2384146
timeCreated: 1464264925
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,17 @@
namespace UnityEditor.Graphing
{
interface ICanChangeShaderGUI
{
string ShaderGUIOverride
{
get;
set;
}
bool OverrideEnabled
{
get;
set;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c645ecec95c53644b9b9777b4faeb75d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,7 @@
namespace UnityEditor.ShaderGraph
{
interface IGeneratesBodyCode
{
void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMode);
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 86155a20c88c9104cac95b7d74ae60dc
timeCreated: 1480587334
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,7 @@
namespace UnityEditor.ShaderGraph
{
interface IGeneratesFunction
{
void GenerateNodeFunction(FunctionRegistry registry, GenerationMode generationMode);
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cd53f18c76af5ab40bad30c1af8e06a0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,12 @@
using System;
using GraphData = UnityEditor.ShaderGraph.GraphData;
namespace UnityEditor.ShaderGraph
{
// An action takes in a reference to a GraphData object and performs some modification on it
interface IGraphDataAction
{
Action<GraphData> modifyGraphDataAction { get; }
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 88c8683c5bbe401583d1c11a0e8af1f1
timeCreated: 1608253648

View file

@ -0,0 +1,9 @@
using System;
namespace UnityEditor.ShaderGraph
{
interface IGroupItem
{
GroupData group { get; set; }
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 677dc1dfd5805074db4920be65a9d9d4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,11 @@
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Internal;
namespace UnityEditor.ShaderGraph
{
interface IHasCustomDeprecationMessage
{
public void GetCustomDeprecationMessage(out string deprecationString, out string buttonText, out string labelText, out MessageType messageType);
public string GetCustomDeprecationLabel();
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d66b353e44dc4eb418b5d5b6c28a82a9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,21 @@
using System;
using System.Reflection;
using UnityEngine.UIElements;
namespace UnityEditor.ShaderGraph.Drawing
{
interface IInspectable
{
// Implementors can override this in order to display their desired string when selected and viewed through the inspector
string inspectorTitle { get; }
// This function should return the underlying data object that user wishes to expose to the Inspector
// For simple data properties like Integers/Floats this is the object that contains the properties
// For complex types like GraphData this is the GraphData itself, its up to the PropertyDrawer to define what it needs
object GetObjectToInspect();
// Used to provide any data needed by the property drawer from the inspectable
// The inspectorUpdateDelegate is used to trigger an inspector update
void SupplyDataToPropertyDrawer(IPropertyDrawer propertyDrawer, Action inspectorUpdateDelegate);
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 52cd086fd60734d89b34f49bd73e7510
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,19 @@
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Internal;
namespace UnityEditor.ShaderGraph
{
interface IMayRequireBitangent
{
NeededCoordinateSpace RequiresBitangent(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
static class MayRequireBitangentExtensions
{
public static NeededCoordinateSpace RequiresBitangent(this MaterialSlot slot)
{
var mayRequireBitangent = slot as IMayRequireBitangent;
return mayRequireBitangent != null ? mayRequireBitangent.RequiresBitangent() : NeededCoordinateSpace.None;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2d413641b2ef00944932ea717573480f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,18 @@
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
interface IMayRequireCameraOpaqueTexture
{
bool RequiresCameraOpaqueTexture(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
static class MayRequireCameraOpaqueTextureExtensions
{
public static bool RequiresCameraOpaqueTexture(this MaterialSlot slot)
{
var mayRequireCameraOpaqueTexture = slot as IMayRequireCameraOpaqueTexture;
return mayRequireCameraOpaqueTexture != null && mayRequireCameraOpaqueTexture.RequiresCameraOpaqueTexture();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 93fdbd040dca943cbbd42c33416450a6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,18 @@
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
interface IMayRequireDepthTexture
{
bool RequiresDepthTexture(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
static class MayRequireDepthTextureExtensions
{
public static bool RequiresDepthTexture(this MaterialSlot slot)
{
var mayRequireDepthTexture = slot as IMayRequireDepthTexture;
return mayRequireDepthTexture != null && mayRequireDepthTexture.RequiresDepthTexture();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6f00cea5e23a84b5bbe1ac581ebfc64e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,18 @@
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
interface IMayRequireFaceSign
{
bool RequiresFaceSign(ShaderStageCapability stageCapability = ShaderStageCapability.Fragment);
}
static class IMayRequireFaceSignExtensions
{
public static bool RequiresFaceSign(this MaterialSlot slot)
{
var mayRequireFaceSign = slot as IMayRequireFaceSign;
return mayRequireFaceSign != null && mayRequireFaceSign.RequiresFaceSign();
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 23f5d9c2f1ec442a7b8c59e893a6724d
timeCreated: 1512469767

View file

@ -0,0 +1,19 @@
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Internal;
namespace UnityEditor.ShaderGraph
{
interface IMayRequireMeshUV
{
bool RequiresMeshUV(UVChannel channel, ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
static class MayRequireMeshUVExtensions
{
public static bool RequiresMeshUV(this MaterialSlot slot, UVChannel channel)
{
var mayRequireMeshUV = slot as IMayRequireMeshUV;
return mayRequireMeshUV != null && mayRequireMeshUV.RequiresMeshUV(channel);
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c23e123c3ff140c997d68b663b484f29
timeCreated: 1512469718

View file

@ -0,0 +1,19 @@
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Internal;
namespace UnityEditor.ShaderGraph
{
interface IMayRequireNormal
{
NeededCoordinateSpace RequiresNormal(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
static class MayRequireNormalExtensions
{
public static NeededCoordinateSpace RequiresNormal(this MaterialSlot slot)
{
var mayRequireNormal = slot as IMayRequireNormal;
return mayRequireNormal != null ? mayRequireNormal.RequiresNormal() : NeededCoordinateSpace.None;
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 51bb8f11fbcf43f9bcec6418f1991397
timeCreated: 1504092018

View file

@ -0,0 +1,19 @@
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Internal;
namespace UnityEditor.ShaderGraph
{
interface IMayRequirePosition
{
NeededCoordinateSpace RequiresPosition(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
static class MayRequirePositionExtensions
{
public static NeededCoordinateSpace RequiresPosition(this MaterialSlot slot)
{
var mayRequirePosition = slot as IMayRequirePosition;
return mayRequirePosition != null ? mayRequirePosition.RequiresPosition() : NeededCoordinateSpace.None;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5ab44fbceb0a1074899755c19bcd75cd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,19 @@
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Internal;
namespace UnityEditor.ShaderGraph
{
interface IMayRequirePositionPredisplacement
{
NeededCoordinateSpace RequiresPositionPredisplacement(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
static class MayRequirePositionPredisplacementExtensions
{
public static NeededCoordinateSpace RequiresPositionPredisplacement(this MaterialSlot slot)
{
var mayRequirePositionPredisplacement = slot as IMayRequirePositionPredisplacement;
return mayRequirePositionPredisplacement != null ? mayRequirePositionPredisplacement.RequiresPositionPredisplacement() : NeededCoordinateSpace.None;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 373b5414d0e188d40a2ece99c22d0915
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,18 @@
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
interface IMayRequireScreenPosition
{
bool RequiresScreenPosition(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
static class MayRequireScreenPositionExtensions
{
public static bool RequiresScreenPosition(this MaterialSlot slot, ShaderStageCapability stageCapability = ShaderStageCapability.All)
{
var mayRequireScreenPosition = slot as IMayRequireScreenPosition;
return mayRequireScreenPosition != null && mayRequireScreenPosition.RequiresScreenPosition(stageCapability);
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f7223ad4b07146cc98966aad000f017d
timeCreated: 1512469767

View file

@ -0,0 +1,19 @@
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Internal;
namespace UnityEditor.ShaderGraph
{
interface IMayRequireTangent
{
NeededCoordinateSpace RequiresTangent(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
static class MayRequireTangentExtensions
{
public static NeededCoordinateSpace RequiresTangent(this MaterialSlot slot)
{
var mayRequireTangent = slot as IMayRequireTangent;
return mayRequireTangent != null ? mayRequireTangent.RequiresTangent() : NeededCoordinateSpace.None;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ab1ebec1bc4dee54c9b0df228d5f6609
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,18 @@
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
interface IMayRequireTime
{
bool RequiresTime();
}
static class MayRequireTimeExtensions
{
public static bool RequiresTime(this AbstractMaterialNode node)
{
return node is IMayRequireTime mayRequireTime && mayRequireTime.RequiresTime();
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 275b56f32a48a0f4ab244ca9aa3884c9
timeCreated: 1480587334
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,55 @@
using System.Collections.Generic;
using UnityEditor.ShaderGraph.Internal;
namespace UnityEditor.ShaderGraph
{
public struct NeededTransform
{
static Dictionary<UnityMatrixType, NeededTransform> s_TransformMap = new Dictionary<UnityMatrixType, NeededTransform>
{
{UnityMatrixType.Model, ObjectToWorld},
{UnityMatrixType.InverseModel, WorldToObject},
// TODO: Define the rest.
{UnityMatrixType.View, None},
{UnityMatrixType.InverseView, None},
{UnityMatrixType.Projection, None},
{UnityMatrixType.InverseProjection, None},
{UnityMatrixType.ViewProjection, None},
{UnityMatrixType.InverseViewProjection, None},
};
public static NeededTransform None => new NeededTransform(NeededCoordinateSpace.None, NeededCoordinateSpace.None);
public static NeededTransform ObjectToWorld => new NeededTransform(NeededCoordinateSpace.Object, NeededCoordinateSpace.World);
public static NeededTransform WorldToObject => new NeededTransform(NeededCoordinateSpace.World, NeededCoordinateSpace.Object);
public NeededTransform(NeededCoordinateSpace from, NeededCoordinateSpace to)
{
this.from = from;
this.to = to;
}
// Secondary constructor for certain nodes like TransformationMatrix.
internal NeededTransform(UnityMatrixType matrix)
{
if (s_TransformMap.TryGetValue(matrix, out var transform))
{
from = transform.from;
to = transform.to;
}
else
{
from = NeededCoordinateSpace.None;
to = NeededCoordinateSpace.None;
}
}
public NeededCoordinateSpace from;
public NeededCoordinateSpace to;
}
interface IMayRequireTransform
{
NeededTransform[] RequiresTransform(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: bd5f4be1039f4da9bbd03e729e6c6a69
timeCreated: 1617224689

View file

@ -0,0 +1,18 @@
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
interface IMayRequireVertexColor
{
bool RequiresVertexColor(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
static class MayRequireVertexColorExtensions
{
public static bool RequiresVertexColor(this MaterialSlot slot)
{
var mayRequireVertexColor = slot as IMayRequireVertexColor;
return mayRequireVertexColor != null && mayRequireVertexColor.RequiresVertexColor();
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 04d654703054418c8db537b52ae070dc
timeCreated: 1512469863

View file

@ -0,0 +1,18 @@
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
interface IMayRequireVertexID
{
bool RequiresVertexID(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
static class MayRequireVertexIDExtensions
{
public static bool RequiresVertexID(this MaterialSlot slot)
{
var mayRequireVertexID = slot as IMayRequireVertexID;
return mayRequireVertexID != null && mayRequireVertexID.RequiresVertexID();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 24d1bff64cfacf64fa3c29ef816872fa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,18 @@
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
interface IMayRequireVertexSkinning
{
bool RequiresVertexSkinning(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
static class MayRequireVertexSkinningExtensions
{
public static bool RequiresVertexSkinning(this MaterialSlot slot)
{
var mayRequireVertexSkinning = slot as IMayRequireVertexSkinning;
return mayRequireVertexSkinning != null && mayRequireVertexSkinning.RequiresVertexSkinning();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dd3bcb98d108fd940bff837c2363725a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,19 @@
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Internal;
namespace UnityEditor.ShaderGraph
{
interface IMayRequireViewDirection
{
NeededCoordinateSpace RequiresViewDirection(ShaderStageCapability stageCapability = ShaderStageCapability.All);
}
static class MayRequireViewDirectionExtensions
{
public static NeededCoordinateSpace RequiresViewDirection(this MaterialSlot slot)
{
var mayRequireViewDirection = slot as IMayRequireViewDirection;
return mayRequireViewDirection != null ? mayRequireViewDirection.RequiresViewDirection() : NeededCoordinateSpace.None;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8d9d2a94c350c0d4791c2220a26a54b0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,23 @@
namespace UnityEditor.ShaderGraph
{
public interface IMaySupportVFX
{
bool SupportsVFX();
bool CanSupportVFX();
}
static class MaySupportVFXExtensions
{
public static bool SupportsVFX(this Target target)
{
var vfxTarget = target as IMaySupportVFX;
return vfxTarget != null && vfxTarget.SupportsVFX();
}
public static bool CanSupportVFX(this Target target)
{
var vfxTarget = target as IMaySupportVFX;
return vfxTarget != null && vfxTarget.CanSupportVFX();
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f908e994cc0047c99385d710cbbb0853
timeCreated: 1617040225

View file

@ -0,0 +1,15 @@
using System;
using System.Reflection;
using UnityEditor.ShaderGraph.Drawing;
using UnityEngine.UIElements;
namespace UnityEditor.ShaderGraph.Drawing
{
// Interface that should be implemented by any property drawer for the inspector view
public interface IPropertyDrawer
{
Action inspectorUpdateDelegate { get; set; }
VisualElement DrawProperty(PropertyInfo propertyInfo, object actualObject, InspectableAttribute attribute);
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e370946d202a43edaabc0940f13932cd
timeCreated: 1588090693

View file

@ -0,0 +1,88 @@
using System;
using System.Linq;
namespace UnityEditor.ShaderGraph.Internal
{
[Flags]
public enum NeededCoordinateSpace
{
None = 0,
Object = 1 << 0,
View = 1 << 1,
World = 1 << 2,
Tangent = 1 << 3,
AbsoluteWorld = 1 << 4
}
public enum CoordinateSpace
{
Object,
View,
World,
Tangent,
AbsoluteWorld
}
public enum InterpolatorType
{
Normal,
BiTangent,
Tangent,
ViewDirection,
Position,
PositionPredisplacement,
}
public static class CoordinateSpaceExtensions
{
static int s_SpaceCount = Enum.GetValues(typeof(CoordinateSpace)).Length;
static int s_InterpolatorCount = Enum.GetValues(typeof(InterpolatorType)).Length;
static string[] s_VariableNames = new string[s_SpaceCount * s_InterpolatorCount];
public static string ToVariableName(this CoordinateSpace space, InterpolatorType type)
{
var index = (int)space + (int)type * s_SpaceCount;
if (string.IsNullOrEmpty(s_VariableNames[index]))
s_VariableNames[index] = string.Format("{0}Space{1}", space, type);
return s_VariableNames[index];
}
public static NeededCoordinateSpace ToNeededCoordinateSpace(this CoordinateSpace space)
{
switch (space)
{
case CoordinateSpace.Object:
return NeededCoordinateSpace.Object;
case CoordinateSpace.View:
return NeededCoordinateSpace.View;
case CoordinateSpace.World:
return NeededCoordinateSpace.World;
case CoordinateSpace.Tangent:
return NeededCoordinateSpace.Tangent;
case CoordinateSpace.AbsoluteWorld:
return NeededCoordinateSpace.AbsoluteWorld;
default:
throw new ArgumentOutOfRangeException(nameof(space), space, null);
}
}
public static CoordinateSpace ToCoordinateSpace(this NeededCoordinateSpace space)
{
switch (space)
{
case NeededCoordinateSpace.Object:
return CoordinateSpace.Object;
case NeededCoordinateSpace.View:
return CoordinateSpace.View;
case NeededCoordinateSpace.World:
return CoordinateSpace.World;
case NeededCoordinateSpace.Tangent:
return CoordinateSpace.Tangent;
case NeededCoordinateSpace.AbsoluteWorld:
return CoordinateSpace.AbsoluteWorld;
default:
throw new ArgumentOutOfRangeException(nameof(space), space, null);
}
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8ad845bb8ef34e4589bcf630a8a8a31a
timeCreated: 1505627582

View file

@ -0,0 +1,10 @@
using System;
namespace UnityEditor.ShaderGraph.Internal
{
public enum PositionSource
{
Default,
Predisplacement,
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 70269079c1aecc24b9897ff3c7369854
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: