Line data Source code
1 : // Copyright (c) 2021 Made to Order Software Corp. All Rights Reserved
2 : //
3 : // https://snapwebsites.org/project/ftmesh
4 : // contact@m2osw.com
5 : //
6 : // This program is free software; you can redistribute it and/or modify
7 : // it under the terms of the GNU General Public License as published by
8 : // the Free Software Foundation; either version 2 of the License, or
9 : // (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License along
17 : // with this program; if not, write to the Free Software Foundation, Inc.,
18 : // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 :
20 : /** \file
21 : * \brief The main class to load fonts and build meshes.
22 : *
23 : * This file implements the ftmesh class which handles the loading of
24 : * fonts and builds meshes for specified glyphs.
25 : */
26 :
27 : // self
28 : //
29 : #include "ftmesh/mesh.h"
30 :
31 :
32 : // OpenGL lib
33 : //
34 : #include <GL/gl.h>
35 :
36 :
37 : // last include
38 : //
39 : #include <snapdev/poison.h>
40 :
41 :
42 :
43 : // we assume that GLdouble is "double" and we want to make sure of that
44 : // (if not, we would need to offer an fttype.h file with such types)
45 : //
46 : static_assert(std::is_same<double, GLdouble>::value, "The library expects GLdouble to be a double");
47 :
48 :
49 :
50 : namespace ftmesh
51 : {
52 :
53 :
54 :
55 9 : mesh::mesh(float advance)
56 9 : : f_advance(advance)
57 : {
58 9 : }
59 :
60 :
61 8 : void mesh::begin()
62 : {
63 8 : f_indexes.push_back(f_points.size());
64 : //f_types.push_back(type);
65 8 : }
66 :
67 :
68 1032 : void mesh::add_point(point const & point)
69 : {
70 1032 : f_points.push_back(point);
71 1032 : }
72 :
73 :
74 8 : void mesh::end()
75 : {
76 8 : }
77 :
78 :
79 9 : point::vector_t const & mesh::get_points() const
80 : {
81 9 : return f_points;
82 : }
83 :
84 :
85 9 : mesh::index_vector_t const & mesh::get_indexes() const
86 : {
87 9 : return f_indexes;
88 : }
89 :
90 :
91 : //mesh::type_vector_t const & mesh::get_types() const
92 : //{
93 : // return f_types;
94 : //}
95 :
96 :
97 9 : float mesh::get_advance() const
98 : {
99 9 : return f_advance;
100 : }
101 :
102 :
103 : } // namespace ftmesh
104 : // vim: ts=4 sw=4 et
|