浏览代码

Merge branch 'hackweek2017' of https://github.com/stramit/MaterialGraph into hackweek2017

/main
bfogerty 8 年前
当前提交
0d1ac07f
共有 20 个文件被更改,包括 324 次插入20 次删除
  1. 2
      MaterialGraphProject/Assets/Andre/New Shader Graph.ShaderGraph
  2. 2
      MaterialGraphProject/Assets/Rinaldo/BlendModeNode.cs
  3. 1
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs
  4. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Range/RemapNode.cs
  5. 9
      MaterialGraphProject/Assets/Andre/Editor.meta
  6. 82
      MaterialGraphProject/Assets/Andre/ToggleNode.cs
  7. 8
      MaterialGraphProject/Assets/Andre/ToggleNode.cs.meta
  8. 29
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixMultiplyNode.cs
  9. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixMultiplyNode.cs.meta
  10. 29
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixTransposeNode.cs
  11. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixTransposeNode.cs.meta
  12. 29
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorProjectionNode.cs
  13. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorProjectionNode.cs.meta
  14. 29
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorRejectionNode.cs
  15. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorRejectionNode.cs.meta
  16. 44
      MaterialGraphProject/Assets/Andre/Editor/ToggleNodePresenter.cs
  17. 12
      MaterialGraphProject/Assets/Andre/Editor/ToggleNodePresenter.cs.meta
  18. 9
      MaterialGraphProject/Assets/Matt&Andre.meta
  19. 9
      MaterialGraphProject/Assets/Matt.meta

2
MaterialGraphProject/Assets/Andre/New Shader Graph.ShaderGraph
文件差异内容过多而无法显示
查看文件

2
MaterialGraphProject/Assets/Rinaldo/BlendModeNode.cs


protected override string GetFunctionName()
{
return "unity_blendmode_" + precision;
return "unity_blendmode_" + System.Enum.GetName(typeof(BlendModesEnum), m_BlendMode);
}
protected override string GetInputSlot1Name()
{

1
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs


typeMapper[typeof(TextureNode)] = typeof(TextureNodePresenter);
typeMapper[typeof(TextureLODNode)] = typeof(TextureLODNodePresenter);
typeMapper[typeof(CubemapNode)] = typeof(CubeNodePresenter);
typeMapper[typeof(ToggleNode)] = typeof(ToggleNodePresenter);
typeMapper[typeof(UVNode)] = typeof(UVNodePresenter);
typeMapper[typeof(Vector1Node)] = typeof(Vector1NodePresenter);
typeMapper[typeof(Vector2Node)] = typeof(Vector2NodePresenter);

2
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Range/RemapNode.cs


public RemapNode ()
{
name = "Remap";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()

9
MaterialGraphProject/Assets/Andre/Editor.meta


fileFormatVersion: 2
guid: bed9a49249fc34bf8adec9aaca294542
folderAsset: yes
timeCreated: 1495545513
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

82
MaterialGraphProject/Assets/Andre/ToggleNode.cs


using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph
{
[Title("Input/Toggle")]
public class ToggleNode : PropertyNode, IGeneratesBodyCode
{
[SerializeField]
private float m_Float;
private const int kOutputSlotId = 0;
private const string kOutputSlotName = "Ouput";
public ToggleNode()
{
name = "Toggle";
UpdateNodeAfterDeserialization();
}
/* public override bool hasPreview
{
get { return true; }
}*/
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Vector1, Vector2.zero));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override PropertyType propertyType
{
get { return PropertyType.Float; }
}
public float value
{
get { return m_Float; }
set
{
if (m_Float == value)
return;
m_Float = value;
if (onModified != null)
{
onModified(this, ModificationScope.Node);
}
}
}
public override void GeneratePropertyBlock(PropertyGenerator visitor, GenerationMode generationMode)
{
if (exposedState == ExposedState.Exposed)
visitor.AddShaderProperty(new FloatPropertyChunk(propertyName, description, 0f, PropertyChunk.HideState.Visible));
}
public override void GeneratePropertyUsages(ShaderGenerator visitor, GenerationMode generationMode)
{
if (exposedState == ExposedState.Exposed || generationMode.IsPreview())
visitor.AddShaderChunk(precision + " " + propertyName + ";", true);
}
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode)
{
if (exposedState == ExposedState.Exposed || generationMode.IsPreview())
return;
visitor.AddShaderChunk(value.ToString (), true);
}
public override PreviewProperty GetPreviewProperty()
{
return new PreviewProperty
{
m_Name = propertyName,
m_PropType = PropertyType.Float,
m_Float = value
};
}
}
}

8
MaterialGraphProject/Assets/Andre/ToggleNode.cs.meta


fileFormatVersion: 2
guid: fccc54ac137a8451d8011f29847e63b1
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

29
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixMultiplyNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Matrix/Multiply Node")]
public class MatrixMultiplyNode : Function2Input, IGeneratesFunction
{
public MatrixMultiplyNode()
{
name = "MatrixMultiplyNode";
}
protected override string GetFunctionName()
{
return "unity_matrix_multiply_" + precision;
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return mul(arg1, arg2);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixMultiplyNode.cs.meta


fileFormatVersion: 2
guid: 8eb82c17970f84fc2b84d060df718533
timeCreated: 1495542985
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

29
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixTransposeNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Matrix/Transpose Node")]
public class MatrixTransposeNode : Function1Input, IGeneratesFunction
{
public MatrixTransposeNode()
{
name = "MatrixTranspose";
}
protected override string GetFunctionName()
{
return "unity_matrix_transpose_" + precision;
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("arg1"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return transpose(arg1);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MatrixTransposeNode.cs.meta


fileFormatVersion: 2
guid: 19da2635a60154a6793334e535a0a856
timeCreated: 1495542985
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

29
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorProjectionNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Vector/Projection Node")]
public class VectorProjectionNode : Function2Input, IGeneratesFunction
{
public VectorProjectionNode()
{
name = "VectorProjection";
}
protected override string GetFunctionName()
{
return "unity_vector_projection_" + precision;
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return arg2 * dot(arg1, arg2) / dot(arg2, arg2);", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorProjectionNode.cs.meta


fileFormatVersion: 2
guid: 7cf458b51c72d4045a820965b8037b9b
timeCreated: 1495542985
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

29
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorRejectionNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Vector/Rejection Node")]
public class VectorRejectionNode : Function2Input, IGeneratesFunction
{
public VectorRejectionNode()
{
name = "VectorRejection";
}
protected override string GetFunctionName()
{
return "unity_vector_rejection_" + precision;
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)
{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk(GetFunctionPrototype("arg1", "arg2"), false);
outputString.AddShaderChunk("{", false);
outputString.Indent();
outputString.AddShaderChunk("return arg1 - (arg2 * dot(arg1, arg2) / dot(arg2, arg2));", false);
outputString.Deindent();
outputString.AddShaderChunk("}", false);
visitor.AddShaderChunk(outputString.GetShaderString(0), true);
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/VectorRejectionNode.cs.meta


fileFormatVersion: 2
guid: 831bc8761a9c9493aac513acc02d3577
timeCreated: 1495542985
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

44
MaterialGraphProject/Assets/Andre/Editor/ToggleNodePresenter.cs


using System;
using System.Collections.Generic;
using RMGUI.GraphView;
using UnityEditor.Graphing.Drawing;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing
{
[Serializable]
class ToggleNodeControlPresenter : GraphControlPresenter
{
public override void OnGUIHandler()
{
base.OnGUIHandler();
var cNode = node as BlendModeNode;
if (cNode == null)
return;
cNode.blendMode = (BlendModesEnum)EditorGUILayout.EnumPopup("", cNode.blendMode);
}
/* public override float GetHeight()
{
return EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
}
*/
public override float GetHeight()
{
return 3 * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing;
}
}
[Serializable]
public class ToggleNodePresenter : MaterialNodePresenter
{
protected override IEnumerable<GraphElementPresenter> GetControlData()
{
var instance = CreateInstance<ToggleNodeControlPresenter>();
instance.Initialize(node);
return new List<GraphElementPresenter> { instance };
}
}
}

12
MaterialGraphProject/Assets/Andre/Editor/ToggleNodePresenter.cs.meta


fileFormatVersion: 2
guid: 55391b421fcbe4e60bf16325132025ff
timeCreated: 1495456482
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

9
MaterialGraphProject/Assets/Matt&Andre.meta


fileFormatVersion: 2
guid: 07096cbe059c94e42b244abc3e875ccf
folderAsset: yes
timeCreated: 1495475979
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
MaterialGraphProject/Assets/Matt.meta


fileFormatVersion: 2
guid: d44a270dca2589e4bb89c277d87ac0d9
folderAsset: yes
timeCreated: 1495475979
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存