Boat Attack使用了Universal RP的许多新图形功能,可以用于探索 Universal RP 的使用方式和技巧。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

46 行
1.4 KiB

using System;
using UnityEditor.Graphing;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Serializable]
class Vector4ShaderProperty : VectorShaderProperty
{
public Vector4ShaderProperty()
{
displayName = "Vector4";
}
public override PropertyType propertyType => PropertyType.Vector4;
public override AbstractMaterialNode ToConcreteNode()
{
var node = new Vector4Node();
node.FindInputSlot<Vector1MaterialSlot>(Vector4Node.InputSlotXId).value = value.x;
node.FindInputSlot<Vector1MaterialSlot>(Vector4Node.InputSlotYId).value = value.y;
node.FindInputSlot<Vector1MaterialSlot>(Vector4Node.InputSlotZId).value = value.z;
node.FindInputSlot<Vector1MaterialSlot>(Vector4Node.InputSlotWId).value = value.w;
return node;
}
public override PreviewProperty GetPreviewMaterialProperty()
{
return new PreviewProperty(propertyType)
{
name = referenceName,
vector4Value = value
};
}
public override ShaderInput Copy()
{
return new Vector4ShaderProperty()
{
displayName = displayName,
hidden = hidden,
value = value
};
}
}
}