WhiteBoxTestUtil.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 <AzCore/Math/Transform.h>
  10. #include <AzFramework/Viewport/ScreenGeometry.h>
  11. #include <AzFramework/Viewport/ViewportScreen.h>
  12. #include <AzTest/AzTest.h>
  13. #include <WhiteBox/WhiteBoxToolApi.h>
  14. namespace WhiteBox
  15. {
  16. std::ostream& operator<<(std::ostream& os, Api::FaceHandle faceHandle);
  17. std::ostream& operator<<(std::ostream& os, Api::VertexHandle vertexHandle);
  18. std::ostream& operator<<(std::ostream& os, Api::PolygonHandle& polygonHandle);
  19. std::ostream& operator<<(std::ostream& os, Api::EdgeHandle edgeHandle);
  20. std::ostream& operator<<(std::ostream& os, Api::HalfedgeHandle halfedgeHandle);
  21. std::ostream& operator<<(std::ostream& os, Api::FaceVertHandles& faceVertHandles);
  22. std::ostream& operator<<(std::ostream& os, Api::FaceVertHandlesList& faceVertHandlesList);
  23. // debug utility to write the white box mesh vertex data to a string
  24. AZStd::string VerticesToString(
  25. const WhiteBox::WhiteBoxMesh* whiteBox, const AZ::Transform& localToWorld = AZ::Transform::CreateIdentity());
  26. // debug utility to write the white box mesh face mid point data to a string
  27. AZStd::string FacesMidPointsToString(
  28. const WhiteBox::WhiteBoxMesh* whiteBox, const AZ::Transform& localToWorld = AZ::Transform::CreateIdentity());
  29. } // namespace WhiteBox
  30. namespace UnitTest
  31. {
  32. void Create2x2CubeGrid(WhiteBox::WhiteBoxMesh& whiteBox);
  33. void Initialize2x2CubeGrid(WhiteBox::WhiteBoxMesh& whiteBox);
  34. void Create3x3CubeGrid(WhiteBox::WhiteBoxMesh& whiteBox);
  35. void Initialize3x3CubeGrid(WhiteBox::WhiteBoxMesh& whiteBox);
  36. void HideAllTopUserEdgesFor2x2Grid(WhiteBox::WhiteBoxMesh& whiteBox);
  37. void HideAllTopUserEdgesFor3x3Grid(WhiteBox::WhiteBoxMesh& whiteBox);
  38. // convenience type to hold the local, world and screen space positions of a point
  39. class MultiSpacePoint
  40. {
  41. public:
  42. MultiSpacePoint(
  43. const AZ::Vector3& local, const AZ::Transform& toWorld, const AzFramework::CameraState& cameraState);
  44. const AZ::Vector3& GetLocalSpace() const;
  45. const AZ::Vector3& GetWorldSpace() const;
  46. const AzFramework::ScreenPoint& GetScreenSpace() const;
  47. private:
  48. AZ::Vector3 m_local;
  49. AZ::Vector3 m_world;
  50. AzFramework::ScreenPoint m_screen;
  51. };
  52. } // namespace UnitTest