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 QRect &geo = screens()->geometry(i); | 659 | const QRect &geo = screens()->geometry(i); | ||
zzag: const int rotation | |||||
660 | QRegion update; | 660 | QRegion update; | ||
661 | QRegion valid; | 661 | QRegion valid; | ||
662 | // prepare rendering makes context current on the output | 662 | // prepare rendering makes context current on the output | ||
663 | QRegion repaint = m_backend->prepareRenderingForScreen(i); | 663 | QRegion repaint = m_backend->prepareRenderingForScreen(i); | ||
664 | GLVertexBuffer::setVirtualScreenGeometry(geo); | 664 | GLVertexBuffer::setVirtualScreenGeometry(geo); | ||
665 | GLRenderTarget::setVirtualScreenGeometry(geo); | 665 | GLRenderTarget::setVirtualScreenGeometry(geo); | ||
666 | GLVertexBuffer::setVirtualScreenScale(screens()->scale(i)); | 666 | GLVertexBuffer::setVirtualScreenScale(screens()->scale(i)); | ||
667 | GLRenderTarget::setVirtualScreenScale(screens()->scale(i)); | 667 | GLRenderTarget::setVirtualScreenScale(screens()->scale(i)); | ||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | |||||
737 | clearStackingOrder(); | 737 | clearStackingOrder(); | ||
738 | return m_backend->renderTime(); | 738 | return m_backend->renderTime(); | ||
739 | } | 739 | } | ||
740 | 740 | | |||
741 | QMatrix4x4 SceneOpenGL::transformation(int mask, const ScreenPaintData &data) const | 741 | QMatrix4x4 SceneOpenGL::transformation(int mask, const ScreenPaintData &data) const | ||
742 | { | 742 | { | ||
743 | QMatrix4x4 matrix; | 743 | QMatrix4x4 matrix; | ||
744 | 744 | | |||
745 | if (!(mask & PAINT_SCREEN_TRANSFORMED)) | 745 | // if (!(mask & PAINT_SCREEN_TRANSFORMED)) | ||
746 | return matrix; | 746 | // return matrix; | ||
747 | 747 | | |||
748 | matrix.translate(data.translation()); | 748 | matrix.translate(data.translation()); | ||
749 | data.scale().applyTo(&matrix); | 749 | data.scale().applyTo(&matrix); | ||
750 | 750 | | |||
751 | if (data.rotationAngle() == 0.0) | 751 | if (data.rotationAngle() == 0.0) | ||
752 | return matrix; | 752 | return matrix; | ||
753 | 753 | | |||
754 | // Apply the rotation | 754 | // Apply the rotation | ||
▲ Show 20 Lines • Show All 216 Lines • ▼ Show 20 Line(s) | 964 | { | |||
971 | 971 | | |||
972 | const float yMax = zNear * std::tan(fovY * M_PI / 360.0f); | 972 | const float yMax = zNear * std::tan(fovY * M_PI / 360.0f); | ||
973 | const float yMin = -yMax; | 973 | const float yMin = -yMax; | ||
974 | const float xMin = yMin * aspect; | 974 | const float xMin = yMin * aspect; | ||
975 | const float xMax = yMax * aspect; | 975 | const float xMax = yMax * aspect; | ||
976 | 976 | | |||
977 | QMatrix4x4 projection; | 977 | QMatrix4x4 projection; | ||
978 | projection.frustum(xMin, xMax, yMin, yMax, zNear, zFar); | 978 | projection.frustum(xMin, xMax, yMin, yMax, zNear, zFar); | ||
979 | 979 | | |||
980 | // Create a second matrix that transforms screen coordinates | 980 | // Create a second matrix that transforms screen coordinates | ||
zzag: Missing braces as well spaces after commas. | |||||
981 | // to world coordinates. | 981 | // to world coordinates. | ||
982 | const float scaleFactor = 1.1 * std::tan(fovY * M_PI / 360.0f) / yMax; | 982 | const float scaleFactor = 1.1 * std::tan(fovY * M_PI / 360.0f) / yMax; | ||
983 | const QSize size = screens()->size(); | 983 | const QSize size = screens()->size(); | ||
984 | 984 | | |||
985 | QMatrix4x4 matrix; | 985 | QMatrix4x4 matrix; | ||
986 | matrix.translate(xMin * scaleFactor, yMax * scaleFactor, -1.1); | 986 | matrix.translate(xMin * scaleFactor, yMax * scaleFactor, -1.1); | ||
987 | matrix.scale( (xMax - xMin) * scaleFactor / size.width(), | 987 | matrix.scale( (xMax - xMin) * scaleFactor / size.width(), | ||
988 | -(yMax - yMin) * scaleFactor / size.height(), | 988 | -(yMax - yMin) * scaleFactor / size.height(), | ||
Show All 12 Lines | |||||
1001 | { | 1001 | { | ||
1002 | m_screenProjectionMatrix = m_projectionMatrix; | 1002 | m_screenProjectionMatrix = m_projectionMatrix; | ||
1003 | 1003 | | |||
1004 | Scene::paintSimpleScreen(mask, region); | 1004 | Scene::paintSimpleScreen(mask, region); | ||
1005 | } | 1005 | } | ||
1006 | 1006 | | |||
1007 | void SceneOpenGL2::paintGenericScreen(int mask, ScreenPaintData data) | 1007 | void SceneOpenGL2::paintGenericScreen(int mask, ScreenPaintData data) | ||
1008 | { | 1008 | { | ||
1009 | const QMatrix4x4 screenMatrix = transformation(mask, data); | 1009 | data.setRotationOrigin(QVector3D(data.outputGeometry().center())); | ||
1010 | 1010 | data.setRotationAxis(QVector3D(0, 0, 1)); | |||
1011 | data.setRotationAngle(90); | ||||
1012 | QMatrix4x4 screenMatrix = transformation(mask, data); | ||||
1011 | m_screenProjectionMatrix = m_projectionMatrix * screenMatrix; | 1013 | m_screenProjectionMatrix = m_projectionMatrix * screenMatrix; | ||
1012 | 1014 | | |||
1013 | Scene::paintGenericScreen(mask, data); | 1015 | Scene::paintGenericScreen(mask, data); | ||
1014 | } | 1016 | } | ||
1015 | 1017 | | |||
1016 | void SceneOpenGL2::doPaintBackground(const QVector< float >& vertices) | 1018 | void SceneOpenGL2::doPaintBackground(const QVector< float >& vertices) | ||
1017 | { | 1019 | { | ||
1018 | GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); | 1020 | GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); | ||
▲ Show 20 Lines • Show All 1551 Lines • Show Last 20 Lines |
const int rotation