AkSurfaceReflectorSetUtils.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*******************************************************************************
  2. The content of this file includes portions of the proprietary AUDIOKINETIC Wwise
  3. Technology released in source code form as part of the game integration package.
  4. The content of this file may not be used without valid licenses to the
  5. AUDIOKINETIC Wwise Technology.
  6. Note that the use of the game engine is subject to the Unreal(R) Engine End User
  7. License Agreement at https://www.unrealengine.com/en-US/eula/unreal
  8. License Usage
  9. Licensees holding valid licenses to the AUDIOKINETIC Wwise Technology may use
  10. this file in accordance with the end user license agreement provided with the
  11. software or, alternatively, in accordance with the terms contained
  12. in a written agreement between you and Audiokinetic Inc.
  13. Copyright (c) 2023 Audiokinetic Inc.
  14. *******************************************************************************/
  15. #include "AkSurfaceReflectorSetUtils.h"
  16. #if WITH_EDITOR
  17. FText FAkSurfacePoly::GetPolyText(bool includeOcclusion) const
  18. {
  19. if (!EnableSurface)
  20. return FText();
  21. FString textureName = FString("None");
  22. if (Texture)
  23. textureName = Texture->GetName();
  24. if (!includeOcclusion)
  25. return FText::FromString(FString::Format(TEXT("{0}"), { textureName }));
  26. FNumberFormattingOptions NumberFormat;
  27. NumberFormat.MaximumFractionalDigits = 2;
  28. NumberFormat.MinimumFractionalDigits = 1;
  29. FString transmissionLossValueString = FText::AsNumber(Occlusion, &NumberFormat).ToString();
  30. return FText::FromString(FString::Format(TEXT("{0}{1}{2}"), { textureName, LINE_TERMINATOR, transmissionLossValueString }));
  31. }
  32. void FAkSurfacePoly::ClearEdgeInfo()
  33. {
  34. Edges.Empty();
  35. OptimalEdgeDP = 0.0f;
  36. }
  37. #endif
  38. bool FAkSurfaceEdgeVerts::EdgesShareVertex(const FAkSurfaceEdgeVerts& Edge1, const FAkSurfaceEdgeVerts& Edge2)
  39. {
  40. return FMath::IsNearlyEqual(FVector::Dist(Edge1.V0, Edge2.V0), 0.0f, AkSurfaceReflectorUtils::EQUALITY_THRESHOLD)
  41. || FMath::IsNearlyEqual(FVector::Dist(Edge1.V1, Edge2.V1), 0.0f, AkSurfaceReflectorUtils::EQUALITY_THRESHOLD);
  42. }
  43. FAkSurfaceEdgeVerts FAkSurfaceEdgeVerts::GetTransformedEdge(const FTransform& Transform) const
  44. {
  45. return FAkSurfaceEdgeVerts(Transform.TransformPositionNoScale(V0), Transform.TransformPositionNoScale(V1));
  46. }
  47. void FAkSurfaceEdgeVerts::TransformEdge(const FTransform& Transform)
  48. {
  49. V0 = Transform.TransformPositionNoScale(V0);
  50. V1 = Transform.TransformPositionNoScale(V1);
  51. }
  52. void FAkSurfaceEdgeVerts::Invert()
  53. {
  54. FVector Temp = V0;
  55. V0 = V1;
  56. V1 = Temp;
  57. }
  58. FAkSurfaceEdgeInfo::FAkSurfaceEdgeInfo() {}
  59. FAkSurfaceEdgeInfo::FAkSurfaceEdgeInfo(FVector InV0, FVector InV1) : EdgeVerts(InV0, InV1) {}