浏览代码

Change ComputeScreenPos to use projection sign as an argument

/main
Matt Dean 7 年前
当前提交
ff6d2e4d
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Util/ShaderGenerator.cs
  2. 4
      MaterialGraphProject/Assets/UnityShaderEditor/ShaderGraphLibrary/Functions.hlsl

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Util/ShaderGenerator.cs


if (combinedRequierments.requiresScreenPosition)
{
interpolators.AddShaderChunk(string.Format("float4 {0} : TEXCOORD{1};", ShaderGeneratorNames.ScreenPosition, interpolatorIndex), false);
vertexShader.AddShaderChunk(string.Format("o.{0} = ComputeScreenPos(mul(GetWorldToHClipMatrix(), mul(GetObjectToWorldMatrix(), v.vertex)));", ShaderGeneratorNames.ScreenPosition), false);
vertexShader.AddShaderChunk(string.Format("o.{0} = ComputeScreenPos(mul(GetWorldToHClipMatrix(), mul(GetObjectToWorldMatrix(), v.vertex)), _ProjectionParams.x);", ShaderGeneratorNames.ScreenPosition), false);
pixelShader.AddShaderChunk(string.Format("float4 {0} = IN.{0};", ShaderGeneratorNames.ScreenPosition), false);
interpolatorIndex++;
}

4
MaterialGraphProject/Assets/UnityShaderEditor/ShaderGraphLibrary/Functions.hlsl


#endif
}
float4 ComputeScreenPos (float4 pos)
float4 ComputeScreenPos (float4 pos, float projectionSign)
o.xy = float2(o.x, o.y*_ProjectionParams.x) + o.w;
o.xy = float2(o.x, o.y * projectionSign) + o.w;
o.zw = pos.zw;
return o;
}
正在加载...
取消
保存