summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobert Brock <robert.brock@kdab.com>2016-04-14 13:34:33 +0100
committerRobert Brock <robert.brock@kdab.com>2016-04-20 07:06:29 +0000
commitd1dfd325aa732aa8a7e834becea640421453d5b6 (patch)
tree6bff9bc06352b406a4a23ada5735466e46fad491 /src
parentb3eea6ae2d91d9f5460d7e80c329d6cf40915732 (diff)
AntiAliasing added as Renderstate
Adding antialiasing that can be enabled in renderstates Change-Id: I0728e69dba5896ca86e56b940682990fafd0a297 Task-number: QTBUG-52191 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick3d/imports/render/qt3dquick3drenderplugin.cpp2
-rw-r--r--src/render/graphicshelpers/graphicscontext.cpp5
-rw-r--r--src/render/graphicshelpers/graphicscontext_p.h1
-rw-r--r--src/render/graphicshelpers/graphicshelperes2.cpp7
-rw-r--r--src/render/graphicshelpers/graphicshelperes2_p.h1
-rw-r--r--src/render/graphicshelpers/graphicshelpergl2.cpp6
-rw-r--r--src/render/graphicshelpers/graphicshelpergl2_p.h1
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3.cpp6
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3_3.cpp6
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3_3_p.h1
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3_p.h1
-rw-r--r--src/render/graphicshelpers/graphicshelpergl4.cpp6
-rw-r--r--src/render/graphicshelpers/graphicshelpergl4_p.h1
-rw-r--r--src/render/graphicshelpers/graphicshelperinterface_p.h1
-rw-r--r--src/render/renderstates/genericstate_p.h3
-rw-r--r--src/render/renderstates/qmultisampleantialiasing.cpp73
-rw-r--r--src/render/renderstates/qmultisampleantialiasing.h68
-rw-r--r--src/render/renderstates/qrenderstate_p.h1
-rw-r--r--src/render/renderstates/renderstates.cpp11
-rw-r--r--src/render/renderstates/renderstates.pri6
-rw-r--r--src/render/renderstates/renderstates_p.h7
-rw-r--r--src/render/renderstates/renderstateset.cpp9
22 files changed, 219 insertions, 4 deletions
diff --git a/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp b/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp
index edefc603f..a9529c189 100644
--- a/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp
+++ b/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp
@@ -83,6 +83,7 @@
#include <Qt3DRender/qclearbuffers.h>
#include <Qt3DRender/qsortcriterion.h>
#include <Qt3DRender/qalphacoverage.h>
+#include <Qt3DRender/qmultisampleantialiasing.h>
#include <Qt3DRender/qpointsize.h>
#include <Qt3DRender/qpolygonoffset.h>
#include <Qt3DRender/qcolormask.h>
@@ -289,6 +290,7 @@ void Qt3DQuick3DRenderPlugin::registerTypes(const char *uri)
qmlRegisterType<Qt3DRender::QBlendEquation>(uri, 2, 0, "BlendEquation");
qmlRegisterType<Qt3DRender::QAlphaTest>(uri, 2, 0, "AlphaTest");
qmlRegisterType<Qt3DRender::QDepthTest>(uri, 2, 0, "DepthTest");
+ qmlRegisterType<Qt3DRender::QMultiSampleAntiAliasing>(uri, 2, 0, "MultiSampleAntiAliasing");
qmlRegisterType<Qt3DRender::QNoDepthMask>(uri, 2, 0, "NoDepthMask");
qmlRegisterType<Qt3DRender::QCullFace>(uri, 2, 0, "CullFace");
qmlRegisterType<Qt3DRender::QFrontFace>(uri, 2, 0, "FrontFace");
diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp
index c1913362d..f3e5fd32f 100644
--- a/src/render/graphicshelpers/graphicscontext.cpp
+++ b/src/render/graphicshelpers/graphicscontext.cpp
@@ -821,6 +821,11 @@ void GraphicsContext::buildUniformBuffer(const QVariant &v, const ShaderUniform
m_glHelper->buildUniformBuffer(v, description, buffer);
}
+void GraphicsContext::setMSAAEnabled(bool enabled)
+{
+ m_glHelper->setMSAAEnabled(enabled);
+}
+
void GraphicsContext::setAlphaCoverageEnabled(bool enabled)
{
m_glHelper->setAlphaCoverageEnabled(enabled);
diff --git a/src/render/graphicshelpers/graphicscontext_p.h b/src/render/graphicshelpers/graphicscontext_p.h
index d73858cdd..c2a9785bb 100644
--- a/src/render/graphicshelpers/graphicscontext_p.h
+++ b/src/render/graphicshelpers/graphicscontext_p.h
@@ -207,6 +207,7 @@ public:
void frontFace(GLenum mode);
GLint maxClipPlaneCount();
void pointSize(bool programmable, GLfloat value);
+ void setMSAAEnabled(bool enabled);
void setAlphaCoverageEnabled(bool enabled);
void setClipPlane(int clipPlane, const QVector3D &normal, float distance);
void setSeamlessCubemap(bool enable);
diff --git a/src/render/graphicshelpers/graphicshelperes2.cpp b/src/render/graphicshelpers/graphicshelperes2.cpp
index 02078c8d4..41a988f62 100644
--- a/src/render/graphicshelpers/graphicshelperes2.cpp
+++ b/src/render/graphicshelpers/graphicshelperes2.cpp
@@ -271,6 +271,11 @@ void GraphicsHelperES2::frontFace(GLenum mode)
m_funcs->glFrontFace(mode);
}
+void GraphicsHelperES2::setMSAAEnabled(bool enabled)
+{
+ qWarning() << "MSAA not available with OpenGL ES 2.0";
+}
+
void GraphicsHelperES2::setAlphaCoverageEnabled(bool enabled)
{
enabled ? m_funcs->glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE)
@@ -341,7 +346,7 @@ bool GraphicsHelperES2::supportsFeature(GraphicsHelperInterface::Feature feature
}
void GraphicsHelperES2::drawBuffers(GLsizei , const int *)
{
- qCritical() << "drawBuffers is not supported by ES 2.0";
+ qWarning() << "drawBuffers is not supported by ES 2.0";
}
void GraphicsHelperES2::bindUniform(const QVariant &v, const ShaderUniform &description)
diff --git a/src/render/graphicshelpers/graphicshelperes2_p.h b/src/render/graphicshelpers/graphicshelperes2_p.h
index f65c3c61b..ae53c9d81 100644
--- a/src/render/graphicshelpers/graphicshelperes2_p.h
+++ b/src/render/graphicshelpers/graphicshelperes2_p.h
@@ -108,6 +108,7 @@ public:
QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) Q_DECL_OVERRIDE;
QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) Q_DECL_OVERRIDE;
void releaseFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
+ void setMSAAEnabled(bool enable) Q_DECL_OVERRIDE;
void setAlphaCoverageEnabled(bool enable) Q_DECL_OVERRIDE;
void setClipPlane(int clipPlane, const QVector3D &normal, float distance) Q_DECL_OVERRIDE;
void setSeamlessCubemap(bool enable) Q_DECL_OVERRIDE;
diff --git a/src/render/graphicshelpers/graphicshelpergl2.cpp b/src/render/graphicshelpers/graphicshelpergl2.cpp
index f97075f17..1f27831bd 100644
--- a/src/render/graphicshelpers/graphicshelpergl2.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl2.cpp
@@ -254,6 +254,12 @@ void GraphicsHelperGL2::frontFace(GLenum mode)
m_funcs->glFrontFace(mode);
}
+void GraphicsHelperGL2::setMSAAEnabled(bool enabled)
+{
+ enabled ? m_funcs->glEnable(GL_MULTISAMPLE)
+ : m_funcs->glDisable(GL_MULTISAMPLE);
+}
+
void GraphicsHelperGL2::setAlphaCoverageEnabled(bool enabled)
{
enabled ? m_funcs->glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE)
diff --git a/src/render/graphicshelpers/graphicshelpergl2_p.h b/src/render/graphicshelpers/graphicshelpergl2_p.h
index 0d38b59c4..ab3993896 100644
--- a/src/render/graphicshelpers/graphicshelpergl2_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl2_p.h
@@ -110,6 +110,7 @@ public:
QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) Q_DECL_OVERRIDE;
QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) Q_DECL_OVERRIDE;
void releaseFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
+ void setMSAAEnabled(bool enable) Q_DECL_OVERRIDE;
void setAlphaCoverageEnabled(bool enable) Q_DECL_OVERRIDE;
void setClipPlane(int clipPlane, const QVector3D &normal, float distance) Q_DECL_OVERRIDE;
void setSeamlessCubemap(bool enable) Q_DECL_OVERRIDE;
diff --git a/src/render/graphicshelpers/graphicshelpergl3.cpp b/src/render/graphicshelpers/graphicshelpergl3.cpp
index 3c822c7e6..27027cd22 100644
--- a/src/render/graphicshelpers/graphicshelpergl3.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl3.cpp
@@ -302,6 +302,12 @@ void GraphicsHelperGL3::frontFace(GLenum mode)
}
+void GraphicsHelperGL3::setMSAAEnabled(bool enabled)
+{
+ enabled ? m_funcs->glEnable(GL_MULTISAMPLE)
+ : m_funcs->glDisable(GL_MULTISAMPLE);
+}
+
void GraphicsHelperGL3::setAlphaCoverageEnabled(bool enabled)
{
enabled ? m_funcs->glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE)
diff --git a/src/render/graphicshelpers/graphicshelpergl3_3.cpp b/src/render/graphicshelpers/graphicshelpergl3_3.cpp
index 621444972..699cc8732 100644
--- a/src/render/graphicshelpers/graphicshelpergl3_3.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl3_3.cpp
@@ -299,6 +299,12 @@ void GraphicsHelperGL3_3::frontFace(GLenum mode)
}
+void GraphicsHelperGL3_3::setMSAAEnabled(bool enabled)
+{
+ enabled ? m_funcs->glEnable(GL_MULTISAMPLE)
+ : m_funcs->glDisable(GL_MULTISAMPLE);
+}
+
void GraphicsHelperGL3_3::setAlphaCoverageEnabled(bool enabled)
{
enabled ? m_funcs->glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE)
diff --git a/src/render/graphicshelpers/graphicshelpergl3_3_p.h b/src/render/graphicshelpers/graphicshelpergl3_3_p.h
index b395ccc6b..def34df85 100644
--- a/src/render/graphicshelpers/graphicshelpergl3_3_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl3_3_p.h
@@ -111,6 +111,7 @@ public:
QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) Q_DECL_OVERRIDE;
QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) Q_DECL_OVERRIDE;
void releaseFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
+ void setMSAAEnabled(bool enable) Q_DECL_OVERRIDE;
void setAlphaCoverageEnabled(bool enable) Q_DECL_OVERRIDE;
void setClipPlane(int clipPlane, const QVector3D &normal, float distance) Q_DECL_OVERRIDE;
void setSeamlessCubemap(bool enable) Q_DECL_OVERRIDE;
diff --git a/src/render/graphicshelpers/graphicshelpergl3_p.h b/src/render/graphicshelpers/graphicshelpergl3_p.h
index c6660aaa3..9c70d34fa 100644
--- a/src/render/graphicshelpers/graphicshelpergl3_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl3_p.h
@@ -111,6 +111,7 @@ public:
QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) Q_DECL_OVERRIDE;
QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) Q_DECL_OVERRIDE;
void releaseFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
+ void setMSAAEnabled(bool enable) Q_DECL_OVERRIDE;
void setAlphaCoverageEnabled(bool enable) Q_DECL_OVERRIDE;
void setClipPlane(int clipPlane, const QVector3D &normal, float distance) Q_DECL_OVERRIDE;
void setSeamlessCubemap(bool enable) Q_DECL_OVERRIDE;
diff --git a/src/render/graphicshelpers/graphicshelpergl4.cpp b/src/render/graphicshelpers/graphicshelpergl4.cpp
index 6dfd7f46e..d7f4ff524 100644
--- a/src/render/graphicshelpers/graphicshelpergl4.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl4.cpp
@@ -292,6 +292,12 @@ void GraphicsHelperGL4::frontFace(GLenum mode)
}
+void GraphicsHelperGL4::setMSAAEnabled(bool enabled)
+{
+ enabled ? m_funcs->glEnable(GL_MULTISAMPLE)
+ : m_funcs->glDisable(GL_MULTISAMPLE);
+}
+
void GraphicsHelperGL4::setAlphaCoverageEnabled(bool enabled)
{
enabled ? m_funcs->glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE)
diff --git a/src/render/graphicshelpers/graphicshelpergl4_p.h b/src/render/graphicshelpers/graphicshelpergl4_p.h
index c9cea669d..4574e7e0f 100644
--- a/src/render/graphicshelpers/graphicshelpergl4_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl4_p.h
@@ -110,6 +110,7 @@ public:
QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) Q_DECL_OVERRIDE;
QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) Q_DECL_OVERRIDE;
void releaseFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
+ void setMSAAEnabled(bool enable) Q_DECL_OVERRIDE;
void setAlphaCoverageEnabled(bool enable) Q_DECL_OVERRIDE;
void setClipPlane(int clipPlane, const QVector3D &normal, float distance) Q_DECL_OVERRIDE;
void setSeamlessCubemap(bool enable) Q_DECL_OVERRIDE;
diff --git a/src/render/graphicshelpers/graphicshelperinterface_p.h b/src/render/graphicshelpers/graphicshelperinterface_p.h
index 458f92d61..16381d024 100644
--- a/src/render/graphicshelpers/graphicshelperinterface_p.h
+++ b/src/render/graphicshelpers/graphicshelperinterface_p.h
@@ -123,6 +123,7 @@ public:
virtual void releaseFrameBufferObject(GLuint frameBufferId) = 0;
virtual void setAlphaCoverageEnabled(bool enable) = 0;
virtual void setClipPlane(int clipPlane, const QVector3D &normal, float distance) = 0;
+ virtual void setMSAAEnabled(bool enable) = 0;
virtual void setSeamlessCubemap(bool enable) = 0;
virtual void setVerticesPerPatch(GLint verticesPerPatch) = 0;
virtual bool supportsFeature(Feature feature) const = 0;
diff --git a/src/render/renderstates/genericstate_p.h b/src/render/renderstates/genericstate_p.h
index 3967e0913..8155288db 100644
--- a/src/render/renderstates/genericstate_p.h
+++ b/src/render/renderstates/genericstate_p.h
@@ -87,7 +87,8 @@ enum StateMask
ClipPlaneMask = 1 << 13,
StencilOpMask = 1 << 14,
PointSizeMask = 1 << 15,
- SeamlessCubemapMask = 1 << 16
+ SeamlessCubemapMask = 1 << 16,
+ MSAAEnabledStateMask = 1 << 17
};
typedef quint64 StateMaskSet;
diff --git a/src/render/renderstates/qmultisampleantialiasing.cpp b/src/render/renderstates/qmultisampleantialiasing.cpp
new file mode 100644
index 000000000..5765a14f0
--- /dev/null
+++ b/src/render/renderstates/qmultisampleantialiasing.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmultisampleantialiasing.h"
+#include "qrenderstate_p.h"
+#include <private/qnode_p.h>
+#include <Qt3DCore/qscenepropertychange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QMultiSampleAntiAliasingPrivate : public QRenderStatePrivate
+{
+public:
+ QMultiSampleAntiAliasingPrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::MSAAEnabled)
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QMultiSampleAntiAliasing)
+};
+
+QMultiSampleAntiAliasing::QMultiSampleAntiAliasing(QNode *parent)
+ : QRenderState(*new QMultiSampleAntiAliasingPrivate, parent)
+{
+}
+
+QMultiSampleAntiAliasing::~QMultiSampleAntiAliasing()
+{
+ QNode::cleanup();
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
diff --git a/src/render/renderstates/qmultisampleantialiasing.h b/src/render/renderstates/qmultisampleantialiasing.h
new file mode 100644
index 000000000..8384a27fe
--- /dev/null
+++ b/src/render/renderstates/qmultisampleantialiasing.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QMULTISAMPLEANTIALIASING_H
+#define QT3DRENDER_QMULTISAMPLEANTIALIASING_H
+
+#include <Qt3DRender/qrenderstate.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QMultiSampleAntiAliasingPrivate;
+
+class QT3DRENDERSHARED_EXPORT QMultiSampleAntiAliasing : public QRenderState
+{
+ Q_OBJECT
+
+public:
+ explicit QMultiSampleAntiAliasing(Qt3DCore::QNode *parent = nullptr);
+ ~QMultiSampleAntiAliasing();
+
+private:
+ Q_DECLARE_PRIVATE(QMultiSampleAntiAliasing)
+ QT3D_CLONEABLE(QMultiSampleAntiAliasing)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QMULTISAMPLEANTIALIASING_H
diff --git a/src/render/renderstates/qrenderstate_p.h b/src/render/renderstates/qrenderstate_p.h
index ee0acd5ca..d59a2791c 100644
--- a/src/render/renderstates/qrenderstate_p.h
+++ b/src/render/renderstates/qrenderstate_p.h
@@ -70,6 +70,7 @@ public:
BlendEquationArguments,
ColorMask,
CullFace,
+ MSAAEnabled,
NoDepthMask,
DepthTest,
Dithering,
diff --git a/src/render/renderstates/renderstates.cpp b/src/render/renderstates/renderstates.cpp
index 6648a70fb..d0aebf09c 100644
--- a/src/render/renderstates/renderstates.cpp
+++ b/src/render/renderstates/renderstates.cpp
@@ -115,6 +115,17 @@ void AlphaFunc::apply(GraphicsContext* gc) const
gc->alphaTest(m_1, m_2);
}
+void MSAAEnabled::apply(GraphicsContext *gc) const
+{
+ gc->setMSAAEnabled(m_1);
+}
+
+void MSAAEnabled::updateProperty(const char *name, const QVariant &value)
+{
+ if (name == QByteArrayLiteral("enabled"))
+ m_1 = value.toBool();
+}
+
void DepthTest::apply(GraphicsContext *gc) const
{
gc->depthTest(m_1);
diff --git a/src/render/renderstates/renderstates.pri b/src/render/renderstates/renderstates.pri
index 818a93cd5..85c5952ff 100644
--- a/src/render/renderstates/renderstates.pri
+++ b/src/render/renderstates/renderstates.pri
@@ -44,7 +44,8 @@ HEADERS += \
$$PWD/qstenciloperationarguments_p.h \
$$PWD/qstenciltest_p.h \
$$PWD/qstenciltestarguments_p.h \
- $$PWD/renderstatenode_p.h
+ $$PWD/renderstatenode_p.h \
+ $$PWD/qmultisampleantialiasing.h
SOURCES += \
@@ -73,4 +74,5 @@ SOURCES += \
$$PWD/qseamlesscubemap.cpp \
$$PWD/qnodepthmask.cpp \
$$PWD/qrenderstatecreatedchange.cpp \
- $$PWD/renderstatenode.cpp
+ $$PWD/renderstatenode.cpp \
+ $$PWD/qmultisampleantialiasing.cpp
diff --git a/src/render/renderstates/renderstates_p.h b/src/render/renderstates/renderstates_p.h
index 308f1957b..ad6ef4ad1 100644
--- a/src/render/renderstates/renderstates_p.h
+++ b/src/render/renderstates/renderstates_p.h
@@ -120,6 +120,13 @@ public:
virtual void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
};
+class Q_AUTOTEST_EXPORT MSAAEnabled : public GenericState1<MSAAEnabled, MSAAEnabledStateMask, GLboolean>
+{
+public:
+ virtual void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
+};
+
class Q_AUTOTEST_EXPORT DepthTest : public GenericState1<DepthTest, DepthTestStateMask, GLenum>
{
public:
diff --git a/src/render/renderstates/renderstateset.cpp b/src/render/renderstates/renderstateset.cpp
index d68600aeb..fc752d743 100644
--- a/src/render/renderstates/renderstateset.cpp
+++ b/src/render/renderstates/renderstateset.cpp
@@ -78,6 +78,7 @@
#include <Qt3DRender/private/qstenciltestarguments_p.h>
#include <Qt3DRender/qclipplane.h>
#include <Qt3DRender/private/qclipplane_p.h>
+#include <Qt3DRender/qmultisampleantialiasing.h>
#include <Qt3DRender/qseamlesscubemap.h>
#include <Qt3DRender/qstenciloperation.h>
#include <Qt3DRender/private/qstenciloperation_p.h>
@@ -292,6 +293,10 @@ RenderStateImpl* RenderStateImpl::getOrCreateState(QRenderState *renderState)
blendState->isEnabled(),
blendState->bufferIndex());
}
+ case QRenderStatePrivate::MSAAEnabled: {
+ QMultiSampleAntiAliasing *setMSAAEnabled = static_cast<QMultiSampleAntiAliasing *>(renderState);
+ return getOrCreateRenderStateImpl<MSAAEnabled>(setMSAAEnabled->isEnabled());
+ }
case QRenderStatePrivate::CullFace: {
QCullFace *cullFace = static_cast<QCullFace *>(renderState);
return getOrCreateRenderStateImpl<CullFace>(cullFace->mode());
@@ -400,6 +405,10 @@ RenderStateImpl* RenderStateImpl::getOrCreateState(const Qt3DRender::QRenderStat
data.bufferIndex);
}
+ case QRenderStatePrivate::MSAAEnabled: {
+ return getOrCreateRenderStateImpl<MSAAEnabled>(change->isNodeEnabled());
+ }
+
case QRenderStatePrivate::CullFace: {
const auto typedChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChange<QCullFaceData>>(change);
const auto &data = typedChange->data;