浏览代码

Fixes to IsFrontFace node

/main
Matt Dean 7 年前
当前提交
de873ebd
共有 1 个文件被更改,包括 7 次插入7 次删除
  1. 14
      com.unity.shadergraph/Editor/Data/Nodes/Input/Geometry/FaceSignNode.cs

14
com.unity.shadergraph/Editor/Data/Nodes/Input/Geometry/FaceSignNode.cs


namespace UnityEditor.ShaderGraph
{
[Title("Input", "Geometry", "Face Sign")]
public class FaceSignNode : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireFaceSign
[Title("Utility", "Logic", "Is Front Face")]
public class IsFrontFaceNode : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireFaceSign
public FaceSignNode()
public IsFrontFaceNode()
name = "Face Sign";
name = "Is Front Face";
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Face-Sign-Node"; }
get { return "https://github.com/Unity-Technologies/ShaderGraph/wiki/Is-Front-Face-Node"; }
private const string kOutputSlotName = "Is Front";
private const string kOutputSlotName = "Out";
public override void UpdateNodeAfterDeserialization()
{

public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode)
{
visitor.AddShaderChunk(string.Format("{0} {1} = IN.{2};", precision, GetVariableNameForSlot(OutputSlotId), ShaderGeneratorNames.FaceSign), true);
visitor.AddShaderChunk(string.Format("{0} {1} = max(0, IN.{2});", precision, GetVariableNameForSlot(OutputSlotId), ShaderGeneratorNames.FaceSign), true);
}
public bool RequiresFaceSign(ShaderStageCapability stageCapability = ShaderStageCapability.Fragment)

正在加载...
取消
保存