您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
50 行
1.4 KiB
50 行
1.4 KiB
using System.ComponentModel;
|
|
using UnityEngine.Graphing;
|
|
|
|
namespace UnityEngine.MaterialGraph
|
|
{
|
|
interface IMayRequireViewDirection
|
|
{
|
|
bool RequiresViewDirection();
|
|
}
|
|
|
|
[Title("Input/World Space View Direction Node")]
|
|
public class WorldSpaceViewDirectionNode : AbstractMaterialNode, IMayRequireViewDirection
|
|
{
|
|
private const int kOutputSlotId = 0;
|
|
|
|
public override bool hasPreview { get { return true; } }
|
|
public override PreviewMode previewMode
|
|
{
|
|
get { return PreviewMode.Preview3D; }
|
|
}
|
|
|
|
public WorldSpaceViewDirectionNode()
|
|
{
|
|
name = "World View Direction";
|
|
UpdateNodeAfterDeserialization();
|
|
}
|
|
|
|
public sealed override void UpdateNodeAfterDeserialization()
|
|
{
|
|
AddSlot(new MaterialSlot(
|
|
kOutputSlotId,
|
|
ShaderGeneratorNames.WorldSpaceViewDirection,
|
|
ShaderGeneratorNames.WorldSpaceViewDirection,
|
|
SlotType.Output,
|
|
SlotValueType.Vector3,
|
|
Vector4.zero));
|
|
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
|
|
}
|
|
|
|
public override string GetVariableNameForSlot(int slotId)
|
|
{
|
|
return ShaderGeneratorNames.WorldSpaceViewDirection;
|
|
}
|
|
|
|
public bool RequiresViewDirection()
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|