]> git.tdb.fi Git - libs/gl.git/blob - source/geometrybuilder.h
e1c877dfbc5fd06f76abbc4103362bf3fb079ca6
[libs/gl.git] / source / geometrybuilder.h
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2011  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GL_GEOMETRYBUILDER_H_
9 #define MSP_GL_GEOMETRYBUILDER_H_
10
11 namespace Msp {
12 namespace GL {
13
14 class Mesh;
15 class PrimitiveBuilder;
16
17 class GeometryBuilder
18 {
19 public:
20         enum TextureFit
21         {
22                 STRETCH,
23                 CROP,
24                 WRAP
25         };
26
27 protected:
28         int tangent_attr;
29         int binormal_attr;
30         TextureFit tex_fit;
31
32         GeometryBuilder();
33
34 public:
35         GeometryBuilder &tangent(unsigned);
36         GeometryBuilder &binormal(unsigned);
37         GeometryBuilder &texture_fit(TextureFit);
38 protected:
39         void adjust_texture_scale(float &, float &, float, float) const;
40
41 public:
42         virtual void build(PrimitiveBuilder &) const = 0;
43         void build(Mesh &) const;
44 };
45
46 } // namespace GL
47 } // namespace Msp
48
49 #endif