src/primitives.cpp

changeset 460
b230ae09c8e5
parent 455
c5d14d112034
child 461
fbcc91ae1dd2
equal deleted inserted replaced
459:51cca3ce540d 460:b230ae09c8e5
309 switch (type) { 309 switch (type) {
310 case Circle: { 310 case Circle: {
311 vertex v0 (x0, 0.0f, z0), 311 vertex v0 (x0, 0.0f, z0),
312 v1 (x1, 0.0f, z1); 312 v1 (x1, 0.0f, z1);
313 313
314 LDLineObject* line = new LDLineObject; 314 LDLine* line = new LDLine;
315 line->setVertex (0, v0); 315 line->setVertex (0, v0);
316 line->setVertex (1, v1); 316 line->setVertex (1, v1);
317 line->setColor (edgecolor); 317 line->setColor (edgecolor);
318 objs << line; 318 objs << line;
319 } 319 }
356 vertex v0 (x0, y0, z0), 356 vertex v0 (x0, y0, z0),
357 v1 (x1, y1, z1), 357 v1 (x1, y1, z1),
358 v2 (x2, y2, z2), 358 v2 (x2, y2, z2),
359 v3 (x3, y3, z3); 359 v3 (x3, y3, z3);
360 360
361 LDQuadObject* quad = new LDQuadObject; 361 LDQuad* quad = new LDQuad;
362 quad->setColor (maincolor); 362 quad->setColor (maincolor);
363 quad->setVertex (0, v0); 363 quad->setVertex (0, v0);
364 quad->setVertex (1, v1); 364 quad->setVertex (1, v1);
365 quad->setVertex (2, v2); 365 quad->setVertex (2, v2);
366 quad->setVertex (3, v3); 366 quad->setVertex (3, v3);
391 v1 (x1, 0.0f, z1), 391 v1 (x1, 0.0f, z1),
392 v2 (x2, 0.0f, z2); 392 v2 (x2, 0.0f, z2);
393 393
394 // Disc negatives need to go the other way around, otherwise 394 // Disc negatives need to go the other way around, otherwise
395 // they'll end up upside-down. 395 // they'll end up upside-down.
396 LDTriangleObject* seg = new LDTriangleObject; 396 LDTriangle* seg = new LDTriangle;
397 seg->setColor (maincolor); 397 seg->setColor (maincolor);
398 seg->setVertex (type == Disc ? 0 : 2, v0); 398 seg->setVertex (type == Disc ? 0 : 2, v0);
399 seg->setVertex (1, v1); 399 seg->setVertex (1, v1);
400 seg->setVertex (type == Disc ? 2 : 0, v2); 400 seg->setVertex (type == Disc ? 2 : 0, v2);
401 objs << seg; 401 objs << seg;
425 v0[X] *= num; 425 v0[X] *= num;
426 v0[Y] = 1.0f; 426 v0[Y] = 1.0f;
427 v0[Z] *= num; 427 v0[Z] *= num;
428 } 428 }
429 429
430 LDCondLineObject* line = new LDCondLineObject; 430 LDCndLine* line = new LDCndLine;
431 line->setColor (edgecolor); 431 line->setColor (edgecolor);
432 line->setVertex (0, v0); 432 line->setVertex (0, v0);
433 line->setVertex (1, v1); 433 line->setVertex (1, v1);
434 line->setVertex (2, v2); 434 line->setVertex (2, v2);
435 line->setVertex (3, v3); 435 line->setVertex (3, v3);
522 descr.insert (0, "Hi-Res "); 522 descr.insert (0, "Hi-Res ");
523 523
524 LDFile* f = new LDFile; 524 LDFile* f = new LDFile;
525 f->setName (QFileDialog::getSaveFileName (null, QObject::tr ("Save Primitive"), name)); 525 f->setName (QFileDialog::getSaveFileName (null, QObject::tr ("Save Primitive"), name));
526 526
527 *f << new LDCommentObject (descr); 527 *f << new LDComment (descr);
528 *f << new LDCommentObject (fmt ("Name: %1", name)); 528 *f << new LDComment (fmt ("Name: %1", name));
529 *f << new LDCommentObject (fmt ("Author: LDForge")); 529 *f << new LDComment (fmt ("Author: LDForge"));
530 *f << new LDCommentObject (fmt ("!LDRAW_ORG Unofficial_%1Primitive", divs == hires ? "48_" : "")); 530 *f << new LDComment (fmt ("!LDRAW_ORG Unofficial_%1Primitive", divs == hires ? "48_" : ""));
531 *f << new LDCommentObject (CALicense); 531 *f << new LDComment (CALicense);
532 *f << new LDEmptyObject; 532 *f << new LDEmpty;
533 *f << new LDBFCObject (LDBFCObject::CertifyCCW); 533 *f << new LDBFC (LDBFC::CertifyCCW);
534 *f << new LDEmptyObject; 534 *f << new LDEmpty;
535 *f << makePrimitive (type, segs, divs, num); 535 *f << makePrimitive (type, segs, divs, num);
536 536
537 g_win->save (f, false); 537 g_win->save (f, false);
538 delete f; 538 delete f;
539 } 539 }

mercurial