浏览代码

Added cam direction node

Added cam position node(should be implemented better but no time)
/main
Andre McGrail 8 年前
当前提交
6d640d6a
共有 4 个文件被更改,包括 87 次插入0 次删除
  1. 35
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/SceneData/CameraDirNode.cs
  2. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/SceneData/CameraDirNode.cs.meta
  3. 36
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/SceneData/CameraPosNode.cs
  4. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/SceneData/CameraPosNode.cs.meta

35
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/SceneData/CameraDirNode.cs


using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph
{
[Title("Input/Scene Data/Camera Direction")]
public class CamDirNode : AbstractMaterialNode
{
public CamDirNode()
{
name = "CameraDirection";
UpdateNodeAfterDeserialization();
}
private const int kOutputSlotId = 0;
private const string kOutputSlotName = "Output";
public override bool hasPreview { get { return true; } }
public override PreviewMode previewMode
{
get { return PreviewMode.Preview2D; }
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Vector4, Vector4.zero));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override string GetVariableNameForSlot(int slotId)
{
return "UNITY_MATRIX_IT_MV [2].xyz";
}
}
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/SceneData/CameraDirNode.cs.meta


fileFormatVersion: 2
guid: dd27728b9ce314209beef46e595204c5
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

36
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/SceneData/CameraPosNode.cs


using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph
{
[Title("Input/Scene Data/Camera Position")]
public class CamPosNode : AbstractMaterialNode
{
//TODO - should be a global and immpiment a Imayrequire
public CamPosNode()
{
name = "CameraPosition";
UpdateNodeAfterDeserialization();
}
private const int kOutputSlotId = 0;
private const string kOutputSlotName = "Output";
public override bool hasPreview { get { return true; } }
public override PreviewMode previewMode
{
get { return PreviewMode.Preview2D; }
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Vector4, Vector4.zero));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override string GetVariableNameForSlot(int slotId)
{
return "_WorldSpaceCameraPos";
}
}
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Input/SceneData/CameraPosNode.cs.meta


fileFormatVersion: 2
guid: 27a1751acacc54e278090fb991699a90
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
正在加载...
取消
保存