浏览代码

Input Part 2

Input/Geometry
/main
Matt Dean 7 年前
当前提交
f3353a02
共有 14 个文件被更改,包括 13 次插入87 次删除
  1. 1
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/AbstractMaterialGraph.cs
  2. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/BitangentNode.cs
  3. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/NormalNode.cs
  4. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/PositionNode.cs
  5. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/TangentNode.cs
  6. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/UVNode.cs
  7. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/VertexColorNode.cs
  8. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/ViewDirectionNode.cs
  9. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Util/ShaderGenerator.cs
  10. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/GradientNode.cs
  11. 12
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/VertexNormalNode.cs.meta
  12. 64
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/VertexNormalNode.cs
  13. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/GradientNode.cs.meta
  14. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/GradientNode.cs

1
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/AbstractMaterialGraph.cs


float4 vertex : POSITION;
float3 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR;
float4 texcoord0 : TEXCOORD0;
float4 lightmapUV : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/BitangentNode.cs


public class BitangentNode : GeometryNode, IMayRequireBitangent
{
public const int kOutputSlotId = 0;
public const string kOutputSlotName = "Bitangent";
public const string kOutputSlotName = "Out";
public BitangentNode()
{

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/NormalNode.cs


public class NormalNode : GeometryNode, IMayRequireNormal
{
public const int kOutputSlotId = 0;
public const string kOutputSlotName = "Normal";
public const string kOutputSlotName = "Out";
public NormalNode()
{

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/PositionNode.cs


public class PositionNode : GeometryNode, IMayRequirePosition
{
private const int kOutputSlotId = 0;
public const string kOutputSlotName = "Position";
public const string kOutputSlotName = "Out";
public PositionNode()

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/TangentNode.cs


public class TangentNode : GeometryNode, IMayRequireTangent
{
public const int kOutputSlotId = 0;
public const string kOutputSlotName = "Tangent";
public const string kOutputSlotName = "Out";
public TangentNode()
{

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/UVNode.cs


public class UVNode : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireMeshUV
{
public const int OutputSlotId = 0;
private const string kOutputSlotName = "UV";
private const string kOutputSlotName = "Out";
[SerializeField]
private UVChannel m_OutputChannel;

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/VertexColorNode.cs


public class VertexColorNode : AbstractMaterialNode, IMayRequireVertexColor
{
private const int kOutputSlotId = 0;
private const string kOutputSlotName = "VertexColor";
private const string kOutputSlotName = "Out";
public override PreviewMode previewMode
{
get { return PreviewMode.Preview3D; }

{
name = "VertexColor";
name = "Vertex Color";
UpdateNodeAfterDeserialization();
}

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/ViewDirectionNode.cs


public class ViewDirectionNode : GeometryNode, IMayRequireViewDirection
{
private const int kOutputSlotId = 0;
public const string kOutputSlotName = "ViewDirection";
public const string kOutputSlotName = "Out";
name = "ViewDirection";
name = "View Direction";
UpdateNodeAfterDeserialization();
}

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Util/ShaderGenerator.cs


if (combinedRequierments.requiresVertexColor)
{
interpolators.AddShaderChunk(string.Format("float4 {0} : COLOR;", ShaderGeneratorNames.VertexColor), false);
vertexShader.AddShaderChunk(string.Format("o.{0} = color", ShaderGeneratorNames.VertexColor), false);
vertexShader.AddShaderChunk(string.Format("o.{0} = v.color;", ShaderGeneratorNames.VertexColor), false);
pixelShader.AddShaderChunk(string.Format("float4 {0} = IN.{0};", ShaderGeneratorNames.VertexColor), false);
}

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/GradientNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Input/Gradient")]
[Title("Input/Basic/Gradient")]
public class GradientNode : AbstractMaterialNode, IGeneratesBodyCode
{
Gradient m_Gradient = new Gradient();

12
MaterialGraphProject/Assets/NewNodes/Editor/Kill/VertexNormalNode.cs.meta


fileFormatVersion: 2
guid: c5532eff58cce43468e6f88386d8ac1c
timeCreated: 1495660146
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

64
MaterialGraphProject/Assets/NewNodes/Editor/Kill/VertexNormalNode.cs


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 Vector4MaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, Vector4.zero));
AddSlot(new Vector3MaterialSlot(OutputSlotIdXYZ, kOutputSlotNameXYZ, kOutputSlotNameXYZ, SlotType.Output, Vector4.zero));
AddSlot(new Vector1MaterialSlot(OutputSlotIdX, kOutputSlotNameX, kOutputSlotNameX, SlotType.Output,0));
AddSlot(new Vector1MaterialSlot(OutputSlotIdY, kOutputSlotNameY, kOutputSlotNameY, SlotType.Output,0));
AddSlot(new Vector1MaterialSlot(OutputSlotIdZ, kOutputSlotNameZ, kOutputSlotNameZ, SlotType.Output, 0));
AddSlot(new Vector1MaterialSlot(OutputSlotIdW, kOutputSlotNameW, kOutputSlotNameW, SlotType.Output, 0));
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";
}
}
}
}

/MaterialGraphProject/Assets/NewNodes/Editor/Keep/GradientNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/GradientNode.cs.meta

/MaterialGraphProject/Assets/NewNodes/Editor/Keep/GradientNode.cs → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/GradientNode.cs

正在加载...
取消
保存