Textures.shader 973 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //======= Copyright (c) Stereolabs Corporation, All rights reserved. ===============
  2. // Displays the texture generated by the mesh
  3. Shader "Custom/Spatial Mapping/ Texture"
  4. {
  5. Properties
  6. {
  7. _MainTex ("Texture", 2D) = "white" {}
  8. }
  9. SubShader
  10. {
  11. Tags { "RenderType"="Opaque" }
  12. Cull Off
  13. Pass
  14. {
  15. CGPROGRAM
  16. #pragma vertex vert
  17. #pragma fragment frag
  18. #include "UnityCG.cginc"
  19. struct appdata
  20. {
  21. float4 vertex : POSITION;
  22. float2 uv : TEXCOORD0;
  23. };
  24. struct v2f
  25. {
  26. float2 uv : TEXCOORD0;
  27. float4 vertex : SV_POSITION;
  28. };
  29. sampler2D _MainTex;
  30. float4 _MainTex_ST;
  31. v2f vert (appdata v)
  32. {
  33. v2f o;
  34. o.vertex = UnityObjectToClipPos(v.vertex);
  35. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  36. return o;
  37. }
  38. fixed4 frag (v2f i) : SV_Target
  39. {
  40. // sample the texture
  41. fixed4 col = tex2D(_MainTex, i.uv);
  42. return col.bgra;
  43. }
  44. ENDCG
  45. }
  46. }
  47. }