]> git.tdb.fi Git - libs/gl.git/blob - source/mesh.h
Allow retrieving data from Mesh
[libs/gl.git] / source / mesh.h
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GL_MESH_H_
9 #define MSP_GL_MESH_H_
10
11 #include <msp/datafile/loader.h>
12 #include "batch.h"
13 #include "vertexarray.h"
14
15 namespace Msp {
16 namespace GL {
17
18 class Mesh
19 {
20 public:
21         class Loader: public DataFile::Loader
22         {
23         public:
24                 Loader(Mesh &);
25         private:
26                 Mesh &mesh;
27
28                 void vertices(VertexFormat);
29                 void batch(PrimitiveType);
30         };
31
32         Mesh();
33         Mesh(VertexFormat f);
34         RefPtr<VertexArrayBuilder> modify_vertices() { return vertices.modify(); }
35         void add_batch(const Batch &b);
36         const VertexArray &get_vertices() const { return vertices; }
37         const std::list<Batch> &get_batches() { return batches; }
38         void draw() const;
39 private:
40         VertexArray vertices;
41         std::list<Batch> batches;
42 };
43
44 } // namespace GL
45 } // namespace Msp
46
47 #endif