# HG changeset patch # User Santeri Piippo # Date 1375441094 -10800 # Node ID c435027ee5cd924b88301b0334354776e98302a9 # Parent 14bfeed046f31fd751ee9b81e55383e50a0ea6bc added support for BFC CLIP/NOCLIP diff -r 14bfeed046f3 -r c435027ee5cd changelog.txt --- a/changelog.txt Thu Aug 01 17:00:14 2013 +0300 +++ b/changelog.txt Fri Aug 02 13:58:14 2013 +0300 @@ -10,6 +10,8 @@ - Fixed: "Hi-Res" was not prepended to the names of 48/ primitives. - Fixed: Checking the Hi-Res option would not allow segment values over 16. - Added support for multiple spaces before the ring number. +- Added support for '0 BFC CLIP' and '0 BFC NOCLIP' and added auto-correction + from errorneous MLCAD syntax ('0 BFC CERTIFY CLIP'). ================================================= == Changes in version 0.2-alpha diff -r 14bfeed046f3 -r c435027ee5cd src/addObjectDialog.cpp --- a/src/addObjectDialog.cpp Thu Aug 01 17:00:14 2013 +0300 +++ b/src/addObjectDialog.cpp Fri Aug 02 13:58:14 2013 +0300 @@ -83,8 +83,13 @@ case LDObject::BFC: rb_bfcType = new RadioBox ("Statement", {}, 0, Qt::Vertical); - for (int i = 0; i < LDBFCObject::NumStatements; ++i) + for (int i = 0; i < LDBFCObject::NumStatements; ++i) { + // Separate these in two columns + if (i == LDBFCObject::NumStatements / 2) + rb_bfcType->rowBreak(); + rb_bfcType->addButton (LDBFCObject::statements[i]); + } if (obj) rb_bfcType->setValue ((int) static_cast (obj)->type); diff -r 14bfeed046f3 -r c435027ee5cd src/file.cpp --- a/src/file.cpp Thu Aug 01 17:00:14 2013 +0300 +++ b/src/file.cpp Fri Aug 02 13:58:14 2013 +0300 @@ -642,9 +642,19 @@ // MLCAD is notorious for stuffing these statements in parts it // creates. The above block only handles valid statements, so we - // need to handle MLCAD-style invertnext separately. - if (comm == "BFC CERTIFY INVERTNEXT") - return new LDBFCObject (LDBFCObject::InvertNext); + // need to handle MLCAD-style invertnext, clip and noclip separately. + struct { + const char* a; + LDBFCObject::Type b; + } BFCData[] = { + { "INVERTNEXT", LDBFCObject::InvertNext }, + { "NOCLIP", LDBFCObject::NoClip }, + { "CLIP", LDBFCObject::Clip } + }; + + for (const auto& i : BFCData) + if (comm == fmt ("BFC CERTIFY %1", i.a)) + return new LDBFCObject (i.b); } if (tokens.size() > 2 && tokens[1] == "!LDFORGE") { diff -r 14bfeed046f3 -r c435027ee5cd src/gldraw.cpp --- a/src/gldraw.cpp Thu Aug 01 17:00:14 2013 +0300 +++ b/src/gldraw.cpp Fri Aug 02 13:58:14 2013 +0300 @@ -741,6 +741,8 @@ break; case LDObject::CondLine: + // Draw conditional lines with a dash pattern - however, use a full + // line when drawing a pick list to make selecting them easier. if (list != GL::PickList) { glLineStipple (1, 0x6666); glEnable (GL_LINE_STIPPLE); @@ -782,40 +784,6 @@ } break; -#if 0 - TODO: find a proper way to draw vertices without having them be affected by zoom. - case LDObject::Vertex: - { - LDVertex* pVert = static_cast (obj); - LDTriangle* pPoly; - vertex* vPos = &(pVert->pos); - const double fPolyScale = max (fZoom, 1.0); - -#define BIPYRAMID_COORD(N) ((((i + N) % 4) >= 2 ? 1 : -1) * 0.3f * fPolyScale) - - for (int i = 0; i < 8; ++i) { - pPoly = new LDTriangle; - pPoly->coords[0] = {vPos->x, vPos->y + ((i >= 4 ? 1 : -1) * 0.4f * fPolyScale), vPos->z}; - pPoly->coords[1] = { - vPos->x + BIPYRAMID_COORD (0), - vPos->y, - vPos->z + BIPYRAMID_COORD (1) - }; - - pPoly->coords[2] = { - vPos->x + BIPYRAMID_COORD (1), - vPos->y, - vPos->z + BIPYRAMID_COORD (2) - }; - - pPoly->dColor = pVert->dColor; - compileOneObject (pPoly, list); - delete pPoly; - } - } - break; -#endif // 0 - default: break; } diff -r 14bfeed046f3 -r c435027ee5cd src/ldtypes.cpp --- a/src/ldtypes.cpp Thu Aug 01 17:00:14 2013 +0300 +++ b/src/ldtypes.cpp Fri Aug 02 13:58:14 2013 +0300 @@ -159,6 +159,10 @@ "CW", "NOCERTIFY", "INVERTNEXT", + "CLIP", + "CLIP CCW", + "CLIP CW", + "NOCLIP", }; str LDBFCObject::raw() { diff -r 14bfeed046f3 -r c435027ee5cd src/ldtypes.h --- a/src/ldtypes.h Thu Aug 01 17:00:14 2013 +0300 +++ b/src/ldtypes.h Fri Aug 02 13:58:14 2013 +0300 @@ -241,6 +241,10 @@ CW, NoCertify, InvertNext, + Clip, + ClipCCW, + ClipCW, + NoClip, NumStatements };