initial commit
This commit is contained in:
parent
6715289efe
commit
788c3389af
37645 changed files with 2526849 additions and 80 deletions
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using UnityEditor.Graphing;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEditor.ShaderGraph.Internal
|
||||
{
|
||||
[Serializable]
|
||||
public abstract class VectorShaderProperty : AbstractShaderProperty<Vector4>
|
||||
{
|
||||
internal override bool isExposable => true;
|
||||
internal override bool isRenamable => true;
|
||||
internal virtual int vectorDimension => 4;
|
||||
|
||||
internal override string GetHLSLVariableName(bool isSubgraphProperty, GenerationMode mode)
|
||||
{
|
||||
HLSLDeclaration decl = GetDefaultHLSLDeclaration();
|
||||
if (decl == HLSLDeclaration.HybridPerInstance)
|
||||
return $"UNITY_ACCESS_HYBRID_INSTANCED_PROP({referenceName}, {concretePrecision.ToShaderString()}{vectorDimension})";
|
||||
else
|
||||
return base.GetHLSLVariableName(isSubgraphProperty, mode);
|
||||
}
|
||||
|
||||
internal override string GetPropertyBlockString()
|
||||
{
|
||||
return $"{hideTagString}{referenceName}(\"{displayName}\", Vector) = ({NodeUtils.FloatToShaderValueShaderLabSafe(value.x)}, {NodeUtils.FloatToShaderValueShaderLabSafe(value.y)}, {NodeUtils.FloatToShaderValueShaderLabSafe(value.z)}, {NodeUtils.FloatToShaderValueShaderLabSafe(value.w)})";
|
||||
}
|
||||
|
||||
internal override string GetPropertyAsArgumentString(string precisionString)
|
||||
{
|
||||
return $"{concreteShaderValueType.ToShaderString(precisionString)} {referenceName}";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue