浏览代码

Rename package folder to match package name

/main
Peter Bay Bastian 7 年前
当前提交
e7ecacd5
共有 8 个文件被更改,包括 185 次插入185 次删除
  1. 4
      MaterialGraphProject/Assets/com.unity.shadergraph.meta
  2. 4
      MaterialGraphProject/Assets/com.unity.shadergraph/Editor/Drawing/PreviewRate.cs.meta
  3. 76
      MaterialGraphProject/Assets/com.unity.shadergraph/Editor/Data/Nodes/Artistic/Filter/DitherNode.cs
  4. 278
      MaterialGraphProject/Assets/com.unity.shadergraph/Editor/Data/Graphs/DynamicValueMaterialSlot.cs
  5. 4
      MaterialGraphProject/Assets/com.unity.shadergraph/Editor/Data/Graphs/SpaceMaterialSlot.cs.meta
  6. 4
      MaterialGraphProject/Assets/com.unity.shadergraph/Editor/Data/Graphs/Texture2DInputMaterialSlot.cs.meta
  7. 0
      /MaterialGraphProject/Assets/com.unity.shadergraph.meta
  8. 0
      /MaterialGraphProject/Assets/com.unity.shadergraph

4
MaterialGraphProject/Assets/com.unity.shadergraph.meta


fileFormatVersion: 2
guid: 0b601fe23f0347ab8e4892edf2cf76d7
fileFormatVersion: 2
guid: 0b601fe23f0347ab8e4892edf2cf76d7
timeCreated: 1513757926

4
MaterialGraphProject/Assets/com.unity.shadergraph/Editor/Drawing/PreviewRate.cs.meta


fileFormatVersion: 2
guid: fa070520993a4b839e705dcd7f22e4d6
fileFormatVersion: 2
guid: fa070520993a4b839e705dcd7f22e4d6
timeCreated: 1506421104

76
MaterialGraphProject/Assets/com.unity.shadergraph/Editor/Data/Nodes/Artistic/Filter/DitherNode.cs


using System.Reflection;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("Artistic", "Filter", "Dither")]
public class DitherNode : CodeFunctionNode
{
public DitherNode()
{
name = "Dither";
UpdateNodeAfterDeserialization();
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Dither", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Dither(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.ScreenPosition)] Vector2 ScreenPosition,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
{precision}2 uv = ScreenPosition.xy * _ScreenParams.xy;
{precision} DITHER_THRESHOLDS[16] =
{
1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
};
uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
Out = In - DITHER_THRESHOLDS[index];
}";
}
}
using System.Reflection;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("Artistic", "Filter", "Dither")]
public class DitherNode : CodeFunctionNode
{
public DitherNode()
{
name = "Dither";
UpdateNodeAfterDeserialization();
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Dither", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Dither(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.ScreenPosition)] Vector2 ScreenPosition,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
{precision}2 uv = ScreenPosition.xy * _ScreenParams.xy;
{precision} DITHER_THRESHOLDS[16] =
{
1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
};
uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
Out = In - DITHER_THRESHOLDS[index];
}";
}
}
}

278
MaterialGraphProject/Assets/com.unity.shadergraph/Editor/Data/Graphs/DynamicValueMaterialSlot.cs


