AGX Dynamics  2.37.3.2
MeshReaderAssimp.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
19 #include <agx/config/AGX_USE_ASSIMP.h>
20 #if AGX_USE_ASSIMP()
21 
22 #include <agxIO/MeshReader.h>
23 
24 namespace Assimp
25 {
26  class Importer;
27 }
28 
29 namespace agxIO
30 {
31 
37  class AGXPHYSICS_EXPORT MeshReaderAssimp : public MeshReader
38  {
39  public:
40 
42  MeshReaderAssimp();
43 
47  MeshReaderAssimp(agx::Vec3Vector& vertices, agx::Vec3Vector& normals, agx::UInt32Vector& indices, agx::Vec2Vector& texCoordinates);
48 
55  size_t readFile( const agx::String& fileName ) override;
56 
62  size_t readString( const agx::String& meshString, FileExtension::FileType fet) override;
63 
64 
70  size_t readStream(std::istream& stream, FileExtension::FileType fet) override;
71 
72  using MeshReader::readString;
73 
74  protected:
75  size_t importModel(std::stringstream& stream, const agx::String& fileName, FileExtension::FileType fet, Assimp::Importer& importer);
76 
77 
78  virtual ~MeshReaderAssimp();
80 
81  agx::Vec3Vector& m_assimp_vertices;
82  agx::Vec3Vector& m_assimp_normals;
83  agx::UInt32Vector& m_assimp_indices;
84  agx::Vec2Vector& m_assimp_texCoordinates;
85  };
86 
87  typedef agx::ref_ptr<MeshReaderAssimp> MeshReaderAssimpRef;
88 }
89 
90 // AGX_USE_ASSIMP.
91 #endif
FileType
Specify the type of file.
The agxIO namespace contains classes for reading, writing and finding files.
Definition: Material.h:41
#define AGXPHYSICS_EXPORT
void AGXCORE_EXPORT readFile(agx::String &result, const agx::String &filePath)