USDLoaderImplTinyusdz.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*
  2. Open Asset Import Library (assimp)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2024, assimp team
  5. All rights reserved.
  6. Redistribution and use of this software in source and binary forms,
  7. with or without modification, are permitted provided that the
  8. following conditions are met:
  9. * Redistributions of source code must retain the above
  10. copyright notice, this list of conditions and the
  11. following disclaimer.
  12. * Redistributions in binary form must reproduce the above
  13. copyright notice, this list of conditions and the
  14. following disclaimer in the documentation and/or other
  15. materials provided with the distribution.
  16. * Neither the name of the assimp team, nor the names of its
  17. contributors may be used to endorse or promote products
  18. derived from this software without specific prior
  19. written permission of the assimp team.
  20. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. ----------------------------------------------------------------------
  32. */
  33. /** @file USDLoader.h
  34. * @brief Declaration of the USD importer class.
  35. */
  36. #pragma once
  37. #ifndef AI_USDLOADER_IMPL_TINYUSDZ_H_INCLUDED
  38. #define AI_USDLOADER_IMPL_TINYUSDZ_H_INCLUDED
  39. #include <assimp/BaseImporter.h>
  40. #include <assimp/scene.h>
  41. #include <assimp/types.h>
  42. #include <vector>
  43. #include <cstdint>
  44. #include "tinyusdz.hh"
  45. #include "tydra/render-data.hh"
  46. namespace Assimp {
  47. class USDImporterImplTinyusdz {
  48. public:
  49. USDImporterImplTinyusdz() = default;
  50. ~USDImporterImplTinyusdz() = default;
  51. void InternReadFile(
  52. const std::string &pFile,
  53. aiScene *pScene,
  54. IOSystem *pIOHandler);
  55. void animations(
  56. const tinyusdz::tydra::RenderScene &render_scene,
  57. aiScene *pScene);
  58. void meshes(
  59. const tinyusdz::tydra::RenderScene &render_scene,
  60. aiScene *pScene,
  61. const std::string &nameWExt);
  62. void verticesForMesh(
  63. const tinyusdz::tydra::RenderScene &render_scene,
  64. aiScene *pScene,
  65. size_t meshIdx,
  66. const std::string &nameWExt);
  67. void facesForMesh(
  68. const tinyusdz::tydra::RenderScene &render_scene,
  69. aiScene *pScene,
  70. size_t meshIdx,
  71. const std::string &nameWExt);
  72. void normalsForMesh(
  73. const tinyusdz::tydra::RenderScene &render_scene,
  74. aiScene *pScene,
  75. size_t meshIdx,
  76. const std::string &nameWExt);
  77. void materialsForMesh(
  78. const tinyusdz::tydra::RenderScene &render_scene,
  79. aiScene *pScene,
  80. size_t meshIdx,
  81. const std::string &nameWExt);
  82. void uvsForMesh(
  83. const tinyusdz::tydra::RenderScene &render_scene,
  84. aiScene *pScene,
  85. size_t meshIdx,
  86. const std::string &nameWExt);
  87. void materials(
  88. const tinyusdz::tydra::RenderScene &render_scene,
  89. aiScene *pScene,
  90. const std::string &nameWExt);
  91. void textures(
  92. const tinyusdz::tydra::RenderScene &render_scene,
  93. aiScene *pScene,
  94. const std::string &nameWExt);
  95. void textureImages(
  96. const tinyusdz::tydra::RenderScene &render_scene,
  97. aiScene *pScene,
  98. const std::string &nameWExt);
  99. void buffers(
  100. const tinyusdz::tydra::RenderScene &render_scene,
  101. aiScene *pScene,
  102. const std::string &nameWExt);
  103. void setupNodes(
  104. const tinyusdz::tydra::RenderScene &render_scene,
  105. aiScene *pScene,
  106. const std::string &nameWExt);
  107. aiNode *nodes(
  108. const tinyusdz::tydra::RenderScene &render_scene,
  109. const std::string &nameWExt);
  110. aiNode *nodesRecursive(
  111. aiNode *pNodeParent,
  112. const tinyusdz::tydra::Node &node,
  113. const std::vector<tinyusdz::tydra::SkelHierarchy> &skeletons);
  114. aiNode *skeletonNodesRecursive(
  115. aiNode *pNodeParent,
  116. const tinyusdz::tydra::SkelNode &joint);
  117. void sanityCheckNodesRecursive(
  118. aiNode *pNode);
  119. void setupBlendShapes(
  120. const tinyusdz::tydra::RenderScene &render_scene,
  121. aiScene *pScene,
  122. const std::string &nameWExt);
  123. void blendShapesForMesh(
  124. const tinyusdz::tydra::RenderScene &render_scene,
  125. aiScene *pScene,
  126. size_t meshIdx,
  127. const std::string &nameWExt);
  128. };
  129. } // namespace Assimp
  130. #endif // AI_USDLOADER_IMPL_TINYUSDZ_H_INCLUDED