浏览代码

[Material Graph]Restore first slot for normal map for now. Needs a real fix.

/main
Tim Cooper 8 年前
当前提交
f6777ffb
共有 1 个文件被更改,包括 25 次插入1 次删除
  1. 26
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/PixelShaderNode.cs

26
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/PixelShaderNode.cs


public override void GenerateNodeCode(ShaderGenerator shaderBody, GenerationMode generationMode)
{
var firstPassSlotId = NormalSlotId;
// do the normal slot first so that it can be used later in the shader :)
var firstPassSlot = FindInputSlot<MaterialSlot>(firstPassSlotId);
NodeUtils.DepthFirstCollectNodesFromNode(nodes, this, firstPassSlotId, NodeUtils.IncludeSelf.Exclude);
for (int index = 0; index < nodes.Count; index++)
{
var node = nodes[index];
if (node is IGeneratesBodyCode)
(node as IGeneratesBodyCode).GenerateNodeCode(shaderBody, generationMode);
}
foreach (var edge in owner.GetEdges(firstPassSlot.slotReference))
{
var outputRef = edge.outputSlot;
var fromNode = owner.GetNodeFromGuid<AbstractMaterialNode>(outputRef.nodeGuid);
if (fromNode == null)
continue;
shaderBody.AddShaderChunk("o." + firstPassSlot.shaderOutputName + " = " + fromNode.GetVariableNameForSlot(outputRef.slotId) + ";", true);
}
// track the last index of nodes... they have already been processed :)
int pass2StartIndex = nodes.Count;
for (var i = 0; i < nodes.Count; i++)
for (var i = pass2StartIndex; i < nodes.Count; i++)
{
var node = nodes[i];
if (node is IGeneratesBodyCode)

正在加载...
取消
保存