浏览代码

Add API for modification of embedded supported subshaders

/main
Tim Cooper 7 年前
当前提交
27b8deec
共有 4 个文件被更改,包括 28 次插入9 次删除
  1. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/LightweightPipeline/LightWeightUnlitSubShader.cs
  2. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/MasterNodes/PBRMasterNode.cs
  3. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/MasterNodes/UnlitMasterNode.cs
  4. 22
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/MasterNode.cs

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/LightweightPipeline/LightWeightUnlitSubShader.cs


[Serializable]
public class LightWeightUnlitSubShader : IUnlitSubShader
{
Pass m_UnlitPass = new Pass()
Pass m_UnlitPass = new Pass
PixelShaderSlots = new List<int>()
PixelShaderSlots = new List<int>
{
UnlitMasterNode.ColorSlotId,
UnlitMasterNode.AlphaSlotId,

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/MasterNodes/PBRMasterNode.cs


using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Drawing.Controls;

AlphaThresholdSlotId
}, true);
if (m_SubShaders.Count == 0)
m_SubShaders.Add(new LightWeightPBRSubShader());
if (!subShaders.Any())
AddSubShader(new LightWeightPBRSubShader());
}
}
}

5
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/MasterNodes/UnlitMasterNode.cs


using System;
using System.Linq;
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Drawing.Controls;
using UnityEngine;

AlphaThresholdSlotId
});
if (m_SubShaders.Count == 0)
m_SubShaders.Add(new LightWeightUnlitSubShader());
if (!subShaders.Any())
AddSubShader(new LightWeightUnlitSubShader());
}
}
}

22
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/MasterNode.cs


public abstract class MasterNode<T> : AbstractMaterialNode, IMasterNode where T : class, ISubShader
{
[NonSerialized]
protected List<T> m_SubShaders = new List<T>();
List<T> m_SubShaders = new List<T>();
[SerializeField]
List<SerializationHelper.JSONSerializedElement> m_SerializableSubShaders = new List<SerializationHelper.JSONSerializedElement>();

public override PreviewMode previewMode
{
get { return PreviewMode.Preview3D; }
}
public IEnumerable<T> subShaders
{
get { return m_SubShaders; }
}
public void AddSubShader(T subshader)
{
if (m_SubShaders.Contains(subshader))
return;
m_SubShaders.Add(subshader);
onModified(this, ModificationScope.Node);
}
public void RemoveSubShader(T subshader)
{
m_SubShaders.RemoveAll(x => x == subshader);
onModified(this, ModificationScope.Node);
}
public string GetShader(GenerationMode mode, string outputName, out List<PropertyCollector.TextureInfo> configuredTextures)

正在加载...
取消
保存