ReflectionProbeRenderObjectSrg.azsli 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #pragma once
  9. #include <Atom/Features/SrgSemantics.azsli>
  10. #ifndef MATERIAL_PIPELINE_OBJECT_SRG_MEMBERS
  11. #define MATERIAL_PIPELINE_OBJECT_SRG_MEMBERS
  12. #endif
  13. ShaderResourceGroup ObjectSrg : SRG_PerObject
  14. {
  15. row_major float3x4 m_modelToWorld;
  16. row_major float3x4 m_modelToWorldInverse; // does not include extents
  17. float3 m_outerObbHalfLengths;
  18. float3 m_innerObbHalfLengths;
  19. bool m_useParallaxCorrection;
  20. float m_exposure;
  21. TextureCube m_reflectionCubeMap;
  22. float4x4 GetWorldMatrix()
  23. {
  24. float4x4 modelToWorld = float4x4(
  25. float4(1, 0, 0, 0),
  26. float4(0, 1, 0, 0),
  27. float4(0, 0, 1, 0),
  28. float4(0, 0, 0, 1));
  29. modelToWorld[0] = ObjectSrg::m_modelToWorld[0];
  30. modelToWorld[1] = ObjectSrg::m_modelToWorld[1];
  31. modelToWorld[2] = ObjectSrg::m_modelToWorld[2];
  32. return modelToWorld;
  33. }
  34. float4x4 GetWorldMatrixInverse()
  35. {
  36. float4x4 modelToWorldInverse = float4x4(
  37. float4(1, 0, 0, 0),
  38. float4(0, 1, 0, 0),
  39. float4(0, 0, 1, 0),
  40. float4(0, 0, 0, 1));
  41. modelToWorldInverse[0] = ObjectSrg::m_modelToWorldInverse[0];
  42. modelToWorldInverse[1] = ObjectSrg::m_modelToWorldInverse[1];
  43. modelToWorldInverse[2] = ObjectSrg::m_modelToWorldInverse[2];
  44. return modelToWorldInverse;
  45. }
  46. MATERIAL_PIPELINE_OBJECT_SRG_MEMBERS
  47. }