您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
31 行
934 B
31 行
934 B
namespace UnityEngine.MaterialGraph
|
|
{
|
|
[Title("Math/Vector/DDXY")]
|
|
public class DDXYNode : Function1Input, IGeneratesFunction
|
|
{
|
|
public DDXYNode()
|
|
{
|
|
name = "DDXY";
|
|
}
|
|
|
|
protected override string GetFunctionName()
|
|
{
|
|
return "unity_ddxy_" + precision;
|
|
}
|
|
|
|
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
|
|
{
|
|
var outputString = new ShaderGenerator();
|
|
outputString.AddShaderChunk(GetFunctionPrototype("arg1"), false);
|
|
outputString.AddShaderChunk("{", false);
|
|
outputString.Indent();
|
|
outputString.AddShaderChunk("return abs(ddx(arg1) + ddy(arg1));", false);
|
|
outputString.Deindent();
|
|
outputString.AddShaderChunk("}", false);
|
|
|
|
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
|
|
}
|
|
}
|
|
}
|
|
|
|
|