AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
MeshReader.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agx/Referenced.h>
20#include <agx/Vector.h>
22#include <string>
23#include <agx/Vec3.h>
25#include <agxIO/FileSystem.h>
26
27namespace agxIO
28{
76
83 {
84 public:
85
87
92 virtual size_t readFile( const agx::String& filename );
93
98 virtual size_t readString( const agx::String& mesh, FileExtension::FileType fet );
99
104 virtual size_t readStream( std::istream& stream, FileExtension::FileType fet );
105
111 const agx::Vec3Vector& getVertices() const;
112
118 const agx::UInt32Vector& getIndices() const;
119
125 const agx::Vec3Vector& getNormals() const;
126
132 const agx::Vec2Vector& getTextureCoordinates() const;
133
139 size_t getNumTriangles() const;
140
141
148
155
156 protected:
157
158
163 size_t readShlStream( std::istream& stream );
164
168 void clear();
169
170 virtual ~MeshReader() {}
171
176
178 };
179
181 {
182 return m_vertices;
183 }
184
186 {
187 return m_indices;
188 }
189
191 {
192 return m_normals;
193 }
194
196 {
197 return m_texCoordinates;
198 }
199
200
201 inline size_t MeshReader::getNumTriangles() const
202 {
203 return m_indices.size() / 3;
204 }
205
206
207} // namespace agxIO
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXPHYSICS_EXPORT
Class for reading a mesh object from file and extracting vertices, normals and indices for collision ...
Definition MeshReader.h:83
agx::Vec2Vector m_texCoordinates
Definition MeshReader.h:175
virtual ~MeshReader()
Definition MeshReader.h:170
size_t getNumTriangles() const
Get number of triangles from previously read mesh file.
Definition MeshReader.h:201
void clear()
Reset all allocated memory.
agx::Vec3Vector m_normals
Definition MeshReader.h:173
virtual size_t readFile(const agx::String &filename)
Read a specified filename containing a mesh description in some mesh format.
size_t readShlStream(std::istream &stream)
Read a specified stream containing a mesh description in SHL format.
agx::UInt32Vector m_indices
Definition MeshReader.h:174
virtual size_t readString(const agx::String &mesh, FileExtension::FileType fet)
Read a specified string containing a mesh description in some mesh format defined as a string.
static agx::StringVector m_extensions
Definition MeshReader.h:177
agx::Vec3Vector m_vertices
Definition MeshReader.h:172
virtual size_t readStream(std::istream &stream, FileExtension::FileType fet)
Read a specified stream containing a mesh description in some mesh format.
const agx::Vec3Vector & getNormals() const
Get normals from previously read mesh file.
Definition MeshReader.h:190
const agx::Vec2Vector & getTextureCoordinates() const
Get texture coordinates from previously read mesh file.
Definition MeshReader.h:195
const agx::Vec3Vector & getVertices() const
Get vertices from previously read mesh file.
Definition MeshReader.h:180
static FileExtension::FileType getFileExtensionType(const agx::String &fileName)
Convert a filename to a known (or unknown) file extension enum.
static agx::String getFileExtension(FileExtension::FileType type)
Convert a filetype enum to a string with the file extension (without '.
const agx::UInt32Vector & getIndices() const
Get indices from previously read mesh file.
Definition MeshReader.h:185
size_t size() const
Definition Container.h:134
Base class providing referencing counted objects.
Definition Referenced.h:120
The agxIO namespace contains classes for reading, writing and finding files.
Definition Material.h:42
Support mesh file formats.
Definition MeshReader.h:33
@ MD3
Quake III Mesh.
Definition MeshReader.h:63
@ IRRMESH
Irrlicht Mesh.
Definition MeshReader.h:59
@ FBX
Filmbox AutoDesk.
Definition MeshReader.h:38
@ BLEND
Blender 3D.
Definition MeshReader.h:41
@ IFC
Industry Foundation Classes (IFC/Step)
Definition MeshReader.h:72
@ OGEX
Open Game Engine Exchange(.ogex)
Definition MeshReader.h:73
@ PK3
Quake III Map/BSP.
Definition MeshReader.h:64
@ ASE
3ds Max ASE
Definition MeshReader.h:43
@ SMD
Valve Model.
Definition MeshReader.h:66
@ OBJ
Wavefront OBJ.
Definition MeshReader.h:36
@ STL
Stereolithography.
Definition MeshReader.h:53
@ DXF
AutoCAD DXF.
Definition MeshReader.h:49
@ M3
Starcraft II M3.
Definition MeshReader.h:67
@ GLTF
Ascii GL Transmission format.
Definition MeshReader.h:45
@ TER
Terragen Terrain.
Definition MeshReader.h:71
@ MAX3DS
3ds Max 3DS
Definition MeshReader.h:42
@ IRR
Irrlicht Scene.
Definition MeshReader.h:60
@ LWS
LightWave Scene.
Definition MeshReader.h:51
@ OFF
Object File Format.
Definition MeshReader.h:70
@ GLTFB
Binary GL Transmission format.
Definition MeshReader.h:44
@ PLY
Stanford Polygon Library.
Definition MeshReader.h:48
@ SHL
Shell data file.
Definition MeshReader.h:37
@ MS3D
Milkshape 3D.
Definition MeshReader.h:56
@ ASSIMP
AssImp reader/writer.
Definition MeshReader.h:39