Advertisement
XorDev

HLSL Passthrough Shader

Dec 2nd, 2022 (edited)
2,337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OpenGL Shading 0.96 KB | Source Code | 0 0
  1. //PASSTHROUGH HLSL 11 VERTEX SHADER FOR GAMEMAKER
  2. struct ATTRIBUTE
  3. {
  4.     float3 pos : POSITION;
  5.     //float3 nor : NORMAL;
  6.     float2 tex : TEXCOORD0;
  7.     float4 col : COLOR;
  8. };
  9. struct VARYING
  10. {
  11.     float4 pos : SV_POSITION;
  12.     float2 tex : TEXCOORD0;
  13.     float4 col : COLOR;
  14. };
  15. VARYING main(ATTRIBUTE INPUT)
  16. {
  17.     VARYING OUTPUT;
  18.     OUTPUT.pos = mul(gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION], float4(INPUT.pos,1));
  19.     OUTPUT.tex = INPUT.tex;
  20.     OUTPUT.col = INPUT.col;
  21.     return OUTPUT;
  22. }
  23.  
  24. //PASSTHROUGH HLSL 11 PIXEL SHADER FOR GAMEMAKER
  25. struct VARYING
  26. {
  27.     float4 pos : POSITION;
  28.     float2 tex : TEXCOORD0;
  29.     float4 col : COLOR;
  30. };
  31.  
  32. struct TARGET
  33. {
  34.     float4 col : COLOR;
  35. };
  36.  
  37. TARGET main(VARYING INPUT) : SV_TARGET
  38. {
  39.     TARGET OUTPUT;
  40.     //Sample texture using the texcoords from the vertex shader and vertex color.
  41.     OUTPUT.col = INPUT.col * gm_BaseTextureObject.Sample(gm_BaseTexture,INPUT.tex);
  42.     return OUTPUT;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement