A game about forced loneliness, made by TACStudios
at master 2.0 kB view raw
1using System; 2using UnityEditor.Graphing; 3using UnityEngine; 4 5namespace UnityEditor.ShaderGraph.Internal 6{ 7 [Serializable] 8 [FormerName("UnityEditor.ShaderGraph.Vector3ShaderProperty")] 9 [BlackboardInputInfo(3)] 10 public sealed class Vector3ShaderProperty : VectorShaderProperty 11 { 12 internal Vector3ShaderProperty() 13 { 14 displayName = "Vector3"; 15 } 16 17 internal override int vectorDimension => 3; 18 19 public override PropertyType propertyType => PropertyType.Vector3; 20 21 internal override AbstractMaterialNode ToConcreteNode() 22 { 23 var node = new Vector3Node(); 24 node.FindInputSlot<Vector1MaterialSlot>(Vector3Node.InputSlotXId).value = value.x; 25 node.FindInputSlot<Vector1MaterialSlot>(Vector3Node.InputSlotYId).value = value.y; 26 node.FindInputSlot<Vector1MaterialSlot>(Vector3Node.InputSlotZId).value = value.z; 27 return node; 28 } 29 30 internal override PreviewProperty GetPreviewMaterialProperty() 31 { 32 return new PreviewProperty(propertyType) 33 { 34 name = referenceName, 35 vector4Value = value 36 }; 37 } 38 39 internal override ShaderInput Copy() 40 { 41 return new Vector3ShaderProperty() 42 { 43 displayName = displayName, 44 value = value, 45 }; 46 } 47 48 internal override void ForeachHLSLProperty(Action<HLSLProperty> action) 49 { 50 HLSLDeclaration decl = GetDefaultHLSLDeclaration(); 51 action(new HLSLProperty(HLSLType._float3, referenceName, decl, concretePrecision)); 52 } 53 54 public override int latestVersion => 1; 55 public override void OnAfterDeserialize(string json) 56 { 57 if (sgVersion == 0) 58 { 59 LegacyShaderPropertyData.UpgradeToHLSLDeclarationOverride(json, this); 60 ChangeVersion(1); 61 } 62 } 63 } 64}