浏览代码

First pass Matrix 4x4 nodes

/main
Matt Dean 7 年前
当前提交
b23f23cb
共有 4 个文件被更改,包括 10 次插入21 次删除
  1. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/AbstractMaterialNode.cs
  2. 17
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/Matrix4Node.cs
  3. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Matrix/MatrixMultiplyByVectorNode.cs
  4. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Matrix/MatrixMultiplyNode.cs

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/AbstractMaterialNode.cs


case ConcreteSlotValueType.Cubemap:
return "Cubemap";
case ConcreteSlotValueType.Matrix2:
return "Matrix2x2";
return p + "x2x2";
return "Matrix3x3";
return p + "3x3";
return "Matrix4x4";
return p + "4x4";
case ConcreteSlotValueType.SamplerState:
return "SamplerState";
default:

17
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/Matrix4Node.cs


RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public string propertyName
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode)
get
{
return string.Format("{0}_{1}_Uniform", name, GetVariableNameForNode());
}
visitor.AddShaderChunk(precision + "4x4 " + GetVariableNameForNode() + " = " + precision + "4x4 (" + row0.x + ", " + row0.y + ", " + row0.z + ", " + row0.w + ", " + m_Row1.x + ", " + m_Row1.y + ", " + m_Row1.z + ", " + m_Row1.w + ", " + m_Row2.x + ", " + m_Row2.y + ", " + m_Row2.z + ", " + m_Row2.w + ", " + m_Row3.x + ", " + m_Row3.y + ", " + m_Row3.z + ", " + m_Row3.w + ");", true);
return propertyName;
}
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode)
{
//if (exposedState == ExposedState.Exposed || generationMode.IsPreview())
// return;
visitor.AddShaderChunk(precision + "4x4 " + propertyName + " = " + precision + "4x4 (" + row0.x + ", " + row0.y + ", " + row0.z + ", " + row0.w + ", " + m_Row1.x + ", " + m_Row1.y + ", " + m_Row1.z + ", " + m_Row1.w + ", " + m_Row2.x + ", " + m_Row2.y + ", " + m_Row2.z + ", " + m_Row2.w + ", " + m_Row3.x + ", " + m_Row3.y + ", " + m_Row3.z + ", " + m_Row3.w + ");", true);
return GetVariableNameForNode();
}
[SerializeField]

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Matrix/MatrixMultiplyByVectorNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("Math", "Matrix", "MultiplyMatrixByVector")]
[Title("Math", "Matrix", "Multiply Matrix By Vector")]
public class MatrixMultiplyByVectorNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction
{
protected const string kInputSlot1ShaderName = "Input1";

public MatrixMultiplyByVectorNode()
{
name = "MultiplyMatrixByVector";
name = "Multiply Matrix By Vector";
UpdateNodeAfterDeserialization();
}

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Matrix/MatrixMultiplyNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("Math", "Matrix", "MultiplyMatrix")]
[Title("Math", "Matrix", "Multiply Matrix")]
public class MatrixMultiplyNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction
{
protected const string kInputSlot1ShaderName = "Input1";

public MatrixMultiplyNode()
{
name = "MultiplyMatrix";
name = "Multiply Matrix";
UpdateNodeAfterDeserialization();
}

正在加载...
取消
保存