您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
49 行
1.3 KiB
49 行
1.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
#if UNITY_EDITOR
|
|
using UnityEditor;
|
|
#endif
|
|
using UnityEngine.Graphing;
|
|
|
|
namespace UnityEngine.MaterialGraph
|
|
{
|
|
[Title("Input/Scene Data/Reflection Probe")]
|
|
public class ReflectionProbeNode : CodeFunctionNode
|
|
{
|
|
public ReflectionProbeNode()
|
|
{
|
|
name = "ReflectionProbe";
|
|
}
|
|
|
|
public override PreviewMode previewMode
|
|
{
|
|
get
|
|
{
|
|
return PreviewMode.Preview3D;
|
|
}
|
|
}
|
|
|
|
protected override MethodInfo GetFunctionToConvert()
|
|
{
|
|
return GetType().GetMethod("Unity_ReflectionProbe", BindingFlags.Static | BindingFlags.NonPublic);
|
|
}
|
|
|
|
static string Unity_ReflectionProbe(
|
|
[Slot(0, Binding.ObjectSpaceNormal)] Vector3 viewDirection,
|
|
[Slot(1, Binding.ObjectSpaceViewDirection)] Vector3 worldSpaceNormal,
|
|
[Slot(2, Binding.None)] Vector1 lod,
|
|
[Slot(3, Binding.None)] out Vector4 color)
|
|
{
|
|
color = Vector4.one;
|
|
return
|
|
@"
|
|
{
|
|
{precision}3 reflect = reflect(-viewDirection, worldSpaceNormal);
|
|
color = DecodeHDR(UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflect, lod), unity_SpecCube0_HDR);
|
|
}
|
|
";
|
|
}
|
|
}
|
|
}
|