src/ldtypes.h

Tue, 22 Oct 2013 13:40:16 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 22 Oct 2013 13:40:16 +0300
changeset 522
afa691788bdb
parent 516
d3373bc7ca3b
child 538
2f85d4d286e5
permissions
-rw-r--r--

- migrated selection from ForgeWindow to individual LDFiles. Should've done this long ago.
- added an operator== for matrix to make stuff actually compile

183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
4 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
9 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
14 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #ifndef LDTYPES_H
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #define LDTYPES_H
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include "common.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include "types.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
25 #define LDOBJ(T) \
377
271d1da66b7e Appended 'Object' to the names of all LDObject derivatives so even though the LD prefix isn't reserved for just LDObjects anymore, these classes remain distinct
Santeri Piippo <crimsondusk64@gmail.com>
parents: 376
diff changeset
26 public: \
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
27 virtual ~LD##T() {} \
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
28 virtual LDObject::Type getType() const override { \
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 return LDObject::T; \
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 } \
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
31 virtual str raw(); \
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
32 virtual LD##T* clone() { \
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
33 return new LD##T (*this); \
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 } \
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
35 virtual void move (vertex where); \
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
36 virtual void invert();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 418
diff changeset
38 #define LDOBJ_NAME(N) virtual str typeName() const override { return #N; }
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 418
diff changeset
39 #define LDOBJ_VERTICES(V) virtual short vertices() const override { return V; }
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 418
diff changeset
40 #define LDOBJ_SETCOLORED(V) virtual bool isColored() const override { return V; }
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 418
diff changeset
41 #define LDOBJ_COLORED LDOBJ_SETCOLORED (true)
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 418
diff changeset
42 #define LDOBJ_UNCOLORED LDOBJ_SETCOLORED (false)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43
367
3745caa5d87d apply the c++11 'override' keyword to overriding virtual functions
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
44 #define LDOBJ_CUSTOM_SCEMANTIC virtual bool isScemantic() const override
357
9c954c222996 Removed the two string arrays containing object types and icon names, moved these as LDObjects' virtual functions
Santeri Piippo <crimsondusk64@gmail.com>
parents: 316
diff changeset
45 #define LDOBJ_SCEMANTIC LDOBJ_CUSTOM_SCEMANTIC { return true; }
9c954c222996 Removed the two string arrays containing object types and icon names, moved these as LDObjects' virtual functions
Santeri Piippo <crimsondusk64@gmail.com>
parents: 316
diff changeset
46 #define LDOBJ_NON_SCEMANTIC LDOBJ_CUSTOM_SCEMANTIC { return false; }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47
367
3745caa5d87d apply the c++11 'override' keyword to overriding virtual functions
Santeri Piippo <crimsondusk64@gmail.com>
parents: 357
diff changeset
48 #define LDOBJ_SETMATRIX(V) virtual bool hasMatrix() const override { return V; }
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 418
diff changeset
49 #define LDOBJ_HAS_MATRIX LDOBJ_SETMATRIX (true)
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 418
diff changeset
50 #define LDOBJ_NO_MATRIX LDOBJ_SETMATRIX (false)
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
51
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 class QListWidgetItem;
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
53 class LDSubfile;
409
8da2563c645a Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
54 class LDFile;
516
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
55 class LDSharedVertex;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 // LDObject
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
59 //
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
60 // Base class object for all object types. Each LDObject represents a single line
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 // in the LDraw code file. The virtual method getType returns an enumerator
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 // which is a token of the object's type. The object can be casted into
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 // sub-classes based on this enumerator.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
65 class LDObject
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
66 { PROPERTY (bool, hidden, setHidden)
223
4f95d7f2e9ef Added PROPERTY macro for easier exposed member variable management
Santeri Piippo <crimsondusk64@gmail.com>
parents: 216
diff changeset
67 PROPERTY (bool, selected, setSelected)
266
12e7302f14e9 Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents: 265
diff changeset
68 PROPERTY (LDObject*, parent, setParent)
409
8da2563c645a Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
69 PROPERTY (LDFile*, file, setFile)
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 418
diff changeset
70 READ_PROPERTY (int32, id, setID)
275
7b5afec27688 Color changing is now logged into history
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
71 DECLARE_PROPERTY (short, color, setColor)
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
72
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
73 public:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
74 // Object type codes. Codes are sorted in order of significance.
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
75 enum Type
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
76 { Subfile, // Object represents a sub-file reference
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
77 Quad, // Object represents a quadrilateral
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
78 Triangle, // Object represents a triangle
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
79 Line, // Object represents a line
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
80 CndLine, // Object represents a conditional line
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
81 Vertex, // Object is a vertex, LDForge extension object
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
82 BFC, // Object represents a BFC statement
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
83 Overlay, // Object contains meta-info about an overlay image.
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
84 Comment, // Object represents a comment
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
85 Error, // Object is the result of failed parsing
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
86 Empty, // Object represents an empty line
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
87 Unidentified, // Object is an uninitialized (SHOULD NEVER HAPPEN)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
88 NumTypes // Amount of object types
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
89 };
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
90
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
91 LDObject();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
92 virtual ~LDObject();
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
93
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
94 virtual LDObject* clone()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
95 { return 0; // Creates a new LDObject identical to this one.
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
96 }
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
97 long getIndex() const; // Index (i.e. line number) of this object
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
98 virtual LDObject::Type getType() const; // Type enumerator of this object
522
afa691788bdb - migrated selection from ForgeWindow to individual LDFiles. Should've done this long ago.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
99 const vertex& getVertex (int i) const; // Get a vertex by index
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
100 virtual bool hasMatrix() const; // Does this object have a matrix and position? (see LDMatrixObject)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
101 virtual void invert(); // Inverts this object (winding is reversed)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
102 virtual bool isColored() const; // Is this object colored?
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
103 virtual bool isScemantic() const; // Does this object have meaning in the part model?
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
104 virtual void move (vertex vect); // Moves this object using the given vertex as a movement List
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
105 LDObject* next() const; // Object after this in the current file
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
106 LDObject* prev() const; // Object prior to this in the current file
522
afa691788bdb - migrated selection from ForgeWindow to individual LDFiles. Should've done this long ago.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
107 virtual str raw() { return ""; } // This object as LDraw code
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
108 void replace (LDObject* other); // Replace this LDObject with another LDObject. Object is deleted in the process.
522
afa691788bdb - migrated selection from ForgeWindow to individual LDFiles. Should've done this long ago.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
109 void select();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
110 void setVertex (int i, const vertex& vert); // Set a vertex to the given value
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
111 void setVertexCoord (int i, Axis ax, double value); // Set a single coordinate of a vertex
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
112 void swap (LDObject* other); // Swap this object with another.
522
afa691788bdb - migrated selection from ForgeWindow to individual LDFiles. Should've done this long ago.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
113 LDObject* topLevelParent(); // What object in the current file ultimately references this?
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
114 virtual str typeName() const; // Type name of this object
522
afa691788bdb - migrated selection from ForgeWindow to individual LDFiles. Should've done this long ago.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
115 void unselect();
afa691788bdb - migrated selection from ForgeWindow to individual LDFiles. Should've done this long ago.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
116 virtual short vertices() const; // Number of vertices this object has
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
117
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
118 static str typeName (LDObject::Type type); // Get type name by enumerator
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
119 static LDObject* getDefault (const LDObject::Type type); // Returns a sample object by the given enumerator
504
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
120 static void moveObjects (QList<LDObject*> objs, const bool up); // TODO: move this to LDFile?
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
121 static str objectListContents (const QList<LDObject*>& objs); // Get a description of a list of LDObjects
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
122 static LDObject* fromID (int id);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
123
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
124 // TODO: make these private!
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
125 // OpenGL list for this object
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
126 uint glLists[4];
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
127
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
128 // Object list entry for this object
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
129 QListWidgetItem* qObjListEntry;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
130
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
131 protected:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
132 bool m_glinit;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
133 friend class GLRenderer;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
134
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
135 private:
516
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
136 LDSharedVertex* m_coords[4];
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
137 };
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
138
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
139 // =============================================================================
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
140 // LDSharedVertex
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
141 //
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
142 // For use as coordinates of LDObjects. Keeps count of references.
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
143 // -----------------------------------------------------------------------------
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
144 class LDSharedVertex
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
145 { public:
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
146 inline const vertex& data() const
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
147 { return m_data;
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
148 }
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
149
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
150 inline operator const vertex&() const
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
151 { return m_data;
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
152 }
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
153
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
154 void addRef (LDObject* a);
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
155 void delRef (LDObject* a);
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
156
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
157 static LDSharedVertex* getSharedVertex (const vertex& a);
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
158
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
159 protected:
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
160 LDSharedVertex (const vertex& a) : m_data (a) {}
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
161
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
162 private:
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
163 QList<LDObject*> m_refs;
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
164 vertex m_data;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
165 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
166
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
167 // =============================================================================
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
168 // LDMatrixObject
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
169 // =============================================================================
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
170 //
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
171 // Common code for objects with matrices. This class is multiple-derived in
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
172 // and thus not used directly other than as a common storage point for matrices
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
173 // and vertices.
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
174 //
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
175 // The link pointer is a pointer to this object's LDObject self - since this is
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
176 // multiple-derived in, static_cast or dynamic_cast won't budge here.
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
177 //
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
178 // In 0.1-alpha, there was a separate 'radial' type which had a position and
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
179 // matrix as well. Even though right now only LDSubfile uses this, I'm keeping
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
180 // this class distinct in case I get new extension ideas. :)
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
181 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
182 class LDMatrixObject
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
183 { DECLARE_PROPERTY (matrix, transform, setTransform)
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
184 PROPERTY (LDObject*, linkPointer, setLinkPointer)
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
185
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
186 public:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
187 LDMatrixObject() {}
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
188 LDMatrixObject (const matrix& transform, const vertex& pos) :
516
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
189 m_transform (transform), m_position (LDSharedVertex::getSharedVertex (pos)) {}
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
190
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
191 const vertex& position() const
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
192 { return m_position->data();
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
193 }
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
194
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
195 void setPosition (const vertex& a);
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
196
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
197 const double& setCoordinate (const Axis ax, double value)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
198 { vertex v = position();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
199 v[ax] = value;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
200 setPosition (v);
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
201
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
202 return position() [ax];
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
203 }
516
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
204
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
205 private:
d3373bc7ca3b - added LDSharedVertex class for holding copy-on-write vertices. Will need this for future features..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 506
diff changeset
206 LDSharedVertex* m_position;
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
207 };
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
208
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
209 // =============================================================================
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
210 // LDError
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
211 //
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
212 // Represents a line in the LDraw file that could not be properly parsed. It is
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
213 // represented by a (!) ERROR in the code view. It exists for the purpose of
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
214 // allowing garbage lines be debugged and corrected within LDForge. The member
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
215 // zContent contains the contents of the unparsable line.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
216 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
217 class LDError : public LDObject
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
218 { LDOBJ (Error)
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
219 LDOBJ_NAME (error)
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
220 LDOBJ_VERTICES (0)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
221 LDOBJ_UNCOLORED
214
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
222 LDOBJ_SCEMANTIC
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
223 LDOBJ_NO_MATRIX
429
3488534b2b31 More work on downloading
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
224 PROPERTY (str, fileRef, setFileRef)
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
225
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
226 public:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
227 LDError();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
228 LDError (str contents, str reason) : contents (contents), reason (reason) {}
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
229
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
230 // Content of this unknown line
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
231 str contents;
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
232
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
233 // Why is this gibberish?
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
234 str reason;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
235 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
236
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
237 // =============================================================================
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
238 // LDEmpty
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
239 //
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
240 // Represents an empty line in the LDraw code file.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
241 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
242 class LDEmpty : public LDObject
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
243 { LDOBJ (Empty)
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
244 LDOBJ_VERTICES (0)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
245 LDOBJ_UNCOLORED
214
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
246 LDOBJ_NON_SCEMANTIC
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
247 LDOBJ_NO_MATRIX
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
248 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
249
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
250 // =============================================================================
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
251 // LDComment
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
252 //
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
253 // Represents a code-0 comment in the LDraw code file. Member text contains
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
254 // the text of the comment.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
255 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
256 class LDComment : public LDObject
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
257 { LDOBJ (Comment)
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
258 LDOBJ_NAME (comment)
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
259 LDOBJ_VERTICES (0)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
260 LDOBJ_UNCOLORED
214
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
261 LDOBJ_NON_SCEMANTIC
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
262 LDOBJ_NO_MATRIX
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
263
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
264 public:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
265 LDComment() {}
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
266 LDComment (str text) : text (text) {}
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
267
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
268 str text; // The text of this comment
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
269 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
270
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
271 // =============================================================================
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
272 // LDBFC
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
273 //
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
274 // Represents a 0 BFC statement in the LDraw code. eStatement contains the type
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
275 // of this statement.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
276 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
277 class LDBFC : public LDObject
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
278 { public:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
279 enum Type
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
280 { CertifyCCW,
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
281 CCW,
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
282 CertifyCW,
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
283 CW,
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
284 NoCertify,
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
285 InvertNext,
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
286 Clip,
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
287 ClipCCW,
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
288 ClipCW,
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
289 NoClip,
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
290 NumStatements
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
291 };
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
292
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
293 LDOBJ (BFC)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
294 LDOBJ_NAME (bfc)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
295 LDOBJ_VERTICES (0)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
296 LDOBJ_UNCOLORED
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
297 LDOBJ_CUSTOM_SCEMANTIC { return (type == InvertNext); }
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
298 LDOBJ_NO_MATRIX
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
299
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
300 public:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
301 LDBFC() {}
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
302 LDBFC (const LDBFC::Type type) : type (type) {}
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
303
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
304 // Statement strings
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
305 static const char* statements[];
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
306
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
307 Type type;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
308 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
309
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
310 // =============================================================================
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
311 // LDSubfile
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
312 //
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
313 // Represents a single code-1 subfile reference.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
314 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
315 class LDSubfile : public LDObject, public LDMatrixObject
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
316 { LDOBJ (Subfile)
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
317 LDOBJ_NAME (subfile)
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
318 LDOBJ_VERTICES (0)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
319 LDOBJ_COLORED
214
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
320 LDOBJ_SCEMANTIC
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
321 LDOBJ_HAS_MATRIX
409
8da2563c645a Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
322 PROPERTY (LDFile*, fileInfo, setFileInfo)
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
323
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
324 public:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
325 enum InlineFlag
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
326 { DeepInline = (1 << 0),
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
327 CacheInline = (1 << 1),
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
328 RendererInline = (1 << 2),
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
329
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
330 DeepCacheInline = DeepInline | CacheInline,
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
331 };
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
332
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
333 Q_DECLARE_FLAGS (InlineFlags, InlineFlag)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
334
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
335 LDSubfile()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
336 { setLinkPointer (this);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
337 }
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
338
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
339 // Inlines this subfile. Note that return type is an array of heap-allocated
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
340 // LDObject-clones, they must be deleted one way or another.
504
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
341 QList<LDObject*> inlineContents (InlineFlags flags);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
342 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
343
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
344 Q_DECLARE_OPERATORS_FOR_FLAGS (LDSubfile::InlineFlags)
459
51cca3ce540d Use QFlags for the inlining flags, type-safety++
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
345
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
346 // =============================================================================
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
347 // LDLine
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
348 //
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
349 // Represents a single code-2 line in the LDraw code file. v0 and v1 are the end
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
350 // points of the line. The line is colored with dColor unless uncolored mode is
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
351 // set.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
352 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
353 class LDLine : public LDObject
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
354 { LDOBJ (Line)
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
355 LDOBJ_NAME (line)
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
356 LDOBJ_VERTICES (2)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
357 LDOBJ_COLORED
214
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
358 LDOBJ_SCEMANTIC
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
359 LDOBJ_NO_MATRIX
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
360
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
361 public:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
362 LDLine() {}
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
363 LDLine (vertex v1, vertex v2);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
364 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
365
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
366 // =============================================================================
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
367 // LDCndLine
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
368 //
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
369 // Represents a single code-5 conditional line. The end-points v0 and v1 are
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
370 // inherited from LDLine, c0 and c1 are the control points of this line.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
371 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
372 class LDCndLine : public LDLine
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
373 { LDOBJ (CndLine)
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
374 LDOBJ_NAME (condline)
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
375 LDOBJ_VERTICES (4)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
376 LDOBJ_COLORED
214
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
377 LDOBJ_SCEMANTIC
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
378 LDOBJ_NO_MATRIX
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
379
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
380 public:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
381 LDCndLine() {}
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
382 LDLine* demote();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
383 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
384
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
385 // =============================================================================
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
386 // LDTriangle
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
387 //
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
388 // Represents a single code-3 triangle in the LDraw code file. Vertices v0, v1
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
389 // and v2 contain the end-points of this triangle. dColor is the color the
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
390 // triangle is colored with.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
391 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
392 class LDTriangle : public LDObject
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
393 { LDOBJ (Triangle)
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
394 LDOBJ_NAME (triangle)
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
395 LDOBJ_VERTICES (3)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
396 LDOBJ_COLORED
214
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
397 LDOBJ_SCEMANTIC
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
398 LDOBJ_NO_MATRIX
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
399
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
400 public:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
401 LDTriangle() {}
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
402 LDTriangle (vertex v0, vertex v1, vertex v2)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
403 { setVertex (0, v0);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
404 setVertex (1, v1);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
405 setVertex (2, v2);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
406 }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
407 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
408
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
409 // =============================================================================
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
410 // LDQuad
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
411 //
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
412 // Represents a single code-4 quadrilateral. v0, v1, v2 and v3 are the end points
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
413 // of the quad, dColor is the color used for the quad.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
414 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
415 class LDQuad : public LDObject
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
416 { LDOBJ (Quad)
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
417 LDOBJ_NAME (quad)
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
418 LDOBJ_VERTICES (4)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
419 LDOBJ_COLORED
214
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
420 LDOBJ_SCEMANTIC
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
421 LDOBJ_NO_MATRIX
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
422
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
423 public:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
424 LDQuad() {}
506
525f6c48db83 Added last-resort ring draw with quads
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
425 LDQuad (const vertex& v0, const vertex& v1, const vertex& v2, const vertex& v3);
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
426
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
427 // Split this quad into two triangles (note: heap-allocated)
504
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
428 QList<LDTriangle*> splitToTriangles();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
429 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
430
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
431 // =============================================================================
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
432 // LDVertex
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
433 //
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
434 // The vertex is an LDForce-specific extension which represents a single
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
435 // vertex which can be used as a parameter to tools or to store coordinates
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
436 // with. Vertices are a part authoring tool and they should not appear in
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
437 // finished parts.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
438 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
439 class LDVertex : public LDObject
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
440 { LDOBJ (Vertex)
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
441 LDOBJ_NAME (vertex)
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
442 LDOBJ_VERTICES (0) // TODO: move pos to vaCoords[0]
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
443 LDOBJ_COLORED
214
28e0b37156be Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
444 LDOBJ_NON_SCEMANTIC
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
445 LDOBJ_NO_MATRIX
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
446
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
447 public:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
448 LDVertex() {}
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
449
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
450 vertex pos;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
451 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
452
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
453 // =============================================================================
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 459
diff changeset
454 // LDOverlay
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
455 //
316
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
456 // Overlay image meta, stored in the header of parts so as to preserve overlay
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
457 // information.
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
458 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
459 class LDOverlay : public LDObject
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
460 { LDOBJ (Overlay)
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
461 LDOBJ_NAME (overlay)
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
462 LDOBJ_VERTICES (0)
316
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
463 LDOBJ_UNCOLORED
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
464 LDOBJ_NON_SCEMANTIC
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
465 LDOBJ_NO_MATRIX
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
466 PROPERTY (int, camera, setCamera)
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
467 PROPERTY (int, x, setX)
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
468 PROPERTY (int, y, setY)
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
469 PROPERTY (int, width, setWidth)
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
470 PROPERTY (int, height, setHeight)
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 367
diff changeset
471 PROPERTY (str, filename, setFilename)
316
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
472 };
b4fefda58f43 Made overlay data be contained in the part files, still wip
Santeri Piippo <crimsondusk64@gmail.com>
parents: 312
diff changeset
473
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 377
diff changeset
474 // Other common LDraw stuff
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 377
diff changeset
475 static const str CALicense = "!LICENSE Redistributable under CCAL version 2.0 : see CAreadme.txt",
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
476 NonCALicense = "!LICENSE Not redistributable : see NonCAreadme.txt";
381
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 377
diff changeset
477 static const short lores = 16;
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 377
diff changeset
478 static const short hires = 48;
241f65769a57 restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 377
diff changeset
479
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
480 #endif // LDTYPES_H

mercurial