using System;
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Drawing.Slots;
using UnityEngine;
using UnityEngine.Experimental.UIElements;
namespace UnityEditor.ShaderGraph
{
[Serializable]
public class DynamicValueMaterialSlot : MaterialSlot, IMaterialSlotHasValue<Matrix4x4>
{
[SerializeField]
private Matrix4x4 m_Value;
[SerializeField]
private Matrix4x4 m_DefaultValue;
private ConcreteSlotValueType m_ConcreteValueType = ConcreteSlotValueType.Vector4;
public DynamicValueMaterialSlot()
{
}
public DynamicValueMaterialSlot(
int slotId,
string displayName,
string shaderOutputName,
SlotType slotType,
Matrix4x4 value,
ShaderStage shaderStage = ShaderStage.Dynamic,
bool hidden = false)
: base(slotId, displayName, shaderOutputName, slotType, shaderStage, hidden)
{
m_Value = value;
}
public Matrix4x4 defaultValue { get { return m_DefaultValue; } }
public Matrix4x4 value
{
get { return m_Value; }
set { m_Value = value; }
}
public override VisualElement InstantiateControl()
{
int components =
concreteValueType == ConcreteSlotValueType.Vector4 ? 4 :
concreteValueType == ConcreteSlotValueType.Vector3 ? 3 :
concreteValueType == ConcreteSlotValueType.Vector2 ? 2 :
concreteValueType == ConcreteSlotValueType.Vector1 ? 1 : 0;
return new MultiFloatSlotControlView(owner, components, () => value.GetRow(0), (newValue) => value = new Matrix4x4(newValue, value.GetRow(1), value.GetRow(2), value.GetRow(3)));
}
public override SlotValueType valueType { get { return SlotValueType.Dynamic; } }
public override ConcreteSlotValueType concreteValueType
{
get { return m_ConcreteValueType; }
}
public void SetConcreteType(ConcreteSlotValueType valueType)
{
m_ConcreteValueType = valueType;
}
public override PreviewProperty GetPreviewProperty(string name)
{
var propType = ConvertConcreteSlotValueTypeToPropertyType(concreteValueType);
var pp = new PreviewProperty(propType) { name = name };
if (propType == PropertyType.Vector1)
pp.floatValue = value.m00;
else
pp.vector4Value = new Vector4(value.m00, value.m01, value.m02, value.m03);
return pp;
}
protected override string ConcreteSlotValueAsVariable(AbstractMaterialNode.OutputPrecision precision)
{
var channelCount = SlotValueHelper.GetChannelCount(concreteValueType);
string values = NodeUtils.FloatToShaderValue(value.m00);
if (channelCount == 1)
return values;
for (var i = 1; i < channelCount; i++)
values += ", " + value.GetRow(0)[i];
return string.Format("{0}{1}({2})", precision, channelCount, values);
}
public override void AddDefaultProperty(PropertyCollector properties, GenerationMode generationMode)
{
if (!generationMode.IsPreview())
return;
var matOwner = owner as AbstractMaterialNode;
if (matOwner == null)
throw new Exception(string.Format("Slot {0} either has no owner, or the owner is not a {1}", this, typeof(AbstractMaterialNode)));
IShaderProperty property;
switch (concreteValueType)
{
case ConcreteSlotValueType.Vector4:
property = new Vector4ShaderProperty();
break;
case ConcreteSlotValueType.Vector3:
property = new Vector3ShaderProperty();
break;
case ConcreteSlotValueType.Vector2:
property = new Vector2ShaderProperty();
break;
case ConcreteSlotValueType.Vector1:
property = new Vector1ShaderProperty();
break;
case ConcreteSlotValueType.Matrix4:
property = new Matrix4ShaderProperty();
break;
case ConcreteSlotValueType.Matrix3:
property = new Matrix3ShaderProperty();
break;
case ConcreteSlotValueType.Matrix2:
property = new Matrix2ShaderProperty();
break;
default:
throw new ArgumentOutOfRangeException();
}
property.overrideReferenceName = matOwner.GetVariableNameForSlot(id);
property.generatePropertyBlock = false;
properties.AddShaderProperty(property);
}
public override void CopyValuesFrom(MaterialSlot foundSlot)
{
var slot = foundSlot as DynamicValueMaterialSlot;
if (slot != null)
value = slot.value;
}
}
}
using System;
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Drawing.Slots;
using UnityEngine;
using UnityEngine.Experimental.UIElements;
namespace UnityEditor.ShaderGraph
{
[Serializable]
public class DynamicValueMaterialSlot : MaterialSlot, IMaterialSlotHasValue<Matrix4x4>
{
[SerializeField]
private Matrix4x4 m_Value;
[SerializeField]
private Matrix4x4 m_DefaultValue;
private ConcreteSlotValueType m_ConcreteValueType = ConcreteSlotValueType.Vector4;
public DynamicValueMaterialSlot()
{
}
public DynamicValueMaterialSlot(
int slotId,
string displayName,
string shaderOutputName,
SlotType slotType,
Matrix4x4 value,
ShaderStage shaderStage = ShaderStage.Dynamic,
bool hidden = false)
: base(slotId, displayName, shaderOutputName, slotType, shaderStage, hidden)
{
m_Value = value;
}
public Matrix4x4 defaultValue { get { return m_DefaultValue; } }
public Matrix4x4 value
{
get { return m_Value; }
set { m_Value = value; }
}
public override VisualElement InstantiateControl()
{
int components =
concreteValueType == ConcreteSlotValueType.Vector4 ? 4 :
concreteValueType == ConcreteSlotValueType.Vector3 ? 3 :
concreteValueType == ConcreteSlotValueType.Vector2 ? 2 :
concreteValueType == ConcreteSlotValueType.Vector1 ? 1 : 0;
return new MultiFloatSlotControlView(owner, components, () => value.GetRow(0), (newValue) => value = new Matrix4x4(newValue, value.GetRow(1), value.GetRow(2), value.GetRow(3)));
}
public override SlotValueType valueType { get { return SlotValueType.Dynamic; } }
public override ConcreteSlotValueType concreteValueType
{
get { return m_ConcreteValueType; }
}
public void SetConcreteType(ConcreteSlotValueType valueType)
{
m_ConcreteValueType = valueType;
}
public override PreviewProperty GetPreviewProperty(string name)
{
var propType = ConvertConcreteSlotValueTypeToPropertyType(concreteValueType);
var pp = new PreviewProperty(propType) { name = name };
if (propType == PropertyType.Vector1)
pp.floatValue = value.m00;
else
pp.vector4Value = new Vector4(value.m00, value.m01, value.m02, value.m03);
return pp;
}
protected override string ConcreteSlotValueAsVariable(AbstractMaterialNode.OutputPrecision precision)
{
var channelCount = SlotValueHelper.GetChannelCount(concreteValueType);
string values = NodeUtils.FloatToShaderValue(value.m00);
if (channelCount == 1)
return values;
for (var i = 1; i < channelCount; i++)
values += ", " + value.GetRow(0)[i];
return string.Format("{0}{1}({2})", precision, channelCount, values);
}
public override void AddDefaultProperty(PropertyCollector properties, GenerationMode generationMode)
{
if (!generationMode.IsPreview())
return;
var matOwner = owner as AbstractMaterialNode;
if (matOwner == null)
throw new Exception(string.Format("Slot {0} either has no owner, or the owner is not a {1}", this, typeof(AbstractMaterialNode)));
IShaderProperty property;
switch (concreteValueType)
{
case ConcreteSlotValueType.Vector4:
property = new Vector4ShaderProperty();
break;
case ConcreteSlotValueType.Vector3:
property = new Vector3ShaderProperty();
break;
case ConcreteSlotValueType.Vector2:
property = new Vector2ShaderProperty();
break;
case ConcreteSlotValueType.Vector1:
property = new Vector1ShaderProperty();
break;
case ConcreteSlotValueType.Matrix4:
property = new Matrix4ShaderProperty();
break;
case ConcreteSlotValueType.Matrix3:
property = new Matrix3ShaderProperty();
break;
case ConcreteSlotValueType.Matrix2:
property = new Matrix2ShaderProperty();
break;
default:
throw new ArgumentOutOfRangeException();
}
property.overrideReferenceName = matOwner.GetVariableNameForSlot(id);
property.generatePropertyBlock = false;
properties.AddShaderProperty(property);
}
public override void CopyValuesFrom(MaterialSlot foundSlot)
{
var slot = foundSlot as DynamicValueMaterialSlot;
if (slot != null)
value = slot.value;
}
}
}

4
MaterialGraphProject/Assets/com.unity.shadergraph/Editor/Data/Graphs/SpaceMaterialSlot.cs.meta


fileFormatVersion: 2
guid: 66199806246c45e493afdfc09208cbdc
fileFormatVersion: 2
guid: 66199806246c45e493afdfc09208cbdc
timeCreated: 1509290088

4
MaterialGraphProject/Assets/com.unity.shadergraph/Editor/Data/Graphs/Texture2DInputMaterialSlot.cs.meta


fileFormatVersion: 2
guid: ebeb3a21d05d49caa5d3318fb49b7612
fileFormatVersion: 2
guid: ebeb3a21d05d49caa5d3318fb49b7612
timeCreated: 1509276977

/MaterialGraphProject/Assets/UnityShaderEditor.meta → /MaterialGraphProject/Assets/com.unity.shadergraph.meta

/MaterialGraphProject/Assets/UnityShaderEditor → /MaterialGraphProject/Assets/com.unity.shadergraph

正在加载...
取消
保存