TextGizmo.bsl 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. Parameters =
  2. {
  3. mat4x4 gMatViewProj;
  4. float4 gViewDir;
  5. Sampler2D gMainTexSamp : alias("gMainTexture");
  6. Texture2D gMainTexture;
  7. };
  8. Blocks =
  9. {
  10. Block Uniforms : auto("GizmoUniforms");
  11. };
  12. Technique =
  13. {
  14. Language = "HLSL11";
  15. Pass =
  16. {
  17. Target =
  18. {
  19. Blend = true;
  20. Color = { SRCA, SRCIA, ADD };
  21. };
  22. DepthWrite = false;
  23. Vertex =
  24. {
  25. cbuffer Uniforms
  26. {
  27. float4x4 gMatViewProj;
  28. float4 gViewDir;
  29. }
  30. void main(
  31. in float3 inPos : POSITION,
  32. in float2 uv : TEXCOORD0,
  33. in float4 color : COLOR0,
  34. out float4 oPosition : SV_Position,
  35. out float2 oUv : TEXCOORD0,
  36. out float4 oColor : COLOR0)
  37. {
  38. oPosition = mul(gMatViewProj, float4(inPos.xyz, 1));
  39. oUv = uv;
  40. oColor = color;
  41. }
  42. };
  43. Fragment =
  44. {
  45. SamplerState gMainTexSamp : register(s0);
  46. Texture2D gMainTexture : register(t0);
  47. float4 main(
  48. in float4 inPos : SV_Position,
  49. float2 uv : TEXCOORD0,
  50. float4 color : COLOR0) : SV_Target
  51. {
  52. return float4(color.rgb, gMainTexture.Sample(gMainTexSamp, uv).r * color.a);
  53. }
  54. };
  55. };
  56. };
  57. Technique =
  58. {
  59. Language = "GLSL";
  60. Pass =
  61. {
  62. Target =
  63. {
  64. Blend = true;
  65. Color = { SRCA, SRCIA, ADD };
  66. };
  67. DepthWrite = false;
  68. Vertex =
  69. {
  70. layout(location = 0) in vec3 bs_position;
  71. layout(location = 1) in vec4 bs_color0;
  72. layout(location = 2) in vec2 bs_texcoord0;
  73. layout(location = 0) out vec4 color0;
  74. layout(location = 1) out vec2 texcoord0;
  75. out gl_PerVertex
  76. {
  77. vec4 gl_Position;
  78. };
  79. layout(binding = 0, std140) uniform Uniforms
  80. {
  81. mat4 gMatViewProj;
  82. vec4 gViewDir;
  83. };
  84. void main()
  85. {
  86. gl_Position = gMatViewProj * vec4(bs_position.xyz, 1);
  87. texcoord0 = bs_texcoord0;
  88. color0 = bs_color0;
  89. }
  90. };
  91. Fragment =
  92. {
  93. layout(location = 0) in vec4 color0;
  94. layout(location = 1) in vec2 texcoord0;
  95. layout(location = 0) out vec4 fragColor;
  96. layout(binding = 1) uniform sampler2D gMainTexture;
  97. void main()
  98. {
  99. fragColor = vec4(color0.rgb, texture(gMainTexture, texcoord0.st).r * color0.a);
  100. }
  101. };
  102. };
  103. };