AGX Dynamics  2.37.2.0
agxIO::MeshReader Class Reference

Class for reading a mesh object from file and extracting vertices, normals and indices for collision detection Notice that this class will read the mesh vertices/indices as is. More...

#include <MeshReader.h>

+ Inheritance diagram for agxIO::MeshReader:

Public Member Functions

 MeshReader ()
 
const agx::UInt32Vector & getIndices () const
 Get indices from previously read mesh file. More...
 
const agx::Vec3Vector & getNormals () const
 Get normals from previously read mesh file. More...
 
size_t getNumTriangles () const
 Get number of triangles from previously read mesh file. More...
 
const agx::Vec2Vector & getTextureCoordinates () const
 Get texture coordinates from previously read mesh file. More...
 
const agx::Vec3Vector & getVertices () const
 Get vertices from previously read mesh file. More...
 
virtual size_t readFile (const agx::String &filename)
 Read a specified filename containing a mesh description in some mesh format. More...
 
virtual size_t readStream (std::istream &stream, FileExtension::FileType fet)
 Read a specified stream containing a mesh description in some mesh format. More...
 
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. More...
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor. More...
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting. More...
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match. More...
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test. More...
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object. More...
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 

Static Public Member Functions

static agx::String getFileExtension (FileExtension::FileType type)
 Convert a filetype enum to a string with the file extension (without '. More...
 
static FileExtension::FileType getFileExtensionType (const agx::String &fileName)
 Convert a filename to a known (or unknown) file extension enum. More...
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 

Protected Member Functions

virtual ~MeshReader ()
 
void clear ()
 Reset all allocated memory. More...
 
size_t readShlStream (std::istream &stream)
 Read a specified stream containing a mesh description in SHL format. More...
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor. More...
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Protected Attributes

agx::UInt32Vector m_indices
 
agx::Vec3Vector m_normals
 
agx::Vec2Vector m_texCoordinates
 
agx::Vec3Vector m_vertices
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Static Protected Attributes

static agx::StringVector m_extensions
 

Additional Inherited Members

- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More...
 

Detailed Description

Class for reading a mesh object from file and extracting vertices, normals and indices for collision detection Notice that this class will read the mesh vertices/indices as is.

No merging of nearby vertices will be done.

Definition at line 82 of file MeshReader.h.

Constructor & Destructor Documentation

◆ MeshReader()

agxIO::MeshReader::MeshReader ( )

◆ ~MeshReader()

virtual agxIO::MeshReader::~MeshReader ( )
inlineprotectedvirtual

Definition at line 170 of file MeshReader.h.

Member Function Documentation

◆ clear()

void agxIO::MeshReader::clear ( )
protected

Reset all allocated memory.

◆ getFileExtension()

static agx::String agxIO::MeshReader::getFileExtension ( FileExtension::FileType  type)
static

Convert a filetype enum to a string with the file extension (without '.

')

Parameters
type- Enum with the filetype to be returned as a string
Returns
a string with the file type without '.'

◆ getFileExtensionType()

static FileExtension::FileType agxIO::MeshReader::getFileExtensionType ( const agx::String &  fileName)
static

Convert a filename to a known (or unknown) file extension enum.

Parameters
fileName- filename including extension of a mesh file
Returns
enum defining the filetype of the filename

◆ getIndices()

const agx::UInt32Vector & agxIO::MeshReader::getIndices ( ) const
inline

Get indices from previously read mesh file.

Note
Must be called after the readFile() method
Returns
a const reference to a vector containing indices found in the model data.

Definition at line 185 of file MeshReader.h.

◆ getNormals()

const agx::Vec3Vector & agxIO::MeshReader::getNormals ( ) const
inline

Get normals from previously read mesh file.

Note
Must be called after the readFile() method
Returns
a const reference to a vector containing normals found in the model data.

Definition at line 190 of file MeshReader.h.

◆ getNumTriangles()

size_t agxIO::MeshReader::getNumTriangles ( ) const
inline

Get number of triangles from previously read mesh file.

Note
Must be called after the readFile() method
Returns
number of triangles.

Definition at line 201 of file MeshReader.h.

◆ getTextureCoordinates()

const agx::Vec2Vector & agxIO::MeshReader::getTextureCoordinates ( ) const
inline

Get texture coordinates from previously read mesh file.

Note
Must be called after the readFile() method
Returns
a const reference to a vector containing texture coordinates normals found in the model data

Definition at line 195 of file MeshReader.h.

◆ getVertices()

const agx::Vec3Vector & agxIO::MeshReader::getVertices ( ) const
inline

Get vertices from previously read mesh file.

Note
Must be called after the readFile() method
Returns
a const reference to a vector containing vertices found in the model data.

Definition at line 180 of file MeshReader.h.

◆ readFile()

virtual size_t agxIO::MeshReader::readFile ( const agx::String &  filename)
virtual

Read a specified filename containing a mesh description in some mesh format.

Returns
number of found triangles.

Reimplemented in agxIO::MeshReaderOBJ.

◆ readShlStream()

size_t agxIO::MeshReader::readShlStream ( std::istream &  stream)
protected

Read a specified stream containing a mesh description in SHL format.

Returns
number of found triangles.

◆ readStream()

virtual size_t agxIO::MeshReader::readStream ( std::istream &  stream,
FileExtension::FileType  fet 
)
virtual

Read a specified stream containing a mesh description in some mesh format.

Returns
number of found triangles.

◆ readString()

virtual size_t agxIO::MeshReader::readString ( const agx::String &  mesh,
FileExtension::FileType  fet 
)
virtual

Read a specified string containing a mesh description in some mesh format defined as a string.

Returns
number of found triangles.

Referenced by agxIO::MeshReaderOBJ::MeshReaderOBJ().

Member Data Documentation

◆ m_extensions

agx::StringVector agxIO::MeshReader::m_extensions
staticprotected

Definition at line 177 of file MeshReader.h.

◆ m_indices

agx::UInt32Vector agxIO::MeshReader::m_indices
protected

Definition at line 174 of file MeshReader.h.

◆ m_normals

agx::Vec3Vector agxIO::MeshReader::m_normals
protected

Definition at line 173 of file MeshReader.h.

◆ m_texCoordinates

agx::Vec2Vector agxIO::MeshReader::m_texCoordinates
protected

Definition at line 175 of file MeshReader.h.

◆ m_vertices

agx::Vec3Vector agxIO::MeshReader::m_vertices
protected

Definition at line 172 of file MeshReader.h.


The documentation for this class was generated from the following file: