Drake
Drake C++ Documentation
MeshSource Class Referencefinal

Detailed Description

Provides a general abstraction to the definition of a mesh.

A mesh definition can come from disk or memory. APIs that support both can take as specification an instance of MeshSource to communicate that ability.

#include <drake/geometry/mesh_source.h>

Public Member Functions

 MeshSource (std::filesystem::path path)
 Constructs from a file path. More...
 
 MeshSource (InMemoryMesh &&mesh)
 Constructs from an in-memory mesh. More...
 
 ~MeshSource ()
 
bool is_path () const
 Reports true if this source is a filesystem path. More...
 
bool is_in_memory () const
 Reports true if this source contains an in-memory mesh definition. More...
 
std::string description () const
 Provides a source-agnostic description of the mesh. More...
 
const std::string & extension () const
 Returns the extension of the mesh type – all lower case and including the dot. More...
 
const std::filesystem::path & path () const
 Returns the source's file path. More...
 
const InMemoryMeshin_memory () const
 Returns the source's in-memory mesh data. More...
 
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 MeshSource (const MeshSource &)=default
 
MeshSourceoperator= (const MeshSource &)=default
 
 MeshSource (MeshSource &&)=default
 
MeshSourceoperator= (MeshSource &&)=default
 

Constructor & Destructor Documentation

◆ MeshSource() [1/4]

MeshSource ( const MeshSource )
default

◆ MeshSource() [2/4]

MeshSource ( MeshSource &&  )
default

◆ MeshSource() [3/4]

MeshSource ( std::filesystem::path  path)

Constructs from a file path.

Note: the path will not be validated in any way (existence, availability, naming an actual mesh file, etc.). Validation occurs where the MeshSource's path is used.

◆ MeshSource() [4/4]

MeshSource ( InMemoryMesh &&  mesh)

Constructs from an in-memory mesh.

◆ ~MeshSource()

~MeshSource ( )

Member Function Documentation

◆ description()

std::string description ( ) const

Provides a source-agnostic description of the mesh.

If is_path() is true, it is the path. If is_in_memory() is true, it is the filename_hint for the in-memory mesh file.

◆ extension()

const std::string& extension ( ) const

Returns the extension of the mesh type – all lower case and including the dot.

If is_path() is true, the extension is extracted from the path. I.e., /foo/bar/mesh.obj and /foo/bar/mesh.OBJ would both report the ".obj" extension. The "extension" portion of the filename is defined as in std::filesystem::path::extension().

If is_in_memory() is true, it is the extension reported by the MemoryFile.

◆ in_memory()

const InMemoryMesh& in_memory ( ) const

Returns the source's in-memory mesh data.

Precondition
is_in_memory() returns true.

◆ is_in_memory()

bool is_in_memory ( ) const

Reports true if this source contains an in-memory mesh definition.

◆ is_path()

bool is_path ( ) const

Reports true if this source is a filesystem path.

◆ operator=() [1/2]

MeshSource& operator= ( const MeshSource )
default

◆ operator=() [2/2]

MeshSource& operator= ( MeshSource &&  )
default

◆ path()

const std::filesystem::path& path ( ) const

Returns the source's file path.

Precondition
is_path() returns true.

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