Rasagar/Library/PackageCache/com.unity.shadergraph/Editor/Data/Util/PropertyUtil.cs
2024-08-26 23:07:20 +03:00

51 lines
2.0 KiB
C#

using System;
using UnityEngine;
using UnityEditor.ShaderGraph.Internal;
namespace UnityEditor.ShaderGraph
{
static class PropertyUtil
{
public static ConcreteSlotValueType ToConcreteShaderValueType(this PropertyType propertyType)
{
switch (propertyType)
{
case PropertyType.SamplerState:
return ConcreteSlotValueType.SamplerState;
case PropertyType.Matrix4:
return ConcreteSlotValueType.Matrix4;
case PropertyType.Matrix3:
return ConcreteSlotValueType.Matrix3;
case PropertyType.Matrix2:
return ConcreteSlotValueType.Matrix2;
case PropertyType.Texture2D:
return ConcreteSlotValueType.Texture2D;
case PropertyType.Texture2DArray:
return ConcreteSlotValueType.Texture2DArray;
case PropertyType.Texture3D:
return ConcreteSlotValueType.Texture3D;
case PropertyType.Cubemap:
return ConcreteSlotValueType.Cubemap;
case PropertyType.Gradient:
return ConcreteSlotValueType.Gradient;
case PropertyType.Vector4:
return ConcreteSlotValueType.Vector4;
case PropertyType.Vector3:
return ConcreteSlotValueType.Vector3;
case PropertyType.Vector2:
return ConcreteSlotValueType.Vector2;
case PropertyType.Float:
return ConcreteSlotValueType.Vector1;
case PropertyType.Boolean:
return ConcreteSlotValueType.Boolean;
case PropertyType.Color:
return ConcreteSlotValueType.Vector4;
case PropertyType.VirtualTexture:
return ConcreteSlotValueType.VirtualTexture;
default:
throw new ArgumentOutOfRangeException();
}
}
}
}