vertexBufferRoot.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef MESH_VERTEXBUFFERROOT_H
00021 #define MESH_VERTEXBUFFERROOT_H
00022
00023
00024 #include "vertexBufferNode.h"
00025 #include "vertexBufferData.h"
00026
00027
00028 namespace mesh
00029 {
00030
00031
00032
00033 class VertexBufferRoot : public VertexBufferNode
00034 {
00035 public:
00036 VertexBufferRoot() : VertexBufferNode(), _invertFaces(false) {}
00037
00038 virtual void render( VertexBufferState& state ) const;
00039
00040 void beginRendering( VertexBufferState& state ) const;
00041 void endRendering( VertexBufferState& state ) const;
00042
00043 void setupTree( VertexData& data );
00044 bool writeToFile( const std::string& filename );
00045 bool readFromFile( const std::string& filename );
00046 bool hasColors() const { return _data.colors.size() > 0; }
00047
00048 void useInvertedFaces() { _invertFaces = true; }
00049
00050 const std::string& getName() const { return _name; }
00051
00052 protected:
00053 virtual void toStream( std::ostream& os );
00054 virtual void fromMemory( char* start );
00055
00056 private:
00057 bool _constructFromPly( const std::string& filename );
00058 bool _readBinary( const std::string& filename );
00059
00060 VertexBufferData _data;
00061 bool _invertFaces;
00062 std::string _name;
00063
00064 friend class eqPly::VertexBufferDist;
00065 };
00066
00067
00068 }
00069
00070
00071 #endif // MESH_VERTEXBUFFERROOT_H