12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using System;
- using UnityEditor.Graphing;
- using UnityEditor.ShaderGraph.Internal;
- using UnityEngine;
- namespace UnityEditor.ShaderGraph
- {
- [Serializable]
- class Matrix2ShaderProperty : MatrixShaderProperty
- {
- public Matrix2ShaderProperty()
- {
- displayName = "Matrix2x2";
- value = Matrix4x4.identity;
- }
- public override PropertyType propertyType => PropertyType.Matrix2;
- internal override string GetPropertyAsArgumentString()
- {
- return $"{concretePrecision.ToShaderString()}2x2 {referenceName}";
- }
- internal override AbstractMaterialNode ToConcreteNode()
- {
- return new Matrix2Node
- {
- row0 = new Vector2(value.m00, value.m01),
- row1 = new Vector2(value.m10, value.m11)
- };
- }
- internal override PreviewProperty GetPreviewMaterialProperty()
- {
- return new PreviewProperty(propertyType)
- {
- name = referenceName,
- matrixValue = value
- };
- }
- internal override ShaderInput Copy()
- {
- return new Matrix2ShaderProperty()
- {
- displayName = displayName,
- hidden = hidden,
- value = value
- };
- }
- }
- }
|