You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
790 B

  1. Shader "Hidden/RotatorNode"
  2. {
  3. Properties
  4. {
  5. _A ("_UVs", 2D) = "white" {}
  6. _B ("_Anchor", 2D) = "white" {}
  7. _C ("_RotTimeTex", 2D) = "white" {}
  8. }
  9. SubShader
  10. {
  11. Pass
  12. {
  13. CGPROGRAM
  14. #pragma vertex vert_img
  15. #pragma fragment frag
  16. #include "UnityCG.cginc"
  17. sampler2D _A;
  18. sampler2D _B;
  19. sampler2D _C;
  20. float _UsingEditor;
  21. float _EditorTime;
  22. float4 frag(v2f_img i) : SV_Target
  23. {
  24. float multiplier = tex2D ( _C, i.uv ).r;
  25. float time = _EditorTime*multiplier;
  26. if ( _UsingEditor == 0 )
  27. {
  28. time = multiplier;
  29. }
  30. float cosT = cos( time );
  31. float sinT = sin( time );
  32. float2 a = tex2D( _B, i.uv ).rg;
  33. return float4( mul( tex2D( _A, i.uv ).xy - a, float2x2( cosT, -sinT, sinT, cosT ) ) + a, 0, 1 );
  34. }
  35. ENDCG
  36. }
  37. }
  38. }