|
|
|
|
|
|
UpdateNodeAfterDeserialization(); |
|
|
|
} |
|
|
|
|
|
|
|
private const int kOutputSlotId = 0; |
|
|
|
private const string kOutputSlotName = "ScreenPos"; |
|
|
|
private const int kOutputSlot1Id = 0; |
|
|
|
private const string kOutputSlot1Name = "Raw ScreenPos"; |
|
|
|
private const int kOutputSlot2Id = 1; |
|
|
|
private const string kOutputSlot2Name = "Normalized"; |
|
|
|
|
|
|
|
public override bool hasPreview { get { return true; } } |
|
|
|
public override PreviewMode previewMode |
|
|
|
|
|
|
|
|
|
|
public sealed override void UpdateNodeAfterDeserialization() |
|
|
|
{ |
|
|
|
AddSlot(new MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, SlotValueType.Vector4, Vector4.zero)); |
|
|
|
RemoveSlotsNameNotMatching(new[] { kOutputSlotId }); |
|
|
|
AddSlot(new MaterialSlot(kOutputSlot1Id, kOutputSlot1Name, kOutputSlot1Name, SlotType.Output, SlotValueType.Vector4, Vector4.zero)); |
|
|
|
AddSlot(new MaterialSlot(kOutputSlot2Id, kOutputSlot2Name, kOutputSlot2Name, SlotType.Output, SlotValueType.Vector3, Vector3.zero)); |
|
|
|
RemoveSlotsNameNotMatching(new[] { kOutputSlot1Id, kOutputSlot2Id }); |
|
|
|
string returnString = ""; |
|
|
|
switch (slotId){ |
|
|
|
case 0: |
|
|
|
returnString = ShaderGeneratorNames.ScreenPosition; |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
returnString = "float3(" + ShaderGeneratorNames.ScreenPosition + ".xy / " + ShaderGeneratorNames.ScreenPosition + ".w, 0)"; |
|
|
|
break; |
|
|
|
} |
|
|
|
return ShaderGeneratorNames.ScreenPosition; |
|
|
|
} |
|
|
|
|
|
|
|