您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
30 行
754 B
30 行
754 B
using System.Reflection;
|
|
|
|
namespace UnityEngine.MaterialGraph
|
|
{
|
|
[Title("Art/Conversion/RGBtoLuminance")]
|
|
public class RGBtoLuminanceNode : CodeFunctionNode
|
|
{
|
|
public RGBtoLuminanceNode()
|
|
{
|
|
name = "RGBtoLuminance";
|
|
}
|
|
|
|
protected override MethodInfo GetFunctionToConvert()
|
|
{
|
|
return GetType().GetMethod("Unity_RGBToLuminance", BindingFlags.Static | BindingFlags.NonPublic);
|
|
}
|
|
|
|
static string Unity_RGBToLuminance(
|
|
[Slot(0, Binding.None)] Vector3 rgb,
|
|
[Slot(1, Binding.None)] out Vector1 luminance)
|
|
{
|
|
return
|
|
@"
|
|
{
|
|
luminance = dot(rgb, {precision}3(0.2126729, 0.7151522, 0.0721750));
|
|
}
|
|
";
|
|
}
|
|
}
|
|
}
|