16 #ifndef SURGSIM_DATASTRUCTURES_TRIANGLEMESHPLYREADERDELEGATE_INL_H 17 #define SURGSIM_DATASTRUCTURES_TRIANGLEMESHPLYREADERDELEGATE_INL_H 21 m_mesh(
std::make_shared<M>())
46 std::placeholders::_1, std::placeholders::_2),
65 std::placeholders::_1, std::placeholders::_2),
85 result = result && reader.
hasProperty(
"vertex",
"x");
86 result = result && reader.
hasProperty(
"vertex",
"y");
87 result = result && reader.
hasProperty(
"vertex",
"z");
88 result = result && reader.
hasProperty(
"face",
"vertex_indices");
89 result = result && !reader.
isScalar(
"face",
"vertex_indices");
108 m_mesh->addVertex(vertex);
115 "There was an overrun while reading the vertex structures, it is likely that data " <<
116 "has become corrupted.";
134 typename M::TriangleType triangle(
m_indices);
135 m_mesh->addTriangle(triangle);
142 <<
"There was an overrun while reading the face structures, it is likely that data " 143 <<
"has become corrupted.";
std::shared_ptr< MeshType > getMesh()
Gets the mesh.
Definition: TriangleMeshPlyReaderDelegate-inl.h:35
bool hasTextureCoordinates()
Definition: TriangleMeshPlyReaderDelegate-inl.h:153
virtual void processVertex(const std::string &elementName)
Callback function to process one vertex.
Definition: TriangleMeshPlyReaderDelegate-inl.h:105
void endFaces(const std::string &elementName)
Callback function to finalize processing of faces.
Definition: TriangleMeshPlyReaderDelegate-inl.h:139
Internal structure, the receiver for data from the "vertex" element Provide space for standard ply ve...
Definition: TriangleMeshPlyReaderDelegate.h:99
virtual bool registerDelegate(PlyReader *reader) override
Registers the delegate with the reader, overridden from.
Definition: TriangleMeshPlyReaderDelegate-inl.h:41
double x
Definition: TriangleMeshPlyReaderDelegate.h:101
double z
Definition: TriangleMeshPlyReaderDelegate.h:103
#define SURGSIM_ASSERT(condition)
Assert that condition is true.
Definition: Assert.h:77
Definition: PlyReader.h:97
std::array< size_t, 3 > m_indices
Definition: TriangleMeshPlyReaderDelegate.h:122
int64_t overrun
Used to check for buffer overruns.
Definition: TriangleMeshPlyReaderDelegate.h:115
Definition: PlyReader.h:99
bool m_hasTextureCoordinates
Set to true if s/t coordinates are found in the .ply file.
Definition: TriangleMeshPlyReaderDelegate.h:126
void endVertices(const std::string &elementName)
Callback function to finalize processing of vertices.
Definition: TriangleMeshPlyReaderDelegate-inl.h:112
Wrapper for the C .ply file parser This class wraps the main functionality for the original C ...
Definition: PlyReader.h:85
TriangleMeshPlyReaderDelegate()
Default constructor.
Definition: TriangleMeshPlyReaderDelegate-inl.h:20
void endFile()
Callback function to finalize processing of the mesh.
Definition: TriangleMeshPlyReaderDelegate-inl.h:147
string(TOUPPER ${DEVICE}DEVICE_UPPER_CASE) option(BUILD_DEVICE_ $
Definition: CMakeLists.txt:35
bool hasProperty(std::string elementName, std::string propertyName) const
Query if 'elementName' has the given property.
Definition: PlyReader.cpp:331
bool requestScalarProperty(std::string elementName, std::string propertyName, int dataType, int dataOffset)
Request a scalar property for parsing.
Definition: PlyReader.cpp:118
struct SurgSim::DataStructures::TriangleMeshPlyReaderDelegate::VertexData m_vertexData
int64_t overrun2
Used to check for buffer overruns.
Definition: TriangleMeshPlyReaderDelegate.h:107
Internal structure, the received for data from the "face" element.
Definition: TriangleMeshPlyReaderDelegate.h:111
unsigned int edgeCount
Definition: TriangleMeshPlyReaderDelegate.h:113
void processFace(const std::string &elementName)
Callback function to process one face.
Definition: TriangleMeshPlyReaderDelegate-inl.h:129
std::shared_ptr< MeshType > m_mesh
The mesh that will be created.
Definition: TriangleMeshPlyReaderDelegate.h:119
bool requestElement(std::string elementName, std::function< void *(const std::string &, size_t)> startElementCallback, std::function< void(const std::string &)> processElementCallback, std::function< void(const std::string &)> endElementCallback)
Request element to be processed during parsing.
Definition: PlyReader.cpp:94
bool requestListProperty(std::string elementName, std::string propertyName, int dataType, int dataOffset, int countType, int countOffset)
Request a list property for parsing.
Definition: PlyReader.cpp:123
bool isScalar(std::string elementName, std::string propertyName) const
Query if the property of the give element is scalar.
Definition: PlyReader.cpp:345
void * beginVertices(const std::string &elementName, size_t vertexCount)
Callback function, begin the processing of vertices.
Definition: TriangleMeshPlyReaderDelegate-inl.h:95
struct SurgSim::DataStructures::TriangleMeshPlyReaderDelegate::FaceData m_faceData
unsigned int * indices
Definition: TriangleMeshPlyReaderDelegate.h:114
void setEndParseFileCallback(std::function< void(void)> endParseFileCallback)
Register callback to be called at the end of parseFile.
Definition: PlyReader.cpp:136
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:56
virtual bool fileIsAcceptable(const PlyReader &reader) override
Check whether this file is acceptable to the delegate, overridden from.
Definition: TriangleMeshPlyReaderDelegate-inl.h:80
int64_t overrun1
Used to check for buffer overruns.
Definition: TriangleMeshPlyReaderDelegate.h:104
double y
Definition: TriangleMeshPlyReaderDelegate.h:102
void * beginFaces(const std::string &elementName, size_t faceCount)
Callback function, begin the processing of faces.
Definition: TriangleMeshPlyReaderDelegate-inl.h:120