A class for input and output to ply files. More...
#include <PLYIO.hpp>
Public Member Functions | |
PLYIO () | |
Ctor. | |
void | addElement (PLYElement *e) |
Adds the given element to the file. | |
void | setVertexArray (float *array, size_t n) |
Sets the vertex array (for meshes). | |
void | setNormalArray (float *array, size_t n) |
Sets the normal array (for meshes). | |
void | setColorArray (float *array, size_t n) |
Sets the color array (for vertex colors). | |
void | setIndexArray (unsigned int *array, size_t n) |
Sets the index buffer. | |
void | save (string filename, bool binary=true) |
Save the currently present information to the given file. | |
void | read (string filename) |
Reads all supported information from the given file. | |
virtual | ~PLYIO () |
Dtor. | |
float * | getVertexArray (size_t &n) |
Returns the interlaced vertex array (or a null pointer if not set). | |
float * | getNormalArray (size_t &n) |
Returns the interlaced normal array (or a null pointer if not set). | |
float * | getColorArray (size_t &) |
Returns the interlaced color array (or a null pointer if not set). | |
float ** | getIndexedVertexArray (size_t &n) |
Returns an index accessible representation (2D array) of the vertex data. | |
float ** | getIndexedNormalArray (size_t &n) |
Returns an index accessible representation (2D array) of the vertex data. | |
void | setIndexedVertexArray (float **arr, size_t size) |
Adds indexed vertex data. | |
void | setIndexedNormalArray (float **arr, size_t size) |
Adds indexed vertex data. | |
unsigned int * | getIndexArray (size_t &n) |
Returns the index array of a mesh. | |
bool | containsElement (PLYElement &e) |
Returns true if the current element contains the provided element. | |
bool | containsElement (string elementName) |
Returns true if the current element lists contains an element with the given name. | |
bool | hasProperty (PLYElement &e, Property &p) |
Checks if e} has property p}. | |
void | printElementsInHeader () |
Prints all elements and properties to stdout. | |
Private Member Functions | |
float ** | interlacedBufferToIndexedBuffer (float *src, size_t n) |
float * | indexedBufferToInterlacedBuffer (float **src, size_t n) |
void | writeHeader (ofstream &str) |
void | writeElements (ofstream &str) |
void | writeFacesBinary (ofstream &str, PLYElement *e) |
void | writeFacesASCII (ofstream &str, PLYElement *e) |
void | writeVerticesBinary (ofstream &str, PLYElement *e) |
void | writeVerticesASCII (ofstream &str, PLYElement *e) |
void | writeNormalsBinary (ofstream &out, PLYElement *e) |
void | writeNormalsASCII (ofstream &out, PLYElement *e) |
void | readVerticesBinary (ifstream &in, PLYElement *descr) |
void | readFacesBinary (ifstream &in, PLYElement *descr) |
void | readNormalsBinary (ifstream &in, PLYElement *descr) |
void | readVerticesASCII (ifstream &in, PLYElement *descr) |
void | readFacesASCII (ifstream &in, PLYElement *descr) |
void | readNormalsASCII (ifstream &in, PLYElement *descr) |
void | readHeader (ifstream &str) |
char * | putElementInBuffer (char *buffer, string s, float value) |
bool | isSupported (string element_name) |
bool | parseHeaderLine (const char *line) |
void | loadElements (ifstream &in) |
void | deleteBuffers () |
void | allocVertexBuffers (PLYElement *dscr) |
void | copyElementToVertexBuffer (ifstream &str, Property *, float *buffer, size_t position) |
template<typename T > | |
void | copyElementToVertexBuffer (char *src, float *buffer, size_t positon) |
Private Attributes | |
float * | m_vertices |
float * | m_normals |
float * | m_colors |
unsigned int * | m_indices |
size_t | m_numberOfNormals |
size_t | m_numberOfVertices |
size_t | m_numberOfFaces |
bool | m_binary |
vector< PLYElement * > | m_elements |
A class for input and output to ply files.
Definition at line 37 of file PLYIO.hpp.
void lssr::PLYIO::addElement | ( | PLYElement * | e | ) |
void lssr::PLYIO::allocVertexBuffers | ( | PLYElement * | dscr | ) | [private] |
bool lssr::PLYIO::containsElement | ( | string | elementName | ) |
bool lssr::PLYIO::containsElement | ( | PLYElement & | e | ) |
Returns true if the current element contains the provided element.
e | A ply element description object |
void lssr::PLYIO::copyElementToVertexBuffer | ( | ifstream & | str, | |
Property * | p, | |||
float * | buffer, | |||
size_t | position | |||
) | [private] |
void lssr::PLYIO::copyElementToVertexBuffer | ( | char * | src, | |
float * | buffer, | |||
size_t | positon | |||
) | [private] |
void lssr::PLYIO::deleteBuffers | ( | ) | [private] |
float * lssr::PLYIO::getColorArray | ( | size_t & | n | ) |
unsigned int * lssr::PLYIO::getIndexArray | ( | size_t & | n | ) |
float ** lssr::PLYIO::getIndexedNormalArray | ( | size_t & | n | ) |
Returns an index accessible representation (2D array) of the vertex data.
n | Contains the number of vertices |
Using this method, the preferred interlaced representation is converted into a 2D array. Be careful with large data sets since the information is duplicated.
Definition at line 905 of file PLYIO.cpp.
float ** lssr::PLYIO::getIndexedVertexArray | ( | size_t & | n | ) |
Returns an index accessible representation (2D array) of the vertex data.
n | Contains the number of vertices |
Using this method, the preferred interlaced representation is converted into a 2D array. Be careful with large data sets since the information is duplicated.
Definition at line 898 of file PLYIO.cpp.
float * lssr::PLYIO::getNormalArray | ( | size_t & | n | ) |
float * lssr::PLYIO::getVertexArray | ( | size_t & | n | ) |
bool lssr::PLYIO::hasProperty | ( | PLYElement & | e, | |
Property & | p | |||
) |
Checks if e} has property p}.
float * lssr::PLYIO::indexedBufferToInterlacedBuffer | ( | float ** | src, | |
size_t | n | |||
) | [private] |
float ** lssr::PLYIO::interlacedBufferToIndexedBuffer | ( | float * | src, | |
size_t | n | |||
) | [private] |
bool lssr::PLYIO::isSupported | ( | string | element_name | ) | [private] |
void lssr::PLYIO::loadElements | ( | ifstream & | in | ) | [private] |
bool lssr::PLYIO::parseHeaderLine | ( | const char * | line | ) | [private] |
void lssr::PLYIO::printElementsInHeader | ( | ) |
char * lssr::PLYIO::putElementInBuffer | ( | char * | buffer, | |
string | s, | |||
float | value | |||
) | [private] |
void lssr::PLYIO::read | ( | string | filename | ) |
void lssr::PLYIO::readFacesASCII | ( | ifstream & | in, | |
PLYElement * | descr | |||
) | [private] |
void lssr::PLYIO::readFacesBinary | ( | ifstream & | in, | |
PLYElement * | descr | |||
) | [private] |
void lssr::PLYIO::readHeader | ( | ifstream & | str | ) | [private] |
void lssr::PLYIO::readNormalsASCII | ( | ifstream & | in, | |
PLYElement * | descr | |||
) | [private] |
void lssr::PLYIO::readNormalsBinary | ( | ifstream & | in, | |
PLYElement * | descr | |||
) | [private] |
void lssr::PLYIO::readVerticesASCII | ( | ifstream & | in, | |
PLYElement * | descr | |||
) | [private] |
void lssr::PLYIO::readVerticesBinary | ( | ifstream & | in, | |
PLYElement * | descr | |||
) | [private] |
void lssr::PLYIO::save | ( | string | filename, | |
bool | binary = true | |||
) |
void lssr::PLYIO::setColorArray | ( | float * | array, | |
size_t | n | |||
) |
void lssr::PLYIO::setIndexArray | ( | unsigned int * | array, | |
size_t | n | |||
) |
void lssr::PLYIO::setIndexedNormalArray | ( | float ** | arr, | |
size_t | size | |||
) |
void lssr::PLYIO::setIndexedVertexArray | ( | float ** | arr, | |
size_t | size | |||
) |
void lssr::PLYIO::setNormalArray | ( | float * | array, | |
size_t | n | |||
) |
void lssr::PLYIO::setVertexArray | ( | float * | array, | |
size_t | n | |||
) |
void lssr::PLYIO::writeElements | ( | ofstream & | str | ) | [private] |
void lssr::PLYIO::writeFacesASCII | ( | ofstream & | str, | |
PLYElement * | e | |||
) | [private] |
void lssr::PLYIO::writeFacesBinary | ( | ofstream & | str, | |
PLYElement * | e | |||
) | [private] |
void lssr::PLYIO::writeHeader | ( | ofstream & | str | ) | [private] |
void lssr::PLYIO::writeNormalsASCII | ( | ofstream & | out, | |
PLYElement * | e | |||
) | [private] |
void lssr::PLYIO::writeNormalsBinary | ( | ofstream & | out, | |
PLYElement * | e | |||
) | [private] |
void lssr::PLYIO::writeVerticesASCII | ( | ofstream & | str, | |
PLYElement * | e | |||
) | [private] |
void lssr::PLYIO::writeVerticesBinary | ( | ofstream & | str, | |
PLYElement * | e | |||
) | [private] |
bool lssr::PLYIO::m_binary [private] |
float* lssr::PLYIO::m_colors [private] |
vector<PLYElement*> lssr::PLYIO::m_elements [private] |
unsigned int* lssr::PLYIO::m_indices [private] |
float* lssr::PLYIO::m_normals [private] |
size_t lssr::PLYIO::m_numberOfFaces [private] |
size_t lssr::PLYIO::m_numberOfNormals [private] |
size_t lssr::PLYIO::m_numberOfVertices [private] |
float* lssr::PLYIO::m_vertices [private] |