浏览代码

Added a Twist UV node and moved the Noise Node into the correct directory.

/main
bfogerty 8 年前
当前提交
a20b7720
共有 5 个文件被更改,包括 84 次插入12 次删除
  1. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/NoiseNode.cs.meta
  2. 60
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/UV/TwistNode.cs
  3. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/UV/TwistNode.cs.meta
  4. 12
      MaterialGraphProject/Assets/Brandon/NoiseNode.cs.meta
  5. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/NoiseNode.cs

12
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/NoiseNode.cs.meta


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

60
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/UV/TwistNode.cs


using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph
{
[Title("UV/Twist")]
public class TwistNode : Function2Input, IGeneratesFunction
{
public TwistNode()
{
name = "Twist";
}
protected override string GetFunctionName()
{
return "unity_twist_" + precision;
}
protected override string GetInputSlot1Name()
{
return "UV";
}
protected override string GetInputSlot2Name()
{
return "Twist";
}
protected override MaterialSlot GetInputSlot1()
{
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, SlotType.Input, SlotValueType.Vector2, Vector2.zero);
}
protected override MaterialSlot GetInputSlot2()
{
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, SlotType.Input, SlotValueType.Vector1, Vector2.zero);
}
protected override MaterialSlot GetOutputSlot()
{
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector2, Vector2.zero);
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("uv", "twist"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("float angle = twist * length(uv);", false);
outputString.AddShaderChunk("float x = cos(angle) * uv.x - sin(angle) * uv.y;", false);
outputString.AddShaderChunk("float y = sin(angle) * uv.x + cos(angle) * uv.y;", false);
outputString.AddShaderChunk("return float2(x, y);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/UV/TwistNode.cs.meta


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

12
MaterialGraphProject/Assets/Brandon/NoiseNode.cs.meta


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

/MaterialGraphProject/Assets/Brandon/NoiseNode.cs → /MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/NoiseNode.cs

正在加载...
取消
保存