浏览代码

Add everything to vertex input struct as default

/main
Matt Dean 7 年前
当前提交
d0f07a14
共有 2 个文件被更改,包括 13 次插入14 次删除
  1. 2
      MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/MetallicTest.ShaderGraph.meta
  2. 25
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/AbstractLightweightPBRMasterNode.cs

2
MaterialGraphProject/Assets/SRP/ScriptableRenderPipeline/LightweightPipeline/Shaders/MetallicTest.ShaderGraph.meta


fileFormatVersion: 2
guid: 02a3ca69ec995e94aa47105621a17e4c
timeCreated: 1505499381
timeCreated: 1505501440
licenseType: Pro
ShaderImporter:
externalObjects: {}

25
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/LightweightPipeline/AbstractLightweightPBRMasterNode.cs


node.GeneratePropertyUsages(propertyUsages, mode);
}
int vertInputIndex = 1;
// Need these for lighting
// always add everything because why not.
shaderInputVisitor.AddShaderChunk("float4 normal : NORMAL;", true);
shaderInputVisitor.AddShaderChunk("float2 lightmapUV : TEXCOORD0;", true);
// always add color because why not.
shaderInputVisitor.AddShaderChunk("float4 color : COLOR;", true);
shaderInputVisitor.AddShaderChunk("half3 normal : NORMAL;", true);
shaderInputVisitor.AddShaderChunk("half4 texcoord0 : TEXCOORD0;", true);
shaderInputVisitor.AddShaderChunk("float2 lightmapUV : TEXCOORD1;", true);
shaderInputVisitor.AddShaderChunk("half4 tangent : TEXCOORD2;", true);
shaderInputVisitor.AddShaderChunk("half4 color : COLOR;", true);
// Need these for lighting
shaderOutputVisitor.AddShaderChunk("float4 posWS : TEXCOORD0;", true);

var channel = (UVChannel)uvIndex;
if (activeNodeList.OfType<IMayRequireMeshUV>().Any(x => x.RequiresMeshUV(channel)))
{
shaderInputVisitor.AddShaderChunk(string.Format("half4 texcoord{0} : TEXCOORD{1};", uvIndex, vertInputIndex), true);
if(uvIndex != 0)
{
shaderInputVisitor.AddShaderChunk(string.Format("half4 texcoord{0} : TEXCOORD{1};", uvIndex, vertInputIndex), true);
vertInputIndex++;
}
vertInputIndex++;
vertOutputIndex++;
}
}

if (requiresScreenPosition)
{
shaderInputVisitor.AddShaderChunk(string.Format("half4 screenPos : TEXCOORD{0};", vertInputIndex), true);
vertexShaderBlock.AddShaderChunk("o.screenPos = v.screenPos;", true);
vertexShaderBlock.AddShaderChunk("o.screenPos = ComputeScreenPos(v.vertex);", true);
vertInputIndex++;
shaderInputVisitor.AddShaderChunk(string.Format("half4 tangent : TEXCOORD{0};", vertInputIndex), true);
vertInputIndex++;
vertOutputIndex++;
}

正在加载...
取消
保存