ShapeComponentConverters.cpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #include "ShapeComponentConverters.h"
  9. #include <Shape/BoxShape.h>
  10. #include <Shape/SphereShape.h>
  11. #include <Shape/CapsuleShape.h>
  12. #include <Shape/CylinderShape.h>
  13. #include <AzCore/Math/PolygonPrism.h>
  14. namespace LmbrCentral
  15. {
  16. namespace ClassConverters
  17. {
  18. bool UpgradeBoxShapeComponent(AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement)
  19. {
  20. // upgrade for editor and runtime components at this stage are the same
  21. return UpgradeShapeComponentConfigToShape<BoxShape, BoxShapeConfig>(
  22. classElement.GetVersion(), "BoxShape", context, classElement);
  23. }
  24. bool UpgradeSphereShapeComponent(AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement)
  25. {
  26. // upgrade for editor and runtime components at this stage are the same
  27. return UpgradeShapeComponentConfigToShape<SphereShape, SphereShapeConfig>(
  28. classElement.GetVersion(), "SphereShape", context, classElement);
  29. }
  30. bool UpgradeCapsuleShapeComponent(AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement)
  31. {
  32. // upgrade for editor and runtime components at this stage are the same
  33. return UpgradeShapeComponentConfigToShape<CapsuleShape, CapsuleShapeConfig>(
  34. classElement.GetVersion(), "CapsuleShape", context, classElement);
  35. }
  36. bool UpgradeCylinderShapeComponent(AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement)
  37. {
  38. // upgrade for editor and runtime components at this stage are the same
  39. return UpgradeShapeComponentConfigToShape<CylinderShape, CylinderShapeConfig>(
  40. classElement.GetVersion(), "CylinderShape", context, classElement);
  41. }
  42. }
  43. }