您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
66 行
1.8 KiB
66 行
1.8 KiB
using System;
|
|
using UnityEditor.Graphing;
|
|
using UnityEngine;
|
|
|
|
namespace UnityEditor.ShaderGraph
|
|
{
|
|
class SamplerStateShaderProperty : AbstractShaderProperty<TextureSamplerState>
|
|
{
|
|
public SamplerStateShaderProperty()
|
|
{
|
|
displayName = "SamplerState";
|
|
value = new TextureSamplerState();
|
|
}
|
|
|
|
public override PropertyType propertyType => PropertyType.SamplerState;
|
|
|
|
public override bool isBatchable => false;
|
|
public override bool isExposable => false;
|
|
public override bool isRenamable => false;
|
|
|
|
public override TextureSamplerState value
|
|
{
|
|
get => base.value;
|
|
set
|
|
{
|
|
overrideReferenceName = $"{concreteShaderValueType.ToShaderString()}_{value.filter}_{value.wrap}";
|
|
base.value = value;
|
|
}
|
|
}
|
|
|
|
public override string GetPropertyDeclarationString(string delimiter = ";")
|
|
{
|
|
return $"SAMPLER({referenceName}){delimiter}";
|
|
}
|
|
|
|
public override string GetPropertyAsArgumentString()
|
|
{
|
|
return $"SamplerState {referenceName}";
|
|
}
|
|
|
|
public override AbstractMaterialNode ToConcreteNode()
|
|
{
|
|
return new SamplerStateNode()
|
|
{
|
|
filter = value.filter,
|
|
wrap = value.wrap
|
|
};
|
|
}
|
|
|
|
public override PreviewProperty GetPreviewMaterialProperty()
|
|
{
|
|
return default(PreviewProperty);
|
|
}
|
|
|
|
public override ShaderInput Copy()
|
|
{
|
|
return new SamplerStateShaderProperty()
|
|
{
|
|
displayName = displayName,
|
|
hidden = hidden,
|
|
overrideReferenceName = overrideReferenceName,
|
|
value = value
|
|
};
|
|
}
|
|
}
|
|
}
|