浏览代码

Changed some function names for noise.

/main
bfogerty 8 年前
当前提交
4799b1ee
共有 1 个文件被更改,包括 9 次插入9 次删除
  1. 18
      MaterialGraphProject/Assets/Brandon/NoiseNode.cs

18
MaterialGraphProject/Assets/Brandon/NoiseNode.cs


{
var outputString = new ShaderGenerator();
outputString.AddShaderChunk("inline float unity_randomValue (float2 uv)", false);
outputString.AddShaderChunk("inline float unity_noise_randomValue (float2 uv)", false);
outputString.AddShaderChunk("{", false);
outputString.Indent();

outputString.AddShaderChunk("}", false);
outputString.AddShaderChunk("inline float unity_interpolate (float a, float b, float t)", false);
outputString.AddShaderChunk("inline float unity_noise_interpolate (float a, float b, float t)", false);
outputString.AddShaderChunk("{", false);
outputString.Indent();

outputString.AddShaderChunk("float2 c1 = i + float2(1.0, 0.0);", false);
outputString.AddShaderChunk("float2 c2 = i + float2(0.0, 1.0);", false);
outputString.AddShaderChunk("float2 c3 = i + float2(1.0, 1.0);", false);
outputString.AddShaderChunk("float r0 = unity_randomValue(c0);", false);
outputString.AddShaderChunk("float r1 = unity_randomValue(c1);", false);
outputString.AddShaderChunk("float r2 = unity_randomValue(c2);", false);
outputString.AddShaderChunk("float r3 = unity_randomValue(c3);", false);
outputString.AddShaderChunk("float r0 = unity_noise_randomValue(c0);", false);
outputString.AddShaderChunk("float r1 = unity_noise_randomValue(c1);", false);
outputString.AddShaderChunk("float r2 = unity_noise_randomValue(c2);", false);
outputString.AddShaderChunk("float r3 = unity_noise_randomValue(c3);", false);
outputString.AddShaderChunk("float bottomOfGrid = unity_interpolate(r0, r1, f.x);", false);
outputString.AddShaderChunk("float topOfGrid = unity_interpolate(r2, r3, f.x);", false);
outputString.AddShaderChunk("float t = unity_interpolate(bottomOfGrid, topOfGrid, f.y);", false);
outputString.AddShaderChunk("float bottomOfGrid = unity_noise_interpolate(r0, r1, f.x);", false);
outputString.AddShaderChunk("float topOfGrid = unity_noise_interpolate(r2, r3, f.x);", false);
outputString.AddShaderChunk("float t = unity_noise_interpolate(bottomOfGrid, topOfGrid, f.y);", false);
outputString.AddShaderChunk("return t;", false);
outputString.Deindent();

正在加载...
取消
保存