浏览代码

Add Orthographic slots to Camera node

/main
Matt Dean 7 年前
当前提交
2d57b390
共有 1 个文件被更改,包括 23 次插入8 次删除
  1. 31
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/CameraNode.cs

31
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/CameraNode.cs


[Title("Input", "Scene", "Camera")]
public class CameraNode : AbstractMaterialNode
{
const string kOutputSlotName = "Pos";
const string kOutputSlot1Name = "Dir";
const string kOutputSlot2Name = "Near";
const string kOutputSlot3Name = "Far";
const string kOutputSlot4Name = "Sign";
const string kOutputSlotName = "Position";
const string kOutputSlot1Name = "Direction";
const string kOutputSlot2Name = "isOrtho";
const string kOutputSlot3Name = "Near Plane";
const string kOutputSlot4Name = "Far Plane";
const string kOutputSlot5Name = "Sign";
const string kOutputSlot6Name = "Width";
const string kOutputSlot7Name = "Height";
public const int OutputSlotId = 0;
public const int OutputSlot1Id = 1;

public const int OutputSlot5Id = 5;
public const int OutputSlot6Id = 6;
public const int OutputSlot7Id = 7;
public CameraNode()
{

AddSlot(new Vector1MaterialSlot(OutputSlot2Id, kOutputSlot2Name, kOutputSlot2Name, SlotType.Output, 0));
AddSlot(new Vector1MaterialSlot(OutputSlot3Id, kOutputSlot3Name, kOutputSlot3Name, SlotType.Output, 0));
AddSlot(new Vector1MaterialSlot(OutputSlot4Id, kOutputSlot4Name, kOutputSlot4Name, SlotType.Output, 1));
RemoveSlotsNameNotMatching(new[] { OutputSlotId, OutputSlot1Id, OutputSlot2Id, OutputSlot3Id, OutputSlot4Id });
AddSlot(new Vector1MaterialSlot(OutputSlot5Id, kOutputSlot5Name, kOutputSlot5Name, SlotType.Output, 1));
AddSlot(new Vector1MaterialSlot(OutputSlot6Id, kOutputSlot6Name, kOutputSlot6Name, SlotType.Output, 1));
AddSlot(new Vector1MaterialSlot(OutputSlot7Id, kOutputSlot7Name, kOutputSlot7Name, SlotType.Output, 1));
RemoveSlotsNameNotMatching(new[] { OutputSlotId, OutputSlot1Id, OutputSlot2Id, OutputSlot3Id, OutputSlot4Id, OutputSlot5Id, OutputSlot6Id, OutputSlot7Id });
}
public override string GetVariableNameForSlot(int slotId)

case OutputSlot1Id:
return "mul(unity_ObjectToWorld, UNITY_MATRIX_IT_MV [2].xyz)";
case OutputSlot2Id:
return "unity_OrthoParams.w";
case OutputSlot3Id:
case OutputSlot3Id:
case OutputSlot4Id:
case OutputSlot4Id:
case OutputSlot5Id:
case OutputSlot6Id:
return "unity_OrthoParams.x";
case OutputSlot7Id:
return "unity_OrthoParams.y";
default:
return "_WorldSpaceCameraPos";
}

正在加载...
取消
保存