src/ldtypes.h

changeset 188
4e686b771996
parent 185
6fea53f1ffc2
child 191
9bb6a17305ad
equal deleted inserted replaced
187:ee42f4442566 188:4e686b771996
79 // Index (i.e. line number) of this object 79 // Index (i.e. line number) of this object
80 long getIndex (OpenFile* pFile); 80 long getIndex (OpenFile* pFile);
81 81
82 // Color used by this object. Comments, gibberish and empty entries 82 // Color used by this object. Comments, gibberish and empty entries
83 // do not use this field. 83 // do not use this field.
84 short dColor; 84 short color;
85 85
86 // OpenGL list for this object 86 // OpenGL list for this object
87 uint glLists[3]; 87 uint glLists[3];
88 88
89 // Vertices of this object 89 // Vertices of this object
90 vertex vaCoords[4]; 90 vertex coords[4];
91 91
92 // Object this object was referenced from, if any 92 // Object this object was referenced from, if any
93 LDObject* parent; 93 LDObject* parent;
94 94
95 // Type enumerator of this object 95 // Type enumerator of this object
113 113
114 // Swap this object with another. 114 // Swap this object with another.
115 void swap (LDObject* other); 115 void swap (LDObject* other);
116 116
117 // Moves this object using the given vertex as a movement vector 117 // Moves this object using the given vertex as a movement vector
118 virtual void move (vertex vVector); 118 virtual void move (vertex vect);
119 119
120 // What object in the current file ultimately references this? 120 // What object in the current file ultimately references this?
121 LDObject* topLevelParent (); 121 LDObject* topLevelParent ();
122 122
123 // Number of vertices this object has 123 // Number of vertices this object has
163 LDOBJ_SCHEMANTIC 163 LDOBJ_SCHEMANTIC
164 164
165 LDGibberish (str _zContent, str _zReason); 165 LDGibberish (str _zContent, str _zReason);
166 166
167 // Content of this unknown line 167 // Content of this unknown line
168 str zContents; 168 str contents;
169 169
170 // Why is this gibberish? 170 // Why is this gibberish?
171 str zReason; 171 str reason;
172 }; 172 };
173 173
174 // ============================================================================= 174 // =============================================================================
175 // LDEmptyLine 175 // LDEmptyLine
176 // 176 //
193 public: 193 public:
194 IMPLEMENT_LDTYPE (Comment, 0) 194 IMPLEMENT_LDTYPE (Comment, 0)
195 LDOBJ_UNCOLORED 195 LDOBJ_UNCOLORED
196 LDOBJ_NON_SCHEMANTIC 196 LDOBJ_NON_SCHEMANTIC
197 197
198 LDComment (str zText) : text (zText) {} 198 LDComment (str text) : text (text) {}
199 199
200 str text; // The text of this comment 200 str text; // The text of this comment
201 }; 201 };
202 202
203 // ============================================================================= 203 // =============================================================================
220 220
221 IMPLEMENT_LDTYPE (BFC, 0) 221 IMPLEMENT_LDTYPE (BFC, 0)
222 LDOBJ_UNCOLORED 222 LDOBJ_UNCOLORED
223 LDOBJ_CUSTOM_SCHEMANTIC { return (type == InvertNext); } 223 LDOBJ_CUSTOM_SCHEMANTIC { return (type == InvertNext); }
224 224
225 LDBFC (const LDBFC::Type eType) : type (eType) {} 225 LDBFC (const LDBFC::Type type) : type (type) {}
226 226
227 // Statement strings 227 // Statement strings
228 static const char* statements[]; 228 static const char* statements[];
229 229
230 Type type; 230 Type type;
239 public: 239 public:
240 IMPLEMENT_LDTYPE (Subfile, 0) 240 IMPLEMENT_LDTYPE (Subfile, 0)
241 LDOBJ_COLORED 241 LDOBJ_COLORED
242 LDOBJ_SCHEMANTIC 242 LDOBJ_SCHEMANTIC
243 243
244 vertex vPosition; // Position of the subpart (FIXME: should get rid of this) 244 vertex pos; // Position of the subpart (TODO: should get rid of this)
245 matrix<3> mMatrix; // Transformation matrix for the subpart 245 matrix<3> transform; // Transformation matrix for the subpart
246 str zFileName; // Filename of the subpart 246 str fileName; // Filename of the subpart (TODO: rid this too - use fileInfo->fileName instead)
247 OpenFile* pFile; // Pointer to opened file for this subfile. null if unopened. 247 OpenFile* fileInfo; // Pointer to opened file for this subfile. null if unopened.
248 248
249 // Inlines this subfile. Note that return type is an array of heap-allocated 249 // Inlines this subfile. Note that return type is an array of heap-allocated
250 // LDObject-clones, they must be deleted one way or another. 250 // LDObject-clones, they must be deleted one way or another.
251 std::vector<LDObject*> inlineContents (bool bDeepInline, bool bCache); 251 std::vector<LDObject*> inlineContents (bool deep, bool cache);
252 }; 252 };
253 253
254 // ============================================================================= 254 // =============================================================================
255 // LDLine 255 // LDLine
256 // 256 //
292 IMPLEMENT_LDTYPE (Triangle, 3) 292 IMPLEMENT_LDTYPE (Triangle, 3)
293 LDOBJ_COLORED 293 LDOBJ_COLORED
294 LDOBJ_SCHEMANTIC 294 LDOBJ_SCHEMANTIC
295 295
296 LDTriangle (vertex _v0, vertex _v1, vertex _v2) { 296 LDTriangle (vertex _v0, vertex _v1, vertex _v2) {
297 vaCoords[0] = _v0; 297 coords[0] = _v0;
298 vaCoords[1] = _v1; 298 coords[1] = _v1;
299 vaCoords[2] = _v2; 299 coords[2] = _v2;
300 } 300 }
301 }; 301 };
302 302
303 // ============================================================================= 303 // =============================================================================
304 // LDQuad 304 // LDQuad
324 // with. Vertices are a part authoring tool and they should not appear in 324 // with. Vertices are a part authoring tool and they should not appear in
325 // finished parts. 325 // finished parts.
326 // ============================================================================= 326 // =============================================================================
327 class LDVertex : public LDObject { 327 class LDVertex : public LDObject {
328 public: 328 public:
329 IMPLEMENT_LDTYPE (Vertex, 0) // TODO: move vPosition to vaCoords[0] 329 IMPLEMENT_LDTYPE (Vertex, 0) // TODO: move pos to vaCoords[0]
330 LDOBJ_COLORED 330 LDOBJ_COLORED
331 LDOBJ_NON_SCHEMANTIC 331 LDOBJ_NON_SCHEMANTIC
332 332
333 vertex vPosition; 333 vertex pos;
334 }; 334 };
335 335
336 // ============================================================================= 336 // =============================================================================
337 // LDRadial 337 // LDRadial
338 // 338 //
356 356
357 IMPLEMENT_LDTYPE (Radial, 0) 357 IMPLEMENT_LDTYPE (Radial, 0)
358 LDOBJ_COLORED 358 LDOBJ_COLORED
359 LDOBJ_SCHEMANTIC 359 LDOBJ_SCHEMANTIC
360 360
361 LDRadial::Type eRadialType; 361 LDRadial::Type radType;
362 vertex vPosition; 362 vertex pos;
363 matrix<3> mMatrix; 363 matrix<3> transform;
364 short dDivisions, dSegments, dRingNum; 364 short divs, segs, ringNum;
365 365
366 LDRadial (LDRadial::Type eRadialType, vertex vPosition, matrix<3> mMatrix, 366 LDRadial (LDRadial::Type radType, vertex pos, matrix<3> transform, short divs, short segs, short ringNum) :
367 short dDivisions, short dSegments, short dRingNum) : 367 radType (radType), pos (pos), transform (transform), divs (divs), segs (segs), ringNum (ringNum) {}
368 eRadialType (eRadialType), vPosition (vPosition), mMatrix (mMatrix),
369 dDivisions (dDivisions), dSegments (dSegments), dRingNum (dRingNum) {}
370 368
371 // Returns a set of objects that provide the equivalent of this radial. 369 // Returns a set of objects that provide the equivalent of this radial.
372 // Note: objects are heap-allocated. 370 // Note: objects are heap-allocated.
373 std::vector<LDObject*> decompose (bool bTransform); 371 std::vector<LDObject*> decompose (bool applyTransform);
374 372
375 // Compose a file name for this radial. 373 // Compose a file name for this radial.
376 str makeFileName (); 374 str makeFileName ();
377 375
378 char const* radialTypeName (); 376 char const* radialTypeName ();
379 static char const* radialTypeName (const LDRadial::Type eType); 377 static char const* radialTypeName (const LDRadial::Type type);
380 }; 378 };
381 379
382 // ============================================================================= 380 // =============================================================================
383 // Object type names. Pass the return value of getType as the index to get a 381 // Object type names. Pass the return value of getType as the index to get a
384 // string representation of the object's type. 382 // string representation of the object's type.

mercurial