TextGizmo.bsl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. Parameters =
  2. {
  3. mat4x4 matViewProj;
  4. Sampler2D mainTexSamp : alias("mainTexture");
  5. Texture2D mainTexture;
  6. };
  7. Technique =
  8. {
  9. Language = "HLSL11";
  10. Pass =
  11. {
  12. Target =
  13. {
  14. Blend = true;
  15. Color = { SRCA, SRCIA, ADD };
  16. };
  17. DepthWrite = false;
  18. Vertex =
  19. {
  20. float4x4 matViewProj;
  21. void main(
  22. in float3 inPos : POSITION,
  23. in float2 uv : TEXCOORD0,
  24. in float4 color : COLOR0,
  25. out float4 oPosition : SV_Position,
  26. out float2 oUv : TEXCOORD0,
  27. out float4 oColor : COLOR0)
  28. {
  29. oPosition = mul(matViewProj, float4(inPos.xyz, 1));
  30. oUv = uv;
  31. oColor = color;
  32. }
  33. };
  34. Fragment =
  35. {
  36. SamplerState mainTexSamp : register(s0);
  37. Texture2D mainTexture : register(t0);
  38. float4 main(
  39. in float4 inPos : SV_Position,
  40. float2 uv : TEXCOORD0,
  41. float4 color : COLOR0) : SV_Target
  42. {
  43. return float4(color.rgb, mainTexture.Sample(mainTexSamp, uv).r * color.a);
  44. }
  45. };
  46. };
  47. };
  48. Technique =
  49. {
  50. Language = "HLSL9";
  51. Pass =
  52. {
  53. Target =
  54. {
  55. Blend = true;
  56. Color = { SRCA, SRCIA, ADD };
  57. };
  58. DepthWrite = false;
  59. Vertex =
  60. {
  61. float4x4 matViewProj;
  62. void main(
  63. in float3 inPos : POSITION,
  64. in float4 color : COLOR0,
  65. in float2 uv : TEXCOORD0,
  66. out float4 oPosition : POSITION,
  67. out float4 oColor : COLOR0,
  68. out float2 oUv : TEXCOORD0)
  69. {
  70. oPosition = mul(matViewProj, float4(inPos.xyz, 1));
  71. oColor = color;
  72. oUv = uv;
  73. }
  74. };
  75. Fragment =
  76. {
  77. sampler2D mainTexture;
  78. float4 main(float2 uv : TEXCOORD0, float4 color : COLOR0) : COLOR0
  79. {
  80. return float4(color.rgb, tex2D(mainTexture, uv).r * color.a);
  81. }
  82. };
  83. };
  84. };
  85. Technique =
  86. {
  87. Language = "GLSL";
  88. Pass =
  89. {
  90. Target =
  91. {
  92. Blend = true;
  93. Color = { SRCA, SRCIA, ADD };
  94. };
  95. DepthWrite = false;
  96. Vertex =
  97. {
  98. uniform mat4 matViewProj;
  99. in vec3 bs_position;
  100. in vec4 bs_color0;
  101. in vec2 bs_texcoord0;
  102. out vec4 color0;
  103. out vec2 texcoord0;
  104. out gl_PerVertex
  105. {
  106. vec4 gl_Position;
  107. };
  108. void main()
  109. {
  110. gl_Position = matViewProj * vec4(bs_position.xyz, 1);
  111. texcoord0 = bs_texcoord0;
  112. color0 = bs_color0;
  113. }
  114. };
  115. Fragment =
  116. {
  117. uniform sampler2D mainTexture;
  118. in vec4 color0;
  119. in vec2 texcoord0;
  120. out vec4 fragColor;
  121. void main()
  122. {
  123. fragColor = vec4(color0.rgb, texture2D(mainTexture, texcoord0.st).r * color0.a);
  124. }
  125. };
  126. };
  127. };