DynamicDrawExample.azsl 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <Atom/Features/SrgSemantics.azsli>
  9. #include <viewsrg.srgi>
  10. ShaderResourceGroup PerContextSrg : SRG_PerSubPass
  11. {
  12. float m_scale;
  13. }
  14. ShaderResourceGroup PerDrawSrg : SRG_PerDraw
  15. {
  16. float3 m_positionOffset;
  17. }
  18. struct VSInput
  19. {
  20. float3 m_position : POSITION;
  21. float4 m_color : COLOR0;
  22. };
  23. struct VSOutput
  24. {
  25. float4 m_position : SV_Position;
  26. float4 m_color : COLOR0;
  27. };
  28. VSOutput MainVS(VSInput IN)
  29. {
  30. VSOutput OUT;
  31. OUT.m_position = float4(IN.m_position + PerDrawSrg::m_positionOffset, 1.0f);// * PerContextSrg::m_scale;
  32. OUT.m_position = mul(ViewSrg::m_viewProjectionMatrix, OUT.m_position);
  33. OUT.m_color = IN.m_color;
  34. return OUT;
  35. };
  36. struct PSOutput
  37. {
  38. float4 m_diffuse : SV_Target0;
  39. };
  40. PSOutput MainPS(VSOutput IN)
  41. {
  42. PSOutput OUT;
  43. OUT.m_diffuse = IN.m_color;
  44. return OUT;
  45. };