3
0

WhiteBoxRenderData.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 "WhiteBoxMaterial.h"
  10. #include <AzCore/Math/Vector2.h>
  11. #include <AzCore/Math/Vector3.h>
  12. #include <AzCore/RTTI/TypeInfo.h>
  13. #include <AzCore/std/containers/vector.h>
  14. namespace AZ
  15. {
  16. class ReflectContext;
  17. }
  18. namespace WhiteBox
  19. {
  20. struct WhiteBoxVertex;
  21. struct WhiteBoxFace;
  22. using WhiteBoxFaces = AZStd::vector<WhiteBoxFace>;
  23. struct WhiteBoxRenderData
  24. {
  25. AZ_TYPE_INFO(WhiteBoxRenderData, "{7B46EB9E-0CDF-492C-B015-240D8AB74A37}");
  26. static void Reflect(AZ::ReflectContext* context);
  27. WhiteBoxRenderData() = default;
  28. ~WhiteBoxRenderData() = default;
  29. WhiteBoxFaces m_faces;
  30. WhiteBoxMaterial m_material;
  31. };
  32. //! Vertex layout for WhiteBox faces
  33. struct WhiteBoxVertex
  34. {
  35. AZ_TYPE_INFO(WhiteBoxVertex, "{617FFD68-3528-4627-92C6-4CC7ACCBD615}");
  36. static void Reflect(AZ::ReflectContext* context);
  37. AZ::Vector3 m_position;
  38. AZ::Vector2 m_uv;
  39. };
  40. //! Triangle primitive with face normals
  41. struct WhiteBoxFace
  42. {
  43. AZ_TYPE_INFO(WhiteBoxFace, "{31293BF0-5789-489B-882A-119AC1797F9E}");
  44. static void Reflect(AZ::ReflectContext* context);
  45. WhiteBoxVertex m_v1;
  46. WhiteBoxVertex m_v2;
  47. WhiteBoxVertex m_v3;
  48. AZ::Vector3 m_normal;
  49. };
  50. //! Builds a vector of visible faces by removing the degenerate faces from the source data
  51. WhiteBoxFaces BuildCulledWhiteBoxFaces(const WhiteBoxFaces& sourceData);
  52. } // namespace WhiteBox