30 #ifndef MESH_VERTEXBUFFERDATA_H
31 #define MESH_VERTEXBUFFERDATA_H
42 class VertexBufferData
54 void toStream( std::ostream& os )
56 writeVector( os, vertices );
57 writeVector( os, colors );
58 writeVector( os, normals );
59 writeVector( os, indices );
63 void fromMemory(
char** addr )
66 readVector( addr, vertices );
67 readVector( addr, colors );
68 readVector( addr, normals );
69 readVector( addr, indices );
72 std::vector< Vertex > vertices;
73 std::vector< Color > colors;
74 std::vector< Normal > normals;
75 std::vector< ShortIndex > indices;
80 void writeVector( std::ostream& os, std::vector< T >& v )
82 size_t length = v.size();
83 os.write( reinterpret_cast< char* >( &length ),
86 os.write( reinterpret_cast< char* >( &v[0] ),
87 length *
sizeof( T ) );
92 void readVector(
char** addr, std::vector< T >& v )
95 memRead( reinterpret_cast< char* >( &length ), addr,
100 memRead( reinterpret_cast< char* >( &v[0] ), addr,
101 length *
sizeof( T ) );
110 #endif // MESH_VERTEXBUFFERDATA_H