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

77 行
2.2 KiB

using System;
using UnityEditor.Graphing;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Serializable]
abstract class AbstractShaderProperty : ShaderInput
{
public abstract PropertyType propertyType { get; }
public override ConcreteSlotValueType concreteShaderValueType => propertyType.ToConcreteShaderValueType();
[SerializeField]
Precision m_Precision = Precision.Inherit;
ConcretePrecision m_ConcretePrecision = ConcretePrecision.Float;
public Precision precision
{
get => m_Precision;
set => m_Precision = value;
}
public ConcretePrecision concretePrecision => m_ConcretePrecision;
public void ValidateConcretePrecision(ConcretePrecision graphPrecision)
{
m_ConcretePrecision = (precision == Precision.Inherit) ? graphPrecision : precision.ToConcrete();
}
public abstract bool isBatchable { get; }
[SerializeField]
bool m_Hidden = false;
public bool hidden
{
get => m_Hidden;
set => m_Hidden = value;
}
public string hideTagString => hidden ? "[HideInInspector]" : "";
public virtual string GetPropertyBlockString()
{
return string.Empty;
}
public virtual string GetPropertyDeclarationString(string delimiter = ";")
{
SlotValueType type = ConcreteSlotValueType.Vector4.ToSlotValueType();
return $"{concreteShaderValueType.ToShaderString(concretePrecision.ToShaderString())} {referenceName}{delimiter}";
}
public virtual string GetPropertyAsArgumentString()
{
return GetPropertyDeclarationString(string.Empty);
}
public abstract AbstractMaterialNode ToConcreteNode();
public abstract PreviewProperty GetPreviewMaterialProperty();
}
[Serializable]
abstract class AbstractShaderProperty<T> : AbstractShaderProperty
{
[SerializeField]
T m_Value;
public virtual T value
{
get => m_Value;
set => m_Value = value;
}
}
}