MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / drawGrid

Method drawGrid

app/src/UI/Widgets/Plot3D.cpp:692–728  ·  view source on GitHub ↗

* @brief Renders the 3D plot background. */

Source from the content-addressed store, hash-verified

690 * @brief Renders the 3D plot background.
691 */
692void Widgets::Plot3D::drawGrid()
693{
694 QMatrix4x4 matrix;
695 matrix.perspective(45.0f, float(width()) / height(), 0.1f, 100.0f);
696 matrix.translate(m_cameraOffsetX, m_cameraOffsetY, m_cameraOffsetZ);
697
698 if (anaglyphEnabled()) {
699 auto eyes = eyeTransformations(matrix);
700
701 eyes.first.rotate(m_cameraAngleX, 1, 0, 0);
702 eyes.first.rotate(m_cameraAngleY, 0, 1, 0);
703 eyes.first.rotate(m_cameraAngleZ, 0, 0, 1);
704 eyes.first.scale(m_worldScale);
705 eyes.first.translate(-m_centerPoint);
706
707 eyes.second.rotate(m_cameraAngleX, 1, 0, 0);
708 eyes.second.rotate(m_cameraAngleY, 0, 1, 0);
709 eyes.second.rotate(m_cameraAngleZ, 0, 0, 1);
710 eyes.second.scale(m_worldScale);
711 eyes.second.translate(-m_centerPoint);
712
713 m_gridImg[0] = renderGrid(eyes.first);
714 m_gridImg[1] = renderGrid(eyes.second);
715 }
716
717 else {
718 matrix.rotate(m_cameraAngleX, 1, 0, 0);
719 matrix.rotate(m_cameraAngleY, 0, 1, 0);
720 matrix.rotate(m_cameraAngleZ, 0, 0, 1);
721 matrix.scale(m_worldScale);
722 matrix.translate(-m_centerPoint);
723
724 m_gridImg[0] = renderGrid(matrix);
725 }
726
727 m_dirtyGrid = false;
728}
729
730/**
731 * @brief Renders the 3D plot background with optional anaglyph effect.

Callers

nothing calls this directly

Calls 3

translateMethod · 0.80
scaleMethod · 0.80
rotateMethod · 0.45

Tested by

no test coverage detected