您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
74 行
2.2 KiB
74 行
2.2 KiB
using System;
|
|
using System.Text;
|
|
using UnityEditor.Graphing;
|
|
using UnityEngine;
|
|
|
|
namespace UnityEditor.ShaderGraph
|
|
{
|
|
[Serializable]
|
|
class Texture2DArrayShaderProperty : AbstractShaderProperty<SerializableTextureArray>
|
|
{
|
|
public Texture2DArrayShaderProperty()
|
|
{
|
|
displayName = "Texture2D Array";
|
|
value = new SerializableTextureArray();
|
|
}
|
|
|
|
public override PropertyType propertyType => PropertyType.Texture2DArray;
|
|
|
|
public override bool isBatchable => false;
|
|
public override bool isExposable => true;
|
|
public override bool isRenamable => true;
|
|
|
|
public string modifiableTagString => modifiable ? "" : "[NonModifiableTextureData]";
|
|
|
|
public override string GetPropertyBlockString()
|
|
{
|
|
return $"{hideTagString}{modifiableTagString}[NoScaleOffset]{referenceName}(\"{displayName}\", 2DArray) = \"white\" {{}}";
|
|
}
|
|
|
|
public override string GetPropertyDeclarationString(string delimiter = ";")
|
|
{
|
|
return $"TEXTURE2D_ARRAY({referenceName}){delimiter} SAMPLER(sampler{referenceName}){delimiter}";
|
|
}
|
|
|
|
public override string GetPropertyAsArgumentString()
|
|
{
|
|
return $"TEXTURE2D_ARRAY_PARAM({referenceName}, sampler{referenceName})";
|
|
}
|
|
|
|
[SerializeField]
|
|
bool m_Modifiable = true;
|
|
|
|
public bool modifiable
|
|
{
|
|
get => m_Modifiable;
|
|
set => m_Modifiable = value;
|
|
}
|
|
|
|
public override AbstractMaterialNode ToConcreteNode()
|
|
{
|
|
return new Texture2DArrayAssetNode { texture = value.textureArray };
|
|
}
|
|
|
|
|
|
public override PreviewProperty GetPreviewMaterialProperty()
|
|
{
|
|
return new PreviewProperty(propertyType)
|
|
{
|
|
name = referenceName,
|
|
textureValue = value.textureArray
|
|
};
|
|
}
|
|
|
|
public override ShaderInput Copy()
|
|
{
|
|
return new Texture2DArrayShaderProperty()
|
|
{
|
|
displayName = displayName,
|
|
hidden = hidden,
|
|
value = value
|
|
};
|
|
}
|
|
}
|
|
}
|