MRPT
2.0.1
|
#include "opengl-precomp.h"
#include <mrpt/core/exceptions.h>
#include <mrpt/core/reverse_bytes.h>
#include <mrpt/opengl/PLY_import_export.h>
#include <mrpt/system/string_utils.h>
#include <cstdio>
Go to the source code of this file.
Classes | |
struct | PlyProperty |
struct | PlyElement |
struct | PlyFile |
struct | TVertex |
struct | TFace |
Macros | |
#define | PLY_ASCII 1 /* ascii PLY file */ |
#define | PLY_BINARY_BE 2 /* binary PLY file, big endian */ |
#define | PLY_BINARY_LE 3 /* binary PLY file, little endian */ |
#define | BIG_STRING 4096 |
Typedefs | |
typedef struct PlyProperty | PlyProperty |
typedef struct PlyElement | PlyElement |
Enumerations | |
enum | { PLY_START_TYPE = 0, PLY_CHAR = 1, PLY_SHORT = 2, PLY_INT = 3, PLY_UCHAR = 4, PLY_USHORT = 5, PLY_UINT = 6, PLY_FLOAT = 7, PLY_DOUBLE = 8, PLY_END_TYPE = 9 } |
Functions | |
PlyElement * | find_element (PlyFile *, const std::string &s) |
PlyProperty * | find_property (PlyElement *, const std::string &s, int *) |
void | write_scalar_type (FILE *, int) |
vector< string > | get_words (FILE *, string &) |
void | write_binary_item (FILE *, int, unsigned int, double, int) |
void | write_ascii_item (FILE *, int, unsigned int, double, int) |
void | add_element (PlyFile *, const vector< string > &) |
void | add_property (PlyFile *, const vector< string > &) |
void | add_comment (PlyFile *, const string &) |
void | add_obj_info (PlyFile *, const string &) |
void | copy_property (PlyProperty *, const PlyProperty *) |
void | store_item (char *, int, int, unsigned int, double) |
void | get_stored_item (void *, int, int *, unsigned int *, double *) |
double | get_item_value (const char *, int) |
void | get_ascii_item (const char *, int, int *, unsigned int *, double *) |
int | get_binary_item (FILE *, int, int, int *, unsigned int *, double *) |
void | ascii_get_element (PlyFile *, char *) |
void | binary_get_element (PlyFile *, char *) |
PlyFile * | ply_write (FILE *fp, const vector< string > &elem_names, int file_type) |
PlyFile * | ply_open_for_writing (const char *name, const vector< string > &elem_names, int file_type, float *version) |
void | ply_describe_element (PlyFile *plyfile, const string &elem_name, int nelems, vector< PlyProperty > &prop_list) |
void | ply_describe_property (PlyFile *plyfile, const char *elem_name, const PlyProperty *prop) |
void | ply_element_count (PlyFile *plyfile, const string &elem_name, int nelems) |
void | ply_header_complete (PlyFile *plyfile) |
void | ply_put_element_setup (PlyFile *plyfile, const string &elem_name) |
void | ply_put_element (PlyFile *plyfile, void *elem_ptr) |
void | ply_put_comment (PlyFile *plyfile, const string &comment) |
void | ply_put_obj_info (PlyFile *plyfile, const string &obj_info) |
PlyFile * | ply_read (FILE *fp, vector< string > &elem_names) |
PlyFile * | ply_open_for_reading (const char *filename, vector< string > &elem_names, int *file_type, float *version) |
vector< PlyProperty > | ply_get_element_description (PlyFile *plyfile, const string &elem_name, int &nelems, int &nprops) |
void | ply_get_property (PlyFile *plyfile, const string &elem_name, const PlyProperty *prop) |
void | ply_get_element (PlyFile *plyfile, void *elem_ptr) |
void | ply_get_comments (PlyFile *plyfile, vector< string > &comments) |
void | ply_get_obj_info (PlyFile *plyfile, vector< string > &obj_info) |
void | ply_close (PlyFile *plyfile) |
void | ply_get_info (PlyFile *ply, float *version, int *file_type) |
double | get_item_value (char *item, int type) |
int | get_prop_type (const string &type_name) |
Variables | |
const int | NO_OTHER_PROPS = -1 |
const char | DONT_STORE_PROP = 0 |
const char | STORE_PROP = 1 |
const char | OTHER_PROP = 0 |
const char | NAMED_PROP = 1 |
const std::string | type_names [] |
const int | ply_type_size [] = {0, 1, 2, 4, 1, 2, 4, 4, 8} |
const float | VAL_NOT_SET = -1e10 |
const PlyProperty | vert_props [] |
const PlyProperty | face_props [] |
#define BIG_STRING 4096 |
Referenced by get_words().
#define PLY_ASCII 1 /* ascii PLY file */ |
Definition at line 62 of file PLY_import_export.cpp.
Referenced by ply_get_element(), ply_header_complete(), ply_put_element(), ply_read(), and mrpt::opengl::PLY_Exporter::saveToPlyFile().
#define PLY_BINARY_BE 2 /* binary PLY file, big endian */ |
Definition at line 63 of file PLY_import_export.cpp.
Referenced by get_binary_item(), ply_header_complete(), ply_read(), and mrpt::opengl::PLY_Exporter::saveToPlyFile().
#define PLY_BINARY_LE 3 /* binary PLY file, little endian */ |
Definition at line 64 of file PLY_import_export.cpp.
Referenced by get_binary_item(), ply_header_complete(), ply_read(), and mrpt::opengl::PLY_Exporter::saveToPlyFile().
typedef struct PlyElement PlyElement |
typedef struct PlyProperty PlyProperty |
anonymous enum |
Enumerator | |
---|---|
PLY_START_TYPE | |
PLY_CHAR | |
PLY_SHORT | |
PLY_INT | |
PLY_UCHAR | |
PLY_USHORT | |
PLY_UINT | |
PLY_FLOAT | |
PLY_DOUBLE | |
PLY_END_TYPE |
Definition at line 71 of file PLY_import_export.cpp.
void add_comment | ( | PlyFile * | plyfile, |
const string & | line | ||
) |
Definition at line 1783 of file PLY_import_export.cpp.
References ply_put_comment(), and mrpt::system::trim().
Referenced by ply_read().
void add_element | ( | PlyFile * | plyfile, |
const vector< string > & | words | ||
) |
Definition at line 1709 of file PLY_import_export.cpp.
References PlyFile::elems, PlyElement::name, and PlyElement::num.
Referenced by ply_read().
void add_obj_info | ( | PlyFile * | plyfile, |
const string & | line | ||
) |
Definition at line 1797 of file PLY_import_export.cpp.
References ply_put_obj_info(), and mrpt::system::trim().
Referenced by ply_read().
void add_property | ( | PlyFile * | plyfile, |
const vector< string > & | words | ||
) |
Definition at line 1749 of file PLY_import_export.cpp.
References PlyProperty::count_external, PlyFile::elems, PlyProperty::external_type, get_prop_type(), PlyProperty::is_list, PlyProperty::name, and PlyElement::props.
Referenced by ply_read().
void ascii_get_element | ( | PlyFile * | plyfile, |
char * | elem_ptr | ||
) |
Definition at line 935 of file PLY_import_export.cpp.
References PlyProperty::count_external, PlyProperty::count_internal, PlyProperty::count_offset, PlyProperty::external_type, PlyFile::fp, get_ascii_item(), get_words(), PlyProperty::internal_type, PlyProperty::is_list, NO_OTHER_PROPS, PlyProperty::offset, PlyElement::other_offset, PlyElement::other_size, ply_type_size, PlyElement::props, store_item(), PlyElement::store_prop, and PlyFile::which_elem.
Referenced by ply_get_element().
void binary_get_element | ( | PlyFile * | plyfile, |
char * | elem_ptr | ||
) |
Definition at line 1062 of file PLY_import_export.cpp.
References PlyProperty::count_external, PlyProperty::count_internal, PlyProperty::count_offset, PlyProperty::external_type, PlyFile::file_type, PlyFile::fp, mrpt::system::os::fprintf(), get_binary_item(), PlyProperty::internal_type, PlyProperty::is_list, NO_OTHER_PROPS, PlyProperty::offset, PlyElement::other_offset, PlyElement::other_size, ply_type_size, PlyElement::props, store_item(), PlyElement::store_prop, and PlyFile::which_elem.
Referenced by ply_get_element().
void copy_property | ( | PlyProperty * | dest, |
const PlyProperty * | src | ||
) |
Definition at line 1807 of file PLY_import_export.cpp.
PlyElement * find_element | ( | PlyFile * | plyfile, |
const std::string & | s | ||
) |
Definition at line 894 of file PLY_import_export.cpp.
References PlyFile::elems.
Referenced by ply_describe_element(), ply_describe_property(), ply_element_count(), ply_get_element_description(), ply_get_property(), and ply_put_element_setup().
PlyProperty * find_property | ( | PlyElement * | elem, |
const std::string & | s, | ||
int * | index | ||
) |
Definition at line 914 of file PLY_import_export.cpp.
References PlyElement::props.
Referenced by ply_get_property().
void get_ascii_item | ( | const char * | word, |
int | type, | ||
int * | int_val, | ||
unsigned int * | uint_val, | ||
double * | double_val | ||
) |
Definition at line 1602 of file PLY_import_export.cpp.
References mrpt::format(), PLY_CHAR, PLY_DOUBLE, PLY_FLOAT, PLY_INT, PLY_SHORT, PLY_UCHAR, PLY_UINT, and PLY_USHORT.
Referenced by ascii_get_element().
int get_binary_item | ( | FILE * | fp, |
int | bin_file_type, | ||
int | type, | ||
int * | int_val, | ||
unsigned int * | uint_val, | ||
double * | double_val | ||
) |
Definition at line 1502 of file PLY_import_export.cpp.
References mrpt::format(), PLY_BINARY_BE, PLY_BINARY_LE, PLY_CHAR, PLY_DOUBLE, PLY_FLOAT, PLY_INT, PLY_SHORT, PLY_UCHAR, PLY_UINT, PLY_USHORT, and mrpt::reverseBytes().
Referenced by binary_get_element().
double get_item_value | ( | const char * | , |
int | |||
) |
double get_item_value | ( | char * | item, |
int | type | ||
) |
Definition at line 1273 of file PLY_import_export.cpp.
References mrpt::format(), PLY_CHAR, PLY_DOUBLE, PLY_FLOAT, PLY_INT, PLY_SHORT, PLY_UCHAR, PLY_UINT, and PLY_USHORT.
int get_prop_type | ( | const string & | type_name | ) |
Definition at line 1729 of file PLY_import_export.cpp.
References PLY_END_TYPE, PLY_START_TYPE, and type_names.
Referenced by add_property().
void get_stored_item | ( | void * | ptr, |
int | type, | ||
int * | int_val, | ||
unsigned int * | uint_val, | ||
double * | double_val | ||
) |
Definition at line 1434 of file PLY_import_export.cpp.
References mrpt::format(), PLY_CHAR, PLY_DOUBLE, PLY_FLOAT, PLY_INT, PLY_SHORT, PLY_UCHAR, PLY_UINT, and PLY_USHORT.
Referenced by ply_put_element().
vector< string > get_words | ( | FILE * | fp, |
string & | orig_line | ||
) |
Definition at line 1239 of file PLY_import_export.cpp.
References ASSERT_, BIG_STRING, and mrpt::system::tokenize().
Referenced by ascii_get_element(), and ply_read().
void ply_close | ( | PlyFile * | plyfile | ) |
Definition at line 856 of file PLY_import_export.cpp.
References mrpt::system::os::fclose(), and PlyFile::fp.
Referenced by mrpt::opengl::PLY_Importer::loadFromPlyFile(), and mrpt::opengl::PLY_Exporter::saveToPlyFile().
void ply_describe_element | ( | PlyFile * | plyfile, |
const string & | elem_name, | ||
int | nelems, | ||
vector< PlyProperty > & | prop_list | ||
) |
Definition at line 280 of file PLY_import_export.cpp.
References find_element(), mrpt::format(), NAMED_PROP, PlyElement::num, PlyElement::props, and PlyElement::store_prop.
void ply_describe_property | ( | PlyFile * | plyfile, |
const char * | elem_name, | ||
const PlyProperty * | prop | ||
) |
Definition at line 315 of file PLY_import_export.cpp.
References find_element(), mrpt::system::os::fprintf(), NAMED_PROP, PlyElement::props, and PlyElement::store_prop.
Referenced by mrpt::opengl::PLY_Exporter::saveToPlyFile().
void ply_element_count | ( | PlyFile * | plyfile, |
const string & | elem_name, | ||
int | nelems | ||
) |
Definition at line 342 of file PLY_import_export.cpp.
References find_element(), mrpt::format(), and PlyElement::num.
Referenced by mrpt::opengl::PLY_Exporter::saveToPlyFile().
void ply_get_comments | ( | PlyFile * | plyfile, |
vector< string > & | comments | ||
) |
Definition at line 823 of file PLY_import_export.cpp.
References PlyFile::comments.
Referenced by mrpt::opengl::PLY_Importer::loadFromPlyFile().
void ply_get_element | ( | PlyFile * | plyfile, |
void * | elem_ptr | ||
) |
Definition at line 804 of file PLY_import_export.cpp.
References ascii_get_element(), binary_get_element(), PlyFile::file_type, and PLY_ASCII.
Referenced by mrpt::opengl::PLY_Importer::loadFromPlyFile().
vector<PlyProperty> ply_get_element_description | ( | PlyFile * | plyfile, |
const string & | elem_name, | ||
int & | nelems, | ||
int & | nprops | ||
) |
Definition at line 738 of file PLY_import_export.cpp.
References find_element(), PlyElement::num, and PlyElement::props.
Referenced by mrpt::opengl::PLY_Importer::loadFromPlyFile().
void ply_get_info | ( | PlyFile * | ply, |
float * | version, | ||
int * | file_type | ||
) |
Definition at line 875 of file PLY_import_export.cpp.
References PlyFile::file_type, and PlyFile::version.
void ply_get_obj_info | ( | PlyFile * | plyfile, |
vector< string > & | obj_info | ||
) |
Definition at line 840 of file PLY_import_export.cpp.
References PlyFile::obj_info.
Referenced by mrpt::opengl::PLY_Importer::loadFromPlyFile().
void ply_get_property | ( | PlyFile * | plyfile, |
const string & | elem_name, | ||
const PlyProperty * | prop | ||
) |
Definition at line 764 of file PLY_import_export.cpp.
References PlyProperty::count_internal, PlyProperty::count_offset, find_element(), find_property(), mrpt::system::os::fprintf(), PlyProperty::internal_type, PlyProperty::name, PlyProperty::offset, STORE_PROP, PlyElement::store_prop, and PlyFile::which_elem.
Referenced by mrpt::opengl::PLY_Importer::loadFromPlyFile().
void ply_header_complete | ( | PlyFile * | plyfile | ) |
Definition at line 365 of file PLY_import_export.cpp.
References PlyFile::comments, PlyProperty::count_external, PlyFile::elems, PlyProperty::external_type, PlyFile::file_type, mrpt::format(), PlyFile::fp, mrpt::system::os::fprintf(), PlyProperty::is_list, PlyProperty::name, PlyElement::name, PlyElement::num, PlyFile::obj_info, PLY_ASCII, PLY_BINARY_BE, PLY_BINARY_LE, PlyElement::props, and write_scalar_type().
Referenced by mrpt::opengl::PLY_Exporter::saveToPlyFile().
PlyFile* ply_open_for_reading | ( | const char * | filename, |
vector< string > & | elem_names, | ||
int * | file_type, | ||
float * | version | ||
) |
Definition at line 697 of file PLY_import_export.cpp.
References PlyFile::file_type, mrpt::system::os::fopen(), ply_read(), and PlyFile::version.
Referenced by mrpt::opengl::PLY_Importer::loadFromPlyFile().
PlyFile* ply_open_for_writing | ( | const char * | name, |
const vector< string > & | elem_names, | ||
int | file_type, | ||
float * | version | ||
) |
Definition at line 241 of file PLY_import_export.cpp.
References mrpt::system::os::fopen(), ply_write(), and PlyFile::version.
Referenced by mrpt::opengl::PLY_Exporter::saveToPlyFile().
void ply_put_comment | ( | PlyFile * | plyfile, |
const string & | comment | ||
) |
Definition at line 579 of file PLY_import_export.cpp.
References PlyFile::comments.
Referenced by add_comment(), and mrpt::opengl::PLY_Exporter::saveToPlyFile().
void ply_put_element | ( | PlyFile * | plyfile, |
void * | elem_ptr | ||
) |
Definition at line 458 of file PLY_import_export.cpp.
References PlyProperty::count_external, PlyProperty::count_internal, PlyProperty::count_offset, PlyProperty::external_type, PlyFile::file_type, PlyFile::fp, mrpt::system::os::fprintf(), get_stored_item(), PlyProperty::internal_type, PlyProperty::is_list, PlyProperty::offset, PlyElement::other_offset, OTHER_PROP, PLY_ASCII, ply_type_size, PlyElement::props, PlyElement::store_prop, PlyFile::which_elem, write_ascii_item(), and write_binary_item().
Referenced by mrpt::opengl::PLY_Exporter::saveToPlyFile().
void ply_put_element_setup | ( | PlyFile * | plyfile, |
const string & | elem_name | ||
) |
Definition at line 436 of file PLY_import_export.cpp.
References find_element(), mrpt::format(), and PlyFile::which_elem.
Referenced by mrpt::opengl::PLY_Exporter::saveToPlyFile().
void ply_put_obj_info | ( | PlyFile * | plyfile, |
const string & | obj_info | ||
) |
Definition at line 593 of file PLY_import_export.cpp.
References PlyFile::obj_info.
Referenced by add_obj_info(), and mrpt::opengl::PLY_Exporter::saveToPlyFile().
PlyFile* ply_read | ( | FILE * | fp, |
vector< string > & | elem_names | ||
) |
Definition at line 615 of file PLY_import_export.cpp.
References add_comment(), add_element(), add_obj_info(), add_property(), mrpt::d2f(), DONT_STORE_PROP, get_words(), NO_OTHER_PROPS, PlyElement::other_offset, PLY_ASCII, PLY_BINARY_BE, PLY_BINARY_LE, PlyElement::props, and PlyElement::store_prop.
Referenced by ply_open_for_reading().
PlyFile* ply_write | ( | FILE * | fp, |
const vector< string > & | elem_names, | ||
int | file_type | ||
) |
Definition at line 203 of file PLY_import_export.cpp.
Referenced by ply_open_for_writing().
void store_item | ( | char * | item, |
int | type, | ||
int | int_val, | ||
unsigned int | uint_val, | ||
double | double_val | ||
) |
Definition at line 1651 of file PLY_import_export.cpp.
References mrpt::d2f(), mrpt::format(), PLY_CHAR, PLY_DOUBLE, PLY_FLOAT, PLY_INT, PLY_SHORT, PLY_UCHAR, PLY_UINT, and PLY_USHORT.
Referenced by ascii_get_element(), and binary_get_element().
void write_ascii_item | ( | FILE * | fp, |
int | int_val, | ||
unsigned int | uint_val, | ||
double | double_val, | ||
int | type | ||
) |
Definition at line 1395 of file PLY_import_export.cpp.
References mrpt::format(), mrpt::system::os::fprintf(), PLY_CHAR, PLY_DOUBLE, PLY_FLOAT, PLY_INT, PLY_SHORT, PLY_UCHAR, PLY_UINT, and PLY_USHORT.
Referenced by ply_put_element().
void write_binary_item | ( | FILE * | fp, |
int | int_val, | ||
unsigned int | uint_val, | ||
double | double_val, | ||
int | type | ||
) |
Definition at line 1338 of file PLY_import_export.cpp.
References mrpt::d2f(), mrpt::format(), PLY_CHAR, PLY_DOUBLE, PLY_FLOAT, PLY_INT, PLY_SHORT, PLY_UCHAR, PLY_UINT, and PLY_USHORT.
Referenced by ply_put_element().
void write_scalar_type | ( | FILE * | fp, |
int | code | ||
) |
Definition at line 1211 of file PLY_import_export.cpp.
References mrpt::format(), mrpt::system::os::fprintf(), PLY_END_TYPE, and type_names.
Referenced by ply_header_complete().
const char DONT_STORE_PROP = 0 |
Definition at line 90 of file PLY_import_export.cpp.
Referenced by ply_read().
const PlyProperty face_props[] |
Definition at line 1834 of file PLY_import_export.cpp.
Referenced by mrpt::opengl::PLY_Exporter::saveToPlyFile().
const char NAMED_PROP = 1 |
Definition at line 94 of file PLY_import_export.cpp.
Referenced by ply_describe_element(), and ply_describe_property().
const int NO_OTHER_PROPS = -1 |
Definition at line 88 of file PLY_import_export.cpp.
Referenced by ascii_get_element(), binary_get_element(), and ply_read().
const char OTHER_PROP = 0 |
Definition at line 93 of file PLY_import_export.cpp.
Referenced by ply_put_element().
const int ply_type_size[] = {0, 1, 2, 4, 1, 2, 4, 4, 8} |
Definition at line 140 of file PLY_import_export.cpp.
Referenced by ascii_get_element(), binary_get_element(), and ply_put_element().
const char STORE_PROP = 1 |
Definition at line 91 of file PLY_import_export.cpp.
Referenced by ply_get_property().
const std::string type_names[] |
Definition at line 135 of file PLY_import_export.cpp.
Referenced by get_prop_type(), and write_scalar_type().
const float VAL_NOT_SET = -1e10 |
Definition at line 1808 of file PLY_import_export.cpp.
Referenced by mrpt::opengl::PLY_Importer::loadFromPlyFile().
const PlyProperty vert_props[] |
Definition at line 1817 of file PLY_import_export.cpp.
Referenced by mrpt::opengl::PLY_Importer::loadFromPlyFile(), and mrpt::opengl::PLY_Exporter::saveToPlyFile().
Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020 |