AssImpImportContexts.cpp 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 <SceneAPI/SceneBuilder/ImportContexts/AssImpImportContexts.h>
  9. #include <SceneAPI/SDKWrapper/AssImpNodeWrapper.h>
  10. #include <SceneAPI/SceneCore/Events/ImportEventContext.h>
  11. namespace AZ
  12. {
  13. namespace SceneAPI
  14. {
  15. namespace SceneBuilder
  16. {
  17. AssImpImportContext::AssImpImportContext(const AssImpSDKWrapper::AssImpSceneWrapper& sourceScene,
  18. const SceneSystem& sourceSceneSystem,
  19. AssImpSDKWrapper::AssImpNodeWrapper& sourceNode)
  20. : m_sourceScene(sourceScene)
  21. , m_sourceSceneSystem(sourceSceneSystem)
  22. , m_sourceNode(sourceNode)
  23. {
  24. }
  25. AssImpNodeEncounteredContext::AssImpNodeEncounteredContext(Containers::Scene& scene,
  26. Containers::SceneGraph::NodeIndex currentGraphPosition,
  27. const AssImpSDKWrapper::AssImpSceneWrapper& sourceScene,
  28. const SceneSystem& sourceSceneSystem,
  29. RenamedNodesMap& nodeNameMap,
  30. AssImpSDKWrapper::AssImpNodeWrapper& sourceNode)
  31. : AssImpImportContext(sourceScene, sourceSceneSystem, sourceNode)
  32. , NodeEncounteredContext(scene, currentGraphPosition, nodeNameMap)
  33. {
  34. }
  35. AssImpNodeEncounteredContext::AssImpNodeEncounteredContext(
  36. Events::ImportEventContext& parent,
  37. Containers::SceneGraph::NodeIndex currentGraphPosition,
  38. const AssImpSDKWrapper::AssImpSceneWrapper& sourceScene,
  39. const SceneSystem& sourceSceneSystem,
  40. RenamedNodesMap& nodeNameMap,
  41. AssImpSDKWrapper::AssImpNodeWrapper& sourceNode)
  42. : AssImpImportContext(sourceScene, sourceSceneSystem, sourceNode)
  43. , NodeEncounteredContext(parent.GetScene(), currentGraphPosition, nodeNameMap)
  44. {
  45. }
  46. AssImpSceneDataPopulatedContext::AssImpSceneDataPopulatedContext(AssImpNodeEncounteredContext& parent,
  47. AZStd::shared_ptr<DataTypes::IGraphObject> graphData, const AZStd::string& dataName)
  48. : AssImpImportContext(parent.m_sourceScene, parent.m_sourceSceneSystem, parent.m_sourceNode)
  49. , SceneDataPopulatedContextBase(parent, AZStd::move(graphData), dataName)
  50. {
  51. }
  52. AssImpSceneDataPopulatedContext::AssImpSceneDataPopulatedContext(Containers::Scene& scene,
  53. Containers::SceneGraph::NodeIndex currentGraphPosition,
  54. const AssImpSDKWrapper::AssImpSceneWrapper& sourceScene,
  55. const SceneSystem& sourceSceneSystem,
  56. RenamedNodesMap& nodeNameMap,
  57. AssImpSDKWrapper::AssImpNodeWrapper& sourceNode,
  58. AZStd::shared_ptr<DataTypes::IGraphObject> nodeData, const AZStd::string& dataName)
  59. : AssImpImportContext(sourceScene, sourceSceneSystem, sourceNode)
  60. , SceneDataPopulatedContextBase(scene, currentGraphPosition, nodeNameMap, AZStd::move(nodeData), dataName)
  61. {
  62. }
  63. AssImpSceneNodeAppendedContext::AssImpSceneNodeAppendedContext(AssImpSceneDataPopulatedContext& parent,
  64. Containers::SceneGraph::NodeIndex newIndex)
  65. : AssImpImportContext(parent.m_sourceScene, parent.m_sourceSceneSystem, parent.m_sourceNode)
  66. , SceneNodeAppendedContextBase(parent.m_scene, newIndex, parent.m_nodeNameMap)
  67. {
  68. }
  69. AssImpSceneNodeAppendedContext::AssImpSceneNodeAppendedContext(Containers::Scene& scene,
  70. Containers::SceneGraph::NodeIndex currentGraphPosition,
  71. const AssImpSDKWrapper::AssImpSceneWrapper& sourceScene,
  72. const SceneSystem& sourceSceneSystem,
  73. RenamedNodesMap& nodeNameMap, AssImpSDKWrapper::AssImpNodeWrapper& sourceNode)
  74. : AssImpImportContext(sourceScene, sourceSceneSystem, sourceNode)
  75. , SceneNodeAppendedContextBase(scene, currentGraphPosition, nodeNameMap)
  76. {
  77. }
  78. AssImpSceneAttributeDataPopulatedContext::AssImpSceneAttributeDataPopulatedContext(AssImpSceneNodeAppendedContext& parent, AZStd::shared_ptr<DataTypes::IGraphObject> nodeData, const Containers::SceneGraph::NodeIndex attributeNodeIndex, const AZStd::string& dataName)
  79. : AssImpImportContext(parent.m_sourceScene, parent.m_sourceSceneSystem, parent.m_sourceNode)
  80. , SceneAttributeDataPopulatedContextBase(parent, AZStd::move(nodeData), attributeNodeIndex, dataName)
  81. {
  82. }
  83. AssImpSceneAttributeNodeAppendedContext::AssImpSceneAttributeNodeAppendedContext(AssImpSceneAttributeDataPopulatedContext& parent, Containers::SceneGraph::NodeIndex newIndex)
  84. : AssImpImportContext(parent.m_sourceScene, parent.m_sourceSceneSystem, parent.m_sourceNode)
  85. , SceneAttributeNodeAppendedContextBase(parent, newIndex)
  86. {
  87. }
  88. AssImpSceneNodeAddedAttributesContext::AssImpSceneNodeAddedAttributesContext(AssImpSceneNodeAppendedContext& parent)
  89. : AssImpImportContext(parent.m_sourceScene, parent.m_sourceSceneSystem, parent.m_sourceNode)
  90. , SceneNodeAddedAttributesContextBase(parent)
  91. {
  92. }
  93. AssImpSceneNodeFinalizeContext::AssImpSceneNodeFinalizeContext(AssImpSceneNodeAddedAttributesContext& parent)
  94. : AssImpImportContext(parent.m_sourceScene, parent.m_sourceSceneSystem, parent.m_sourceNode)
  95. , SceneNodeFinalizeContextBase(parent)
  96. {
  97. }
  98. AssImpFinalizeSceneContext::AssImpFinalizeSceneContext(Containers::Scene& scene,
  99. const AssImpSDKWrapper::AssImpSceneWrapper& sourceScene,
  100. const SceneSystem& sourceSceneSystem,
  101. RenamedNodesMap& nodeNameMap)
  102. : FinalizeSceneContextBase(scene, nodeNameMap)
  103. , m_sourceScene(sourceScene)
  104. , m_sourceSceneSystem(sourceSceneSystem)
  105. {
  106. }
  107. } // namespace SceneAPI
  108. } // namespace SceneBuilder
  109. } // namespace AZ