summaryrefslogtreecommitdiffstats
path: root/src/extras
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-23 07:41:37 +0200
committerLiang Qi <liang.qi@qt.io>2016-08-23 07:41:49 +0200
commitf37222cecb804b154a38b37607b21577de4c5e8c (patch)
treef1b49dd9055ddb9cba85e0f7ad0c0d48701c0a5d /src/extras
parent3cae63081cc2d5878527d80bc199fee64727e123 (diff)
parente8bdcd57657e427bdc9a7bfef58033015b0b299f (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Diffstat (limited to 'src/extras')
-rw-r--r--src/extras/defaults/qphongalphamaterial.cpp71
-rw-r--r--src/extras/defaults/qphongalphamaterial.h23
-rw-r--r--src/extras/geometries/qconegeometry.cpp1
3 files changed, 95 insertions, 0 deletions
diff --git a/src/extras/defaults/qphongalphamaterial.cpp b/src/extras/defaults/qphongalphamaterial.cpp
index 9d80751c5..efc413a86 100644
--- a/src/extras/defaults/qphongalphamaterial.cpp
+++ b/src/extras/defaults/qphongalphamaterial.cpp
@@ -226,6 +226,17 @@ QPhongAlphaMaterial::QPhongAlphaMaterial(QNode *parent)
{
Q_D(QPhongAlphaMaterial);
d->init();
+
+ QObject::connect(d->m_blendEquation, &Qt3DRender::QBlendEquation::blendFunctionChanged,
+ this, &QPhongAlphaMaterial::blendFunctionArgChanged);
+ QObject::connect(d->m_blendState, &Qt3DRender::QBlendEquationArguments::destinationAlphaChanged,
+ this, &QPhongAlphaMaterial::destinationAlphaArgChanged);
+ QObject::connect(d->m_blendState, &Qt3DRender::QBlendEquationArguments::destinationRgbChanged,
+ this, &QPhongAlphaMaterial::destinationRgbArgChanged);
+ QObject::connect(d->m_blendState, &Qt3DRender::QBlendEquationArguments::sourceAlphaChanged,
+ this, &QPhongAlphaMaterial::sourceAlphaArgChanged);
+ QObject::connect(d->m_blendState, &Qt3DRender::QBlendEquationArguments::sourceRgbChanged,
+ this, &QPhongAlphaMaterial::sourceRgbArgChanged);
}
/*!
@@ -292,6 +303,36 @@ float QPhongAlphaMaterial::alpha() const
return d->m_alphaParameter->value().toFloat();
}
+QBlendEquationArguments::Blending QPhongAlphaMaterial::sourceRgbArg() const
+{
+ Q_D(const QPhongAlphaMaterial);
+ return d->m_blendState->sourceRgb();
+}
+
+QBlendEquationArguments::Blending QPhongAlphaMaterial::destinationRgbArg() const
+{
+ Q_D(const QPhongAlphaMaterial);
+ return d->m_blendState->destinationRgb();
+}
+
+QBlendEquationArguments::Blending QPhongAlphaMaterial::sourceAlphaArg() const
+{
+ Q_D(const QPhongAlphaMaterial);
+ return d->m_blendState->sourceAlpha();
+}
+
+QBlendEquationArguments::Blending QPhongAlphaMaterial::destinationAlphaArg() const
+{
+ Q_D(const QPhongAlphaMaterial);
+ return d->m_blendState->destinationAlpha();
+}
+
+QBlendEquation::BlendFunction QPhongAlphaMaterial::blendFunctionArg() const
+{
+ Q_D(const QPhongAlphaMaterial);
+ return d->m_blendEquation->blendFunction();
+}
+
void QPhongAlphaMaterial::setAmbient(const QColor &ambient)
{
Q_D(QPhongAlphaMaterial);
@@ -322,6 +363,36 @@ void QPhongAlphaMaterial::setAlpha(float alpha)
d->m_alphaParameter->setValue(alpha);
}
+void QPhongAlphaMaterial::setSourceRgbArg(QBlendEquationArguments::Blending sourceRgbArg)
+{
+ Q_D(QPhongAlphaMaterial);
+ d->m_blendState->setSourceRgb(sourceRgbArg);
+}
+
+void QPhongAlphaMaterial::setDestinationRgbArg(QBlendEquationArguments::Blending destinationRgbArg)
+{
+ Q_D(QPhongAlphaMaterial);
+ d->m_blendState->setDestinationRgb(destinationRgbArg);
+}
+
+void QPhongAlphaMaterial::setSourceAlphaArg(QBlendEquationArguments::Blending sourceAlphaArg)
+{
+ Q_D(QPhongAlphaMaterial);
+ d->m_blendState->setSourceAlpha(sourceAlphaArg);
+}
+
+void QPhongAlphaMaterial::setDestinationAlphaArg(QBlendEquationArguments::Blending destinationAlphaArg)
+{
+ Q_D(QPhongAlphaMaterial);
+ d->m_blendState->setDestinationAlpha(destinationAlphaArg);
+}
+
+void QPhongAlphaMaterial::setBlendFunctionArg(QBlendEquation::BlendFunction blendFunctionArg)
+{
+ Q_D(QPhongAlphaMaterial);
+ d->m_blendEquation->setBlendFunction(blendFunctionArg);
+}
+
} // namespace Qt3DExtras
QT_END_NAMESPACE
diff --git a/src/extras/defaults/qphongalphamaterial.h b/src/extras/defaults/qphongalphamaterial.h
index fb2ae1857..b67524ef7 100644
--- a/src/extras/defaults/qphongalphamaterial.h
+++ b/src/extras/defaults/qphongalphamaterial.h
@@ -42,6 +42,8 @@
#include <Qt3DExtras/qt3dextras_global.h>
#include <Qt3DRender/qmaterial.h>
+#include <Qt3DRender/qblendequationarguments.h>
+#include <Qt3DRender/qblendequation.h>
#include <QColor>
QT_BEGIN_NAMESPACE
@@ -58,6 +60,11 @@ class QT3DEXTRASSHARED_EXPORT QPhongAlphaMaterial : public Qt3DRender::QMaterial
Q_PROPERTY(QColor specular READ specular WRITE setSpecular NOTIFY specularChanged)
Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
Q_PROPERTY(float alpha READ alpha WRITE setAlpha NOTIFY alphaChanged)
+ Q_PROPERTY(Qt3DRender::QBlendEquationArguments::Blending sourceRgbArg READ sourceRgbArg WRITE setSourceRgbArg NOTIFY sourceRgbArgChanged)
+ Q_PROPERTY(Qt3DRender::QBlendEquationArguments::Blending destinationRgbArg READ destinationRgbArg WRITE setDestinationRgbArg NOTIFY destinationRgbArgChanged)
+ Q_PROPERTY(Qt3DRender::QBlendEquationArguments::Blending sourceAlphaArg READ sourceAlphaArg WRITE setSourceAlphaArg NOTIFY sourceAlphaArgChanged)
+ Q_PROPERTY(Qt3DRender::QBlendEquationArguments::Blending destinationAlphaArg READ destinationAlphaArg WRITE setDestinationAlphaArg NOTIFY destinationAlphaArgChanged)
+ Q_PROPERTY(Qt3DRender::QBlendEquation::BlendFunction blendFunctionArg READ blendFunctionArg WRITE setBlendFunctionArg NOTIFY blendFunctionArgChanged)
public:
explicit QPhongAlphaMaterial(Qt3DCore::QNode *parent = nullptr);
@@ -69,12 +76,23 @@ public:
float shininess() const;
float alpha() const;
+ Qt3DRender::QBlendEquationArguments::Blending sourceRgbArg() const;
+ Qt3DRender::QBlendEquationArguments::Blending destinationRgbArg() const;
+ Qt3DRender::QBlendEquationArguments::Blending sourceAlphaArg() const;
+ Qt3DRender::QBlendEquationArguments::Blending destinationAlphaArg() const;
+ Qt3DRender::QBlendEquation::BlendFunction blendFunctionArg() const;
+
public Q_SLOTS:
void setAmbient(const QColor &ambient);
void setDiffuse(const QColor &diffuse);
void setSpecular(const QColor &specular);
void setShininess(float shininess);
void setAlpha(float alpha);
+ void setSourceRgbArg(Qt3DRender::QBlendEquationArguments::Blending sourceRgbArg);
+ void setDestinationRgbArg(Qt3DRender::QBlendEquationArguments::Blending destinationRgbArg);
+ void setSourceAlphaArg(Qt3DRender::QBlendEquationArguments::Blending sourceAlphaArg);
+ void setDestinationAlphaArg(Qt3DRender::QBlendEquationArguments::Blending destinationAlphaArg);
+ void setBlendFunctionArg(Qt3DRender::QBlendEquation::BlendFunction blendFunctionArg);
Q_SIGNALS:
void ambientChanged(const QColor &ambient);
@@ -82,6 +100,11 @@ Q_SIGNALS:
void specularChanged(const QColor &specular);
void shininessChanged(float shininess);
void alphaChanged(float alpha);
+ void sourceRgbArgChanged(Qt3DRender::QBlendEquationArguments::Blending sourceRgbArg);
+ void destinationRgbArgChanged(Qt3DRender::QBlendEquationArguments::Blending destinationRgbArg);
+ void sourceAlphaArgChanged(Qt3DRender::QBlendEquationArguments::Blending sourceAlphaArg);
+ void destinationAlphaArgChanged(Qt3DRender::QBlendEquationArguments::Blending destinationAlphaArg);
+ void blendFunctionArgChanged(Qt3DRender::QBlendEquation::BlendFunction blendFunctionArg);
private:
Q_DECLARE_PRIVATE(QPhongAlphaMaterial)
diff --git a/src/extras/geometries/qconegeometry.cpp b/src/extras/geometries/qconegeometry.cpp
index 0413d9f24..ab652b5dd 100644
--- a/src/extras/geometries/qconegeometry.cpp
+++ b/src/extras/geometries/qconegeometry.cpp
@@ -349,6 +349,7 @@ QConeGeometryPrivate::QConeGeometryPrivate()
, m_normalAttribute(nullptr)
, m_texCoordAttribute(nullptr)
, m_indexAttribute(nullptr)
+ , m_positionBuffer(nullptr)
, m_vertexBuffer(nullptr)
, m_indexBuffer(nullptr)
{