src/glRenderer.cpp

changeset 966
a834e43a57da
parent 962
a4b463a7ee82
child 967
eb586d3e1a6a
equal deleted inserted replaced
965:d1b0aa40db91 966:a834e43a57da
483 // ============================================================================= 483 // =============================================================================
484 // 484 //
485 void GLRenderer::drawVBOs (EVBOSurface surface, EVBOComplement colors, GLenum type) 485 void GLRenderer::drawVBOs (EVBOSurface surface, EVBOComplement colors, GLenum type)
486 { 486 {
487 // Filter this through some configuration options 487 // Filter this through some configuration options
488 if ((Eq (surface, VBOSF_Quads, VBOSF_Triangles) and cfg::DrawSurfaces == false) or 488 if ((isOneOf (surface, VBOSF_Quads, VBOSF_Triangles) and cfg::DrawSurfaces == false) or
489 (surface == VBOSF_Lines and cfg::DrawEdgeLines == false) or 489 (surface == VBOSF_Lines and cfg::DrawEdgeLines == false) or
490 (surface == VBOSF_CondLines and cfg::DrawConditionalLines == false)) 490 (surface == VBOSF_CondLines and cfg::DrawConditionalLines == false))
491 { 491 {
492 return; 492 return;
493 } 493 }
634 if (overlay.img != null) 634 if (overlay.img != null)
635 { 635 {
636 QPoint v0 = coordconv3_2 (currentDocumentData().overlays[camera()].v0), 636 QPoint v0 = coordconv3_2 (currentDocumentData().overlays[camera()].v0),
637 v1 = coordconv3_2 (currentDocumentData().overlays[camera()].v1); 637 v1 = coordconv3_2 (currentDocumentData().overlays[camera()].v1);
638 638
639 QRect targRect (v0.x(), v0.y(), Abs (v1.x() - v0.x()), Abs (v1.y() - v0.y())), 639 QRect targRect (v0.x(), v0.y(), qAbs (v1.x() - v0.x()), qAbs (v1.y() - v0.y())),
640 srcRect (0, 0, overlay.img->width(), overlay.img->height()); 640 srcRect (0, 0, overlay.img->width(), overlay.img->height());
641 paint.drawImage (targRect, *overlay.img, srcRect); 641 paint.drawImage (targRect, *overlay.img, srcRect);
642 } 642 }
643 643
644 // Paint the coordinates onto the screen. 644 // Paint the coordinates onto the screen.
794 // 794 //
795 void GLRenderer::mouseMoveEvent (QMouseEvent* ev) 795 void GLRenderer::mouseMoveEvent (QMouseEvent* ev)
796 { 796 {
797 int dx = ev->x() - m_mousePosition.x(); 797 int dx = ev->x() - m_mousePosition.x();
798 int dy = ev->y() - m_mousePosition.y(); 798 int dy = ev->y() - m_mousePosition.y();
799 m_totalmove += Abs (dx) + Abs (dy); 799 m_totalmove += qAbs (dx) + qAbs (dy);
800 setCameraMoving (false); 800 setCameraMoving (false);
801 801
802 if (not m_editmode->mouseMoved (ev)) 802 if (not m_editmode->mouseMoved (ev))
803 { 803 {
804 const bool left = ev->buttons() & Qt::LeftButton, 804 const bool left = ev->buttons() & Qt::LeftButton,
866 void GLRenderer::wheelEvent (QWheelEvent* ev) 866 void GLRenderer::wheelEvent (QWheelEvent* ev)
867 { 867 {
868 doMakeCurrent(); 868 doMakeCurrent();
869 869
870 zoomNotch (ev->delta() > 0); 870 zoomNotch (ev->delta() > 0);
871 zoom() = Clamp (zoom(), 0.01, 10000.0); 871 zoom() = qBound (0.01, zoom(), 10000.0);
872 setCameraMoving (true); 872 setCameraMoving (true);
873 update(); 873 update();
874 ev->accept(); 874 ev->accept();
875 } 875 }
876 876
935 int y0 = range.top(); 935 int y0 = range.top();
936 int x1 = x0 + range.width(); 936 int x1 = x0 + range.width();
937 int y1 = y0 + range.height(); 937 int y1 = y0 + range.height();
938 938
939 // Clamp the values to ensure they're within bounds 939 // Clamp the values to ensure they're within bounds
940 x0 = Max (0, x0); 940 x0 = qMax (0, x0);
941 y0 = Max (0, y0); 941 y0 = qMax (0, y0);
942 x1 = Min (x1, m_width); 942 x1 = qMin (x1, m_width);
943 y1 = Min (y1, m_height); 943 y1 = qMin (y1, m_height);
944 const int areawidth = (x1 - x0); 944 const int areawidth = (x1 - x0);
945 const int areaheight = (y1 - y0); 945 const int areaheight = (y1 - y0);
946 const qint32 numpixels = areawidth * areaheight; 946 const qint32 numpixels = areawidth * areaheight;
947 947
948 // Allocate space for the pixel data. 948 // Allocate space for the pixel data.
967 967
968 if (idx != 0) 968 if (idx != 0)
969 indices << idx; 969 indices << idx;
970 } 970 }
971 971
972 RemoveDuplicates (indices); 972 removeDuplicates (indices);
973 973
974 for (qint32 idx : indices) 974 for (qint32 idx : indices)
975 { 975 {
976 LDObject* obj = LDObject::fromID (idx); 976 LDObject* obj = LDObject::fromID (idx);
977 977
1080 if (isPicking()) 1080 if (isPicking())
1081 { 1081 {
1082 glDisable (GL_DITHER); 1082 glDisable (GL_DITHER);
1083 1083
1084 // Use particularly thick lines while picking ease up selecting lines. 1084 // Use particularly thick lines while picking ease up selecting lines.
1085 glLineWidth (Max<double> (cfg::LineThickness, 6.5)); 1085 glLineWidth (qMax<double> (cfg::LineThickness, 6.5));
1086 } 1086 }
1087 else 1087 else
1088 { 1088 {
1089 glEnable (GL_DITHER); 1089 glEnable (GL_DITHER);
1090 1090

mercurial