diff options
Diffstat (limited to 'src/render/framegraph/qviewport.cpp')
-rw-r--r-- | src/render/framegraph/qviewport.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/render/framegraph/qviewport.cpp b/src/render/framegraph/qviewport.cpp index a78e260a5..8c1ebe67c 100644 --- a/src/render/framegraph/qviewport.cpp +++ b/src/render/framegraph/qviewport.cpp @@ -50,6 +50,7 @@ namespace Qt3DRender { QViewportPrivate::QViewportPrivate() : QFrameGraphNodePrivate() , m_normalizedRect(QRectF(0.0f, 0.0f, 1.0f, 1.0f)) + , m_gamma(2.2f) { } @@ -62,7 +63,8 @@ QViewportPrivate::QViewportPrivate() \inherits Qt3DRender::QFrameGraphNode Qt3DRender::QViewport of the scene specifies at which portion of the render surface Qt3D - is rendering to. Area outside the viewport is left untouched. + is rendering to. Area outside the viewport is left untouched. It also controls global parameters + to the rendering in that viewport like gamma. */ /*! @@ -74,7 +76,8 @@ QViewportPrivate::QViewportPrivate() \brief A viewport on the Qt3D Scene Viewport of the scene specifies at which portion of the render surface Qt3D is - rendering to. Area outside the viewport is left untouched. + rendering to. Area outside the viewport is left untouched. It also controls global parameters + to the rendering in that viewport like gamma. */ /*! @@ -86,6 +89,12 @@ QViewportPrivate::QViewportPrivate() */ /*! + \qmlproperty rect Viewport::gamma + + Specifies the gamma factor for the viewport. The default is 2.2 which should give proper result on most screens. + */ + +/*! Constructs QViewport with given \a parent. */ QViewport::QViewport(QNode *parent) @@ -111,6 +120,12 @@ QRectF QViewport::normalizedRect() const return d->m_normalizedRect; } +float QViewport::gamma() const +{ + Q_D(const QViewport); + return d->m_gamma; +} + /*! \property QViewport::normalizedRect @@ -127,12 +142,27 @@ void QViewport::setNormalizedRect(const QRectF &normalizedRect) } } +/*! + \property QViewport::gamma + + Specifies the gamma factor for the viewport. The default is 2.2 which should give proper result on most screens. + */ +void QViewport::setGamma(float gamma) +{ + Q_D(QViewport); + if (gamma != d->m_gamma) { + d->m_gamma = gamma; + emit gammaChanged(gamma); + } +} + Qt3DCore::QNodeCreatedChangeBasePtr QViewport::createNodeCreationChange() const { auto creationChange = QFrameGraphNodeCreatedChangePtr<QViewportData>::create(this); auto &data = creationChange->data; Q_D(const QViewport); data.normalizedRect = d->m_normalizedRect; + data.gamma = d->m_gamma; return creationChange; } |