TextGizmo.bsl 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 = "GLSL";
  51. Pass =
  52. {
  53. Target =
  54. {
  55. Blend = true;
  56. Color = { SRCA, SRCIA, ADD };
  57. };
  58. DepthWrite = false;
  59. Vertex =
  60. {
  61. layout(location = 0) in vec3 bs_position;
  62. layout(location = 1) in vec4 bs_color0;
  63. layout(location = 2) in vec2 bs_texcoord0;
  64. layout(location = 0) out vec4 color0;
  65. layout(location = 1) out vec2 texcoord0;
  66. out gl_PerVertex
  67. {
  68. vec4 gl_Position;
  69. };
  70. layout(binding = 0) uniform VertUBO
  71. {
  72. mat4 matViewProj;
  73. };
  74. void main()
  75. {
  76. gl_Position = matViewProj * vec4(bs_position.xyz, 1);
  77. texcoord0 = bs_texcoord0;
  78. color0 = bs_color0;
  79. }
  80. };
  81. Fragment =
  82. {
  83. layout(location = 0) in vec4 color0;
  84. layout(location = 1) in vec2 texcoord0;
  85. layout(location = 0) out vec4 fragColor;
  86. layout(binding = 1) uniform sampler2D mainTexture;
  87. void main()
  88. {
  89. fragColor = vec4(color0.rgb, texture2D(mainTexture, texcoord0.st).r * color0.a);
  90. }
  91. };
  92. };
  93. };