浏览代码
Merge branch 'hackweek2017' of https://github.com/stramit/MaterialGraph into hackweek2017
/main
Merge branch 'hackweek2017' of https://github.com/stramit/MaterialGraph into hackweek2017
/main
Matt Dean
8 年前
当前提交
eeb9f4ff
共有 8 个文件被更改,包括 146 次插入 和 13 次删除
-
7MaterialGraphProject/Assets/Andre/Nodes/ToggleNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/ColorNodePresenter.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/PropertyChunkTests.cs
-
23MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/ColorNode.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Util/ColorPropertyChunk.cs
-
31MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Util/FloatPropertyChunk.cs
-
64MaterialGraphProject/Assets/Eduardo/VertexNormalNode.cs
-
12MaterialGraphProject/Assets/Eduardo/VertexNormalNode.cs.meta
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Input/Geometry/Vertex Normal")] |
|||
public class VertexNormalNode : AbstractMaterialNode |
|||
{ |
|||
private const string kOutputSlotName = "XYZW"; |
|||
private const string kOutputSlotNameXYZ = "XYZ"; |
|||
private const string kOutputSlotNameX = "X"; |
|||
private const string kOutputSlotNameY = "Y"; |
|||
private const string kOutputSlotNameZ = "Z"; |
|||
private const string kOutputSlotNameW = "W"; |
|||
|
|||
public const int OutputSlotId = 0; |
|||
public const int OutputSlotIdXYZ = 1; |
|||
public const int OutputSlotIdX = 2; |
|||
public const int OutputSlotIdY = 3; |
|||
public const int OutputSlotIdZ = 4; |
|||
public const int OutputSlotIdW = 5; |
|||
|
|||
public VertexNormalNode() |
|||
{ |
|||
name = "VertexNormal"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new MaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Vector4, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdXYZ, kOutputSlotNameXYZ, kOutputSlotNameXYZ, SlotType.Output, SlotValueType.Vector3, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdX, kOutputSlotNameX, kOutputSlotNameX, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdY, kOutputSlotNameY, kOutputSlotNameY, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdZ, kOutputSlotNameZ, kOutputSlotNameZ, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdW, kOutputSlotNameW, kOutputSlotNameW, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
|
|||
RemoveSlotsNameNotMatching(validSlots); |
|||
} |
|||
|
|||
protected int[] validSlots |
|||
{ |
|||
get { return new[] { OutputSlotId, OutputSlotIdXYZ, OutputSlotIdX, OutputSlotIdY, OutputSlotIdZ, OutputSlotIdW }; } |
|||
} |
|||
|
|||
public override string GetVariableNameForSlot(int slotId) |
|||
{ |
|||
switch (slotId) |
|||
{ |
|||
case OutputSlotIdXYZ: |
|||
return "v.normal.xyz"; |
|||
case OutputSlotIdX: |
|||
return "v.normal.x"; |
|||
case OutputSlotIdY: |
|||
return "v.normal.y"; |
|||
case OutputSlotIdZ: |
|||
return "v.normal.z"; |
|||
case OutputSlotIdW: |
|||
return "v.normal.w"; |
|||
default: |
|||
return "v.normal"; |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c5532eff58cce43468e6f88386d8ac1c |
|||
timeCreated: 1495660146 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue