23 #ifndef __PLYIMPORTER__ 24 #define __PLYIMPORTER__ 32 namespace MeshImporter
34 #if _WIN32 //define something for Windows (32-bit and 64-bit, this part is common) 35 #pragma warning(disable:4996) 38 static bool loadPlyFile (Mesh* mesh,
string filename) __attribute__ ((unused));
45 static Eigen::Vector3f v;
52 vector<Eigen::Vector3f>* vec =
static_cast< vector<Eigen::Vector3f>*
>( data );
72 static Eigen::Vector4f c;
93 (
static_cast< vector<Eigen::Vector4f>*
>( data ))->push_back( c );
102 static Eigen::Vector4f v;
118 (
static_cast< vector<Eigen::Vector4f>*
>( data ))->push_back( v );
136 if (value_index >= 0 && value_index < 3)
155 std::cerr <<
"Cannot open " << filename.c_str() << std::endl;
160 std::cout <<
"Opening Stanford ply file " << filename.c_str() << std::endl << std::endl;
164 vector<Eigen::Vector4f> vertices;
165 vector<Eigen::Vector3f> norm;
166 vector<Eigen::Vector2f> texCoord;
167 vector<Eigen::Vector4f> color;
168 std::vector<unsigned int> indices;
198 if (vertices.size() > 0)
202 if (texCoord.size() > 0)
204 if (color.size() > 0)
206 if (indices.size() > 0)
int ply_get_argument_user_data(p_ply_argument argument, void **pdata, long *idata)
Definition: rply.hpp:1410
void loadNormals(vector< Eigen::Vector3f > &norm)
Load normals (x,y,z) as a vertex attribute.
Definition: mesh.hpp:384
void loadColors(vector< Eigen::Vector4f > &clrs)
Load colors (r,g,b,a) as a vertex attribute.
Definition: mesh.hpp:438
Definition: bufferobject.hpp:34
static int face_cb(p_ply_argument argument)
Definition: plyimporter.hpp:126
static int color_cb(p_ply_argument argument)
Definition: plyimporter.hpp:70
int ply_read(p_ply ply)
Definition: rply.hpp:1067
void errorCheckFunc(std::string file, int line, std::string message="")
GL error check method.
Definition: misc.hpp:53
double ply_get_argument_value(p_ply_argument argument)
Definition: rply.hpp:1419
void loadIndices(vector< GLuint > &ind)
Load indices into indices array.
Definition: mesh.hpp:448
static int vertex_cb(p_ply_argument argument)
Definition: plyimporter.hpp:100
int ply_close(p_ply ply)
Definition: rply.hpp:1306
p_ply ply_open(const char *name, p_ply_error_cb error_cb, long idata, void *pdata)
Definition: rply.hpp:993
int ply_get_argument_property(p_ply_argument argument, p_ply_property *property, long *length, long *value_index)
Definition: rply.hpp:1400
void setDefaultAttribLocations(void)
Sets default attribute locations. vertex coords -> location 0 normals -> location 1 colors -> locatio...
Definition: mesh.hpp:474
static bool loadPlyFile(Mesh *mesh, string filename) __attribute__((unused))
Loads a mesh from an PLY file.
Definition: plyimporter.hpp:150
int ply_read_header(p_ply ply)
Definition: rply.hpp:1022
long ply_set_read_cb(p_ply ply, const char *element_name, const char *property_name, p_ply_read_cb read_cb, void *pdata, long idata)
Definition: rply.hpp:1051
void loadVertices(vector< Eigen::Vector4f > &vert)
Load vertices (x,y,z,w) and creates appropriate vertex attribute. The default attribute name is "in_P...
Definition: mesh.hpp:312
void loadTexCoords(vector< Eigen::Vector2f > &tex, bool normalize=false)
Load tex coords (u,v) as a vertex attribute. Optionally normalizes coords in range [0...
Definition: mesh.hpp:397
A common Mesh, usually containing triagles or points.
Definition: mesh.hpp:194
static int normal_cb(p_ply_argument argument)
Definition: plyimporter.hpp:43