91 |
91 |
92 public: |
92 public: |
93 // Object type codes. Codes are sorted in order of significance. |
93 // Object type codes. Codes are sorted in order of significance. |
94 enum Type { |
94 enum Type { |
95 Subfile, // Object represents a sub-file reference |
95 Subfile, // Object represents a sub-file reference |
96 Radial, // Object represents a generic radial |
|
97 Quad, // Object represents a quadrilateral |
96 Quad, // Object represents a quadrilateral |
98 Triangle, // Object represents a triangle |
97 Triangle, // Object represents a triangle |
99 Line, // Object represents a line |
98 Line, // Object represents a line |
100 CondLine, // Object represents a conditional line |
99 CondLine, // Object represents a conditional line |
101 Vertex, // Object is a vertex, LDForge extension object |
100 Vertex, // Object is a vertex, LDForge extension object |
388 |
387 |
389 vertex pos; |
388 vertex pos; |
390 }; |
389 }; |
391 |
390 |
392 // ============================================================================= |
391 // ============================================================================= |
393 // LDRadial |
|
394 // |
|
395 // The generic radial primitive (radial for short) is another LDforge-specific |
|
396 // extension which represents an arbitrary circular primitive. Radials can appear |
|
397 // as circles, cylinders, rings, cones, discs and disc negatives; the point is to |
|
398 // allow part authors to add radial primitives to parts without much hassle about |
|
399 // non-existant primitive parts. |
|
400 // ============================================================================= |
|
401 class LDRadial : public LDObject, public LDMatrixObject { |
|
402 public: |
|
403 enum Type { |
|
404 Circle, |
|
405 Cylinder, |
|
406 Disc, |
|
407 DiscNeg, |
|
408 Ring, |
|
409 Cone, |
|
410 NumTypes |
|
411 }; |
|
412 |
|
413 PROPERTY (LDRadial::Type, type, setType) |
|
414 PROPERTY (short, divisions, setDivisions) |
|
415 PROPERTY (short, segments, setSegments) |
|
416 PROPERTY (short, number, setNumber) |
|
417 |
|
418 public: |
|
419 LDOBJ (Radial) |
|
420 LDOBJ_VERTICES (0) |
|
421 LDOBJ_COLORED |
|
422 LDOBJ_SCEMANTIC |
|
423 LDOBJ_HAS_MATRIX |
|
424 |
|
425 LDRadial () { setLinkPointer (this); } |
|
426 LDRadial (LDRadial::Type radType, vertex pos, matrix transform, short divs, short segs, short ringNum) : |
|
427 LDMatrixObject (transform, pos), PROP_NAME (type) (radType), PROP_NAME (divisions) (divs), |
|
428 PROP_NAME (segments) (segs), PROP_NAME (number) (ringNum) |
|
429 { |
|
430 setLinkPointer (this); |
|
431 } |
|
432 |
|
433 // Returns a set of objects that provide the equivalent of this radial. |
|
434 // Note: objects are heap-allocated. |
|
435 vector<LDObject*> decompose (bool applyTransform); |
|
436 |
|
437 // Compose a file name for this radial. |
|
438 str makeFileName (); |
|
439 |
|
440 char const* radialTypeName (); |
|
441 static char const* radialTypeName (const LDRadial::Type type); |
|
442 }; |
|
443 |
|
444 // ============================================================================= |
|
445 // Object type names. Pass the return value of getType as the index to get a |
392 // Object type names. Pass the return value of getType as the index to get a |
446 // string representation of the object's type. |
393 // string representation of the object's type. |
447 extern const char* g_saObjTypeNames[]; |
394 extern const char* g_saObjTypeNames[]; |
448 |
395 |
449 // Icons for these types |
396 // Icons for these types |