AssImpImportContexts.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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/RTTI/RTTI.h>
  10. #include <AzCore/std/string/string.h>
  11. #include <SceneAPI/SceneBuilder/ImportContexts/ImportContexts.h>
  12. #include <SceneAPI/SceneCore/Containers/SceneGraph.h>
  13. namespace AZ
  14. {
  15. namespace AssImpSDKWrapper
  16. {
  17. class AssImpNodeWrapper;
  18. class AssImpSceneWrapper;
  19. }
  20. namespace SceneAPI
  21. {
  22. class SceneSystem;
  23. namespace SceneBuilder
  24. {
  25. class RenamedNodesMap;
  26. // AssImpImportContext
  27. // Base structure containing common data needed for all import contexts
  28. // Member Variables:
  29. // m_sourceNode - AssImp node being used for data processing.
  30. struct AssImpImportContext
  31. {
  32. AZ_RTTI(AssImpImportContext, "{B1076AFF-991B-423C-8D3E-D5C9230434AB}");
  33. AssImpImportContext(const AssImpSDKWrapper::AssImpSceneWrapper& sourceScene,
  34. const SceneSystem& sourceSceneSystem,
  35. AssImpSDKWrapper::AssImpNodeWrapper& sourceNode);
  36. const AssImpSDKWrapper::AssImpSceneWrapper& m_sourceScene;
  37. AssImpSDKWrapper::AssImpNodeWrapper& m_sourceNode;
  38. const SceneSystem& m_sourceSceneSystem; // Needed for unit and axis conversion
  39. };
  40. // AssImpNodeEncounteredContext
  41. // Context pushed to indicate that a new AssImp Node has been found and any
  42. // importers that have means to process the contained data should do so
  43. struct AssImpNodeEncounteredContext
  44. : public AssImpImportContext
  45. , public NodeEncounteredContext
  46. {
  47. AZ_RTTI(AssImpNodeEncounteredContext, "{C2305BC5-EAEC-4515-BAD6-45E63C3FBD3D}", AssImpImportContext, NodeEncounteredContext);
  48. AssImpNodeEncounteredContext(Containers::Scene& scene,
  49. Containers::SceneGraph::NodeIndex currentGraphPosition,
  50. const AssImpSDKWrapper::AssImpSceneWrapper& sourceScene,
  51. const SceneSystem& sourceSceneSystem,
  52. RenamedNodesMap& nodeNameMap,
  53. AssImpSDKWrapper::AssImpNodeWrapper& sourceNode);
  54. AssImpNodeEncounteredContext(Events::ImportEventContext& parent,
  55. Containers::SceneGraph::NodeIndex currentGraphPosition,
  56. const AssImpSDKWrapper::AssImpSceneWrapper& sourceScene,
  57. const SceneSystem& sourceSceneSystem,
  58. RenamedNodesMap& nodeNameMap,
  59. AssImpSDKWrapper::AssImpNodeWrapper& sourceNode);
  60. };
  61. // AssImpSceneDataPopulatedContext
  62. // Context pushed to indicate that a piece of scene data has been fully
  63. // processed and any importers that wish to place it within the scene graph
  64. // may now do so.
  65. struct AssImpSceneDataPopulatedContext
  66. : public AssImpImportContext
  67. , public SceneDataPopulatedContextBase
  68. {
  69. AZ_RTTI(AssImpSceneDataPopulatedContext, "{888DA37E-4234-4990-AD50-E6E54AFA9C35}", AssImpImportContext, SceneDataPopulatedContextBase);
  70. AssImpSceneDataPopulatedContext(AssImpNodeEncounteredContext& parent,
  71. AZStd::shared_ptr<DataTypes::IGraphObject> nodeData,
  72. const AZStd::string& dataName);
  73. AssImpSceneDataPopulatedContext(Containers::Scene& scene,
  74. Containers::SceneGraph::NodeIndex currentGraphPosition,
  75. const AssImpSDKWrapper::AssImpSceneWrapper& sourceScene,
  76. const SceneSystem& sourceSceneSystem,
  77. RenamedNodesMap& nodeNameMap,
  78. AssImpSDKWrapper::AssImpNodeWrapper& sourceNode,
  79. AZStd::shared_ptr<DataTypes::IGraphObject> nodeData,
  80. const AZStd::string& dataName);
  81. };
  82. // AssImpSceneNodeAppendedContext
  83. // Context pushed to indicate that data has been added to the scene graph.
  84. // Generally created due to the insertion of a node during SceneDataPopulatedContext
  85. // processing.
  86. struct AssImpSceneNodeAppendedContext
  87. : public AssImpImportContext
  88. , public SceneNodeAppendedContextBase
  89. {
  90. AZ_RTTI(AssImpSceneNodeAppendedContext, "{9C8B688E-8ECD-4EF0-9AC6-21BBCFE8F5A3}", AssImpImportContext, SceneNodeAppendedContextBase);
  91. AssImpSceneNodeAppendedContext(AssImpSceneDataPopulatedContext& parent, Containers::SceneGraph::NodeIndex newIndex);
  92. AssImpSceneNodeAppendedContext(Containers::Scene& scene,
  93. Containers::SceneGraph::NodeIndex currentGraphPosition,
  94. const AssImpSDKWrapper::AssImpSceneWrapper& sourceScene,
  95. const SceneSystem& sourceSceneSystem,
  96. RenamedNodesMap& nodeNameMap,
  97. AssImpSDKWrapper::AssImpNodeWrapper& sourceNode);
  98. };
  99. // AssImpSceneAttributeDataPopulatedContext
  100. // Context pushed to indicate that attribute data has been found and processed
  101. struct AssImpSceneAttributeDataPopulatedContext
  102. : public AssImpImportContext
  103. , public SceneAttributeDataPopulatedContextBase
  104. {
  105. AZ_RTTI(AssImpSceneAttributeDataPopulatedContext, "{A5EFB485-2F36-4214-972B-0EFF4EFBF33D}", AssImpImportContext, SceneAttributeDataPopulatedContextBase);
  106. AssImpSceneAttributeDataPopulatedContext(AssImpSceneNodeAppendedContext& parent,
  107. AZStd::shared_ptr<DataTypes::IGraphObject> nodeData,
  108. const Containers::SceneGraph::NodeIndex attributeNodeIndex,const AZStd::string& dataName);
  109. };
  110. // AssImpSceneAttributeNodeAppendedContext
  111. // Context pushed to indicate that an attribute node has been added to the scene graph
  112. struct AssImpSceneAttributeNodeAppendedContext
  113. : public AssImpImportContext
  114. , public SceneAttributeNodeAppendedContextBase
  115. {
  116. AZ_RTTI(AssImpSceneAttributeNodeAppendedContext, "{96FDC405-2D3B-4030-A301-B3A2B5432498}", AssImpImportContext, SceneAttributeNodeAppendedContextBase);
  117. AssImpSceneAttributeNodeAppendedContext(AssImpSceneAttributeDataPopulatedContext& parent, Containers::SceneGraph::NodeIndex newIndex);
  118. };
  119. // AssImpSceneNodeAddedAttributesContext
  120. // Context pushed to indicate that all attribute processors have completed their
  121. // work for a specific data node.
  122. struct AssImpSceneNodeAddedAttributesContext
  123. : public AssImpImportContext
  124. , public SceneNodeAddedAttributesContextBase
  125. {
  126. AZ_RTTI(AssImpSceneNodeAddedAttributesContext, "{D305EAA5-5F16-4AAD-805D-DF07A1B355B9}", AssImpImportContext, SceneNodeAddedAttributesContextBase);
  127. AssImpSceneNodeAddedAttributesContext(AssImpSceneNodeAppendedContext& parent);
  128. };
  129. // AssImpSceneNodeFinalizeContext
  130. // Context pushed last after all other contexts for a scene node to allow any
  131. // post-processing needed for an importer.
  132. struct AssImpSceneNodeFinalizeContext
  133. : public AssImpImportContext
  134. , public SceneNodeFinalizeContextBase
  135. {
  136. AZ_RTTI(AssImpSceneNodeFinalizeContext, "{FD8B4AD5-3735-4D55-9455-504AB1DCA655}", AssImpImportContext, SceneNodeFinalizeContextBase);
  137. AssImpSceneNodeFinalizeContext(AssImpSceneNodeAddedAttributesContext& parent);
  138. };
  139. // AssImpFinalizeSceneContext
  140. // Context pushed after the scene has been fully created. This can be used to finalize pending work
  141. // such as resolving named links.
  142. struct AssImpFinalizeSceneContext
  143. : public FinalizeSceneContextBase
  144. {
  145. AZ_RTTI(AssImpFinalizeSceneContext, "{6B23A54A-44BF-4661-A130-6B4D06A57B9F}", FinalizeSceneContextBase);
  146. AssImpFinalizeSceneContext(
  147. Containers::Scene& scene,
  148. const AssImpSDKWrapper::AssImpSceneWrapper& sourceScene,
  149. const SceneSystem& sourceSceneSystem,
  150. RenamedNodesMap& nodeNameMap);
  151. const AssImpSDKWrapper::AssImpSceneWrapper& m_sourceScene;
  152. const SceneSystem& m_sourceSceneSystem; // Needed for unit and axis conversion
  153. };
  154. } // namespace SceneBuilder
  155. } // namespace SceneAPI
  156. } // namespace AZ