Matt Dean
8 年前
当前提交
3bce395a
共有 12 个文件被更改,包括 210 次插入 和 8 次删除
-
1MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Matrix/Matrix2Node.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Matrix/Matrix3Node.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Vector/Vector2Node.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MaterialSlot.cs
-
26MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixMultiplyNode.cs
-
1MaterialGraphProject/Assets/Matt/Test.ShaderGraph
-
9MaterialGraphProject/Assets/Matt/Test.ShaderGraph.meta
-
42MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Matrix4NodePresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Matrix4NodePresenter.cs.meta
-
103MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Matrix/Matrix4Node.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Matrix/Matrix4Node.cs.meta
1
MaterialGraphProject/Assets/Matt/Test.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 62568f909ca80d342836892f01cb06c9 |
|||
timeCreated: 1495663356 |
|||
licenseType: Pro |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using RMGUI.GraphView; |
|||
using UnityEditor.Graphing.Drawing; |
|||
using UnityEngine; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
class Matrix4ControlPresenter : GraphControlPresenter |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as UnityEngine.MaterialGraph.Matrix4Node; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
tNode[0] = EditorGUILayout.Vector4Field("", tNode[0]); |
|||
tNode[1] = EditorGUILayout.Vector4Field("", tNode[1]); |
|||
tNode[2] = EditorGUILayout.Vector4Field("", tNode[2]); |
|||
tNode[3] = EditorGUILayout.Vector4Field("", tNode[3]); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return (EditorGUIUtility.singleLineHeight * 4 + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class Matrix4NodePresenter : PropertyNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<Matrix4ControlPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter>(base.GetControlData()) { instance }; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8183008b69a6d79419dc9f1f08d12f4d |
|||
timeCreated: 1476871291 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Input/Matrix/Matrix 4")] |
|||
public class Matrix4Node : AbstractMaterialNode, IGeneratesBodyCode |
|||
{ |
|||
private const int kOutputSlotId = 0; |
|||
private const string kOutputSlotName = "Value"; |
|||
|
|||
[SerializeField] |
|||
private Vector4[] m_Value = new Vector4[4]; |
|||
|
|||
public Vector4 this[int index] |
|||
{ |
|||
get { return m_Value[index]; } |
|||
set |
|||
{ |
|||
if (m_Value[index] == value) |
|||
return; |
|||
|
|||
m_Value[index] = value; |
|||
|
|||
if (onModified != null) |
|||
onModified(this, ModificationScope.Node); |
|||
} |
|||
} |
|||
|
|||
public Matrix4Node() |
|||
{ |
|||
name = "Matrix4"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Matrix4, Vector4.zero)); |
|||
RemoveSlotsNameNotMatching(new[] { kOutputSlotId }); |
|||
} |
|||
|
|||
public string propertyName |
|||
{ |
|||
get |
|||
{ |
|||
return string.Format("{0}_{1}_Uniform", name, guid.ToString().Replace("-", "_")); |
|||
} |
|||
} |
|||
|
|||
public override string GetVariableNameForSlot(int slotId) |
|||
{ |
|||
return propertyName; |
|||
} |
|||
|
|||
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
//if (exposedState == ExposedState.Exposed || generationMode.IsPreview())
|
|||
// return;
|
|||
|
|||
visitor.AddShaderChunk(precision + "4x4 " + propertyName + " = " + precision + "4x4 (" + m_Value[0].x + ", " + m_Value[0].y + ", " + m_Value[0].z + ", " + m_Value[0].w + ", " + m_Value[1].x + ", " + m_Value[1].y + ", " + m_Value[1].z + ", " + m_Value[1].w + ", " + m_Value[2].x + ", " + m_Value[2].y + ", " + m_Value[2].z + ", " + m_Value[2].w + ", " + m_Value[3].x + ", " + m_Value[3].y + ", " + m_Value[3].z + ", " + m_Value[3].w + ");", true); |
|||
} |
|||
|
|||
[SerializeField] |
|||
private string m_Description = string.Empty; |
|||
|
|||
public string description |
|||
{ |
|||
get |
|||
{ |
|||
return string.IsNullOrEmpty(m_Description) ? name : m_Description; |
|||
} |
|||
set { m_Description = value; } |
|||
} |
|||
|
|||
// TODO - Remove Property entries everywhere?
|
|||
// Matrix cant be a shader property
|
|||
/*public override PropertyType propertyType |
|||
{ |
|||
get { return PropertyType.Matrix2; } |
|||
}*/ |
|||
|
|||
/*public override void GeneratePropertyBlock(PropertyGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
if (exposedState == ExposedState.Exposed) |
|||
visitor.AddShaderProperty(new VectorPropertyChunk(propertyName, description, m_Value, PropertyChunk.HideState.Visible)); |
|||
}*/ |
|||
|
|||
/*public override void GeneratePropertyUsages(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
if (exposedState == ExposedState.Exposed || generationMode.IsPreview()) |
|||
visitor.AddShaderChunk(precision + "2 " + propertyName + ";", true); |
|||
}*/ |
|||
|
|||
/*public override PreviewProperty GetPreviewProperty() |
|||
{ |
|||
return new PreviewProperty |
|||
{ |
|||
m_Name = propertyName, |
|||
m_PropType = PropertyType.Vector2, |
|||
m_Vector4 = m_Value |
|||
}; |
|||
}*/ |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: d3889ae2c6ffabd40a2ee45f5b051d3b |
|||
timeCreated: 1446473341 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue