ldtypes.cpp

Mon, 08 Apr 2013 18:47:31 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Mon, 08 Apr 2013 18:47:31 +0300
changeset 76
42284126072a
parent 75
e95a00e34711
child 84
c9438ea54ed9
permissions
-rw-r--r--

Added a New Part dialog

30
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
1 /*
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
2 * LDForge: LDraw parts authoring CAD
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
3 * Copyright (C) 2013 Santeri `arezey` Piippo
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
4 *
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
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: 29
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: 29
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: 29
diff changeset
8 * (at your option) any later version.
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
9 *
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
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: 29
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: 29
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: 29
diff changeset
13 * GNU General Public License for more details.
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
14 *
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
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: 29
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: 29
diff changeset
17 */
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
18
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include "common.h"
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include "ldtypes.h"
26
83184d9407c7 Renamed io.cpp to file.cpp, draw.cpp to gldraw.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 24
diff changeset
21 #include "file.h"
18
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
22 #include "misc.h"
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
24 char const* g_saObjTypeNames[] = {
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 "unidentified",
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 "unknown",
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 "empty",
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 "comment",
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 "subfile",
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 "line",
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 "triangle",
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 "quadrilateral",
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 "condline",
73
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
34 "bfc",
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 "vertex",
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 };
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents: 32
diff changeset
38 char const* g_saObjTypeIcons[] = {
41
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
39 "error",
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
40 "error",
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
41 "empty",
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
42 "comment",
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
43 "subfile",
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
44 "line",
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
45 "triangle",
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
46 "quad",
4ca63da5546b Added insert vertex function and added vertex icons.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
47 "condline",
73
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
48 "bfc",
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
49 "vertex",
39
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents: 32
diff changeset
50 };
110669124caf Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents: 32
diff changeset
51
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 // =============================================================================
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
54 // =============================================================================
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 // LDObject constructors
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 LDObject::LDObject () {
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
57 commonInit ();
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
58 }
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
59
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
60 void LDObject::commonInit () {
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
61 qObjListEntry = nullptr;
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 LDGibberish::LDGibberish () {
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
65 commonInit ();
50
7fd213c6b844 Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
66 dColor = -1;
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68
11
323390a03294 Color gibberish red. Check for line code length for gibberish (must be 1 to be valid)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
69 LDGibberish::LDGibberish (str _zContent, str _zReason) {
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
70 zContents = _zContent;
11
323390a03294 Color gibberish red. Check for line code length for gibberish (must be 1 to be valid)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
71 zReason = _zReason;
50
7fd213c6b844 Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
72 dColor = -1;
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
73
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
74 commonInit ();
11
323390a03294 Color gibberish red. Check for line code length for gibberish (must be 1 to be valid)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
75 }
323390a03294 Color gibberish red. Check for line code length for gibberish (must be 1 to be valid)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 0
diff changeset
76
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77 LDEmpty::LDEmpty () {
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
78 commonInit ();
50
7fd213c6b844 Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
79 dColor = -1;
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82 LDComment::LDComment () {
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
83 commonInit ();
50
7fd213c6b844 Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
84 dColor = -1;
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87 LDSubfile::LDSubfile () {
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
88 commonInit ();
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 LDLine::LDLine () {
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
92 commonInit ();
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
94
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
95 LDTriangle::LDTriangle () {
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
96 commonInit ();
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
98
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99 LDQuad::LDQuad () {
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
100 commonInit ();
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
102
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103 LDCondLine::LDCondLine () {
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
104 commonInit ();
0
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105 }
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106
c51cce84a9ac Initial commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107 LDVertex::LDVertex () {
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
108 commonInit ();
13
3955ff2a7d72 Added logf function to write to message log. Write warnings of unparsable files into the message log.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 11
diff changeset
109 }
3955ff2a7d72 Added logf function to write to message log. Write warnings of unparsable files into the message log.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 11
diff changeset
110
73
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
111 LDBFC::LDBFC () {
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
112 commonInit ();
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
113 }
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
114
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: 57
diff changeset
115 // =============================================================================
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
116 str LDComment::getContents () {
17
5606eebd0b90 Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 14
diff changeset
117 return str::mkfmt ("0 %s", zText.chars ());
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
118 }
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
119
18
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
120 str LDSubfile::getContents () {
65
e4f25b44e240 Reverted changes on LDSubfile::getContents, I had a temporary, hackier solution there and forgot to change it back
Santeri Piippo <crimsondusk64@gmail.com>
parents: 64
diff changeset
121 str val = str::mkfmt ("1 %d %s ", dColor, vPosition.getStringRep (false).chars ());
e4f25b44e240 Reverted changes on LDSubfile::getContents, I had a temporary, hackier solution there and forgot to change it back
Santeri Piippo <crimsondusk64@gmail.com>
parents: 64
diff changeset
122
e4f25b44e240 Reverted changes on LDSubfile::getContents, I had a temporary, hackier solution there and forgot to change it back
Santeri Piippo <crimsondusk64@gmail.com>
parents: 64
diff changeset
123 for (short i = 0; i < 9; ++i)
e4f25b44e240 Reverted changes on LDSubfile::getContents, I had a temporary, hackier solution there and forgot to change it back
Santeri Piippo <crimsondusk64@gmail.com>
parents: 64
diff changeset
124 val.appendformat ("%s ", ftoa (mMatrix[i]).chars());
e4f25b44e240 Reverted changes on LDSubfile::getContents, I had a temporary, hackier solution there and forgot to change it back
Santeri Piippo <crimsondusk64@gmail.com>
parents: 64
diff changeset
125
e4f25b44e240 Reverted changes on LDSubfile::getContents, I had a temporary, hackier solution there and forgot to change it back
Santeri Piippo <crimsondusk64@gmail.com>
parents: 64
diff changeset
126 val += zFileName;
e4f25b44e240 Reverted changes on LDSubfile::getContents, I had a temporary, hackier solution there and forgot to change it back
Santeri Piippo <crimsondusk64@gmail.com>
parents: 64
diff changeset
127 return val;
18
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
128 }
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
129
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
130 str LDLine::getContents () {
18
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
131 str val = str::mkfmt ("2 %d", dColor);
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
132
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
133 for (ushort i = 0; i < 2; ++i)
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
134 val.appendformat (" %s", vaCoords[i].getStringRep (false).chars ());
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
135
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
136 return val;
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
137 }
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
138
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
139 str LDTriangle::getContents () {
18
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
140 str val = str::mkfmt ("3 %d", dColor);
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
141
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
142 for (ushort i = 0; i < 3; ++i)
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
143 val.appendformat (" %s", vaCoords[i].getStringRep (false).chars ());
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
144
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
145 return val;
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
146 }
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
147
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
148 str LDQuad::getContents () {
18
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
149 str val = str::mkfmt ("4 %d", dColor);
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
150
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
151 for (ushort i = 0; i < 4; ++i)
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
152 val.appendformat (" %s", vaCoords[i].getStringRep (false).chars ());
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
153
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
154 return val;
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
155 }
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
156
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
157 str LDCondLine::getContents () {
18
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
158 str val = str::mkfmt ("5 %d", dColor);
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
159
40
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
160 // Add the coordinates
215b9f8f0cd7 Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
161 for (ushort i = 0; i < 4; ++i)
18
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
162 val.appendformat (" %s", vaCoords[i].getStringRep (false).chars ());
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
163
a6732098fed8 Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents: 17
diff changeset
164 return val;
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
165 }
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
166
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
167 str LDGibberish::getContents () {
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
168 return zContents;
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
169 }
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
170
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
171 str LDVertex::getContents () {
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
172 return str::mkfmt ("0 !LDFORGE VERTEX %d %s", dColor, vPosition.getStringRep (false).chars());
14
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
173 }
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
174
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
175 str LDEmpty::getContents () {
6d9d8efae2f8 this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 13
diff changeset
176 return str ();
21
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
177 }
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
178
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: 57
diff changeset
179 // =============================================================================
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: 57
diff changeset
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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: 57
diff changeset
181 // =============================================================================
73
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
182 const char* LDBFC::saStatements[] = {
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
183 "CCW",
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
184 "CW",
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
185 "CERTIFY CCW",
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
186 "CERTIFY CW",
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
187 "NOCERTIFY",
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
188 "INVERTNEXT",
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
189 };
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
190
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
191 str LDBFC::getContents () {
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
192 return str::mkfmt ("0 BFC %s", LDBFC::saStatements[dStatement]);
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
193 }
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
194
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
195 // =============================================================================
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
197 // =============================================================================
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
198 vector<LDTriangle*> LDQuad::splitToTriangles () {
21
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
199 // Create the two triangles based on this quadrilateral:
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
200 // 0---3 0---3 3
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
201 // | | | / /|
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
202 // | | = | / / |
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
203 // | | |/ / |
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
204 // 1---2 1 1---2
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
205 LDTriangle* tri1 = new LDTriangle;
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
206 tri1->vaCoords[0] = vaCoords[0];
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
207 tri1->vaCoords[1] = vaCoords[1];
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
208 tri1->vaCoords[2] = vaCoords[3];
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
209
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
210 LDTriangle* tri2 = new LDTriangle;
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
211 tri2->vaCoords[0] = vaCoords[1];
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
212 tri2->vaCoords[1] = vaCoords[2];
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
213 tri2->vaCoords[2] = vaCoords[3];
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
214
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
215 // The triangles also inherit the quad's color
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
216 tri1->dColor = tri2->dColor = dColor;
9aebaaafa5da Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
217
73
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
218 vector<LDTriangle*> triangles;
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
219 triangles.push_back (tri1);
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
220 triangles.push_back (tri2);
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
221 return triangles;
24
d2d4d0154338 added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 22
diff changeset
222 }
d2d4d0154338 added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 22
diff changeset
223
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: 57
diff changeset
224 // =============================================================================
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: 57
diff changeset
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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: 57
diff changeset
226 // =============================================================================
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
227 void LDObject::replace (LDObject* replacement) {
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
228 // Replace all instances of the old object with the new object
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
229 for (ulong i = 0; i < g_CurrentFile->objects.size(); ++i) {
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
230 if (g_CurrentFile->objects[i] == this)
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
231 g_CurrentFile->objects[i] = replacement;
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
232 }
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
233
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
234 // Remove the old object
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
235 delete this;
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
236 }
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
237
57
6e89589f1fe8 Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 50
diff changeset
238 LDLine::LDLine (vertex v1, vertex v2) {
6e89589f1fe8 Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 50
diff changeset
239 commonInit ();
6e89589f1fe8 Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 50
diff changeset
240
6e89589f1fe8 Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 50
diff changeset
241 vaCoords[0] = v1;
6e89589f1fe8 Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 50
diff changeset
242 vaCoords[1] = v2;
6e89589f1fe8 Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 50
diff changeset
243 }
6e89589f1fe8 Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents: 50
diff changeset
244
24
d2d4d0154338 added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 22
diff changeset
245 LDObject::~LDObject () {}
d2d4d0154338 added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 22
diff changeset
246 LDComment::~LDComment () {}
d2d4d0154338 added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 22
diff changeset
247 LDCondLine::~LDCondLine () {}
d2d4d0154338 added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 22
diff changeset
248 LDEmpty::~LDEmpty () {}
d2d4d0154338 added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 22
diff changeset
249 LDGibberish::~LDGibberish () {}
d2d4d0154338 added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 22
diff changeset
250 LDLine::~LDLine () {}
d2d4d0154338 added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 22
diff changeset
251 LDQuad::~LDQuad () {}
d2d4d0154338 added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 22
diff changeset
252 LDSubfile::~LDSubfile () {}
d2d4d0154338 added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 22
diff changeset
253 LDTriangle::~LDTriangle () {}
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: 57
diff changeset
254 LDVertex::~LDVertex () {}
73
d20867ac03cc Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
255 LDBFC::~LDBFC () {}
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: 57
diff changeset
256
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
257 // =============================================================================
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
259 // =============================================================================
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
260 template<class T> static void transformSubObject (LDObject* obj, matrix mMatrix,
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
261 vertex vPos, short dColor)
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
262 {
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
263 T* newobj = static_cast<T*> (obj);
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
264 for (short i = 0; i < (short)(sizeof newobj->vaCoords / sizeof *newobj->vaCoords); ++i)
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
265 newobj->vaCoords[i].transform (mMatrix, vPos);
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
266
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
267 if (newobj->dColor == dMainColor)
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
268 newobj->dColor = dColor;
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
269 }
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
270
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
271 // -----------------------------------------------------------------------------
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
272 static void transformObject (LDObject* obj, matrix mMatrix, vertex vPos,
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
273 short dColor)
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
274 {
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
275 switch (obj->getType()) {
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
276 case OBJ_Line:
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
277 transformSubObject<LDLine> (obj, mMatrix, vPos, dColor);
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
278 break;
76
42284126072a Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
279
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
280 case OBJ_CondLine:
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
281 transformSubObject<LDCondLine> (obj, mMatrix, vPos, dColor);
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
282 break;
76
42284126072a Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
283
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
284 case OBJ_Triangle:
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
285 transformSubObject<LDTriangle> (obj, mMatrix, vPos, dColor);
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
286 break;
76
42284126072a Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
287
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
288 case OBJ_Quad:
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
289 transformSubObject<LDQuad> (obj, mMatrix, vPos, dColor);
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
290 break;
76
42284126072a Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
291
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
292 case OBJ_Subfile:
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
293 {
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
294 LDSubfile* ref = static_cast<LDSubfile*> (obj);
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
295
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
296 matrix mNewMatrix = mMatrix * ref->mMatrix;
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
297 ref->vPosition.transform (mMatrix, vPos);
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
298 ref->mMatrix = mNewMatrix;
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
299 }
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
300
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
301 break;
76
42284126072a Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
302
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
303 default:
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
304 break;
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
305 }
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
306 }
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: 57
diff changeset
307
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: 57
diff changeset
308 // =============================================================================
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: 57
diff changeset
309 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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: 57
diff changeset
310 // =============================================================================
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
311 vector<LDObject*> LDSubfile::inlineContents (bool bDeepInline, bool bCache) {
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
312 vector<LDObject*> objs, cache;
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: 57
diff changeset
313
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
314 // If we have this cached, just clone that
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
315 if (bDeepInline && pFile->objCache.size ()) {
69
6790dea720a8 Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 67
diff changeset
316 for (LDObject* obj : pFile->objCache)
76
42284126072a Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
317 objs.push_back (obj->clone ());
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
318 } else {
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
319 if (!bDeepInline)
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
320 bCache = false;
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: 57
diff changeset
321
69
6790dea720a8 Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 67
diff changeset
322 for (LDObject* obj : pFile->objects) {
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
323 // Skip those without schemantic meaning
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
324 switch (obj->getType ()) {
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
325 case OBJ_Comment:
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
326 case OBJ_Empty:
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
327 case OBJ_Gibberish:
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
328 case OBJ_Unidentified:
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
329 case OBJ_Vertex:
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
330 continue;
75
e95a00e34711 Don't include non-INVERTNEXT BFC statements in inlined objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 74
diff changeset
331
e95a00e34711 Don't include non-INVERTNEXT BFC statements in inlined objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 74
diff changeset
332 case OBJ_BFC:
e95a00e34711 Don't include non-INVERTNEXT BFC statements in inlined objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 74
diff changeset
333 // Filter non-INVERTNEXT statements
e95a00e34711 Don't include non-INVERTNEXT BFC statements in inlined objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 74
diff changeset
334 if (static_cast<LDBFC*> (obj)->dStatement != BFC_InvertNext)
e95a00e34711 Don't include non-INVERTNEXT BFC statements in inlined objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 74
diff changeset
335 continue;
e95a00e34711 Don't include non-INVERTNEXT BFC statements in inlined objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 74
diff changeset
336 break;
e95a00e34711 Don't include non-INVERTNEXT BFC statements in inlined objects.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 74
diff changeset
337
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
338 default:
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
339 break;
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
340 }
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
341
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
342 // Got another sub-file reference, inline it if we're deep-inlining. If not,
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
343 // just add it into the objects normally. Also, we only cache immediate
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
344 // subfiles and this is not one. Yay, recursion!
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
345 if (bDeepInline && obj->getType() == OBJ_Subfile) {
63
aa40ce18f869 Implemented the inline action to expose inlining to the user. Also added a `deep inline` action to inline subfile recursively down into polygons and lines only.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 62
diff changeset
346 LDSubfile* ref = static_cast<LDSubfile*> (obj);
aa40ce18f869 Implemented the inline action to expose inlining to the user. Also added a `deep inline` action to inline subfile recursively down into polygons and lines only.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 62
diff changeset
347
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
348 vector<LDObject*> otherobjs = ref->inlineContents (true, false);
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
349
69
6790dea720a8 Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 67
diff changeset
350 for (LDObject* otherobj : otherobjs) {
76
42284126072a Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
351 // Cache this object, if desired
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
352 if (bCache)
76
42284126072a Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
353 cache.push_back (otherobj->clone ());
63
aa40ce18f869 Implemented the inline action to expose inlining to the user. Also added a `deep inline` action to inline subfile recursively down into polygons and lines only.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 62
diff changeset
354
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
355 objs.push_back (otherobj);
63
aa40ce18f869 Implemented the inline action to expose inlining to the user. Also added a `deep inline` action to inline subfile recursively down into polygons and lines only.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 62
diff changeset
356 }
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
357 } else {
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
358 if (bCache)
76
42284126072a Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
359 cache.push_back (obj->clone ());
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
360
76
42284126072a Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
361 objs.push_back (obj->clone ());
63
aa40ce18f869 Implemented the inline action to expose inlining to the user. Also added a `deep inline` action to inline subfile recursively down into polygons and lines only.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 62
diff changeset
362 }
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: 57
diff changeset
363 }
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
364
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
365 if (bCache)
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
366 pFile->objCache = cache;
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: 57
diff changeset
367 }
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: 57
diff changeset
368
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
369 // Transform the objects
69
6790dea720a8 Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 67
diff changeset
370 for (LDObject* obj : objs)
66
12aca5d5a51e Restructured inlining to use a proper caching.. one cache per sub-file reference? What was I thinking? *whacks self with a 55295.dat*
Santeri Piippo <crimsondusk64@gmail.com>
parents: 65
diff changeset
371 transformObject (obj, mMatrix, vPosition, dColor);
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: 57
diff changeset
372
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: 57
diff changeset
373 return objs;
63
aa40ce18f869 Implemented the inline action to expose inlining to the user. Also added a `deep inline` action to inline subfile recursively down into polygons and lines only.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 62
diff changeset
374 }
aa40ce18f869 Implemented the inline action to expose inlining to the user. Also added a `deep inline` action to inline subfile recursively down into polygons and lines only.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 62
diff changeset
375
aa40ce18f869 Implemented the inline action to expose inlining to the user. Also added a `deep inline` action to inline subfile recursively down into polygons and lines only.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 62
diff changeset
376 // =============================================================================
aa40ce18f869 Implemented the inline action to expose inlining to the user. Also added a `deep inline` action to inline subfile recursively down into polygons and lines only.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 62
diff changeset
377 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
aa40ce18f869 Implemented the inline action to expose inlining to the user. Also added a `deep inline` action to inline subfile recursively down into polygons and lines only.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 62
diff changeset
378 // =============================================================================
aa40ce18f869 Implemented the inline action to expose inlining to the user. Also added a `deep inline` action to inline subfile recursively down into polygons and lines only.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 62
diff changeset
379 long LDObject::getIndex (OpenFile* pFile) {
74
1affec15e572 LDObject::getIndex was bogus which would cause inlining to crash
Santeri Piippo <crimsondusk64@gmail.com>
parents: 73
diff changeset
380 for (ulong i = 0; i < pFile->objects.size(); ++i)
1affec15e572 LDObject::getIndex was bogus which would cause inlining to crash
Santeri Piippo <crimsondusk64@gmail.com>
parents: 73
diff changeset
381 if (pFile->objects[i] == this)
1affec15e572 LDObject::getIndex was bogus which would cause inlining to crash
Santeri Piippo <crimsondusk64@gmail.com>
parents: 73
diff changeset
382 return i;
63
aa40ce18f869 Implemented the inline action to expose inlining to the user. Also added a `deep inline` action to inline subfile recursively down into polygons and lines only.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 62
diff changeset
383
aa40ce18f869 Implemented the inline action to expose inlining to the user. Also added a `deep inline` action to inline subfile recursively down into polygons and lines only.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 62
diff changeset
384 return -1;
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: 57
diff changeset
385 }

mercurial