vertexData.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef MESH_VERTEXDATA_H
00024 #define MESH_VERTEXDATA_H
00025
00026
00027 #include "typedefs.h"
00028 #include <vector>
00029
00030
00031
00032 class PlyFile;
00033
00034 namespace mesh
00035 {
00036
00037 class VertexData
00038 {
00039 public:
00040 VertexData();
00041
00042 bool readPlyFile( const std::string& file );
00043 void sort( const Index start, const Index length, const Axis axis );
00044 void scale( const float baseSize = 2.0f );
00045 void calculateNormals( const bool vertexNormals = true );
00046 void calculateBoundingBox();
00047 const BoundingBox& getBoundingBox() const { return _boundingBox; }
00048 Axis getLongestAxis( const size_t start, const size_t elements ) const;
00049
00050 void useInvertedFaces() { _invertFaces = true; }
00051
00052 std::vector< Vertex > vertices;
00053 std::vector< Color > colors;
00054 std::vector< Normal > normals;
00055 std::vector< Triangle > triangles;
00056
00057 private:
00058 void readVertices( PlyFile* file, const int nVertices,
00059 const bool readColors );
00060 void readTriangles( PlyFile* file, const int nFaces );
00061
00062 BoundingBox _boundingBox;
00063 bool _invertFaces;
00064 };
00065 }
00066
00067
00068 #endif // MESH_VERTEXDATA_H