浏览代码
Merge branch 'hackweek2017' of https://github.com/stramit/MaterialGraph into hackweek2017
/main
Merge branch 'hackweek2017' of https://github.com/stramit/MaterialGraph into hackweek2017
/main
Florent Guinier
8 年前
当前提交
fe87f870
共有 101 个文件被更改,包括 2885 次插入 和 170 次删除
-
7MaterialGraphProject/Assets/Andre/Nodes/ToggleNode.cs
-
1MaterialGraphProject/Assets/Eduardo/ConstantsNode.cs
-
2MaterialGraphProject/Assets/Eduardo/EduardoTestGraph.ShaderGraph
-
141MaterialGraphProject/Assets/GeneratedShader.shader
-
8MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Implementation/NodeUtils.cs
-
4MaterialGraphProject/Assets/GraphView/Editor.meta
-
2MaterialGraphProject/Assets/Matt/EyeMaster.ShaderGraph
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/ColorNodePresenter.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/GradientNodePresenter.cs
-
21MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialGraphPresenter.cs
-
49MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Vector1NodePresenter.cs
-
17MaterialGraphProject/Assets/UnityShaderEditor/Editor/HelperShader.shader
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/HelperShader.shader.meta
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/PropertyChunkTests.cs
-
18MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/AbstractMaterialNode.cs
-
23MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/ColorNode.cs
-
54MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Vector/Vector1Node.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Vector/Vector2Node.cs
-
26MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/MaterialSlot.cs
-
4MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/CheckerboardNode.cs
-
42MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/VoronoiNoise.cs
-
5MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/PropertyType.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/SlotValue.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/UV/UVTileNode.cs
-
110MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SurfaceModel/AbstractSurfaceMasterNode.cs
-
35MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SurfaceModel/MetallicMasterNode.cs
-
30MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SurfaceModel/SpecularMasterNode.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Util/ColorPropertyChunk.cs
-
39MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Util/FloatPropertyChunk.cs
-
29MaterialGraphProject/Assets/_MingWai/GradientNode.cs
-
102MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Matrix/MatrixMultiplyNode.cs
-
21MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Matrix/MatrixTransposeNode.cs
-
43MaterialGraphProject/Assets/Andre/Nodes/Editor/TransformNodePresenter.cs
-
12MaterialGraphProject/Assets/Andre/Nodes/Editor/TransformNodePresenter.cs.meta
-
196MaterialGraphProject/Assets/Andre/Nodes/TransformNode.cs
-
12MaterialGraphProject/Assets/Andre/Nodes/TransformNode.cs.meta
-
1MaterialGraphProject/Assets/Andre/Shaders/StandardOpaqueShader.ShaderGraph
-
9MaterialGraphProject/Assets/Andre/Shaders/StandardOpaqueShader.ShaderGraph.meta
-
1MaterialGraphProject/Assets/Andre/Shaders/TestingGraph.ShaderGraph
-
9MaterialGraphProject/Assets/Andre/Shaders/TestingGraph.ShaderGraph.meta
-
83MaterialGraphProject/Assets/Eduardo/EduardoTestMat.mat
-
9MaterialGraphProject/Assets/Eduardo/EduardoTestMat.mat.meta
-
64MaterialGraphProject/Assets/Eduardo/VertexNormalNode.cs
-
12MaterialGraphProject/Assets/Eduardo/VertexNormalNode.cs.meta
-
64MaterialGraphProject/Assets/Eduardo/VertexPositionNode.cs
-
12MaterialGraphProject/Assets/Eduardo/VertexPositionNode.cs.meta
-
363MaterialGraphProject/Assets/Eduardo/eduardoScene.unity
-
8MaterialGraphProject/Assets/Eduardo/eduardoScene.unity.meta
-
9MaterialGraphProject/Assets/Florent.meta
-
22MaterialGraphProject/Assets/Matt/CommonMatrixType.cs
-
12MaterialGraphProject/Assets/Matt/CommonMatrixType.cs.meta
-
9MaterialGraphProject/Assets/Matt/Examples.meta
-
1MaterialGraphProject/Assets/Matt/Test.ShaderGraph
-
9MaterialGraphProject/Assets/Matt/Test.ShaderGraph.meta
-
40MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Matrix2NodePresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Matrix2NodePresenter.cs.meta
-
41MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Matrix3NodePresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Matrix3NodePresenter.cs.meta
-
42MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Matrix4NodePresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/Matrix4NodePresenter.cs.meta
-
51MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MatrixCommonNodePresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MatrixCommonNodePresenter.cs.meta
-
43MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/ScatterNodePresenter.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/ScatterNodePresenter.cs.meta
-
9MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Art/Filters.meta
-
9MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Matrix.meta
-
9MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Matrix.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/NoiseNode.cs.meta
-
60MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/UV/TwistNode.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/UV/TwistNode.cs.meta
-
55MaterialGraphProject/Assets/_MingWai/ColorBalanceNode.cs
-
12MaterialGraphProject/Assets/_MingWai/ColorBalanceNode.cs.meta
-
67MaterialGraphProject/Assets/_MingWai/RandomRangeNode.cs
-
12MaterialGraphProject/Assets/_MingWai/RandomRangeNode.cs.meta
-
121MaterialGraphProject/Assets/_MingWai/ScatterNode.cs
-
12MaterialGraphProject/Assets/_MingWai/ScatterNode.cs.meta
-
9MaterialGraphProject/Assets/Florent/GeneratedTexture.meta
-
1MaterialGraphProject/Assets/Matt/Examples/HueStrip.ShaderGraph
-
9MaterialGraphProject/Assets/Matt/Examples/HueStrip.ShaderGraph.meta
-
1MaterialGraphProject/Assets/Matt/Examples/Swirl.ShaderGraph
-
9MaterialGraphProject/Assets/Matt/Examples/Swirl.ShaderGraph.meta
-
103MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Matrix/Matrix2Node.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Matrix/Matrix2Node.cs.meta
-
103MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Matrix/Matrix3Node.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Matrix/Matrix3Node.cs.meta
-
103MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Matrix/Matrix4Node.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Matrix/Matrix4Node.cs.meta
-
68MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Matrix/MatrixCommonNode.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/Matrix/MatrixCommonNode.cs.meta
-
123MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Matrix/MatrixMultiplyByVectorNode.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Matrix/MatrixMultiplyByVectorNode.cs.meta
-
12MaterialGraphProject/Assets/Brandon/NoiseNode.cs.meta
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/NoiseNode.cs
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Matrix/MatrixMultiplyNode.cs
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Matrix/MatrixMultiplyNode.cs.meta
-
0/MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Math/Matrix/MatrixTransposeNode.cs
2
MaterialGraphProject/Assets/Eduardo/EduardoTestGraph.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 9635695807dafd94992e8eb6a9346b63 |
|||
guid: 7a91bd168256a4fecb2d532dc2f38d8a |
|||
timeCreated: 1485805545 |
|||
timeCreated: 1495668355 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
2
MaterialGraphProject/Assets/Matt/EyeMaster.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using RMGUI.GraphView; |
|||
using UnityEditor.Graphing.Drawing; |
|||
using UnityEngine.MaterialGraph; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
class TransformControlPresenter : GraphControlPresenter |
|||
{ |
|||
|
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as TransformNode; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
//EditorGUILayout.BeginHorizontal ();
|
|||
tNode.spaceFrom = (SimpleMatrixType)EditorGUILayout.EnumPopup ("From", tNode.spaceFrom); |
|||
tNode.spaceTo = (SimpleMatrixType)EditorGUILayout.EnumPopup ("To", tNode.spaceTo); |
|||
//EditorGUILayout.BeginHorizontal ();
|
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return (EditorGUIUtility.singleLineHeight + 6 * EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class TransformNodePresenter : PropertyNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<TransformControlPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter>(base.GetControlData()) { instance }; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 01ea0408c41734e0b8b28e0983f7a700 |
|||
timeCreated: 1476732809 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title ("Math/Vector/Transform")] |
|||
public class TransformNode : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireTangent, IMayRequireBitangent, IMayRequireNormal |
|||
{ |
|||
[SerializeField] |
|||
private SimpleMatrixType m_spaceListFrom; |
|||
[SerializeField] |
|||
private SimpleMatrixType m_spaceListTo; |
|||
|
|||
private const int InputSlotId = 0; |
|||
private const int OutputSlotId = 1; |
|||
private const string kInputSlotName = "Input"; |
|||
private const string kOutputSlotName = "Output"; |
|||
|
|||
public SimpleMatrixType spaceFrom |
|||
{ |
|||
get { return m_spaceListFrom; } |
|||
set |
|||
{ |
|||
if (m_spaceListFrom == value) |
|||
return; |
|||
|
|||
m_spaceListFrom = value; |
|||
if (onModified != null) |
|||
{ |
|||
onModified(this, ModificationScope.Graph); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public override bool hasPreview |
|||
{ |
|||
get { return false; } |
|||
} |
|||
|
|||
public SimpleMatrixType spaceTo |
|||
{ |
|||
get { return m_spaceListTo; } |
|||
set |
|||
{ |
|||
if (m_spaceListTo == value) |
|||
return; |
|||
|
|||
m_spaceListTo = value; |
|||
if (onModified != null) |
|||
{ |
|||
onModified(this, ModificationScope.Graph); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public TransformNode () |
|||
{ |
|||
name = "Transform"; |
|||
UpdateNodeAfterDeserialization (); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(GetInputSlot()); |
|||
AddSlot(GetOutputSlot()); |
|||
RemoveSlotsNameNotMatching(validSlots); |
|||
} |
|||
|
|||
protected int[] validSlots |
|||
{ |
|||
get { return new[] {InputSlotId, OutputSlotId}; } |
|||
} |
|||
|
|||
protected virtual MaterialSlot GetInputSlot() |
|||
{ |
|||
return new MaterialSlot(InputSlotId, GetInputSlotName(), kInputSlotName, SlotType.Input, SlotValueType.Vector3, Vector3.zero); |
|||
} |
|||
|
|||
protected virtual MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotName, SlotType.Output, SlotValueType.Vector3, Vector4.zero); |
|||
} |
|||
|
|||
protected virtual string GetInputSlotName() |
|||
{ |
|||
return "Input"; |
|||
} |
|||
|
|||
protected virtual string GetOutputSlotName() |
|||
{ |
|||
return "Output"; |
|||
} |
|||
|
|||
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
NodeUtils.SlotConfigurationExceptionIfBadConfiguration(this, new[] { InputSlotId }, new[] { OutputSlotId }); |
|||
string inputValue = GetSlotValue(InputSlotId, generationMode); |
|||
string transformString = ""; |
|||
bool requiresTangentTransform = false; |
|||
|
|||
if(spaceFrom == SimpleMatrixType.World){ |
|||
if (spaceTo == SimpleMatrixType.World) { |
|||
transformString = inputValue; |
|||
} else if (spaceTo == SimpleMatrixType.Local) { |
|||
transformString = "mul(unity_WorldToObject, float4(" + inputValue + ", 0)).xyz"; |
|||
} else if (spaceTo == SimpleMatrixType.Tangent) { |
|||
requiresTangentTransform = true; |
|||
transformString = "mul(tangentTransform, " + inputValue + ").xyz"; |
|||
} else if (spaceTo == SimpleMatrixType.View) { |
|||
transformString = "mul( UNITY_MATRIX_V, float4(" + inputValue + ", 0)).xyz"; |
|||
} |
|||
}else if(spaceFrom == SimpleMatrixType.Local){ |
|||
if (spaceTo == SimpleMatrixType.World) { |
|||
transformString = "mul(unity_ObjectToWorld, float4(" + inputValue + ", 0)).xyz"; |
|||
} else if (spaceTo == SimpleMatrixType.Local) { |
|||
transformString = inputValue; |
|||
} else if (spaceTo == SimpleMatrixType.Tangent) { |
|||
requiresTangentTransform = true; |
|||
transformString = "mul( tangentTransform, mul( unity_ObjectToWorld, float4(" + inputValue + ", 0) ).xyz).xyz"; |
|||
} else if (spaceTo == SimpleMatrixType.View) { |
|||
transformString = "mul( UNITY_MATRIX_MV, float4(" + inputValue + ", 0)).xyz"; |
|||
} |
|||
}else if(spaceFrom == SimpleMatrixType.Tangent){ |
|||
requiresTangentTransform = true; |
|||
if (spaceTo == SimpleMatrixType.World) { |
|||
transformString = "mul( " + inputValue + ", tangentTransform ).xyz"; |
|||
} else if (spaceTo == SimpleMatrixType.Local) { |
|||
transformString = "mul( unity_WorldToObject, float4(mul(" + inputValue + ", tangentTransform ),0) ).xyz"; |
|||
} else if (spaceTo == SimpleMatrixType.Tangent) { |
|||
transformString = inputValue; |
|||
} else if (spaceTo == SimpleMatrixType.View) { |
|||
transformString = "mul( UNITY_MATRIX_V, float4(mul(" + inputValue + ", tangentTransform ),0) ).xyz"; |
|||
} |
|||
}else if(spaceFrom == SimpleMatrixType.View){ |
|||
if (spaceTo == SimpleMatrixType.World) { |
|||
transformString = "mul( float4(" + inputValue + ", 0), UNITY_MATRIX_V ).xyz"; |
|||
} else if (spaceTo == SimpleMatrixType.Local) { |
|||
transformString = "mul( float4(" + inputValue + ", 0), UNITY_MATRIX_MV ).xyz"; |
|||
} else if (spaceTo == SimpleMatrixType.Tangent) { |
|||
requiresTangentTransform = true; |
|||
transformString = "mul( tangentTransform, mul( float4(" + inputValue + ", 0), UNITY_MATRIX_V ).xyz ).xyz"; |
|||
} else if (spaceTo == SimpleMatrixType.View) { |
|||
transformString = inputValue; |
|||
} |
|||
} |
|||
|
|||
if(requiresTangentTransform) |
|||
visitor.AddShaderChunk ("float3x3 tangentTransform = float3x3( worldSpaceTangent, worldSpaceBitangent, worldSpaceNormal);", false); |
|||
|
|||
visitor.AddShaderChunk(precision + outputDimension + " " + GetVariableNameForSlot(OutputSlotId) + " = " + transformString + ";", true); |
|||
} |
|||
|
|||
//float3x3 tangentTransform = float3x3( i.tangentDir, i.bitangentDir, i.normalDir);------
|
|||
|
|||
//mul(unity_WorldToObject, float4(i.posWorld.rgb,0) ).xyz - world to local---------
|
|||
//mul( tangentTransform, i.posWorld.rgb ).xyz - world to tangent-----------------
|
|||
//mul( UNITY_MATRIX_V, float4(i.posWorld.rgb,0) ).xyz - world to view-------------
|
|||
|
|||
//mul( unity_ObjectToWorld, float4(i.posWorld.rgb,0) ).xyz - local to world--------
|
|||
//mul( tangentTransform, mul( unity_ObjectToWorld, float4(i.posWorld.rgb,0) ).xyz - local to tangent------------
|
|||
//mul( UNITY_MATRIX_MV, float4(i.posWorld.rgb,0) ).xyz - local to view--------------
|
|||
|
|||
//mul( i.posWorld.rgb, tangentTransform ).xyz - tangent to world---------
|
|||
//mul( unity_WorldToObject, float4(mul( i.posWorld.rgb, tangentTransform ),0) ).xyz - tangent to local-----
|
|||
//mul( UNITY_MATRIX_V, float4(mul( i.posWorld.rgb, tangentTransform ),0) ).xyz - tangent to view-------
|
|||
|
|||
//mul( float4(i.posWorld.rgb,0), UNITY_MATRIX_V ).xyz - view to world
|
|||
//mul( float4(i.posWorld.rgb,0), UNITY_MATRIX_MV ).xyz - view to local
|
|||
//mul( tangentTransform, mul( float4(i.posWorld.rgb,0), UNITY_MATRIX_V ).xyz ).xyz - view to tangent
|
|||
|
|||
|
|||
public string outputDimension |
|||
{ |
|||
get { return ConvertConcreteSlotValueTypeToString(FindOutputSlot<MaterialSlot>(OutputSlotId).concreteValueType); } |
|||
} |
|||
private string inputDimension |
|||
{ |
|||
get { return ConvertConcreteSlotValueTypeToString(FindInputSlot<MaterialSlot>(InputSlotId).concreteValueType); } |
|||
} |
|||
|
|||
public bool RequiresTangent() |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
public bool RequiresBitangent() |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
public bool RequiresNormal(){ |
|||
return true; |
|||
} |
|||
} |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 1d252394349e74b278276a6e0857635e |
|||
timeCreated: 1490745697 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1
MaterialGraphProject/Assets/Andre/Shaders/StandardOpaqueShader.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 6e097b4224bbd407cb33de4f4b78ff0c |
|||
timeCreated: 1495651266 |
|||
licenseType: Pro |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} |
1
MaterialGraphProject/Assets/Andre/Shaders/TestingGraph.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: e1a3554230a1a400ea481f2db95e273e |
|||
timeCreated: 1495650612 |
|||
licenseType: Pro |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!21 &2100000 |
|||
Material: |
|||
serializedVersion: 6 |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_Name: EduardoTestMat |
|||
m_Shader: {fileID: 4800000, guid: 9ab5e16c2083a4fe689209a8c1ae425e, type: 3} |
|||
m_ShaderKeywords: |
|||
m_LightmapFlags: 0 |
|||
m_EnableInstancingVariants: 0 |
|||
m_CustomRenderQueue: -1 |
|||
stringTagMap: {} |
|||
disabledShaderPasses: [] |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- Texture_8fd49eff_ec05_41e3_9bc1_5bdfc20db019_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 6ff1e57e8df9d2948bb6d703d02af730, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- Texture_ec519094_93da_4612_af61_2f8bcdc6589e_Uniform: |
|||
m_Texture: {fileID: 2800000, guid: 6ff1e57e8df9d2948bb6d703d02af730, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BumpMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailAlbedoMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMask: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MainTex: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MetallicGlossMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _OcclusionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ParallaxMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- _BumpScale: 1 |
|||
- _Cutoff: 0.5 |
|||
- _DetailNormalMapScale: 1 |
|||
- _DstBlend: 0 |
|||
- _GlossMapScale: 1 |
|||
- _Glossiness: 0.5 |
|||
- _GlossyReflections: 1 |
|||
- _Metallic: 0 |
|||
- _Mode: 0 |
|||
- _OcclusionStrength: 1 |
|||
- _Parallax: 0.02 |
|||
- _SmoothnessTextureChannel: 0 |
|||
- _SpecularHighlights: 1 |
|||
- _SrcBlend: 1 |
|||
- _UVSec: 0 |
|||
- _ZWrite: 1 |
|||
m_Colors: |
|||
- _Color: {r: 1, g: 1, b: 1, a: 1} |
|||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
|
|||
fileFormatVersion: 2 |
|||
guid: 51689361644e44b41aa59664b34a6e45 |
|||
timeCreated: 1495654926 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
mainObjectFileID: 2100000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Input/Geometry/Vertex Normal")] |
|||
public class VertexNormalNode : AbstractMaterialNode |
|||
{ |
|||
private const string kOutputSlotName = "XYZW"; |
|||
private const string kOutputSlotNameXYZ = "XYZ"; |
|||
private const string kOutputSlotNameX = "X"; |
|||
private const string kOutputSlotNameY = "Y"; |
|||
private const string kOutputSlotNameZ = "Z"; |
|||
private const string kOutputSlotNameW = "W"; |
|||
|
|||
public const int OutputSlotId = 0; |
|||
public const int OutputSlotIdXYZ = 1; |
|||
public const int OutputSlotIdX = 2; |
|||
public const int OutputSlotIdY = 3; |
|||
public const int OutputSlotIdZ = 4; |
|||
public const int OutputSlotIdW = 5; |
|||
|
|||
public VertexNormalNode() |
|||
{ |
|||
name = "VertexNormal"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new MaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Vector4, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdXYZ, kOutputSlotNameXYZ, kOutputSlotNameXYZ, SlotType.Output, SlotValueType.Vector3, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdX, kOutputSlotNameX, kOutputSlotNameX, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdY, kOutputSlotNameY, kOutputSlotNameY, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdZ, kOutputSlotNameZ, kOutputSlotNameZ, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdW, kOutputSlotNameW, kOutputSlotNameW, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
|
|||
RemoveSlotsNameNotMatching(validSlots); |
|||
} |
|||
|
|||
protected int[] validSlots |
|||
{ |
|||
get { return new[] { OutputSlotId, OutputSlotIdXYZ, OutputSlotIdX, OutputSlotIdY, OutputSlotIdZ, OutputSlotIdW }; } |
|||
} |
|||
|
|||
public override string GetVariableNameForSlot(int slotId) |
|||
{ |
|||
switch (slotId) |
|||
{ |
|||
case OutputSlotIdXYZ: |
|||
return "v.normal.xyz"; |
|||
case OutputSlotIdX: |
|||
return "v.normal.x"; |
|||
case OutputSlotIdY: |
|||
return "v.normal.y"; |
|||
case OutputSlotIdZ: |
|||
return "v.normal.z"; |
|||
case OutputSlotIdW: |
|||
return "v.normal.w"; |
|||
default: |
|||
return "v.normal"; |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c5532eff58cce43468e6f88386d8ac1c |
|||
timeCreated: 1495660146 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Input/Geometry/Vertex Position")] |
|||
public class VertexPositionNode : AbstractMaterialNode |
|||
{ |
|||
private const string kOutputSlotName = "XYZW"; |
|||
private const string kOutputSlotNameXYZ = "XYZ"; |
|||
private const string kOutputSlotNameX = "X"; |
|||
private const string kOutputSlotNameY = "Y"; |
|||
private const string kOutputSlotNameZ = "Z"; |
|||
private const string kOutputSlotNameW = "W"; |
|||
|
|||
public const int OutputSlotId = 0; |
|||
public const int OutputSlotIdXYZ = 1; |
|||
public const int OutputSlotIdX = 2; |
|||
public const int OutputSlotIdY = 3; |
|||
public const int OutputSlotIdZ = 4; |
|||
public const int OutputSlotIdW = 5; |
|||
|
|||
public VertexPositionNode() |
|||
{ |
|||
name = "VertexPostion"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new MaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Vector4, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdXYZ, kOutputSlotNameXYZ, kOutputSlotNameXYZ, SlotType.Output, SlotValueType.Vector3, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdX, kOutputSlotNameX, kOutputSlotNameX, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdY, kOutputSlotNameY, kOutputSlotNameY, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdZ, kOutputSlotNameZ, kOutputSlotNameZ, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
AddSlot(new MaterialSlot(OutputSlotIdW, kOutputSlotNameW, kOutputSlotNameW, SlotType.Output, SlotValueType.Vector1, Vector4.zero)); |
|||
|
|||
RemoveSlotsNameNotMatching(validSlots); |
|||
} |
|||
|
|||
protected int[] validSlots |
|||
{ |
|||
get { return new[] { OutputSlotId, OutputSlotIdXYZ ,OutputSlotIdX, OutputSlotIdY, OutputSlotIdZ, OutputSlotIdW }; } |
|||
} |
|||
|
|||
public override string GetVariableNameForSlot(int slotId) |
|||
{ |
|||
switch (slotId) |
|||
{ |
|||
case OutputSlotIdXYZ: |
|||
return "v.vertex.xyz"; |
|||
case OutputSlotIdX: |
|||
return "v.vertex.x"; |
|||
case OutputSlotIdY: |
|||
return "v.vertex.y"; |
|||
case OutputSlotIdZ: |
|||
return "v.vertex.z"; |
|||
case OutputSlotIdW: |
|||
return "v.vertex.w"; |
|||
default: |
|||
return "v.vertex"; |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 27fd3b60f289f4242a6142556ed287f1 |
|||
timeCreated: 1495658351 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!29 &1 |
|||
OcclusionCullingSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 2 |
|||
m_OcclusionBakeSettings: |
|||
smallestOccluder: 5 |
|||
smallestHole: 0.25 |
|||
backfaceThreshold: 100 |
|||
m_SceneGUID: 00000000000000000000000000000000 |
|||
m_OcclusionCullingData: {fileID: 0} |
|||
--- !u!104 &2 |
|||
RenderSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 8 |
|||
m_Fog: 0 |
|||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
|||
m_FogMode: 3 |
|||
m_FogDensity: 0.01 |
|||
m_LinearFogStart: 0 |
|||
m_LinearFogEnd: 300 |
|||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} |
|||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} |
|||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} |
|||
m_AmbientIntensity: 1 |
|||
m_AmbientMode: 0 |
|||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
|||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_HaloStrength: 0.5 |
|||
m_FlareStrength: 1 |
|||
m_FlareFadeSpeed: 3 |
|||
m_HaloTexture: {fileID: 0} |
|||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
|||
m_DefaultReflectionMode: 0 |
|||
m_DefaultReflectionResolution: 128 |
|||
m_ReflectionBounces: 1 |
|||
m_ReflectionIntensity: 1 |
|||
m_CustomReflection: {fileID: 0} |
|||
m_Sun: {fileID: 0} |
|||
m_IndirectSpecularColor: {r: 0.18028316, g: 0.22571331, b: 0.306922, a: 1} |
|||
--- !u!157 &3 |
|||
LightmapSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 11 |
|||
m_GIWorkflowMode: 0 |
|||
m_GISettings: |
|||
serializedVersion: 2 |
|||
m_BounceScale: 1 |
|||
m_IndirectOutputScale: 1 |
|||
m_AlbedoBoost: 1 |
|||
m_TemporalCoherenceThreshold: 1 |
|||
m_EnvironmentLightingMode: 0 |
|||
m_EnableBakedLightmaps: 1 |
|||
m_EnableRealtimeLightmaps: 1 |
|||
m_LightmapEditorSettings: |
|||
serializedVersion: 9 |
|||
m_Resolution: 2 |
|||
m_BakeResolution: 40 |
|||
m_TextureWidth: 1024 |
|||
m_TextureHeight: 1024 |
|||
m_AO: 0 |
|||
m_AOMaxDistance: 1 |
|||
m_CompAOExponent: 1 |
|||
m_CompAOExponentDirect: 0 |
|||
m_Padding: 2 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_LightmapsBakeMode: 1 |
|||
m_TextureCompression: 1 |
|||
m_FinalGather: 0 |
|||
m_FinalGatherFiltering: 1 |
|||
m_FinalGatherRayCount: 256 |
|||
m_ReflectionCompression: 2 |
|||
m_MixedBakeMode: 2 |
|||
m_BakeBackend: 0 |
|||
m_PVRSampling: 1 |
|||
m_PVRDirectSampleCount: 32 |
|||
m_PVRSampleCount: 500 |
|||
m_PVRBounces: 2 |
|||
m_PVRFiltering: 0 |
|||
m_PVRFilteringMode: 1 |
|||
m_PVRCulling: 1 |
|||
m_PVRFilteringGaussRadiusDirect: 1 |
|||
m_PVRFilteringGaussRadiusIndirect: 5 |
|||
m_PVRFilteringGaussRadiusAO: 2 |
|||
m_PVRFilteringAtrousColorSigma: 1 |
|||
m_PVRFilteringAtrousNormalSigma: 1 |
|||
m_PVRFilteringAtrousPositionSigma: 1 |
|||
m_LightingDataAsset: {fileID: 0} |
|||
m_UseShadowmask: 1 |
|||
--- !u!196 &4 |
|||
NavMeshSettings: |
|||
serializedVersion: 2 |
|||
m_ObjectHideFlags: 0 |
|||
m_BuildSettings: |
|||
serializedVersion: 2 |
|||
agentTypeID: 0 |
|||
agentRadius: 0.5 |
|||
agentHeight: 2 |
|||
agentSlope: 45 |
|||
agentClimb: 0.4 |
|||
ledgeDropHeight: 0 |
|||
maxJumpAcrossDistance: 0 |
|||
minRegionArea: 2 |
|||
manualCellSize: 0 |
|||
cellSize: 0.16666667 |
|||
manualTileSize: 0 |
|||
tileSize: 256 |
|||
accuratePlacement: 0 |
|||
debug: |
|||
m_Flags: 0 |
|||
m_NavMeshData: {fileID: 0} |
|||
--- !u!1 &165786477 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 165786481} |
|||
- component: {fileID: 165786480} |
|||
- component: {fileID: 165786479} |
|||
- component: {fileID: 165786478} |
|||
m_Layer: 0 |
|||
m_Name: Cube |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!23 &165786478 |
|||
MeshRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 165786477} |
|||
m_Enabled: 1 |
|||
m_CastShadows: 1 |
|||
m_ReceiveShadows: 1 |
|||
m_DynamicOccludee: 1 |
|||
m_MotionVectors: 1 |
|||
m_LightProbeUsage: 1 |
|||
m_ReflectionProbeUsage: 1 |
|||
m_Materials: |
|||
- {fileID: 2100000, guid: 51689361644e44b41aa59664b34a6e45, type: 2} |
|||
m_StaticBatchInfo: |
|||
firstSubMesh: 0 |
|||
subMeshCount: 0 |
|||
m_StaticBatchRoot: {fileID: 0} |
|||
m_ProbeAnchor: {fileID: 0} |
|||
m_LightProbeVolumeOverride: {fileID: 0} |
|||
m_ScaleInLightmap: 1 |
|||
m_PreserveUVs: 1 |
|||
m_IgnoreNormalsForChartDetection: 0 |
|||
m_ImportantGI: 0 |
|||
m_SelectedEditorRenderState: 3 |
|||
m_MinimumChartSize: 4 |
|||
m_AutoUVMaxDistance: 0.5 |
|||
m_AutoUVMaxAngle: 89 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_SortingLayerID: 0 |
|||
m_SortingLayer: 0 |
|||
m_SortingOrder: 0 |
|||
--- !u!65 &165786479 |
|||
BoxCollider: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 165786477} |
|||
m_Material: {fileID: 0} |
|||
m_IsTrigger: 0 |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_Size: {x: 1, y: 1, z: 1} |
|||
m_Center: {x: 0, y: 0, z: 0} |
|||
--- !u!33 &165786480 |
|||
MeshFilter: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 165786477} |
|||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} |
|||
--- !u!4 &165786481 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 165786477} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 2 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &545929005 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 545929010} |
|||
- component: {fileID: 545929009} |
|||
- component: {fileID: 545929008} |
|||
- component: {fileID: 545929007} |
|||
- component: {fileID: 545929006} |
|||
m_Layer: 0 |
|||
m_Name: Main Camera |
|||
m_TagString: MainCamera |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!81 &545929006 |
|||
AudioListener: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 545929005} |
|||
m_Enabled: 1 |
|||
--- !u!124 &545929007 |
|||
Behaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 545929005} |
|||
m_Enabled: 1 |
|||
--- !u!92 &545929008 |
|||
Behaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 545929005} |
|||
m_Enabled: 1 |
|||
--- !u!20 &545929009 |
|||
Camera: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 545929005} |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_ClearFlags: 1 |
|||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} |
|||
m_NormalizedViewPortRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
near clip plane: 0.3 |
|||
far clip plane: 1000 |
|||
field of view: 60 |
|||
orthographic: 0 |
|||
orthographic size: 5 |
|||
m_Depth: -1 |
|||
m_CullingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
m_RenderingPath: -1 |
|||
m_TargetTexture: {fileID: 0} |
|||
m_TargetDisplay: 0 |
|||
m_TargetEye: 3 |
|||
m_HDR: 1 |
|||
m_AllowMSAA: 1 |
|||
m_ForceIntoRT: 0 |
|||
m_OcclusionCulling: 1 |
|||
m_StereoConvergence: 10 |
|||
m_StereoSeparation: 0.022 |
|||
m_StereoMirrorMode: 0 |
|||
--- !u!4 &545929010 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 545929005} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 1, z: -10} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &1301173965 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
serializedVersion: 5 |
|||
m_Component: |
|||
- component: {fileID: 1301173967} |
|||
- component: {fileID: 1301173966} |
|||
m_Layer: 0 |
|||
m_Name: Directional Light |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!108 &1301173966 |
|||
Light: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1301173965} |
|||
m_Enabled: 1 |
|||
serializedVersion: 8 |
|||
m_Type: 1 |
|||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} |
|||
m_Intensity: 1 |
|||
m_Range: 10 |
|||
m_SpotAngle: 30 |
|||
m_CookieSize: 10 |
|||
m_Shadows: |
|||
m_Type: 2 |
|||
m_Resolution: -1 |
|||
m_CustomResolution: -1 |
|||
m_Strength: 1 |
|||
m_Bias: 0.05 |
|||
m_NormalBias: 0.4 |
|||
m_NearPlane: 0.2 |
|||
m_Cookie: {fileID: 0} |
|||
m_DrawHalo: 0 |
|||
m_Flare: {fileID: 0} |
|||
m_RenderMode: 0 |
|||
m_CullingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
m_Lightmapping: 4 |
|||
m_AreaSize: {x: 1, y: 1} |
|||
m_BounceIntensity: 1 |
|||
m_FalloffTable: |
|||
m_Table[0]: 0 |
|||
m_Table[1]: 0 |
|||
m_Table[2]: 0 |
|||
m_Table[3]: 0 |
|||
m_Table[4]: 0 |
|||
m_Table[5]: 0 |
|||
m_Table[6]: 0 |
|||
m_Table[7]: 0 |
|||
m_Table[8]: 0 |
|||
m_Table[9]: 0 |
|||
m_Table[10]: 0 |
|||
m_Table[11]: 0 |
|||
m_Table[12]: 0 |
|||
m_ColorTemperature: 6570 |
|||
m_UseColorTemperature: 0 |
|||
m_ShadowRadius: 0 |
|||
m_ShadowAngle: 0 |
|||
--- !u!4 &1301173967 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 1301173965} |
|||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} |
|||
m_LocalPosition: {x: 0, y: 3, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 1 |
|||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: 418471c069e40784489ba3ba9d0bb95b |
|||
timeCreated: 1495655530 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: e9dab59e587c7f244adde1add29b34fc |
|||
folderAsset: yes |
|||
timeCreated: 1495531757 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
public enum CommonMatrixType |
|||
{ |
|||
ModelView, |
|||
View, |
|||
Projection, |
|||
ViewProjection, |
|||
TransposeModelView, |
|||
InverseTransposeModelView, |
|||
ObjectToWorld, |
|||
WorldToObject |
|||
}; |
|||
|
|||
public enum SimpleMatrixType |
|||
{ |
|||
World, |
|||
Local, |
|||
Tangent, |
|||
View |
|||
}; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e466cff33b1ebe64eb2b897b9534a4a4 |
|||
timeCreated: 1495703998 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 6a5311f2c2db6e34f8da2333309aab50 |
|||
folderAsset: yes |
|||
timeCreated: 1495713891 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1
MaterialGraphProject/Assets/Matt/Test.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: fd03b3a3f54f741498f9bea81e951ebb |
|||
timeCreated: 1495668190 |
|||
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 Matrix2ControlPresenter : GraphControlPresenter |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as UnityEngine.MaterialGraph.Matrix2Node; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
tNode[0] = EditorGUILayout.Vector2Field("", tNode[0]); |
|||
tNode[1] = EditorGUILayout.Vector2Field("", tNode[1]); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return (EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class Matrix2NodePresenter : PropertyNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<Matrix2ControlPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter>(base.GetControlData()) { instance }; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7a56e192798ff9a45a01f10c9113e539 |
|||
timeCreated: 1476871291 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using RMGUI.GraphView; |
|||
using UnityEditor.Graphing.Drawing; |
|||
using UnityEngine; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
class Matrix3ControlPresenter : GraphControlPresenter |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var tNode = node as UnityEngine.MaterialGraph.Matrix3Node; |
|||
if (tNode == null) |
|||
return; |
|||
|
|||
tNode[0] = EditorGUILayout.Vector3Field("", tNode[0]); |
|||
tNode[1] = EditorGUILayout.Vector3Field("", tNode[1]); |
|||
tNode[2] = EditorGUILayout.Vector3Field("", tNode[2]); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return (EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing) + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class Matrix3NodePresenter : PropertyNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<Matrix3ControlPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter>(base.GetControlData()) { instance }; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8cb077290891de74d905d2361f73441b |
|||
timeCreated: 1476871291 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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 System; |
|||
using System.Collections.Generic; |
|||
using UnityEngine.MaterialGraph; |
|||
using RMGUI.GraphView; |
|||
using UnityEditor.Graphing.Drawing; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
[Serializable] |
|||
class MatrixCommonContolPresenter : GraphControlPresenter |
|||
{ |
|||
|
|||
private string[] m_MatrixTypeNames; |
|||
private string[] matrixTypeNames |
|||
{ |
|||
get |
|||
{ |
|||
if (m_MatrixTypeNames == null) |
|||
m_MatrixTypeNames = Enum.GetNames(typeof(CommonMatrixType)); |
|||
return m_MatrixTypeNames; |
|||
} |
|||
} |
|||
|
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var cNode = node as UnityEngine.MaterialGraph.MatrixCommonNode; |
|||
if (cNode == null) |
|||
return; |
|||
|
|||
cNode.matrix = (CommonMatrixType)EditorGUILayout.Popup((int)cNode.matrix, matrixTypeNames, EditorStyles.popup); |
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class MatrixCommonNodePresenter : MaterialNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<MatrixCommonContolPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter> { instance }; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b7283eb87c37e4a43b5eddbf2d4360d1 |
|||
timeCreated: 1495448531 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using RMGUI.GraphView; |
|||
using UnityEditor.Graphing.Drawing; |
|||
|
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
[Serializable] |
|||
class ScatterContolPresenter : GraphControlPresenter |
|||
{ |
|||
public override void OnGUIHandler() |
|||
{ |
|||
base.OnGUIHandler(); |
|||
|
|||
var cNode = node as UnityEngine.MaterialGraph.ScatterNode; |
|||
if (cNode == null) |
|||
return; |
|||
|
|||
cNode.num = EditorGUILayout.IntField(cNode.num, "Number", null); |
|||
cNode.num = Math.Min(cNode.num, 50); //prevent infinite => hang!
|
|||
} |
|||
|
|||
public override float GetHeight() |
|||
{ |
|||
return EditorGUIUtility.singleLineHeight + 10 * EditorGUIUtility.standardVerticalSpacing; |
|||
} |
|||
|
|||
} |
|||
|
|||
[Serializable] |
|||
public class ScatterNodePresenter : MaterialNodePresenter |
|||
{ |
|||
protected override IEnumerable<GraphElementPresenter> GetControlData() |
|||
{ |
|||
var instance = CreateInstance<ScatterContolPresenter>(); |
|||
instance.Initialize(node); |
|||
return new List<GraphElementPresenter> { instance }; |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 324b6873762a09544a3cebd0f0c7721d |
|||
timeCreated: 1495713547 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 7ed888a282fe7b54e968311cd68c4862 |
|||
folderAsset: yes |
|||
timeCreated: 1495638073 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 278936628273864438e48ff64aa20e32 |
|||
folderAsset: yes |
|||
timeCreated: 1495662409 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: bfc8dbcaa9711c945b8fd983b819335d |
|||
folderAsset: yes |
|||
timeCreated: 1495700996 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 3b0333da20fc0bf48a4d9b09a9d8d9db |
|||
timeCreated: 1495718308 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("UV/Twist")] |
|||
public class TwistNode : Function2Input, IGeneratesFunction |
|||
{ |
|||
public TwistNode() |
|||
{ |
|||
name = "Twist"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_twist_" + precision; |
|||
} |
|||
|
|||
protected override string GetInputSlot1Name() |
|||
{ |
|||
return "UV"; |
|||
} |
|||
|
|||
protected override string GetInputSlot2Name() |
|||
{ |
|||
return "Twist"; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot1() |
|||
{ |
|||
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot2() |
|||
{ |
|||
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, SlotType.Input, SlotValueType.Vector1, Vector2.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector2, Vector2.zero); |
|||
} |
|||
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk(GetFunctionPrototype("uv", "twist"), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
outputString.AddShaderChunk("float angle = twist * length(uv);", false); |
|||
outputString.AddShaderChunk("float x = cos(angle) * uv.x - sin(angle) * uv.y;", false); |
|||
outputString.AddShaderChunk("float y = sin(angle) * uv.x + cos(angle) * uv.y;", false); |
|||
outputString.AddShaderChunk("return float2(x, y);", false); |
|||
|
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3933f2692da9060438719b86844dcc7e |
|||
timeCreated: 1495718285 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Art/Adjustments/ColorBalance")] |
|||
public class ColorBalanceNode : FunctionNInNOut, IGeneratesFunction |
|||
{ |
|||
public ColorBalanceNode() |
|||
{ |
|||
name = "ColorBalance"; |
|||
AddSlot("Color", "inputColor", Graphing.SlotType.Input, SlotValueType.Vector4, Vector4.one); |
|||
AddSlot("AdjustRGB", "adjustRGB", Graphing.SlotType.Input, SlotValueType.Vector3, Vector3.zero); |
|||
AddSlot("RGBA", "finalColor", Graphing.SlotType.Output, SlotValueType.Vector4, Vector4.zero); |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_colorbalance_" + precision; |
|||
} |
|||
|
|||
public override bool hasPreview |
|||
{ |
|||
get { return true; } |
|||
} |
|||
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk(GetFunctionPrototype(), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
|
|||
outputString.AddShaderChunk("float red = 0;", false); |
|||
outputString.AddShaderChunk("float green = 0;", false); |
|||
outputString.AddShaderChunk("float blue = 0;", false); |
|||
|
|||
outputString.AddShaderChunk("red = 1.00f / (1-adjustRGB.r) * inputColor.r;", false); |
|||
outputString.AddShaderChunk("green = 1.00f / (1-adjustRGB.g) * inputColor.g;", false); |
|||
outputString.AddShaderChunk("blue = 1.00f / (1-adjustRGB.b) * inputColor.b;", false); |
|||
|
|||
outputString.AddShaderChunk("red = clamp(red,0.00f,1.00f);", false); |
|||
outputString.AddShaderChunk("green = clamp(green,0.00f,1.00f);", false); |
|||
outputString.AddShaderChunk("blue = clamp(blue,0.00f,1.00f);", false); |
|||
|
|||
outputString.AddShaderChunk("finalColor.r = red;", false); |
|||
outputString.AddShaderChunk("finalColor.g = green;", false); |
|||
outputString.AddShaderChunk("finalColor.b = blue;", false); |
|||
outputString.AddShaderChunk("finalColor.a = inputColor.a;", false); |
|||
|
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 1e71a86c3ae7610479697effc1e8b703 |
|||
timeCreated: 1495705851 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Range/RandomRange")] |
|||
public class RandomRangeNode : Function3Input, IGeneratesFunction |
|||
{ |
|||
public RandomRangeNode() |
|||
{ |
|||
name = "RandomRange"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_randomrange_" + precision; |
|||
} |
|||
|
|||
protected override string GetInputSlot1Name() |
|||
{ |
|||
return "Seed"; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot1() |
|||
{ |
|||
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|||
} |
|||
|
|||
protected override string GetInputSlot2Name() |
|||
{ |
|||
return "Min"; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot2() |
|||
{ |
|||
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector2.zero); |
|||
} |
|||
|
|||
protected override string GetInputSlot3Name() |
|||
{ |
|||
return "Max"; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot3() |
|||
{ |
|||
return new MaterialSlot(InputSlot3Id, GetInputSlot3Name(), kInputSlot3ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector3.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector1, Vector2.zero); |
|||
} |
|||
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk(GetFunctionPrototype("seed", "min", "max"), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
|
|||
outputString.AddShaderChunk("float randomno = frac(sin(dot(seed, float2(12.9898, 78.233)))*43758.5453);", false); |
|||
outputString.AddShaderChunk("return floor(randomno * (max - min + 1)) + min;", false); |
|||
|
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 5e7048f6323341547955eab30f96151f |
|||
timeCreated: 1495703851 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Procedural/Scatter")] |
|||
public class ScatterNode : FunctionNInNOut, IGeneratesFunction |
|||
{ |
|||
|
|||
[SerializeField] |
|||
private int m_num = 1 ; |
|||
|
|||
|
|||
public int num |
|||
{ |
|||
get { return m_num; } |
|||
set |
|||
{ |
|||
|
|||
if (m_num == value) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
m_num = value; |
|||
if (onModified != null) |
|||
{ |
|||
onModified(this, ModificationScope.Graph); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public ScatterNode() |
|||
{ |
|||
name = "Scatter"; |
|||
AddSlot("Texture", "inputTex", Graphing.SlotType.Input, SlotValueType.sampler2D, Vector4.zero); |
|||
AddSlot("UV", "inputUV", Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.one); |
|||
AddSlot("Seed", "seed", Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.one); |
|||
AddSlot("PositionRange", "p_range", Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|||
AddSlot("RotationRange", "r_range", Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|||
AddSlot("ScaleRange", "s_range", Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|||
AddSlot("RGBA", "finalColor", Graphing.SlotType.Output, SlotValueType.Vector4, Vector4.zero); |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_scatter_" + precision; |
|||
} |
|||
|
|||
public override bool hasPreview |
|||
{ |
|||
get { return true; } |
|||
} |
|||
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
|
|||
//RotateUVFunction ===================================================================
|
|||
outputString.AddShaderChunk("inline float2 rotateUV( float2 arg1, float arg2 )", false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
//center texture's pivot
|
|||
outputString.AddShaderChunk("arg1.xy -= 0.5;", false); |
|||
//rotation matrix
|
|||
outputString.AddShaderChunk(precision + " s = sin(arg2);", false); |
|||
outputString.AddShaderChunk(precision + " c = cos(arg2);", false); |
|||
outputString.AddShaderChunk(precision + "2x2 rMatrix = float2x2(c, -s, s, c);", false); |
|||
//center rotation matrix
|
|||
outputString.AddShaderChunk("rMatrix *= 0.5;", false); |
|||
outputString.AddShaderChunk("rMatrix += 0.5;", false); |
|||
outputString.AddShaderChunk("rMatrix = rMatrix*2 - 1;", false); |
|||
//multiply the UVs by the rotation matrix
|
|||
outputString.AddShaderChunk("arg1.xy = mul(arg1.xy, rMatrix);", false); |
|||
outputString.AddShaderChunk("arg1.xy += 0.5;", false); |
|||
outputString.AddShaderChunk("return " + "arg1;", false); |
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
//RamdomFunction ===================================================================
|
|||
outputString.AddShaderChunk("inline float randomrange(float2 randomseed, float min, float max)", false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
outputString.AddShaderChunk("float randomno = frac(sin(dot(randomseed, float2(12.9898, 78.233)))*43758.5453);", false); |
|||
outputString.AddShaderChunk("return floor(randomno * (max - min + 1)) + min;", false); |
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
//ScatterFunction ===================================================================
|
|||
outputString.AddShaderChunk(GetFunctionPrototype(), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
|
|||
outputString.AddShaderChunk("finalColor = float4(0,0,0,0);", false); |
|||
outputString.AddShaderChunk("float2 newuv = inputUV;", false); |
|||
outputString.AddShaderChunk("float4 tex = tex2D(inputTex,newuv);", false); |
|||
|
|||
for (int i=0; i<m_num; i++) |
|||
{ |
|||
//random UV
|
|||
outputString.AddShaderChunk("newuv *= randomrange(seed,s_range.x,s_range.y);", false); //Scale
|
|||
outputString.AddShaderChunk("newuv = rotateUV(newuv,randomrange(seed,r_range.x,r_range.y));", false); //Rotate
|
|||
outputString.AddShaderChunk("newuv += randomrange(seed,p_range.x,p_range.y));", false); //Position
|
|||
|
|||
//seamless
|
|||
|
|||
|
|||
//sample
|
|||
outputString.AddShaderChunk("tex = tex2D(inputTex,newuv);", false); |
|||
|
|||
//blend together
|
|||
outputString.AddShaderChunk("finalColor += tex/"+m_num+";", false); |
|||
} |
|||
|
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7726e0a353d4a53499b58140956b2c9b |
|||
timeCreated: 1495709638 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: fbb15485f0112484eaa58e88a4ac393f |
|||
folderAsset: yes |
|||
timeCreated: 1495654193 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1
MaterialGraphProject/Assets/Matt/Examples/HueStrip.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: ef4863cc0eaedba4d8ab1d6de73caabf |
|||
timeCreated: 1495713916 |
|||
licenseType: Pro |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} |
1
MaterialGraphProject/Assets/Matt/Examples/Swirl.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: c4bdf1ebef2b7aa4f8683354d16b64a1 |
|||
timeCreated: 1495715410 |
|||
licenseType: Pro |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Input/Matrix/Matrix 2")] |
|||
public class Matrix2Node : AbstractMaterialNode, IGeneratesBodyCode |
|||
{ |
|||
private const int kOutputSlotId = 0; |
|||
private const string kOutputSlotName = "Value"; |
|||
|
|||
[SerializeField] |
|||
private Vector2[] m_Value = new Vector2[2]; |
|||
|
|||
public Vector2 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 Matrix2Node() |
|||
{ |
|||
name = "Matrix2"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Matrix2, 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 + "2 " + propertyName + " = " + precision + "2x2 (" + m_Value[0].x + ", " + m_Value[0].y + ", " + m_Value[1].x + ", " + m_Value[1].y + ");", 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: a01da6bf9ffa118478ae371b28d2e166 |
|||
timeCreated: 1446473341 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Input/Matrix/Matrix 3")] |
|||
public class Matrix3Node : AbstractMaterialNode, IGeneratesBodyCode |
|||
{ |
|||
private const int kOutputSlotId = 0; |
|||
private const string kOutputSlotName = "Value"; |
|||
|
|||
[SerializeField] |
|||
private Vector3[] m_Value = new Vector3[3]; |
|||
|
|||
public Vector3 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 Matrix3Node() |
|||
{ |
|||
name = "Matrix3"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Matrix3, 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 + "3x3 " + propertyName + " = " + precision + "3x3 (" + m_Value[0].x + ", " + m_Value[0].y + ", " + m_Value[0].z + ", " + m_Value[1].x + ", " + m_Value[1].y + ", " + m_Value[1].z + ", " + m_Value[2].x + ", " + m_Value[2].y + ", " + m_Value[2].z + ");", 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: fec4ad06a8bd71044af822b7d2258a69 |
|||
timeCreated: 1446473341 |
|||
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: |
|
|||
using System.ComponentModel; |
|||
using UnityEngine.Graphing; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Input/Matrix/CommonMatrix")] |
|||
public class MatrixCommonNode : AbstractMaterialNode |
|||
{ |
|||
static Dictionary<CommonMatrixType, string> m_matrixList = new Dictionary<CommonMatrixType, string> |
|||
{ |
|||
{CommonMatrixType.ModelView, "UNITY_MATRIX_MV"}, |
|||
{CommonMatrixType.View, "UNITY_MATRIX_V"}, |
|||
{CommonMatrixType.Projection, "UNITY_MATRIX_P"}, |
|||
{CommonMatrixType.ViewProjection, "UNITY_MATRIX_VP"}, |
|||
{CommonMatrixType.TransposeModelView, "UNITY_MATRIX_T_MV"}, |
|||
{CommonMatrixType.InverseTransposeModelView, "UNITY_MATRIX_IT_MV"}, |
|||
{CommonMatrixType.ObjectToWorld, "unity_ObjectToWorld"}, |
|||
{CommonMatrixType.WorldToObject, "unity_WorldToObject"}, |
|||
}; |
|||
|
|||
[SerializeField] |
|||
private CommonMatrixType m_matrix = CommonMatrixType.ModelView; |
|||
|
|||
private const int kOutputSlotId = 0; |
|||
private const string kOutputSlotName = "Output"; |
|||
|
|||
public override bool hasPreview { get { return false; } } |
|||
|
|||
public CommonMatrixType matrix |
|||
{ |
|||
get { return m_matrix; } |
|||
set |
|||
{ |
|||
if (m_matrix == value) |
|||
return; |
|||
|
|||
m_matrix = value; |
|||
if (onModified != null) |
|||
{ |
|||
onModified(this, ModificationScope.Graph); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public MatrixCommonNode() |
|||
{ |
|||
name = "CommonMatrix"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Matrix4, Vector4.zero)); |
|||
RemoveSlotsNameNotMatching(new[] { kOutputSlotId }); |
|||
} |
|||
|
|||
public override string GetVariableNameForSlot(int slotId) |
|||
{ |
|||
return m_matrixList[matrix]; |
|||
} |
|||
|
|||
public bool RequiresVertexColor() |
|||
{ |
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 080829bc2938e23489292a936367364d |
|||
timeCreated: 1481123160 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Graphing; |
|||
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Matrix/MultiplyMatrixByVector")] |
|||
public class MatrixMultiplyByVectorNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction |
|||
{ |
|||
protected const string kInputSlot1ShaderName = "Input1"; |
|||
protected const string kInputSlot2ShaderName = "Input2"; |
|||
protected const string kOutputSlotShaderName = "Output"; |
|||
|
|||
public const int InputSlot1Id = 0; |
|||
public const int InputSlot2Id = 1; |
|||
public const int OutputSlotId = 2; |
|||
|
|||
public override bool hasPreview |
|||
{ |
|||
get { return false; } |
|||
} |
|||
|
|||
public MatrixMultiplyByVectorNode() |
|||
{ |
|||
name = "MultiplyMatrixByVector"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
protected string GetFunctionName() |
|||
{ |
|||
return "unity_matrix_multiplybyvector_" + precision; |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(GetInputSlot1()); |
|||
AddSlot(GetInputSlot2()); |
|||
AddSlot(GetOutputSlot()); |
|||
RemoveSlotsNameNotMatching(validSlots); |
|||
} |
|||
|
|||
protected int[] validSlots |
|||
{ |
|||
get { return new[] { InputSlot1Id, InputSlot2Id, OutputSlotId }; } |
|||
} |
|||
|
|||
protected MaterialSlot GetInputSlot1() |
|||
{ |
|||
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, SlotType.Input, SlotValueType.Matrix4, Vector4.zero); |
|||
} |
|||
|
|||
protected MaterialSlot GetInputSlot2() |
|||
{ |
|||
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, SlotType.Input, SlotValueType.Vector4, Vector4.zero); |
|||
} |
|||
|
|||
protected MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, SlotType.Output, SlotValueType.Vector4, Vector4.zero); |
|||
} |
|||
|
|||
protected virtual string GetInputSlot1Name() |
|||
{ |
|||
return "Input1"; |
|||
} |
|||
|
|||
protected virtual string GetInputSlot2Name() |
|||
{ |
|||
return "Input2"; |
|||
} |
|||
|
|||
protected string GetOutputSlotName() |
|||
{ |
|||
return "Output"; |
|||
} |
|||
|
|||
protected string GetFunctionPrototype(string arg1Name, string arg2Name) |
|||
{ |
|||
return "inline " + precision + outputDimension + " " + GetFunctionName() + " (" |
|||
+ precision + input1Dimension + " " + arg1Name + ", " |
|||
+ precision + input2Dimension + " " + arg2Name + ")"; |
|||
} |
|||
|
|||
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
NodeUtils.SlotConfigurationExceptionIfBadConfiguration(this, new[] { InputSlot1Id, InputSlot2Id }, new[] { OutputSlotId }); |
|||
string input1Value = GetSlotValue(InputSlot1Id, generationMode); |
|||
string input2Value = GetSlotValue(InputSlot2Id, generationMode); |
|||
visitor.AddShaderChunk(precision + outputDimension + " " + GetVariableNameForSlot(OutputSlotId) + " = " + GetFunctionCallBody(input1Value, input2Value) + ";", true); |
|||
} |
|||
|
|||
protected string GetFunctionCallBody(string input1Value, string input2Value) |
|||
{ |
|||
return GetFunctionName() + " (" + input1Value + ", " + input2Value + ")"; |
|||
} |
|||
|
|||
public string outputDimension |
|||
{ |
|||
get { return ConvertConcreteSlotValueTypeToString(FindInputSlot<MaterialSlot>(InputSlot2Id).concreteValueType); } |
|||
} |
|||
|
|||
private string input1Dimension |
|||
{ |
|||
get { return ConvertConcreteSlotValueTypeToString(FindInputSlot<MaterialSlot>(InputSlot1Id).concreteValueType); } |
|||
} |
|||
|
|||
private string input2Dimension |
|||
{ |
|||
get { return ConvertConcreteSlotValueTypeToString(FindInputSlot<MaterialSlot>(InputSlot2Id).concreteValueType); } |
|||
} |
|||
|
|||
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); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: ad9cec4b346abf749b3eb1730875ee5d |
|||
timeCreated: 1495542985 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 6e05bd4324babff4498e856ab63b993c |
|||
timeCreated: 1495526233 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue