diff --git a/toonz/sources/common/tgl/tgl.cpp b/toonz/sources/common/tgl/tgl.cpp index 705c47a..88c6989 100644 --- a/toonz/sources/common/tgl/tgl.cpp +++ b/toonz/sources/common/tgl/tgl.cpp @@ -123,34 +123,6 @@ void tglDrawSegment(const TPointD &p1, const TPointD &p2) { //----------------------------------------------------------------------------- -void tglDrawDoubleSegment(const TPointD &p1, const TPointD &p2) { - double color[4] = {}; - double width = 1.0; - glGetDoublev(GL_CURRENT_COLOR, color); - glGetDoublev(GL_LINE_WIDTH, &width); - if (width < 1.0) width = 1.0; - - TPointD d = p2 - p1; - double k = sqrt(d.x*d.x + d.y*d.y); - if (k <= 1e-9) return; - k = 0.5*width/k; - TPointD offset(-k*d.y, k*d.x); - - glColor4d(1.0 - color[0], 1.0 - color[1], 1.0 - color[2], color[3]); - glBegin(GL_LINES); - tglVertex(p1 - offset); - tglVertex(p2 - offset); - glEnd(); - - glColor4dv(color); - glBegin(GL_LINES); - tglVertex(p1 + offset); - tglVertex(p2 + offset); - glEnd(); -} - -//----------------------------------------------------------------------------- - void tglDrawCircle(const TPointD ¢er, double radius) { if (radius <= 0) return; diff --git a/toonz/sources/include/tgl.h b/toonz/sources/include/tgl.h index 67435ea..5c993b1 100644 --- a/toonz/sources/include/tgl.h +++ b/toonz/sources/include/tgl.h @@ -141,11 +141,6 @@ DVAPI void tglDrawDisk(const TPointD &c, double r); */ DVAPI void tglDrawSegment(const TPointD &p1, const TPointD &p2); -/*! - Draw a segment pair - positive and negative. - */ -DVAPI void tglDrawDoubleSegment(const TPointD &p1, const TPointD &p2); - inline void tglDrawSegment(const TPoint &p1, const TPoint &p2) { tglDrawSegment(convert(p1), convert(p2)); } diff --git a/toonz/sources/tnztools/inputmanager.cpp b/toonz/sources/tnztools/inputmanager.cpp index 76ef14a..0cb6bc7 100644 --- a/toonz/sources/tnztools/inputmanager.cpp +++ b/toonz/sources/tnztools/inputmanager.cpp @@ -638,6 +638,9 @@ TInputManager::draw() { glPushAttrib(GL_ALL_ATTRIB_BITS); tglEnableBlending(); tglEnableLineSmooth(true, 0.5); + double pixelSize = sqrt(tglGetPixelSize2()); + double colorBlack[4] = { 0.0, 0.0, 0.0, 1.0 }; + double colorWhite[4] = { 1.0, 1.0, 1.0, 1.0 }; for(TTrackList::const_iterator ti = getOutputTracks().begin(); ti != getOutputTracks().end(); ++ti) { TTrack &track = **ti; if (TrackHandler *handler = dynamic_cast(track.handler.getPointer())) { @@ -645,14 +648,24 @@ TInputManager::draw() { if (start < 0) start = 0; if (start + 1 < track.size()) { int level = m_savePointsSent; - double alpha = 1.0; - glColor4d(1.0, 1.0, 1.0, alpha); + colorBlack[3] = (colorWhite[3] = 0.8); for(int i = start + 1; i < track.size(); ++i) { - while(level < (int)handler->saves.size() && handler->saves[level] <= i) { - glColor4d(1.0, 1.0, 1.0, alpha *= 1.0); - ++level; + while(level < (int)handler->saves.size() && handler->saves[level] <= i) + colorBlack[3] = (colorWhite[3] *= 0.8), ++level; + + const TPointD &a = track[i-1].position; + const TPointD &b = track[i].position; + TPointD d = b - a; + + double k = norm2(d); + if (k > TConsts::epsilon*TConsts::epsilon) { + double k = 0.5*pixelSize/sqrt(k); + d = TPointD(-k*d.y, k*d.x); + glColor4dv(colorWhite); + tglDrawSegment(a - d, b - d); + glColor4dv(colorBlack); + tglDrawSegment(a + d, b + d); } - tglDrawDoubleSegment(track[i-1].position, track[i].position); } } }