您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

29 行
1006 B

namespace UnityEngine.MaterialGraph
{
[Title("Vector/Projection Node")]
public class VectorProjectionNode : Function2Input, IGeneratesFunction
{
public VectorProjectionNode()
{
name = "VectorProjection";
}
protected override string GetFunctionName()
{
return "unity_vector_projection_" + precision;
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return arg2 * dot(arg1, arg2) / dot(arg2, arg2);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}