浏览代码

Replace Color Node

/main
Matt Dean 7 年前
当前提交
8707e0ea
共有 2 个文件被更改,包括 50 次插入0 次删除
  1. 38
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Adjustment/ReplaceColorNode.cs
  2. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Adjustment/ReplaceColorNode.cs.meta

38
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Adjustment/ReplaceColorNode.cs


using System.Reflection;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("Artistic/Adjustment/Replace Color")]
public class ReplaceColorNode : CodeFunctionNode
{
public ReplaceColorNode()
{
name = "Replace Color";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_ReplaceColor", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_ReplaceColor(
[Slot(0, Binding.None)] Vector3 In,
[Slot(1, Binding.None)] Vector3 From,
[Slot(2, Binding.None)] Vector3 To,
[Slot(3, Binding.None)] Vector1 Range,
[Slot(4, Binding.None)] out Vector3 Out)
{
Out = Vector2.zero;
return
@"
{
{precision}3 col = In;
{precision} Distance = distance(From, In);
if(Distance <= Range)
col = To;
Out = col;
}";
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Adjustment/ReplaceColorNode.cs.meta


fileFormatVersion: 2
guid: a60be5fb80fbbdb449fcc95fa2256cc5
timeCreated: 1444218016
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存