src/types.h

Tue, 30 Jul 2013 07:38:08 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 30 Jul 2013 07:38:08 +0300
changeset 402
ec95fc95e5f3
parent 381
241f65769a57
child 403
43c1f5b17bfd
permissions
-rw-r--r--

Renamed vector to List, changed it to wrap around std::deque.

183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #ifndef TYPES_H
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #define TYPES_H
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
22 #include <QString>
290
be0c367e7420 Added primitive scanning, replaced parts list in subfile add dialog with it
Santeri Piippo <crimsondusk64@gmail.com>
parents: 288
diff changeset
23 #include <QObject>
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
24 #include <deque>
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 #include "common.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
27 class LDObject;
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
28
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
29 typedef QChar qchar;
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
30 typedef QString str;
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
31 template<class T> class ConstListReverser;
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
32 template<class T> using c_rev = ConstListReverser<T>;
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
33 class strconfig;
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
34 class intconfig;
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
35 class floatconfig;
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
36 class QFile;
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
37 class QTextStream;
271
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
38
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 typedef unsigned int uint;
188
4e686b771996 Further removal of hungarian notation
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
40 typedef unsigned short ushort;
4e686b771996 Further removal of hungarian notation
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
41 typedef unsigned long ulong;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 // Typedef out the _t suffices :)
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 typedef int8_t int8;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 typedef int16_t int16;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 typedef int32_t int32;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 typedef int64_t int64;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 typedef uint8_t uint8;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 typedef uint16_t uint16;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 typedef uint32_t uint32;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 typedef uint64_t uint64;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 template<class T> using initlist = std::initializer_list<T>;
293
a0ed563e14b2 Added support for regex-based primitive categorization
Santeri Piippo <crimsondusk64@gmail.com>
parents: 290
diff changeset
54 template<class T, class R> using pair = std::pair<T, R>;
272
2074672a6554 Cleansed the string class, moved implementations from header to code file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 271
diff changeset
55 using std::size_t;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 enum Axis { X, Y, Z };
274
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 273
diff changeset
58 static const Axis g_Axes[3] = { X, Y, Z };
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 // matrix
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
64 //
274
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 273
diff changeset
65 // A mathematical 3 x 3 matrix
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66 // =============================================================================
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
67 class matrix {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68 public:
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69 matrix () {}
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
70 matrix (initlist<double> vals);
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
71 matrix (double fillval);
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
72 matrix (double vals[]);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
74 double determinant () const;
268
778eed342ee4 Make LDMatrixObject's transform and pos members properties
Santeri Piippo <crimsondusk64@gmail.com>
parents: 261
diff changeset
75 matrix mult (matrix other) const;
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
76 void puts () const;
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
77 str stringRep () const;
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
78 void zero ();
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
79 double& val (const uint idx) { return m_vals[idx]; }
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
80 const double& val (const uint idx) const { return m_vals[idx]; }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
82 matrix& operator= (matrix other);
268
778eed342ee4 Make LDMatrixObject's transform and pos members properties
Santeri Piippo <crimsondusk64@gmail.com>
parents: 261
diff changeset
83 matrix operator* (matrix other) const { return mult (other); }
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
84 double& operator[] (const uint idx) { return m_vals[idx]; }
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
85 const double& operator[] (const uint idx) const { return m_vals[idx]; }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87 private:
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
88 double m_vals[9];
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
94 // vertex
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
95 //
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96 // Vertex class, contains a single point in 3D space. Not to be confused with
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97 // LDVertex, which is a vertex used in an LDraw part file.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
98 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99 class vertex {
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
100 public:
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101 vertex () {}
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
102 vertex (double x, double y, double z);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
104 double& coord (const ushort n) { return m_coords[n]; }
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
105 const double& coord (const ushort n) const { return m_coords[n]; }
268
778eed342ee4 Make LDMatrixObject's transform and pos members properties
Santeri Piippo <crimsondusk64@gmail.com>
parents: 261
diff changeset
106 vertex midpoint (const vertex& other);
778eed342ee4 Make LDMatrixObject's transform and pos members properties
Santeri Piippo <crimsondusk64@gmail.com>
parents: 261
diff changeset
107 void move (const vertex& other);
778eed342ee4 Make LDMatrixObject's transform and pos members properties
Santeri Piippo <crimsondusk64@gmail.com>
parents: 261
diff changeset
108 str stringRep (bool mangled) const;
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
109 void transform (matrix matr, vertex pos);
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
110 double& x () { return m_coords[X]; }
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
111 const double& x () const { return m_coords[X]; }
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
112 double& y () { return m_coords[Y]; }
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
113 const double& y () const { return m_coords[Y]; }
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
114 double& z () { return m_coords[Z]; }
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
115 const double& z () const { return m_coords[Z]; }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
116
268
778eed342ee4 Make LDMatrixObject's transform and pos members properties
Santeri Piippo <crimsondusk64@gmail.com>
parents: 261
diff changeset
117 vertex& operator+= (const vertex& other);
270
f5f2353af0d9 fixed: subfiles and radials couldn't be moved, made add-picking with control work again despite its double-use as range picking, changed 'Name' to 'Title' in new part dialog and widened it a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 268
diff changeset
118 vertex operator+ (const vertex& other) const;
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
119 vertex operator/ (const double d) const;
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
120 vertex& operator/= (const double d);
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
121 bool operator== (const vertex& other) const;
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
122 bool operator!= (const vertex& other) const;
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
123 vertex operator- () const;
261
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
124 int operator< (const vertex& other) const;
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
125 double& operator[] (const Axis ax);
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
126 const double& operator[] (const Axis ax) const;
219
70eb948a2b02 Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 198
diff changeset
127 double& operator[] (const int ax);
70eb948a2b02 Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 198
diff changeset
128 const double& operator[] (const int ax) const;
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
129
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
130 private:
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
131 double m_coords[3];
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
132 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
133
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
134 // =============================================================================
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
136 // =============================================================================
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
137 // List
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
138 //
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
139 // Array class that wraps around std::deque
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
140 // =============================================================================
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
141 template<class T> class List {
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
142 public:
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
143 typedef typename std::deque<T>::iterator it;
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
144 typedef typename std::deque<T>::const_iterator c_it;
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
145 typedef typename std::deque<T>::reverse_iterator r_it;
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
146 typedef typename std::deque<T>::const_reverse_iterator cr_it;
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
147
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
148 List () {}
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
149 List (initlist<T> vals) {
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
150 m_vect = vals;
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
151 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
152
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
153 it begin () {
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
154 return m_vect.begin ();
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
155 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
156
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
157 c_it begin () const {
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
158 return m_vect.cbegin ();
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
159 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
160
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
161 it end () {
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
162 return m_vect.end ();
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
163 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
164
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
165 c_it end () const {
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
166 return m_vect.cend ();
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
167 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
168
271
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
169 r_it rbegin () {
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
170 return m_vect.rbegin ();
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
171 }
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
172
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
173 cr_it crbegin () const {
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
174 return m_vect.crbegin ();
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
175 }
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
176
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
177 r_it rend () {
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
178 return m_vect.rend ();
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
179 }
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
180
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
181 cr_it crend () const {
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
182 return m_vect.crend ();
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
183 }
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
184
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
185 void erase (ulong pos) {
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
186 assert (pos < size ());
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
187 m_vect.erase (m_vect.begin () + pos);
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
188 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
189
293
a0ed563e14b2 Added support for regex-based primitive categorization
Santeri Piippo <crimsondusk64@gmail.com>
parents: 290
diff changeset
190 T& push_back (const T& value) {
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
191 m_vect.push_back (value);
293
a0ed563e14b2 Added support for regex-based primitive categorization
Santeri Piippo <crimsondusk64@gmail.com>
parents: 290
diff changeset
192 return m_vect[m_vect.size () - 1];
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
193 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
194
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
195 void push_back (const List<T>& vals) {
261
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
196 for (const T& val : vals)
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
197 push_back (val);
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
198 }
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
199
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
200 bool pop (T& val) {
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
201 if (size () == 0)
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
202 return false;
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
203
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
204 val = m_vect[size () - 1];
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
205 erase (size () - 1);
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
206 return true;
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
207 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
208
293
a0ed563e14b2 Added support for regex-based primitive categorization
Santeri Piippo <crimsondusk64@gmail.com>
parents: 290
diff changeset
209 T& operator<< (const T& value) {
a0ed563e14b2 Added support for regex-based primitive categorization
Santeri Piippo <crimsondusk64@gmail.com>
parents: 290
diff changeset
210 return push_back (value);
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
211 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
212
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
213 void operator<< (const List<T>& vals) {
261
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
214 push_back (vals);
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
215 }
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
216
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
217 bool operator>> (T& value) {
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
218 return pop (value);
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
219 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
220
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
221 List<T> reverse () const {
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
222 List<T> rev;
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
223
271
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
224 for (const T& val : c_rev<T> (*this))
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
225 rev << val;
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
226
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
227 return rev;
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
228 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
229
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
230 void clear () {
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
231 m_vect.clear ();
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
232 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
233
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
234 void insert (ulong pos, const T& value) {
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
235 m_vect.insert (m_vect.begin () + pos, value);
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
236 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
237
261
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
238 void makeUnique () {
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
239 // Remove duplicate entries. For this to be effective, the List must be
261
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
240 // sorted first.
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
241 sort ();
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
242 it pos = std::unique (begin (), end ());
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
243 resize (std::distance (begin (), pos));
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
244 }
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
245
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
246 ulong size () const {
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
247 return m_vect.size ();
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
248 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
249
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
250 T& operator[] (ulong n) {
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
251 assert (n < size ());
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
252 return m_vect[n];
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
253 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
254
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
255 const T& operator[] (ulong n) const {
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
256 assert (n < size ());
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
257 return m_vect[n];
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
258 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
259
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
260 void resize (std::ptrdiff_t size) {
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
261 m_vect.resize (size);
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
262 }
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
263
261
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
264 void sort () {
c4ad4e3c6839 Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
265 std::sort (begin (), end ());
253
0737c217a54d Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
266 }
0737c217a54d Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
267
273
0a9141118630 Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
268 ulong find (const T& needle) {
0a9141118630 Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
269 ulong i = 0;
0a9141118630 Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
270 for (const T& hay : *this) {
0a9141118630 Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
271 if (hay == needle)
0a9141118630 Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
272 return i;
0a9141118630 Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
273
0a9141118630 Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
274 i++;
0a9141118630 Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
275 }
0a9141118630 Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
276
0a9141118630 Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
277 return -1u;
0a9141118630 Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
278 }
0a9141118630 Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 272
diff changeset
279
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
280 private:
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
281 std::deque<T> m_vect;
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
282 };
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 219
diff changeset
283
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
284 // =============================================================================
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
285 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
286 // =============================================================================
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
287 // ListReverser (aka rev)
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
288 //
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
289 // Helper class used to reverse-iterate Lists in range-for-loops.
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
290 // =============================================================================
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
291 template<class T> class ListReverser {
271
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
292 public:
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
293 typedef typename List<T>::r_it it;
271
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
294
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
295 ListReverser (List<T>& vect) {
271
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
296 m_vect = &vect;
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
297 }
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
298
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
299 it begin () {
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
300 return m_vect->rbegin ();
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
301 }
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
302
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
303 it end () {
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
304 return m_vect->rend ();
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
305 }
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
306
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
307 private:
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
308 List<T>* m_vect;
271
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
309 };
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
310
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
311 // =============================================================================
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
312 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
313 // =============================================================================
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
314 // ConstListReverser (aka c_rev)
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
315 //
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
316 // Like ListReverser, except works on const Lists.
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
317 // =============================================================================
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
318 template<class T> class ConstListReverser {
271
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
319 public:
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
320 typedef typename List<T>::cr_it it;
271
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
321
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
322 ConstListReverser (const List<T>& vect) {
271
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
323 m_vect = &vect;
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
324 }
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
325
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
326 it begin () const {
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
327 return m_vect->crbegin ();
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
328 }
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
329
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
330 it end () const {
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
331 return m_vect->crend ();
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
332 }
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
333
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
334 private:
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
335 const List<T>* m_vect;
271
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
336 };
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
337
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
338 template<class T> using rev = ListReverser<T>;
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
339 template<class T> using c_rev = ConstListReverser<T>;
271
d5ec224c1879 Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
340
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
341 // =============================================================================
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
342 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
343 // =============================================================================
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
344 // StringFormatArg
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
345 //
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
346 // Converts a given value into a string that can be retrieved with ::value ().
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
347 // Used as the argument type to the formatting functions, hence its name.
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
348 // =============================================================================
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
349 class StringFormatArg {
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
350 public:
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
351 StringFormatArg (const str& v);
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
352 StringFormatArg (const char& v);
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
353 StringFormatArg (const uchar& v);
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
354 StringFormatArg (const qchar& v);
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
355
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
356 #define NUMERIC_FORMAT_ARG(T,C) \
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
357 StringFormatArg (const T& v) { \
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
358 char valstr[32]; \
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
359 sprintf (valstr, "%" #C, v); \
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
360 m_val = valstr; \
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
361 }
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
362
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
363 NUMERIC_FORMAT_ARG (int, d)
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
364 NUMERIC_FORMAT_ARG (short, d)
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
365 NUMERIC_FORMAT_ARG (long, ld)
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
366 NUMERIC_FORMAT_ARG (uint, u)
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
367 NUMERIC_FORMAT_ARG (ushort, u)
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
368 NUMERIC_FORMAT_ARG (ulong, lu)
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
369
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
370 StringFormatArg (const float& v);
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
371 StringFormatArg (const double& v);
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
372 StringFormatArg (const vertex& v);
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
373 StringFormatArg (const matrix& v);
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
374 StringFormatArg (const char* v);
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
375 StringFormatArg (const strconfig& v);
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
376 StringFormatArg (const intconfig& v);
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
377 StringFormatArg (const floatconfig& v);
322
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 297
diff changeset
378 StringFormatArg (const void* v);
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
379
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
380 template<class T> StringFormatArg (const List<T>& v) {
297
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
381 m_val = "{ ";
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
382
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
383 uint i = 0;
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
384 for (const T& it : v) {
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
385 if (i++)
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
386 m_val += ", ";
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
387
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
388 StringFormatArg arg (it);
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
389 m_val += arg.value ();
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
390 }
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
391
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
392 if (i)
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
393 m_val += " ";
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
394
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
395 m_val += "}";
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
396 }
2cbd8ac8293b Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 293
diff changeset
397
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
398 str value () const { return m_val; }
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
399 private:
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
400 str m_val;
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
401 };
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
402
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
403 // =============================================================================
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
404 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
405 // =============================================================================
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
406 // File
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
407 //
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
408 // A file interface with simple interface and support for range-for-loops.
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
409 // =============================================================================
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
410 class File {
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
411 public:
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
412 // Iterator class to enable range-for-loop support. Rough hack.. don't use directly!
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
413 class iterator {
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
414 public:
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
415 iterator () : m_file (null) {} // end iterator has m_file == null
288
2980d7fd948e Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents: 287
diff changeset
416 iterator (File* f);
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
417 void operator++ ();
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
418 str operator* ();
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
419 bool operator== (iterator& other);
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
420 bool operator!= (iterator& other);
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
421
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
422 private:
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
423 File* m_file;
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
424 str m_text;
288
2980d7fd948e Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents: 287
diff changeset
425 bool m_gotdata = false;
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
426 };
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
427
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
428 enum OpenType {
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
429 Read,
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
430 Write,
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
431 Append
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
432 };
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
433
288
2980d7fd948e Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents: 287
diff changeset
434 File ();
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
435 File (str path, File::OpenType rtype);
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
436 File (FILE* fp, File::OpenType rtype);
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
437 ~File ();
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
438
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
439 bool atEnd () const;
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
440 iterator begin ();
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
441 void close ();
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
442 iterator& end ();
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
443 bool flush ();
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
444 bool isNull () const;
288
2980d7fd948e Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents: 287
diff changeset
445 bool readLine (str& line);
2980d7fd948e Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents: 287
diff changeset
446 void rewind ();
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
447 bool open (FILE* fp, OpenType rtype);
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
448 bool open (str path, OpenType rtype, FILE* fp = null);
288
2980d7fd948e Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents: 287
diff changeset
449 void write (str msg);
2980d7fd948e Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents: 287
diff changeset
450
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
451 bool operator! () const;
288
2980d7fd948e Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents: 287
diff changeset
452 operator bool () const;
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
453
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
454 private:
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
455 QFile* m_file;
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
456 QTextStream* m_textstream;
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
457 iterator m_endIterator;
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
458 };
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
459
380
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
460 // =============================================================================
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
461 // LDBoundingBox
380
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
462 //
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
463 // The bounding box is the box that encompasses a given set of objects.
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
464 // v0 is the minimum vertex, v1 is the maximum vertex.
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
465 // =============================================================================
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
466 class LDBoundingBox {
380
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
467 READ_PROPERTY (bool, empty, setEmpty)
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
468 READ_PROPERTY (vertex, v0, setV0)
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
469 READ_PROPERTY (vertex, v1, setV1)
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
470
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
471 public:
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
472 LDBoundingBox();
380
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
473 void reset();
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
474 void calculate();
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
475 double size() const;
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
476 void calcObject (LDObject* obj);
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
477 void calcVertex (const vertex& v);
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
478 vertex center() const;
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
479
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
480 LDBoundingBox& operator<< (LDObject* obj);
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
481 LDBoundingBox& operator<< (const vertex& v);
380
e442d9b7c251 Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
482 };
287
3fcccd8c3357 Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
483
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
484 // Formatter function
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 381
diff changeset
485 str DoFormat (List<StringFormatArg> args);
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
486
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
487 // printf replacement
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
488 void doPrint (File& f, initlist<StringFormatArg> args);
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
489 void doPrint (FILE* f, initlist<StringFormatArg> args); // heh
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
490
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
491 // log() - universal access to the message log. Defined here so that I don't have
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
492 // to include messagelog.h here and recompile everything every time that file changes.
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
493 void DoLog( std::initializer_list<StringFormatArg> args );
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
494
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
495 // Macros to access these functions
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
496 # ifndef IN_IDE_PARSER
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
497 #define fmt(...) DoFormat ({__VA_ARGS__})
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
498 # define print(...) doPrint (g_file_stdout, {__VA_ARGS__})
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
499 # define fprint(F, ...) doPrint (F, {__VA_ARGS__})
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
500 # define log(...) DoLog({ __VA_ARGS__ });
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
501 #else
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
502 str fmt (const char* fmtstr, ...);
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
503 void print (const char* fmtstr, ...);
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
504 void fprint (File& f, const char* fmtstr, ...);
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
505 void log( const char* fmtstr, ... );
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
506 #endif
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
507
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
508 extern File g_file_stdout;
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
509 extern File g_file_stderr;
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
510 extern const vertex g_origin; // Vertex at (0, 0, 0)
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
511 extern const matrix g_identity; // Identity matrix
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
512
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
513 static const double pi = 3.14159265358979323846f;
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
514
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 380
diff changeset
515 #endif // TYPES_H

mercurial