Tue, 09 Apr 2013 18:23:07 +0300
Added a button to clear a keyboard shortcut.
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 | 19 | #ifndef __LDTYPES_H__ |
20 | #define __LDTYPES_H__ | |
21 | ||
22 | #include "common.h" | |
64
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
63
diff
changeset
|
23 | #include "types.h" |
0 | 24 | |
25 | #define IMPLEMENT_LDTYPE(N) \ | |
26 | LD##N (); \ | |
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:
23
diff
changeset
|
27 | virtual ~LD##N (); \ |
0 | 28 | virtual LDObjectType_e getType () const { \ |
29 | return OBJ_##N; \ | |
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
|
30 | } \ |
55
b08f10e668e5
Added clipboard, added delete action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
50
diff
changeset
|
31 | virtual str getContents (); \ |
76
42284126072a
Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
73
diff
changeset
|
32 | virtual LD##N* clone () { \ |
55
b08f10e668e5
Added clipboard, added delete action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
50
diff
changeset
|
33 | return new LD##N (*this); \ |
b08f10e668e5
Added clipboard, added delete action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
50
diff
changeset
|
34 | } |
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
|
35 | |
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
|
36 | class QTreeWidgetItem; |
0 | 37 | |
38 | // ============================================================================= | |
39 | // LDObjectType_e | |
40 | // | |
41 | // Object type codes | |
42 | // ============================================================================= | |
43 | enum LDObjectType_e { | |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
44 | OBJ_Unidentified, // Object is an uninitialized (LDObject) (SHOULD NEVER HAPPEN) |
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
45 | OBJ_Gibberish, // Object is the result of failed parsing (LDGibberish) |
0 | 46 | OBJ_Empty, // Object represents an empty line (LDEmpty) |
47 | OBJ_Comment, // Object represents a comment (LDComment, code: 0) | |
48 | OBJ_Subfile, // Object represents a sub-file reference (LDSubfile, code: 1) | |
49 | OBJ_Line, // Object represents a line (LDLine, code: 2) | |
50 | OBJ_Triangle, // Object represents a triangle (LDTriangle, code: 3) | |
51 | OBJ_Quad, // Object represents a quadrilateral (LDQuad, code: 4) | |
52 | OBJ_CondLine, // Object represents a conditional line (LDCondLine, code: 5) | |
73
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
53 | OBJ_BFC, // Object represents a BFC statement |
0 | 54 | OBJ_Vertex // Object is a vertex, LDForge extension object (LDVertex) |
55 | }; | |
56 | ||
57 | // ============================================================================= | |
58 | // LDObject | |
59 | // | |
60 | // Base class object for all LD* types. Each LDObject represents a single line | |
61 | // in the LDraw code file. The virtual method getType returns an enumerator | |
62 | // which is a token of the object's type. The object can be casted into | |
63 | // sub-classes based on this enumerator. | |
64 | // ============================================================================= | |
65 | class LDObject { | |
66 | public: | |
67 | LDObject (); | |
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:
23
diff
changeset
|
68 | virtual ~LDObject (); |
0 | 69 | |
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
|
70 | // Index (i.e. line number) of this object |
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:
64
diff
changeset
|
71 | long getIndex (OpenFile* pFile); |
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
|
72 | |
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
|
73 | // Color used by this object. Comments, gibberish and empty entries |
7fd213c6b844
Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
74 | // do not use this field. |
7fd213c6b844
Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
75 | short dColor; |
7fd213c6b844
Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
76 | |
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
|
77 | // Type enumerator of this object |
0 | 78 | virtual LDObjectType_e getType () const { |
79 | return OBJ_Unidentified; | |
80 | }; | |
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
|
81 | |
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
|
82 | // A string that represents this line |
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 | virtual str 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
|
84 | return ""; |
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
|
85 | } |
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
|
86 | |
76
42284126072a
Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
73
diff
changeset
|
87 | // Creates a new LDObject identical to this one and returns a pointer to it. |
42284126072a
Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
73
diff
changeset
|
88 | virtual LDObject* clone () { |
55
b08f10e668e5
Added clipboard, added delete action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
50
diff
changeset
|
89 | return new LDObject (*this); |
b08f10e668e5
Added clipboard, added delete action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
50
diff
changeset
|
90 | } |
b08f10e668e5
Added clipboard, added delete action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
50
diff
changeset
|
91 | |
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 | void 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
|
93 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
94 | // Replace this LDObject with another LDObject. This method deletes the |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
95 | // object and any pointers to it become invalid. |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
96 | void replace (LDObject* replacement); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
97 | |
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
|
98 | QTreeWidgetItem* qObjListEntry; |
0 | 99 | }; |
100 | ||
101 | // ============================================================================= | |
102 | // LDGibberish | |
103 | // | |
104 | // Represents a line in the LDraw file that could not be properly parsed. It is | |
105 | // represented by a (!) ERROR in the code view. It exists for the purpose of | |
106 | // allowing garbage lines be debugged and corrected within LDForge. The member | |
107 | // zContent contains the contents of the unparsable line. | |
108 | // ============================================================================= | |
109 | class LDGibberish : public LDObject { | |
110 | public: | |
111 | IMPLEMENT_LDTYPE (Gibberish) | |
112 | ||
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
|
113 | LDGibberish (str _zContent, str _zReason); |
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
|
114 | |
0 | 115 | // Content of this unknown line |
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 zContents; |
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
|
117 | |
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
|
118 | // Why is this gibberish? |
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
|
119 | str zReason; |
0 | 120 | }; |
121 | ||
122 | // ============================================================================= | |
123 | // LDEmptyLine | |
124 | // | |
125 | // Represents an empty line in the LDraw code file. | |
126 | // ============================================================================= | |
127 | class LDEmpty : public LDObject { | |
128 | public: | |
129 | IMPLEMENT_LDTYPE (Empty) | |
130 | }; | |
131 | ||
132 | // ============================================================================= | |
133 | // LDComment | |
134 | // | |
135 | // Represents a code-0 comment in the LDraw code file. Member zText contains | |
136 | // the text of the comment. | |
137 | // ============================================================================= | |
138 | class LDComment : public LDObject { | |
139 | public: | |
140 | IMPLEMENT_LDTYPE (Comment) | |
76
42284126072a
Added a New Part dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
73
diff
changeset
|
141 | LDComment (str zText) : zText (zText) {} |
0 | 142 | |
143 | str zText; // The text of this comment | |
144 | }; | |
145 | ||
146 | // ============================================================================= | |
73
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
147 | // LDBFC |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
148 | // |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
149 | // Represents a 0 BFC statement in the LDraw code. eStatement contains the type |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
150 | // of this statement. |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
151 | // ============================================================================= |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
152 | class LDBFC : public LDComment { |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
153 | public: |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
154 | IMPLEMENT_LDTYPE (BFC) |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
155 | LDBFC (const int dType) : dStatement (dType) {} |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
156 | |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
157 | // Statement strings |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
158 | static const char* saStatements[]; |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
159 | |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
160 | static str statementString (short dValue); |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
161 | short dStatement; |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
162 | }; |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
163 | |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
164 | |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
165 | // ----------------------------------------------------------------------------- |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
166 | // Enumerator for LDBFC's dStatement |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
167 | enum LDBFCType_e { |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
168 | BFC_CertifyCCW, |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
169 | BFC_CCW, |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
170 | BFC_CertifyCW, |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
171 | BFC_CW, |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
172 | BFC_NoCertify, // Winding becomes disabled (0 BFC NOCERTIFY) |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
173 | BFC_InvertNext, // Winding is inverted for next object (0 BFC INVERTNEXT) |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
174 | NUM_BFCStatements |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
175 | }; |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
176 | |
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
177 | // ============================================================================= |
0 | 178 | // LDSubfile |
179 | // | |
180 | // Represents a single code-1 subfile reference. | |
181 | // ============================================================================= | |
182 | class LDSubfile : public LDObject { | |
183 | public: | |
184 | IMPLEMENT_LDTYPE (Subfile) | |
185 | ||
186 | vertex vPosition; // Position of the subpart | |
64
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
63
diff
changeset
|
187 | matrix mMatrix; // Transformation matrix for the subpart |
0 | 188 | str zFileName; // Filename of the subpart |
23
69a91c1ff583
begin work on subfile caching
Santeri Piippo <crimsondusk64@gmail.com>
parents:
21
diff
changeset
|
189 | OpenFile* pFile; // Pointer to opened file for this subfile. nullptr if unopened. |
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
|
190 | |
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
|
191 | // Gets the inlined contents of this subfile. |
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:
64
diff
changeset
|
192 | std::vector<LDObject*> inlineContents (bool bDeepInline, bool bCache); |
0 | 193 | }; |
194 | ||
195 | // ============================================================================= | |
196 | // LDLine | |
197 | // | |
198 | // Represents a single code-2 line in the LDraw code file. v0 and v1 are the end | |
199 | // points of the line. The line is colored with dColor unless uncolored mode is | |
200 | // set. | |
201 | // ============================================================================= | |
202 | class LDLine : public LDObject { | |
203 | public: | |
204 | IMPLEMENT_LDTYPE (Line) | |
57
6e89589f1fe8
Added polygon bordering function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
55
diff
changeset
|
205 | LDLine (vertex v1, vertex v2); |
0 | 206 | |
207 | vertex vaCoords[2]; // End points of this line | |
208 | }; | |
209 | ||
210 | // ============================================================================= | |
211 | // LDCondLine | |
212 | // | |
213 | // Represents a single code-5 conditional line. The end-points v0 and v1 are | |
214 | // inherited from LDLine, c0 and c1 are the control points of this line. | |
215 | // ============================================================================= | |
216 | class LDCondLine : public LDLine { | |
217 | public: | |
218 | IMPLEMENT_LDTYPE (CondLine) | |
219 | ||
40
215b9f8f0cd7
Added triangle, quad and condline to the add object dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
220 | vertex vaCoords[4]; // End points + control points of this line |
0 | 221 | }; |
222 | ||
223 | // ============================================================================= | |
224 | // LDTriangle | |
225 | // | |
226 | // Represents a single code-3 triangle in the LDraw code file. Vertices v0, v1 | |
227 | // and v2 contain the end-points of this triangle. dColor is the color the | |
228 | // triangle is colored with. | |
229 | // ============================================================================= | |
230 | class LDTriangle : public LDObject { | |
231 | public: | |
232 | IMPLEMENT_LDTYPE (Triangle) | |
233 | ||
234 | vertex vaCoords[3]; | |
235 | ||
236 | LDTriangle (vertex _v0, vertex _v1, vertex _v2) { | |
237 | vaCoords[0] = _v0; | |
238 | vaCoords[1] = _v1; | |
239 | vaCoords[2] = _v2; | |
240 | } | |
241 | }; | |
242 | ||
243 | // ============================================================================= | |
244 | // LDQuad | |
245 | // | |
246 | // Represents a single code-4 quadrilateral. v0, v1, v2 and v3 are the end points | |
247 | // of the quad, dColor is the color used for the quad. | |
248 | // ============================================================================= | |
249 | class LDQuad : public LDObject { | |
250 | public: | |
251 | IMPLEMENT_LDTYPE (Quad) | |
252 | ||
253 | vertex vaCoords[4]; | |
21
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
19
diff
changeset
|
254 | |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
19
diff
changeset
|
255 | // Split this quad into two triangles |
73
d20867ac03cc
Added support for BFC types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
66
diff
changeset
|
256 | vector<LDTriangle*> splitToTriangles (); |
0 | 257 | }; |
258 | ||
259 | // ============================================================================= | |
260 | // LDVertex | |
261 | // | |
262 | // The vertex is another LDForce-specific extension. It represents a single | |
263 | // vertex which can be used as a parameter to tools or to store coordinates | |
264 | // with. Vertices are a part authoring tool and they should not appear in | |
265 | // finished parts. | |
266 | // ============================================================================= | |
267 | class LDVertex : public LDObject { | |
268 | public: | |
269 | IMPLEMENT_LDTYPE (Vertex) | |
270 | ||
271 | vertex vPosition; | |
272 | }; | |
273 | ||
274 | // ============================================================================= | |
275 | // Object type names. Pass the return value of getType as the index to get a | |
276 | // string representation of the object's type. | |
277 | extern const char* g_saObjTypeNames[]; | |
278 | ||
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
279 | // Icons for these types |
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
280 | extern const char* g_saObjTypeIcons[]; |
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
281 | |
0 | 282 | #endif |