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 InMemoryMesh & | in_memory () const |
Returns the source's in-memory mesh data. More... | |
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable | |
MeshSource (const MeshSource &)=default | |
MeshSource & | operator= (const MeshSource &)=default |
MeshSource (MeshSource &&)=default | |
MeshSource & | operator= (MeshSource &&)=default |
|
default |
|
default |
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 | ( | InMemoryMesh && | mesh | ) |
Constructs from an in-memory mesh.
~MeshSource | ( | ) |
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. If the in-memory mesh file has an empty filename hint, the description will explicitly communicate that; the empty string will never be returned.
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.
const InMemoryMesh& in_memory | ( | ) | const |
Returns the source's in-memory mesh data.
true
. bool is_in_memory | ( | ) | const |
Reports true
if this source contains an in-memory mesh definition.
bool is_path | ( | ) | const |
Reports true
if this source is a filesystem path.
|
default |
|
default |
const std::filesystem::path& path | ( | ) | const |
Returns the source's file path.
true
.