effects: Drop WindowPaintData::modelViewMatrix()

It's unused and it conflicts in a way with PaintData::translation(),
PaintData::rotationAngle() and PaintData::scale().
This commit is contained in:
Vlad Zahorodnii 2022-06-15 12:43:39 +03:00
parent ef97158f96
commit 24dfdd70c0
4 changed files with 7 additions and 54 deletions

View file

@ -217,7 +217,6 @@ public:
int screen; int screen;
qreal crossFadeProgress; qreal crossFadeProgress;
QMatrix4x4 pMatrix; QMatrix4x4 pMatrix;
QMatrix4x4 mvMatrix;
QMatrix4x4 screenProjectionMatrix; QMatrix4x4 screenProjectionMatrix;
}; };
@ -257,7 +256,6 @@ WindowPaintData::WindowPaintData(const WindowPaintData &other)
setScreen(other.screen()); setScreen(other.screen());
setCrossFadeProgress(other.crossFadeProgress()); setCrossFadeProgress(other.crossFadeProgress());
setProjectionMatrix(other.projectionMatrix()); setProjectionMatrix(other.projectionMatrix());
setModelViewMatrix(other.modelViewMatrix());
d->screenProjectionMatrix = other.d->screenProjectionMatrix; d->screenProjectionMatrix = other.d->screenProjectionMatrix;
} }
@ -349,21 +347,6 @@ QMatrix4x4 &WindowPaintData::rprojectionMatrix()
return d->pMatrix; return d->pMatrix;
} }
void WindowPaintData::setModelViewMatrix(const QMatrix4x4 &matrix)
{
d->mvMatrix = matrix;
}
QMatrix4x4 WindowPaintData::modelViewMatrix() const
{
return d->mvMatrix;
}
QMatrix4x4 &WindowPaintData::rmodelViewMatrix()
{
return d->mvMatrix;
}
WindowPaintData &WindowPaintData::operator*=(qreal scale) WindowPaintData &WindowPaintData::operator*=(qreal scale)
{ {
this->setXScale(this->xScale() * scale); this->setXScale(this->xScale() * scale);

View file

@ -2545,7 +2545,7 @@ public:
*/ */
virtual bool isCriticalNotification() const = 0; virtual bool isCriticalNotification() const = 0;
/** /**
* Returns whether the window is a window used for applet popups. * Returns whether the window is a window used for applet popups.
*/ */
virtual bool isAppletPopup() const = 0; virtual bool isAppletPopup() const = 0;
/** /**
@ -3274,26 +3274,6 @@ public:
*/ */
QMatrix4x4 &rprojectionMatrix(); QMatrix4x4 &rprojectionMatrix();
/**
* Sets the model-view matrix that will be used when painting the window.
*
* The default model-view matrix can be overridden by setting this matrix
* to a non-identity matrix.
*/
void setModelViewMatrix(const QMatrix4x4 &matrix);
/**
* Returns the current model-view matrix.
*
* The default value for this matrix is the identity matrix.
*/
QMatrix4x4 modelViewMatrix() const;
/**
* Returns a reference to the model-view matrix.
*/
QMatrix4x4 &rmodelViewMatrix();
/** /**
* Returns The projection matrix as used by the current screen painting pass * Returns The projection matrix as used by the current screen painting pass
* including screen transformations. * including screen transformations.

View file

@ -444,10 +444,9 @@ void SceneOpenGL::createRenderNode(Item *item, RenderContext *context)
context->opacityStack.pop(); context->opacityStack.pop();
} }
QMatrix4x4 SceneOpenGL::modelViewProjectionMatrix(int mask, const WindowPaintData &data) const QMatrix4x4 SceneOpenGL::modelViewProjectionMatrix(const WindowPaintData &data) const
{ {
const QMatrix4x4 pMatrix = data.projectionMatrix(); const QMatrix4x4 pMatrix = data.projectionMatrix();
const QMatrix4x4 mvMatrix = data.modelViewMatrix();
// An effect may want to override the default projection matrix in some cases, // An effect may want to override the default projection matrix in some cases,
// such as when it is rendering a window on a render target that doesn't have // such as when it is rendering a window on a render target that doesn't have
@ -455,17 +454,9 @@ QMatrix4x4 SceneOpenGL::modelViewProjectionMatrix(int mask, const WindowPaintDat
// //
// Note that the screen transformation is not applied here. // Note that the screen transformation is not applied here.
if (!pMatrix.isIdentity()) { if (!pMatrix.isIdentity()) {
return pMatrix * mvMatrix; return pMatrix;
} }
return m_screenProjectionMatrix;
// If an effect has specified a model-view matrix, we multiply that matrix
// with the default projection matrix. If the effect hasn't specified a
// model-view matrix, mvMatrix will be the identity matrix.
if (mask & Scene::PAINT_SCREEN_TRANSFORMED) {
return screenProjectionMatrix() * mvMatrix;
}
return renderTargetProjectionMatrix() * mvMatrix;
} }
static QMatrix4x4 transformForPaintData(int mask, const WindowPaintData &data) static QMatrix4x4 transformForPaintData(int mask, const WindowPaintData &data)
@ -589,7 +580,7 @@ void SceneOpenGL::render(Item *item, int mask, const QRegion &region, const Wind
scissorRegion = mapToRenderTarget(region); scissorRegion = mapToRenderTarget(region);
} }
const QMatrix4x4 modelViewProjection = modelViewProjectionMatrix(mask, data); const QMatrix4x4 projectionMatrix = modelViewProjectionMatrix(data);
for (int i = 0; i < renderContext.renderNodes.count(); i++) { for (int i = 0; i < renderContext.renderNodes.count(); i++) {
const RenderNode &renderNode = renderContext.renderNodes[i]; const RenderNode &renderNode = renderContext.renderNodes[i];
if (renderNode.vertexCount == 0) { if (renderNode.vertexCount == 0) {
@ -598,8 +589,7 @@ void SceneOpenGL::render(Item *item, int mask, const QRegion &region, const Wind
setBlendEnabled(renderNode.hasAlpha || renderNode.opacity < 1.0); setBlendEnabled(renderNode.hasAlpha || renderNode.opacity < 1.0);
shader->setUniform(GLShader::ModelViewProjectionMatrix, shader->setUniform(GLShader::ModelViewProjectionMatrix, projectionMatrix * renderNode.transformMatrix);
modelViewProjection * renderNode.transformMatrix);
if (opacity != renderNode.opacity) { if (opacity != renderNode.opacity) {
shader->setUniform(GLShader::ModulationConstant, shader->setUniform(GLShader::ModulationConstant,
modulate(renderNode.opacity, data.brightness())); modulate(renderNode.opacity, data.brightness()));

View file

@ -90,7 +90,7 @@ protected:
private: private:
void doPaintBackground(const QVector<float> &vertices); void doPaintBackground(const QVector<float> &vertices);
QMatrix4x4 modelViewProjectionMatrix(int mask, const WindowPaintData &data) const; QMatrix4x4 modelViewProjectionMatrix(const WindowPaintData &data) const;
QVector4D modulate(float opacity, float brightness) const; QVector4D modulate(float opacity, float brightness) const;
void setBlendEnabled(bool enabled); void setBlendEnabled(bool enabled);
void createRenderNode(Item *item, RenderContext *context); void createRenderNode(Item *item, RenderContext *context);