SimpleMesh.azsl 1.3 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 <scenesrg_all.srgi>
  9. #include <viewsrg_all.srgi>
  10. // To get the world matrix shader constant for the current object.
  11. #include <Atom/Features/PBR/DefaultObjectSrg.azsli>
  12. struct VSInput
  13. {
  14. float3 m_position : POSITION;
  15. float3 m_normal : NORMAL;
  16. // For the complete list of supported input stream semantics see ModelAssetBuilderComponent::CreateMesh()
  17. };
  18. struct VSOutput
  19. {
  20. float4 m_position : SV_Position;
  21. float3 m_normal: NORMAL;
  22. };
  23. VSOutput MainVS(VSInput IN)
  24. {
  25. VSOutput OUT;
  26. float3 worldPosition = mul(ObjectSrg::GetWorldMatrix(), float4(IN.m_position, 1.0)).xyz;
  27. OUT.m_position = mul(ViewSrg::m_viewProjectionMatrix, float4(worldPosition, 1.0));
  28. OUT.m_normal = IN.m_normal;
  29. return OUT;
  30. }
  31. struct PSOutput
  32. {
  33. float4 m_color : SV_Target0;
  34. };
  35. PSOutput MainPS(VSOutput IN)
  36. {
  37. PSOutput OUT;
  38. const float3 RED_COLOR = float3(1, 0, 0);
  39. const float3 GREEN_COLOR = float3(0, 1, 0);
  40. const float3 BLUE_COLOR = float3(0, 0, 1);
  41. // ShaderReloadTest START
  42. const float3 TEST_COLOR = BLUE_COLOR;
  43. // ShaderReloadTest END
  44. OUT.m_color = float4(TEST_COLOR, 1.0);
  45. return OUT;
  46. }