浏览代码

Change normal slot in PBR Master node to display default space binding rather than a vector3 control

/main
Jens Holm 7 年前
当前提交
bcf4854e
共有 2 个文件被更改,包括 8 次插入2 次删除
  1. 8
      com.unity.shadergraph/Editor/Data/Graphs/NormalMaterialSlot.cs
  2. 2
      com.unity.shadergraph/Editor/Data/MasterNodes/PBRMasterNode.cs

8
com.unity.shadergraph/Editor/Data/Graphs/NormalMaterialSlot.cs


namespace UnityEditor.ShaderGraph
{
[Serializable]
public class NormalMaterialSlot : SpaceMaterialSlot, IMayRequireNormal
public class NormalMaterialSlot : SpaceMaterialSlot, IMayRequireNormal, IMayRequireTangent
{
public NormalMaterialSlot()
{}

}
public NeededCoordinateSpace RequiresNormal()
{
if (isConnected)
return NeededCoordinateSpace.None;
return space.ToNeededCoordinateSpace();
}
public NeededCoordinateSpace RequiresTangent()
{
if (isConnected)
return NeededCoordinateSpace.None;

2
com.unity.shadergraph/Editor/Data/MasterNodes/PBRMasterNode.cs


{
name = "PBR Master";
AddSlot(new ColorRGBMaterialSlot(AlbedoSlotId, AlbedoSlotName, AlbedoSlotName, SlotType.Input, Color.grey, ShaderStage.Fragment));
AddSlot(new Vector3MaterialSlot(NormalSlotId, NormalSlotName, NormalSlotName, SlotType.Input, new Vector3(0, 0, 1), ShaderStage.Fragment));
AddSlot(new NormalMaterialSlot(NormalSlotId, NormalSlotName, NormalSlotName, CoordinateSpace.Tangent, ShaderStage.Fragment));
AddSlot(new ColorRGBMaterialSlot(EmissionSlotId, EmissionSlotName, EmissionSlotName, SlotType.Input, Color.black, ShaderStage.Fragment));
if (model == Model.Metallic)
AddSlot(new Vector1MaterialSlot(MetallicSlotId, MetallicSlotName, MetallicSlotName, SlotType.Input, 0, ShaderStage.Fragment));

正在加载...
取消
保存