|
|
|
|
|
|
{ |
|
|
|
static class GraphUtil |
|
|
|
{ |
|
|
|
internal static void GenerateApplicationVertexInputs(ShaderGraphRequirements graphRequiements, ShaderGenerator vertexInputs, int vertexInputStartIndex, int maxVertexInputs) |
|
|
|
internal static void GenerateApplicationVertexInputs(ShaderGraphRequirements graphRequiements, ShaderGenerator vertexInputs) |
|
|
|
int vertexInputIndex = vertexInputStartIndex; |
|
|
|
|
|
|
|
vertexInputs.AddShaderChunk("struct GraphVertexInput", false); |
|
|
|
vertexInputs.AddShaderChunk("{", false); |
|
|
|
vertexInputs.Indent(); |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
foreach (var channel in graphRequiements.requiresMeshUVs.Distinct()) |
|
|
|
{ |
|
|
|
vertexInputs.AddShaderChunk(String.Format("float4 texcoord{0} : TEXCOORD{1};", ((int)channel).ToString(), vertexInputIndex.ToString()), false); |
|
|
|
vertexInputIndex++; |
|
|
|
} |
|
|
|
vertexInputs.AddShaderChunk(string.Format("float4 texcoord{0} : TEXCOORD{0};", (int)channel), false); |
|
|
|
|
|
|
|
vertexInputs.AddShaderChunk("UNITY_VERTEX_INPUT_INSTANCE_ID", false); |
|
|
|
vertexInputs.Deindent(); |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var requirements = ShaderGraphRequirements.FromNodes(activeNodeList); |
|
|
|
GenerateApplicationVertexInputs(requirements, vertexInputs, 0, 8); |
|
|
|
GenerateApplicationVertexInputs(requirements, vertexInputs); |
|
|
|
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresNormal, InterpolatorType.Normal, surfaceInputs); |
|
|
|
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresTangent, InterpolatorType.Tangent, surfaceInputs); |
|
|
|
ShaderGenerator.GenerateSpaceTranslationSurfaceInputs(requirements.requiresBitangent, InterpolatorType.BiTangent, surfaceInputs); |
|
|
|