PlyLoader.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /** @file Definition of the .ply importer class. */
  2. #ifndef AI_PLYLOADER_H_INCLUDED
  3. #define AI_PLYLOADER_H_INCLUDED
  4. #include "BaseImporter.h"
  5. #include "../include/aiTypes.h"
  6. struct aiNode;
  7. #include "PlyParser.h"
  8. namespace Assimp
  9. {
  10. class MaterialHelper;
  11. using namespace PLY;
  12. // ---------------------------------------------------------------------------
  13. /** Used to load PLY files
  14. */
  15. class PLYImporter : public BaseImporter
  16. {
  17. friend class Importer;
  18. protected:
  19. /** Constructor to be privately used by Importer */
  20. PLYImporter();
  21. /** Destructor, private as well */
  22. ~PLYImporter();
  23. public:
  24. // -------------------------------------------------------------------
  25. /** Returns whether the class can handle the format of the given file.
  26. * See BaseImporter::CanRead() for details. */
  27. bool CanRead( const std::string& pFile, IOSystem* pIOHandler) const;
  28. protected:
  29. // -------------------------------------------------------------------
  30. /** Imports the given file into the given scene structure.
  31. * See BaseImporter::InternReadFile() for details
  32. */
  33. void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
  34. protected:
  35. // -------------------------------------------------------------------
  36. /** Extract vertices from the DOM
  37. */
  38. void LoadVertices(std::vector<aiVector3D>* pvOut,bool p_bNormals = false);
  39. // -------------------------------------------------------------------
  40. /** Extract vertex color channels
  41. */
  42. void LoadVertexColor(std::vector<aiColor4D>* pvOut);
  43. // -------------------------------------------------------------------
  44. /** Extract a face list from the DOM
  45. */
  46. void LoadFaces(std::vector<PLY::Face>* pvOut);
  47. // -------------------------------------------------------------------
  48. /** Extract a material list from the DOM
  49. */
  50. void LoadMaterial(std::vector<MaterialHelper*>* pvOut);
  51. // -------------------------------------------------------------------
  52. /** Validate material indices, replace default material identifiers
  53. */
  54. void ReplaceDefaultMaterial(std::vector<PLY::Face>* avFaces,
  55. std::vector<MaterialHelper*>* avMaterials);
  56. // -------------------------------------------------------------------
  57. /** Convert all meshes into our ourer representation
  58. */
  59. void ConvertMeshes(std::vector<PLY::Face>* avFaces,
  60. const std::vector<aiVector3D>* avPositions,
  61. const std::vector<aiVector3D>* avNormals,
  62. const std::vector<aiColor4D>* avColors,
  63. const std::vector<MaterialHelper*>* avMaterials,
  64. std::vector<aiMesh*>* avOut);
  65. /** Buffer to hold the loaded file */
  66. unsigned char* mBuffer;
  67. /** Document object model representation extracted from the file */
  68. PLY::DOM* pcDOM;
  69. };
  70. } // end of namespace Assimp
  71. #endif // AI_3DSIMPORTER_H_INC