RenderingKey.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright (C) 2009-2021, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <AnKi/Resource/Common.h>
  7. #include <AnKi/Util/Hash.h>
  8. namespace anki
  9. {
  10. /// The AnKi passes visible to materials.
  11. enum class RenderingTechnique : U8
  12. {
  13. GBUFFER,
  14. FORWARD_SHADING,
  15. RT_SHADOWS,
  16. COUNT,
  17. FIRST = 0
  18. };
  19. ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(RenderingTechnique)
  20. enum class RenderingTechniqueBit : U8
  21. {
  22. NONE = 0,
  23. GBUFFER = 1 << 0,
  24. FORWARD_SHADING = 1 << 1,
  25. RT_SHADOWS = 1 << 2
  26. };
  27. ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(RenderingTechniqueBit)
  28. enum class RenderingSubTechnique : U8
  29. {
  30. MAIN,
  31. SHADOW_MAPPING,
  32. EARLY_Z,
  33. COUNT,
  34. FIRST = 0
  35. };
  36. ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(RenderingSubTechnique)
  37. /// A key that is used to fetch stuff from various resources.
  38. class RenderingKey
  39. {
  40. public:
  41. RenderingKey()
  42. {
  43. memset(this, 0, sizeof(*this)); // Zero it because it will be hashed
  44. m_renderingTechnique = RenderingTechnique::COUNT;
  45. m_renderingSubTechnique = RenderingSubTechnique::COUNT;
  46. m_lod = MAX_U8;
  47. }
  48. RenderingTechnique m_renderingTechnique;
  49. RenderingSubTechnique m_renderingSubTechnique;
  50. U8 m_lod;
  51. Bool m_skinned : 1;
  52. Bool m_velocity : 1;
  53. };
  54. static_assert(sizeof(RenderingKey) == 4, "Should be packed because it will be hashed");
  55. } // end namespace anki