]> git.tdb.fi Git - libs/gl.git/blob - source/geometrybuilder.cpp
Add classes for building some geometric shapes
[libs/gl.git] / source / geometrybuilder.cpp
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 #include "geometrybuilder.h"
9 #include "meshbuilder.h"
10
11 namespace Msp {
12 namespace GL {
13
14 GeometryBuilder::GeometryBuilder():
15         tangent_attr(-1),
16         binormal_attr(-1),
17         tex_fit(STRETCH)
18 { }
19
20 GeometryBuilder &GeometryBuilder::tangent(unsigned t)
21 {
22         tangent_attr = t;
23         return *this;
24 }
25
26 GeometryBuilder &GeometryBuilder::binormal(unsigned b)
27 {
28         binormal_attr = b;
29         return *this;
30 }
31
32 GeometryBuilder &GeometryBuilder::texture_fit(TextureFit tf)
33 {
34         tex_fit = tf;
35         return *this;
36 }
37
38 void GeometryBuilder::build(Mesh &mesh) const
39 {
40         MeshBuilder builder(mesh);
41         build(builder);
42 }
43
44 } // namespace GL
45 } // namespace Msp