Changeset View
Changeset View
Standalone View
Standalone View
plugins/scenes/opengl/scene_opengl.cpp
Show First 20 Lines • Show All 650 Lines • ▼ Show 20 Line(s) | 645 | { | |||
---|---|---|---|---|---|
651 | // the front buffer. It doesn't include the additional damage returned | 651 | // the front buffer. It doesn't include the additional damage returned | ||
652 | // by prepareRenderingFrame(). validRegion is the region that has been | 652 | // by prepareRenderingFrame(). validRegion is the region that has been | ||
653 | // repainted, and may be larger than updateRegion. | 653 | // repainted, and may be larger than updateRegion. | ||
654 | QRegion updateRegion, validRegion; | 654 | QRegion updateRegion, validRegion; | ||
655 | if (m_backend->perScreenRendering()) { | 655 | if (m_backend->perScreenRendering()) { | ||
656 | // trigger start render timer | 656 | // trigger start render timer | ||
657 | m_backend->prepareRenderingFrame(); | 657 | m_backend->prepareRenderingFrame(); | ||
658 | for (int i = 0; i < screens()->count(); ++i) { | 658 | for (int i = 0; i < screens()->count(); ++i) { | ||
659 | const auto rotation = screens()->rotation(i); | ||||
zzag: const int rotation | |||||
659 | const QRect &geo = screens()->geometry(i); | 660 | const QRect &geo = screens()->geometry(i); | ||
660 | QRegion update; | 661 | QRegion update; | ||
661 | QRegion valid; | 662 | QRegion valid; | ||
662 | // prepare rendering makes context current on the output | 663 | // prepare rendering makes context current on the output | ||
663 | QRegion repaint = m_backend->prepareRenderingForScreen(i); | 664 | QRegion repaint = m_backend->prepareRenderingForScreen(i); | ||
664 | GLVertexBuffer::setVirtualScreenGeometry(geo); | 665 | GLVertexBuffer::setVirtualScreenGeometry(geo); | ||
665 | GLRenderTarget::setVirtualScreenGeometry(geo); | 666 | GLRenderTarget::setVirtualScreenGeometry(geo); | ||
666 | GLVertexBuffer::setVirtualScreenScale(screens()->scale(i)); | 667 | GLVertexBuffer::setVirtualScreenScale(screens()->scale(i)); | ||
667 | GLRenderTarget::setVirtualScreenScale(screens()->scale(i)); | 668 | GLRenderTarget::setVirtualScreenScale(screens()->scale(i)); | ||
668 | 669 | | |||
669 | const GLenum status = glGetGraphicsResetStatus(); | 670 | const GLenum status = glGetGraphicsResetStatus(); | ||
670 | if (status != GL_NO_ERROR) { | 671 | if (status != GL_NO_ERROR) { | ||
671 | handleGraphicsReset(status); | 672 | handleGraphicsReset(status); | ||
672 | return 0; | 673 | return 0; | ||
673 | } | 674 | } | ||
674 | 675 | | |||
675 | int mask = 0; | 676 | int mask = 0; | ||
676 | updateProjectionMatrix(); | 677 | updateProjectionMatrix(); | ||
677 | paintScreen(&mask, damage.intersected(geo), repaint, &update, &valid, projectionMatrix(), geo); // call generic implementation | 678 | auto matrix = projectionMatrix(); | ||
679 | matrix.translate(geo.width()/2, geo.height()/2, 0); | ||||
680 | matrix.rotate(rotation, 0,0,1); | ||||
681 | matrix.translate(-geo.width()/2, -geo.height()/2, 0); | ||||
682 | | ||||
683 | paintScreen(&mask, damage.intersected(geo), repaint, &update, &valid, matrix, geo); // call generic implementation | ||||
678 | paintCursor(); | 684 | paintCursor(); | ||
679 | 685 | | |||
680 | GLVertexBuffer::streamingBuffer()->endOfFrame(); | 686 | GLVertexBuffer::streamingBuffer()->endOfFrame(); | ||
681 | 687 | | |||
682 | m_backend->endRenderingFrameForScreen(i, valid, update); | 688 | m_backend->endRenderingFrameForScreen(i, valid, update); | ||
683 | 689 | | |||
684 | GLVertexBuffer::streamingBuffer()->framePosted(); | 690 | GLVertexBuffer::streamingBuffer()->framePosted(); | ||
685 | } | 691 | } | ||
▲ Show 20 Lines • Show All 285 Lines • ▼ Show 20 Line(s) | 970 | { | |||
971 | 977 | | |||
972 | const float yMax = zNear * std::tan(fovY * M_PI / 360.0f); | 978 | const float yMax = zNear * std::tan(fovY * M_PI / 360.0f); | ||
973 | const float yMin = -yMax; | 979 | const float yMin = -yMax; | ||
974 | const float xMin = yMin * aspect; | 980 | const float xMin = yMin * aspect; | ||
975 | const float xMax = yMax * aspect; | 981 | const float xMax = yMax * aspect; | ||
976 | 982 | | |||
977 | QMatrix4x4 projection; | 983 | QMatrix4x4 projection; | ||
978 | projection.frustum(xMin, xMax, yMin, yMax, zNear, zFar); | 984 | projection.frustum(xMin, xMax, yMin, yMax, zNear, zFar); | ||
979 | 985 | | |||
980 | // Create a second matrix that transforms screen coordinates | 986 | // Create a second matrix that transforms screen coordinates | ||
zzag: Missing braces as well spaces after commas. | |||||
981 | // to world coordinates. | 987 | // to world coordinates. | ||
982 | const float scaleFactor = 1.1 * std::tan(fovY * M_PI / 360.0f) / yMax; | 988 | const float scaleFactor = 1.1 * std::tan(fovY * M_PI / 360.0f) / yMax; | ||
983 | const QSize size = screens()->size(); | 989 | const QSize size = screens()->size(); | ||
984 | 990 | | |||
985 | QMatrix4x4 matrix; | 991 | QMatrix4x4 matrix; | ||
986 | matrix.translate(xMin * scaleFactor, yMax * scaleFactor, -1.1); | 992 | matrix.translate(xMin * scaleFactor, yMax * scaleFactor, -1.1); | ||
987 | matrix.scale( (xMax - xMin) * scaleFactor / size.width(), | 993 | matrix.scale( (xMax - xMin) * scaleFactor / size.width(), | ||
988 | -(yMax - yMin) * scaleFactor / size.height(), | 994 | -(yMax - yMin) * scaleFactor / size.height(), | ||
▲ Show 20 Lines • Show All 1581 Lines • Show Last 20 Lines |
const int rotation