|
|
|
|
|
|
|
|
|
|
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) |
|
|
|