浏览代码

Fixes for PR

/main
Matt Dean 7 年前
当前提交
5e47b629
共有 2 个文件被更改,包括 8 次插入22 次删除
  1. 29
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Adjustment/ChannelMixerNode.cs
  2. 1
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/ChannelMixerControl.cs

29
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Artistic/Adjustment/ChannelMixerNode.cs


get { return m_ChannelMixer; }
set
{
if (Equals(value))
if ((value.outRed == m_ChannelMixer.outRed) && (value.outGreen == m_ChannelMixer.outGreen) && (value.outBlue == m_ChannelMixer.outBlue))
}
bool Equals(ChannelMixer c)
{
if (ReferenceEquals(c, null))
return false;
if (ReferenceEquals(c, m_ChannelMixer))
return true;
return (c.outRed == m_ChannelMixer.outRed) && (c.outGreen == m_ChannelMixer.outGreen) && (c.outBlue == m_ChannelMixer.outBlue);
}
string GetFunctionPrototype(string argIn, string argRed, string argGreen, string argBlue, string argOut)

public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("In", "Red", "Green", "Blue", "Out"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk(string.Format("Out = {0} {1};",
ConvertConcreteSlotValueTypeToString(precision, FindOutputSlot<MaterialSlot>(OutputSlotId).concreteValueType),
"(dot(In, Red), dot(In, Green), dot(In, Blue))"), true);
visitor.AddShaderChunk(GetFunctionPrototype("In", "Red", "Green", "Blue", "Out"), false);
visitor.AddShaderChunk("{", false);
visitor.Indent();
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(string.Format("Out = {0} (dot(In, Red), dot(In, Green), dot(In, Blue));",
ConvertConcreteSlotValueTypeToString(precision, FindOutputSlot<MaterialSlot>(OutputSlotId).concreteValueType)), true);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
visitor.Deindent();
visitor.AddShaderChunk("}", false);
}
}
}

1
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/ChannelMixerControl.cs


void OnClickButton(int outChannel)
{
m_Node.owner.owner.RegisterCompleteObjectUndo("Button Change");
m_OutChannel = outChannel;
ResetSliders();
}

正在加载...
取消
保存