]> git.tdb.fi Git - libs/gl.git/blob - source/mesh.h
Add class MeshBuilder
[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 "meshbuilder.h"
14 #include "vertexarray.h"
15
16 namespace Msp {
17 namespace GL {
18
19 class Mesh
20 {
21         friend class MeshBuilder;
22
23 public:
24         class Loader: public DataFile::Loader
25         {
26         public:
27                 Loader(Mesh &);
28         private:
29                 Mesh &mesh;
30
31                 void vertices(VertexFormat);
32                 void batch(PrimitiveType);
33         };
34
35 private:
36         VertexArray vertices;
37         std::list<Batch> batches;
38
39 public:
40         Mesh();
41         Mesh(VertexFormat f);
42         RefPtr<MeshBuilder> modify();
43         const VertexArray &get_vertices() const { return vertices; }
44         void add_batch(const Batch &b);
45         const std::list<Batch> &get_batches() { return batches; }
46         void draw() const;
47 };
48
49 } // namespace GL
50 } // namespace Msp
51
52 #endif