浏览代码

Fixed float value to string error and truncation warning for normal create node

/main
Peter Bay Bastian 7 年前
当前提交
b5379b4b
共有 4 个文件被更改,包括 14 次插入14 次删除
  1. 8
      ShaderGraph/com.unity.shadergraph/Editor/Data/Graphs/ColorMaterialSlot.cs
  2. 6
      ShaderGraph/com.unity.shadergraph/Editor/Data/Graphs/ColorRGBMaterialSlot.cs
  3. 6
      ShaderGraph/com.unity.shadergraph/Editor/Data/Nodes/Artistic/Normal/NormalCreateNode.cs
  4. 8
      ShaderGraph/com.unity.shadergraph/Editor/Data/Nodes/Input/Basic/ColorNode.cs

8
ShaderGraph/com.unity.shadergraph/Editor/Data/Graphs/ColorMaterialSlot.cs


{
return string.Format("IsGammaSpace() ? {0}4({1}, {2}, {3}, {4}) : {0}4 (SRGBToLinear({0}3({1}, {2}, {3})), {4})"
, precision
, value.x
, value.y
, value.z
, value.w);
, NodeUtils.FloatToShaderValue(value.x)
, NodeUtils.FloatToShaderValue(value.y)
, NodeUtils.FloatToShaderValue(value.z)
, NodeUtils.FloatToShaderValue(value.w));
}
public override void AddDefaultProperty(PropertyCollector properties, GenerationMode generationMode)

6
ShaderGraph/com.unity.shadergraph/Editor/Data/Graphs/ColorRGBMaterialSlot.cs


{
return string.Format("IsGammaSpace() ? {0}3({1}, {2}, {3}) : SRGBToLinear({0}3({1}, {2}, {3}))"
, precision
, value.x
, value.y
, value.z);
, NodeUtils.FloatToShaderValue(value.x)
, NodeUtils.FloatToShaderValue(value.y)
, NodeUtils.FloatToShaderValue(value.z));
}
public override void AddDefaultProperty(PropertyCollector properties, GenerationMode generationMode)

6
ShaderGraph/com.unity.shadergraph/Editor/Data/Nodes/Artistic/Normal/NormalCreateNode.cs


sb.AppendLine("{0}2 offsetU = float2(UV.x + Offset, UV.y);", precision);
sb.AppendLine("{0}2 offsetV = float2(UV.x, UV.y + Offset);", precision);
sb.AppendLine("{0} normalSample = Texture.Sample(Sampler, UV);", precision);
sb.AppendLine("{0} uSample = Texture.Sample(Sampler, offsetU);", precision);
sb.AppendLine("{0} vSample = Texture.Sample(Sampler, offsetV);", precision);
sb.AppendLine("{0} normalSample = Texture.Sample(Sampler, UV).x;", precision);
sb.AppendLine("{0} uSample = Texture.Sample(Sampler, offsetU).x;", precision);
sb.AppendLine("{0} vSample = Texture.Sample(Sampler, offsetV).x;", precision);
sb.AppendLine("{0}3 va = float3(1, 0, (uSample - normalSample) * Strength);", precision);
sb.AppendLine("{0}3 vb = float3(0, 1, (vSample - normalSample) * Strength);", precision);

8
ShaderGraph/com.unity.shadergraph/Editor/Data/Nodes/Input/Basic/ColorNode.cs


@"{0}4 {1} = IsGammaSpace() ? {0}4({2}, {3}, {4}, {5}) : {0}4(SRGBToLinear({0}3({2}, {3}, {4})), {5});"
, precision
, GetVariableNameForNode()
, color.color.r
, color.color.g
, color.color.b
, color.color.a), true);
, NodeUtils.FloatToShaderValue(color.color.r)
, NodeUtils.FloatToShaderValue(color.color.g)
, NodeUtils.FloatToShaderValue(color.color.b)
, NodeUtils.FloatToShaderValue(color.color.a)), true);
}
public override string GetVariableNameForSlot(int slotId)

正在加载...
取消
保存