您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
46 行
1.2 KiB
46 行
1.2 KiB
using System;
|
|
using System.Text;
|
|
using UnityEngine;
|
|
|
|
namespace UnityEditor.ShaderGraph
|
|
{
|
|
[Serializable]
|
|
public class SamplerShaderProperty : AbstractShaderProperty<float>
|
|
{
|
|
public override PropertyType propertyType
|
|
{
|
|
get { return PropertyType.Float; }
|
|
}
|
|
|
|
public override Vector4 defaultValue
|
|
{
|
|
get { return new Vector4(value, value, value, value);}
|
|
}
|
|
|
|
public override string GetPropertyBlockString()
|
|
{
|
|
var result = new StringBuilder();
|
|
result.Append(referenceName);
|
|
result.Append("(\"");
|
|
result.Append(displayName);
|
|
result.Append("\", Float) = ");
|
|
result.Append(value);
|
|
return result.ToString();
|
|
}
|
|
|
|
public override string GetPropertyDeclarationString()
|
|
{
|
|
return "sampler2D " + referenceName + ";";
|
|
}
|
|
|
|
public override PreviewProperty GetPreviewMaterialProperty()
|
|
{
|
|
return new PreviewProperty()
|
|
{
|
|
m_Name = referenceName,
|
|
m_PropType = PropertyType.Float,
|
|
m_Float = value
|
|
};
|
|
}
|
|
}
|
|
}
|