UnityObjToClipPosHlpNode.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Amplify Shader Editor - Visual Shader Editing Tool
  2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
  3. using System;
  4. namespace AmplifyShaderEditor
  5. {
  6. [Serializable]
  7. [NodeAttributes( "Object To Clip Pos", "Object Transform", "Transforms a point from object space to the camera’s clip space in homogeneous coordinates" )]
  8. public sealed class UnityObjToClipPosHlpNode : HelperParentNode
  9. {
  10. protected override void CommonInit( int uniqueId )
  11. {
  12. base.CommonInit( uniqueId );
  13. m_funcType = "UnityObjectToClipPos";
  14. //TODO: revisit this later
  15. m_funcLWFormatOverride = "TransformWorldToHClip( TransformObjectToWorld( ( {0} ).xyz ) )";
  16. m_funcHDFormatOverride = "TransformWorldToHClip( TransformObjectToWorld( ( {0} ).xyz ) )";
  17. m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false );
  18. m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false );
  19. m_outputPorts[ 0 ].Name = "XYZW";
  20. AddOutputPort( WirePortDataType.FLOAT, "X" );
  21. AddOutputPort( WirePortDataType.FLOAT, "Y" );
  22. AddOutputPort( WirePortDataType.FLOAT, "Z" );
  23. AddOutputPort( WirePortDataType.FLOAT, "W" );
  24. m_previewShaderGUID = "14ec765a147a53340877b489e73f1c9f";
  25. }
  26. protected override void OnUniqueIDAssigned()
  27. {
  28. base.OnUniqueIDAssigned();
  29. m_localVarName = "unityObjectToClipPos" + OutputId;
  30. }
  31. }
  32. }