25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

117 satır
3.6 KiB

  1. /*
  2. Open Asset Import Library (assimp)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2012, 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. #ifndef AI_OGREXMLSERIALIZER_H_INC
  34. #define AI_OGREXMLSERIALIZER_H_INC
  35. #ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
  36. #include "OgreStructs.h"
  37. #include "irrXMLWrapper.h"
  38. namespace Assimp
  39. {
  40. namespace Ogre
  41. {
  42. typedef irr::io::IrrXMLReader XmlReader;
  43. typedef boost::shared_ptr<XmlReader> XmlReaderPtr;
  44. class OgreXmlSerializer
  45. {
  46. public:
  47. /// Imports mesh and returns the result.
  48. /** @note Fatal unrecoverable errors will throw a DeadlyImportError. */
  49. static MeshXml *ImportMesh(XmlReader *reader);
  50. /// Imports skeleton to @c mesh.
  51. /** If mesh does not have a skeleton reference or the skeleton file
  52. cannot be found it is not a fatal DeadlyImportError.
  53. @return If skeleton import was successful. */
  54. static bool ImportSkeleton(Assimp::IOSystem *pIOHandler, MeshXml *mesh);
  55. static bool ImportSkeleton(Assimp::IOSystem *pIOHandler, Mesh *mesh);
  56. private:
  57. OgreXmlSerializer(XmlReader *reader) :
  58. m_reader(reader)
  59. {
  60. }
  61. static XmlReaderPtr OpenReader(Assimp::IOSystem *pIOHandler, const std::string &filename);
  62. // Mesh
  63. void ReadMesh(MeshXml *mesh);
  64. void ReadSubMesh(MeshXml *mesh);
  65. void ReadGeometry(VertexDataXml *dest);
  66. void ReadGeometryVertexBuffer(VertexDataXml *dest);
  67. void ReadBoneAssignments(VertexDataXml *dest);
  68. // Skeleton
  69. void ReadSkeleton(Skeleton *skeleton);
  70. void ReadBones(Skeleton *skeleton);
  71. void ReadBoneHierarchy(Skeleton *skeleton);
  72. void ReadAnimations(Skeleton *skeleton);
  73. void ReadAnimationTracks(Animation *dest);
  74. void ReadAnimationKeyFrames(Animation *anim, VertexAnimationTrack *dest);
  75. template<typename T>
  76. T ReadAttribute(const std::string &name) const;
  77. bool HasAttribute(const std::string &name) const;
  78. std::string &NextNode();
  79. std::string &SkipCurrentNode();
  80. bool CurrentNodeNameEquals(const std::string &name) const;
  81. std::string CurrentNodeName(bool forceRead = false);
  82. XmlReader *m_reader;
  83. std::string m_currentNodeName;
  84. };
  85. } // Ogre
  86. } // Assimp
  87. #endif // ASSIMP_BUILD_NO_OGRE_IMPORTER
  88. #endif // AI_OGREXMLSERIALIZER_H_INC