Tue, 07 May 2013 15:07:23 +0300
Restructured the shortcut configuration tab a little, allowing it to be sorted.
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
1 | /* |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
104 | 3 | * Copyright (C) 2013 Santeri Piippo |
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
4 | * |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
8 | * (at your option) any later version. |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
9 | * |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
13 | * GNU General Public License for more details. |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
14 | * |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
17 | */ |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
18 | |
0 | 19 | #include "common.h" |
20 | #include "bbox.h" | |
21 | #include "ldtypes.h" | |
26
83184d9407c7
Renamed io.cpp to file.cpp, draw.cpp to gldraw.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
22 | #include "file.h" |
0 | 23 | |
60
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
24 | // ============================================================================= |
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
25 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
26 | // ============================================================================= |
121
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
27 | bbox::bbox () { |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
28 | reset (); |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
29 | } |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
30 | |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
31 | // ============================================================================= |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
32 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
33 | // ============================================================================= |
0 | 34 | void bbox::calculate () { |
60
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
35 | reset (); |
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
36 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
147
diff
changeset
|
37 | if (!g_curfile) |
3
2b78cf8634c3
don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
38 | return; |
2b78cf8634c3
don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
39 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
147
diff
changeset
|
40 | for (LDObject* obj : g_curfile->m_objs) |
121
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
41 | calcObject (obj); |
71
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
42 | } |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
43 | |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
44 | // ============================================================================= |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
46 | // ============================================================================= |
121
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
47 | void bbox::calcObject (LDObject* obj) { |
71
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
48 | switch (obj->getType ()) { |
168
96691a009dff
Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
49 | case LDObject::Line: |
71
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
50 | { |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
51 | LDLine* line = static_cast<LDLine*> (obj); |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
52 | for (short i = 0; i < 2; ++i) |
121
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
53 | calcVertex (line->vaCoords[i]); |
71
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
54 | } |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
55 | break; |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
56 | |
168
96691a009dff
Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
57 | case LDObject::Triangle: |
71
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
58 | { |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
59 | LDTriangle* tri = static_cast<LDTriangle*> (obj); |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
60 | for (short i = 0; i < 3; ++i) |
121
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
61 | calcVertex (tri->vaCoords[i]); |
71
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
62 | } |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
63 | break; |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
64 | |
168
96691a009dff
Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
65 | case LDObject::Quad: |
71
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
66 | { |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
67 | LDQuad* quad = static_cast<LDQuad*> (obj); |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
68 | for (short i = 0; i < 4; ++i) |
121
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
69 | calcVertex (quad->vaCoords[i]); |
71
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
70 | } |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
71 | break; |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
72 | |
168
96691a009dff
Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
73 | case LDObject::CondLine: |
71
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
74 | { |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
75 | LDCondLine* line = static_cast<LDCondLine*> (obj); |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
76 | for (short i = 0; i < 4; ++i) |
121
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
77 | calcVertex (line->vaCoords[i]); |
71
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
78 | } |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
79 | break; |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
80 | |
168
96691a009dff
Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
81 | case LDObject::Subfile: |
71
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
82 | { |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
83 | LDSubfile* ref = static_cast<LDSubfile*> (obj); |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
84 | vector<LDObject*> objs = ref->inlineContents (true, true); |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
85 | |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
86 | for (LDObject* obj : objs) { |
121
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
87 | calcObject (obj); |
71
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
88 | delete obj; |
0 | 89 | } |
90 | } | |
121
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
91 | break; |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
92 | |
168
96691a009dff
Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents:
164
diff
changeset
|
93 | case LDObject::Radial: |
121
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
94 | { |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
95 | LDRadial* rad = static_cast<LDRadial*> (obj); |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
96 | vector<LDObject*> objs = rad->decompose (true); |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
97 | |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
98 | for (LDObject* obj : objs) { |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
99 | calcObject (obj); |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
100 | delete obj; |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
101 | } |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
102 | } |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
103 | break; |
71
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
104 | |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
105 | default: |
c9f02d2dd9eb
Draw main color in the selection dialog based on preferences, take subfiles into account when calculating bbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
106 | break; |
0 | 107 | } |
108 | } | |
109 | ||
60
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
110 | // ============================================================================= |
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
111 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
112 | // ============================================================================= |
121
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
113 | void bbox::calcVertex (vertex v) { |
147
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
121
diff
changeset
|
114 | for (const Axis ax : g_Axes) { |
164 | 115 | if (v[ax] < m_v0[ax]) |
116 | m_v0[ax] = v[ax]; | |
147
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
121
diff
changeset
|
117 | |
164 | 118 | if (v[ax] > m_v1[ax]) |
119 | m_v1[ax] = v[ax]; | |
147
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
121
diff
changeset
|
120 | } |
164 | 121 | |
122 | m_empty = false; | |
0 | 123 | } |
124 | ||
60
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
125 | // ============================================================================= |
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
126 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
127 | // ============================================================================= |
121
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
128 | void bbox::reset () { |
164 | 129 | m_v0[X] = m_v0[Y] = m_v0[Z] = +0x7FFFFFFF; |
130 | m_v1[X] = m_v1[Y] = m_v1[Z] = -0x7FFFFFFF; | |
131 | ||
132 | m_empty = true; | |
60
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
133 | } |
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
134 | |
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
135 | // ============================================================================= |
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
136 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
137 | // ============================================================================= |
121
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
138 | double bbox::size () const { |
164 | 139 | double fXScale = (m_v0[X] - m_v1[X]); |
140 | double fYScale = (m_v0[Y] - m_v1[Y]); | |
141 | double fZScale = (m_v0[Z] - m_v1[Z]); | |
61
109b07334fa0
If editing contents of a gibberish object, show the reason for the gibberishness in the dialog. Clamp the bounding box scale to at least 1.0 so that polygons are visible in new files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
60
diff
changeset
|
142 | double fSize = fZScale; |
60
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
143 | |
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
144 | if (fXScale > fYScale) { |
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
145 | if (fXScale > fZScale) |
61
109b07334fa0
If editing contents of a gibberish object, show the reason for the gibberishness in the dialog. Clamp the bounding box scale to at least 1.0 so that polygons are visible in new files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
60
diff
changeset
|
146 | fSize = fXScale; |
60
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
147 | } else if (fYScale > fZScale) |
61
109b07334fa0
If editing contents of a gibberish object, show the reason for the gibberishness in the dialog. Clamp the bounding box scale to at least 1.0 so that polygons are visible in new files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
60
diff
changeset
|
148 | fSize = fYScale; |
60
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
149 | |
62
915fc477cb6a
Got inlining working. 3002.dat renders properly now! Now just to iron out the bugs and hone the behavior..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
61
diff
changeset
|
150 | if (abs (fSize) >= 2.0f) |
915fc477cb6a
Got inlining working. 3002.dat renders properly now! Now just to iron out the bugs and hone the behavior..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
61
diff
changeset
|
151 | return abs (fSize / 2); |
110
a62ab18d1b80
Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
152 | |
61
109b07334fa0
If editing contents of a gibberish object, show the reason for the gibberishness in the dialog. Clamp the bounding box scale to at least 1.0 so that polygons are visible in new files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
60
diff
changeset
|
153 | return 1.0f; |
60
961663d05463
Parsing stability, finally figured that dumb crash
Santeri Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
154 | } |
121
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
155 | |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
156 | // ============================================================================= |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
157 | vertex bbox::center () const { |
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
158 | return vertex ( |
164 | 159 | (m_v0[X] + m_v1[X]) / 2, |
160 | (m_v0[Y] + m_v1[Y]) / 2, | |
161 | (m_v0[Z] + m_v1[Z]) / 2); | |
162 | } | |
163 | ||
164 | // ============================================================================= | |
165 | bool bbox::empty() const { | |
166 | return m_empty; | |
121
7e87c85ad092
Rotation improvements; allow radials be inlined
Santeri Piippo <crimsondusk64@gmail.com>
parents:
110
diff
changeset
|
167 | } |